237 #else // !_LP64 238 #define FORMAT64_MODIFIER "ll" 239 #endif // _LP64 240 241 // HACK: gcc warns about applying offsetof() to non-POD object or calculating 242 // offset directly when base address is NULL. Use 16 to get around the 243 // warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress 244 // this warning. 245 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16) 246 247 #ifdef offsetof 248 # undef offsetof 249 #endif 250 #define offsetof(klass,field) offset_of(klass,field) 251 252 #if defined(_LP64) && defined(__APPLE__) 253 #define JLONG_FORMAT "%ld" 254 #define JLONG_FORMAT_W(width) "%" #width "ld" 255 #endif // _LP64 && __APPLE__ 256 257 #ifndef USE_LIBRARY_BASED_TLS_ONLY 258 #define THREAD_LOCAL_DECL __thread 259 #endif 260 261 // Inlining support 262 #define NOINLINE __attribute__ ((noinline)) 263 #define ALWAYSINLINE inline __attribute__ ((always_inline)) 264 265 // Alignment 266 // 267 // NOTE! The "+0" below is a workaround for a known bug in older GCC versions 268 // (known to fail with 4.6.0, fixed in 4.9.0). This bug affects systems such as 269 // RedHat/Oracle Linux 7.5, which ships with GCC 4.8.5. For more details, see 270 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and 271 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017 272 // 273 // GCC versions older than 4.6.4 would fail even with "+0", and needs additional 274 // cast to __typeof__(x) to work around the similar bug. 275 // 276 #define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((__typeof__(x))x+0))) 277 278 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP | 237 #else // !_LP64 238 #define FORMAT64_MODIFIER "ll" 239 #endif // _LP64 240 241 // HACK: gcc warns about applying offsetof() to non-POD object or calculating 242 // offset directly when base address is NULL. Use 16 to get around the 243 // warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress 244 // this warning. 245 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16) 246 247 #ifdef offsetof 248 # undef offsetof 249 #endif 250 #define offsetof(klass,field) offset_of(klass,field) 251 252 #if defined(_LP64) && defined(__APPLE__) 253 #define JLONG_FORMAT "%ld" 254 #define JLONG_FORMAT_W(width) "%" #width "ld" 255 #endif // _LP64 && __APPLE__ 256 257 #if __cplusplus < 201103L 258 #define thread_local __thread 259 #endif 260 261 // Inlining support 262 #define NOINLINE __attribute__ ((noinline)) 263 #define ALWAYSINLINE inline __attribute__ ((always_inline)) 264 265 // Alignment 266 // 267 // NOTE! The "+0" below is a workaround for a known bug in older GCC versions 268 // (known to fail with 4.6.0, fixed in 4.9.0). This bug affects systems such as 269 // RedHat/Oracle Linux 7.5, which ships with GCC 4.8.5. For more details, see 270 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and 271 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017 272 // 273 // GCC versions older than 4.6.4 would fail even with "+0", and needs additional 274 // cast to __typeof__(x) to work around the similar bug. 275 // 276 #define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((__typeof__(x))x+0))) 277 278 #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP |