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

src/share/vm/utilities/globalDefinitions.hpp

Print this page




 441 #define align_object_size_(size) align_size_up_(size, MinObjAlignment)
 442 
 443 inline intptr_t align_object_size(intptr_t size) {
 444   return align_size_up(size, MinObjAlignment);
 445 }
 446 
 447 inline bool is_object_aligned(intptr_t addr) {
 448   return addr == align_object_size(addr);
 449 }
 450 
 451 // Pad out certain offsets to jlong alignment, in HeapWord units.
 452 
 453 inline intptr_t align_object_offset(intptr_t offset) {
 454   return align_size_up(offset, HeapWordsPerLong);
 455 }
 456 
 457 inline void* align_pointer_up(const void* addr, size_t size) {
 458   return (void*) align_size_up_((uintptr_t)addr, size);
 459 }
 460 







 461 // Clamp an address to be within a specific page
 462 // 1. If addr is on the page it is returned as is
 463 // 2. If addr is above the page_address the start of the *next* page will be returned
 464 // 3. Otherwise, if addr is below the page_address the start of the page will be returned
 465 inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
 466   if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) {
 467     // address is in the specified page, just return it as is
 468     return addr;
 469   } else if (addr > page_address) {
 470     // address is above specified page, return start of next page
 471     return (address)align_size_down(intptr_t(page_address), page_size) + page_size;
 472   } else {
 473     // address is below specified page, return start of page
 474     return (address)align_size_down(intptr_t(page_address), page_size);
 475   }
 476 }
 477 
 478 
 479 // The expected size in bytes of a cache line, used to pad data structures.
 480 #define DEFAULT_CACHE_LINE_SIZE 64




 441 #define align_object_size_(size) align_size_up_(size, MinObjAlignment)
 442 
 443 inline intptr_t align_object_size(intptr_t size) {
 444   return align_size_up(size, MinObjAlignment);
 445 }
 446 
 447 inline bool is_object_aligned(intptr_t addr) {
 448   return addr == align_object_size(addr);
 449 }
 450 
 451 // Pad out certain offsets to jlong alignment, in HeapWord units.
 452 
 453 inline intptr_t align_object_offset(intptr_t offset) {
 454   return align_size_up(offset, HeapWordsPerLong);
 455 }
 456 
 457 inline void* align_pointer_up(const void* addr, size_t size) {
 458   return (void*) align_size_up_((uintptr_t)addr, size);
 459 }
 460 
 461 // Align down with a lower bound. If the aligning results in 0, return 'alignment'.
 462 
 463 inline size_t align_size_down_bounded(size_t size, size_t alignment) {
 464   size_t aligned_size = align_size_down_(size, alignment);
 465   return aligned_size > 0 ? aligned_size : alignment;
 466 }
 467 
 468 // Clamp an address to be within a specific page
 469 // 1. If addr is on the page it is returned as is
 470 // 2. If addr is above the page_address the start of the *next* page will be returned
 471 // 3. Otherwise, if addr is below the page_address the start of the page will be returned
 472 inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
 473   if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) {
 474     // address is in the specified page, just return it as is
 475     return addr;
 476   } else if (addr > page_address) {
 477     // address is above specified page, return start of next page
 478     return (address)align_size_down(intptr_t(page_address), page_size) + page_size;
 479   } else {
 480     // address is below specified page, return start of page
 481     return (address)align_size_down(intptr_t(page_address), page_size);
 482   }
 483 }
 484 
 485 
 486 // The expected size in bytes of a cache line, used to pad data structures.
 487 #define DEFAULT_CACHE_LINE_SIZE 64


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