• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef JNI_ZERO_JNI_EXPORT_H_
6 #define JNI_ZERO_JNI_EXPORT_H_
7 
8 #if defined(COMPONENT_BUILD)
9 #define JNI_ZERO_COMPONENT_BUILD_EXPORT __attribute__((visibility("default")))
10 #else
11 #define JNI_ZERO_COMPONENT_BUILD_EXPORT
12 #endif
13 
14 #if defined(__i386__)
15 // Dalvik JIT generated code doesn't guarantee 16-byte stack alignment on
16 // x86 - use force_align_arg_pointer to realign the stack at the JNI
17 // boundary. crbug.com/655248
18 #define JNI_ZERO_BOUNDARY_EXPORT \
19   extern "C" __attribute__((visibility("default"), force_align_arg_pointer))
20 #else
21 #define JNI_ZERO_BOUNDARY_EXPORT \
22   extern "C" __attribute__((visibility("default")))
23 #endif
24 
25 #if defined(__clang__) && __has_attribute(noinline)
26 #define JNI_ZERO_NEVER_INLINE [[clang::noinline]]
27 #elif __has_attribute(noinline)
28 #define JNI_ZERO_NEVER_INLINE __attribute__((noinline))
29 #else
30 #define JNI_ZERO_NEVER_INLINE
31 #endif
32 
33 #if defined(__clang__) && __has_attribute(always_inline)
34 #define JNI_ZERO_ALWAYS_INLINE [[clang::always_inline]]
35 #elif __has_attribute(always_inline)
36 #define JNI_ZERO_ALWAYS_INLINE __attribute__((__always_inline__))
37 #else
38 #define JNI_ZERO_ALWAYS_INLINE
39 #endif
40 
41 #define JNI_ZERO_MUXED_ENTRYPOINT extern "C" JNI_ZERO_ALWAYS_INLINE
42 
43 #endif  // JNI_ZERO_JNI_EXPORT_H_
44