comparison src/share/vm/utilities/globalDefinitions.hpp @ 9088:89e4d67fdd2a

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 12 Apr 2013 14:05:42 +0200
parents 3ac7d10a6572 7a5aec879506
children 836a62f43af9
comparison
equal deleted inserted replaced
9037:b008f40b67d0 9088:89e4d67fdd2a
416 // Pad out certain offsets to jlong alignment, in HeapWord units. 416 // Pad out certain offsets to jlong alignment, in HeapWord units.
417 417
418 inline intptr_t align_object_offset(intptr_t offset) { 418 inline intptr_t align_object_offset(intptr_t offset) {
419 return align_size_up(offset, HeapWordsPerLong); 419 return align_size_up(offset, HeapWordsPerLong);
420 } 420 }
421
422 // Clamp an address to be within a specific page
423 // 1. If addr is on the page it is returned as is
424 // 2. If addr is above the page_address the start of the *next* page will be returned
425 // 3. Otherwise, if addr is below the page_address the start of the page will be returned
426 inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
427 if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) {
428 // address is in the specified page, just return it as is
429 return addr;
430 } else if (addr > page_address) {
431 // address is above specified page, return start of next page
432 return (address)align_size_down(intptr_t(page_address), page_size) + page_size;
433 } else {
434 // address is below specified page, return start of page
435 return (address)align_size_down(intptr_t(page_address), page_size);
436 }
437 }
438
421 439
422 // The expected size in bytes of a cache line, used to pad data structures. 440 // The expected size in bytes of a cache line, used to pad data structures.
423 #define DEFAULT_CACHE_LINE_SIZE 64 441 #define DEFAULT_CACHE_LINE_SIZE 64
424 442
425 // Bytes needed to pad type to avoid cache-line sharing; alignment should be the 443 // Bytes needed to pad type to avoid cache-line sharing; alignment should be the
825 843
826 inline bool is_highest_tier_compile(int comp_level) { 844 inline bool is_highest_tier_compile(int comp_level) {
827 return comp_level == CompLevel_highest_tier; 845 return comp_level == CompLevel_highest_tier;
828 } 846 }
829 847
848 inline bool is_compile(int comp_level) {
849 return is_c1_compile(comp_level) || is_c2_compile(comp_level);
850 }
851
830 //---------------------------------------------------------------------------------------------------- 852 //----------------------------------------------------------------------------------------------------
831 // 'Forward' declarations of frequently used classes 853 // 'Forward' declarations of frequently used classes
832 // (in order to reduce interface dependencies & reduce 854 // (in order to reduce interface dependencies & reduce
833 // number of unnecessary compilations after changes) 855 // number of unnecessary compilations after changes)
834 856
1294 // specific. 1316 // specific.
1295 static inline void* dereference_vptr(void* addr) { 1317 static inline void* dereference_vptr(void* addr) {
1296 return *(void**)addr; 1318 return *(void**)addr;
1297 } 1319 }
1298 1320
1321
1322 #ifndef PRODUCT
1323
1324 // For unit testing only
1325 class GlobalDefinitions {
1326 public:
1327 static void test_globals();
1328 };
1329
1330 #endif // PRODUCT
1331
1299 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP 1332 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP