Wed, 25 Sep 2013 17:23:41 +0200
8025228: assert(new_entry->reserved_words() == vs_word_size) fails in nightly
Reviewed-by: mgerdin, tschatzl, jmasa
src/share/vm/memory/metaspace.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/prims/jni.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/memory/metaspace.cpp Wed Sep 25 13:25:24 2013 +0200 1.2 +++ b/src/share/vm/memory/metaspace.cpp Wed Sep 25 17:23:41 2013 +0200 1.3 @@ -1095,7 +1095,7 @@ 1.4 } 1.5 // Reserve the space 1.6 size_t vs_byte_size = vs_word_size * BytesPerWord; 1.7 - assert(vs_byte_size % os::vm_page_size() == 0, "Not aligned"); 1.8 + assert(vs_byte_size % os::vm_allocation_granularity() == 0, "Not aligned"); 1.9 1.10 // Allocate the meta virtual space and initialize it. 1.11 VirtualSpaceNode* new_entry = new VirtualSpaceNode(vs_byte_size); 1.12 @@ -1167,12 +1167,14 @@ 1.13 // being used for CompressedHeaders, don't allocate a new virtualspace. 1.14 if (can_grow() && MetaspaceGC::should_expand(this, word_size)) { 1.15 // Get another virtual space. 1.16 - size_t grow_vs_words = 1.17 - MAX2((size_t)VirtualSpaceSize, aligned_expand_vs_by_words); 1.18 + size_t allocation_aligned_expand_words = 1.19 + align_size_up(aligned_expand_vs_by_words, os::vm_allocation_granularity() / BytesPerWord); 1.20 + size_t grow_vs_words = 1.21 + MAX2((size_t)VirtualSpaceSize, allocation_aligned_expand_words); 1.22 if (grow_vs(grow_vs_words)) { 1.23 // Got it. It's on the list now. Get a chunk from it. 1.24 assert(current_virtual_space()->expanded_words() == 0, 1.25 - "New virtuals space nodes should not have expanded"); 1.26 + "New virtual space nodes should not have expanded"); 1.27 1.28 size_t grow_chunks_by_words_aligned = align_size_up(grow_chunks_by_words, 1.29 page_size_words); 1.30 @@ -3357,7 +3359,7 @@ 1.31 1.32 #ifndef PRODUCT 1.33 1.34 -class MetaspaceAuxTest : AllStatic { 1.35 +class TestMetaspaceAuxTest : AllStatic { 1.36 public: 1.37 static void test_reserved() { 1.38 size_t reserved = MetaspaceAux::reserved_bytes(); 1.39 @@ -3397,14 +3399,25 @@ 1.40 } 1.41 } 1.42 1.43 + static void test_virtual_space_list_large_chunk() { 1.44 + VirtualSpaceList* vs_list = new VirtualSpaceList(os::vm_allocation_granularity()); 1.45 + MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); 1.46 + // A size larger than VirtualSpaceSize (256k) and add one page to make it _not_ be 1.47 + // vm_allocation_granularity aligned on Windows. 1.48 + size_t large_size = (size_t)(2*256*K + (os::vm_page_size()/BytesPerWord)); 1.49 + large_size += (os::vm_page_size()/BytesPerWord); 1.50 + vs_list->get_new_chunk(large_size, large_size, 0); 1.51 + } 1.52 + 1.53 static void test() { 1.54 test_reserved(); 1.55 test_committed(); 1.56 + test_virtual_space_list_large_chunk(); 1.57 } 1.58 }; 1.59 1.60 -void MetaspaceAux_test() { 1.61 - MetaspaceAuxTest::test(); 1.62 +void TestMetaspaceAux_test() { 1.63 + TestMetaspaceAuxTest::test(); 1.64 } 1.65 1.66 #endif
2.1 --- a/src/share/vm/prims/jni.cpp Wed Sep 25 13:25:24 2013 +0200 2.2 +++ b/src/share/vm/prims/jni.cpp Wed Sep 25 17:23:41 2013 +0200 2.3 @@ -5046,7 +5046,7 @@ 2.4 void TestReservedSpace_test(); 2.5 void TestReserveMemorySpecial_test(); 2.6 void TestVirtualSpace_test(); 2.7 -void MetaspaceAux_test(); 2.8 +void TestMetaspaceAux_test(); 2.9 #if INCLUDE_ALL_GCS 2.10 void TestG1BiasedArray_test(); 2.11 #endif 2.12 @@ -5057,7 +5057,7 @@ 2.13 run_unit_test(TestReservedSpace_test()); 2.14 run_unit_test(TestReserveMemorySpecial_test()); 2.15 run_unit_test(TestVirtualSpace_test()); 2.16 - run_unit_test(MetaspaceAux_test()); 2.17 + run_unit_test(TestMetaspaceAux_test()); 2.18 run_unit_test(GlobalDefinitions::test_globals()); 2.19 run_unit_test(GCTimerAllTest::all()); 2.20 run_unit_test(arrayOopDesc::test_max_array_length());