src/share/vm/utilities/globalDefinitions.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8007074 Sdiff src/share/vm/utilities

src/share/vm/utilities/globalDefinitions.hpp

Print this page




 348 #endif
 349 #ifdef TARGET_ARCH_arm
 350 # include "globalDefinitions_arm.hpp"
 351 #endif
 352 #ifdef TARGET_ARCH_ppc
 353 # include "globalDefinitions_ppc.hpp"
 354 #endif
 355 
 356 
 357 // The byte alignment to be used by Arena::Amalloc.  See bugid 4169348.
 358 // Note: this value must be a power of 2
 359 
 360 #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord)
 361 
 362 // Signed variants of alignment helpers.  There are two versions of each, a macro
 363 // for use in places like enum definitions that require compile-time constant
 364 // expressions and a function for all other places so as to get type checking.
 365 
 366 #define align_size_up_(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1))
 367 








 368 inline intptr_t align_size_up(intptr_t size, intptr_t alignment) {
 369   return align_size_up_(size, alignment);
 370 }
 371 
 372 #define align_size_down_(size, alignment) ((size) & ~((alignment) - 1))
 373 
 374 inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
 375   return align_size_down_(size, alignment);












 376 }
 377 
 378 // Align objects by rounding up their size, in HeapWord units.
 379 
 380 #define align_object_size_(size) align_size_up_(size, MinObjAlignment)
 381 
 382 inline intptr_t align_object_size(intptr_t size) {
 383   return align_size_up(size, MinObjAlignment);
 384 }
 385 
 386 inline bool is_object_aligned(intptr_t addr) {
 387   return addr == align_object_size(addr);
 388 }
 389 
 390 // Pad out certain offsets to jlong alignment, in HeapWord units.
 391 
 392 inline intptr_t align_object_offset(intptr_t offset) {
 393   return align_size_up(offset, HeapWordsPerLong);
 394 }
 395 




 348 #endif
 349 #ifdef TARGET_ARCH_arm
 350 # include "globalDefinitions_arm.hpp"
 351 #endif
 352 #ifdef TARGET_ARCH_ppc
 353 # include "globalDefinitions_ppc.hpp"
 354 #endif
 355 
 356 
 357 // The byte alignment to be used by Arena::Amalloc.  See bugid 4169348.
 358 // Note: this value must be a power of 2
 359 
 360 #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord)
 361 
 362 // Signed variants of alignment helpers.  There are two versions of each, a macro
 363 // for use in places like enum definitions that require compile-time constant
 364 // expressions and a function for all other places so as to get type checking.
 365 
 366 #define align_size_up_(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1))
 367 
 368 inline bool is_size_aligned(size_t size, size_t alignment) {
 369   return align_size_up_(size, alignment) == size;
 370 }
 371 
 372 inline bool is_ptr_aligned(void* ptr, size_t alignment) {
 373   return align_size_up_((intptr_t)ptr, (intptr_t)alignment) == (intptr_t)ptr;
 374 }
 375 
 376 inline intptr_t align_size_up(intptr_t size, intptr_t alignment) {
 377   return align_size_up_(size, alignment);
 378 }
 379 
 380 #define align_size_down_(size, alignment) ((size) & ~((alignment) - 1))
 381 
 382 inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
 383   return align_size_down_(size, alignment);
 384 }
 385 
 386 inline void* align_ptr_up(void* ptr, size_t alignment) {
 387   return (void*)align_size_up((intptr_t)ptr, (intptr_t)alignment);
 388 }
 389 
 390 inline void* align_ptr_down(void* ptr, size_t alignment) {
 391   return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
 392 }
 393 
 394 inline void* offset_ptr(void* ptr, size_t offset) {
 395   return (void*)((intptr_t)ptr + (intptr_t)offset);
 396 }
 397 
 398 // Align objects by rounding up their size, in HeapWord units.
 399 
 400 #define align_object_size_(size) align_size_up_(size, MinObjAlignment)
 401 
 402 inline intptr_t align_object_size(intptr_t size) {
 403   return align_size_up(size, MinObjAlignment);
 404 }
 405 
 406 inline bool is_object_aligned(intptr_t addr) {
 407   return addr == align_object_size(addr);
 408 }
 409 
 410 // Pad out certain offsets to jlong alignment, in HeapWord units.
 411 
 412 inline intptr_t align_object_offset(intptr_t offset) {
 413   return align_size_up(offset, HeapWordsPerLong);
 414 }
 415 


src/share/vm/utilities/globalDefinitions.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File