< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page

        

*** 1175,1195 **** // 3: allocate a block of new ObjectMonitors // Both the local and global free lists are empty -- resort to malloc(). // In the current implementation objectMonitors are TSM - immortal. // Ideally, we'd write "new ObjectMonitor[_BLOCKSIZE], but we want // each ObjectMonitor to start at the beginning of a cache line, ! // so we use align_size_up(). // A better solution would be to use C++ placement-new. // BEWARE: As it stands currently, we don't run the ctors! assert(_BLOCKSIZE > 1, "invariant"); size_t neededsize = sizeof(PaddedEnd<ObjectMonitor>) * _BLOCKSIZE; PaddedEnd<ObjectMonitor> * temp; size_t aligned_size = neededsize + (DEFAULT_CACHE_LINE_SIZE - 1); void* real_malloc_addr = (void *)NEW_C_HEAP_ARRAY(char, aligned_size, mtInternal); temp = (PaddedEnd<ObjectMonitor> *) ! align_ptr_up(real_malloc_addr, DEFAULT_CACHE_LINE_SIZE); // NOTE: (almost) no way to recover if allocation failed. // We might be able to induce a STW safepoint and scavenge enough // objectMonitors to permit progress. --- 1175,1195 ---- // 3: allocate a block of new ObjectMonitors // Both the local and global free lists are empty -- resort to malloc(). // In the current implementation objectMonitors are TSM - immortal. // Ideally, we'd write "new ObjectMonitor[_BLOCKSIZE], but we want // each ObjectMonitor to start at the beginning of a cache line, ! // so we use align_up(). // A better solution would be to use C++ placement-new. // BEWARE: As it stands currently, we don't run the ctors! assert(_BLOCKSIZE > 1, "invariant"); size_t neededsize = sizeof(PaddedEnd<ObjectMonitor>) * _BLOCKSIZE; PaddedEnd<ObjectMonitor> * temp; size_t aligned_size = neededsize + (DEFAULT_CACHE_LINE_SIZE - 1); void* real_malloc_addr = (void *)NEW_C_HEAP_ARRAY(char, aligned_size, mtInternal); temp = (PaddedEnd<ObjectMonitor> *) ! align_up(real_malloc_addr, DEFAULT_CACHE_LINE_SIZE); // NOTE: (almost) no way to recover if allocation failed. // We might be able to induce a STW safepoint and scavenge enough // objectMonitors to permit progress.
< prev index next >