Tue, 27 Nov 2012 07:57:57 -0800
8003879: Duplicate definitions in vmStructs
Summary: Removed duplicate entries
Reviewed-by: dholmes, sspitsyn
1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Wed Nov 21 21:26:12 2012 -0500 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Tue Nov 27 07:57:57 2012 -0800 1.3 @@ -65,8 +65,7 @@ 1.4 declare_toplevel_type(AFLBinaryTreeDictionary*) \ 1.5 declare_toplevel_type(LinearAllocBlock) \ 1.6 declare_toplevel_type(FreeBlockDictionary<FreeChunk>) \ 1.7 - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>) \ 1.8 - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>) \ 1.9 + declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>) 1.10 1.11 #define VM_INT_CONSTANTS_CMS(declare_constant) \ 1.12 declare_constant(Generation::ConcurrentMarkSweep) \
2.1 --- a/src/share/vm/prims/jni.cpp Wed Nov 21 21:26:12 2012 -0500 2.2 +++ b/src/share/vm/prims/jni.cpp Tue Nov 27 07:57:57 2012 -0800 2.3 @@ -5044,6 +5044,9 @@ 2.4 2.5 #include "gc_interface/collectedHeap.hpp" 2.6 #include "utilities/quickSort.hpp" 2.7 +#if INCLUDE_VM_STRUCTS 2.8 +#include "runtime/vmStructs.hpp" 2.9 +#endif 2.10 2.11 #define run_unit_test(unit_test_function_call) \ 2.12 tty->print_cr("Running test: " #unit_test_function_call); \ 2.13 @@ -5056,6 +5059,9 @@ 2.14 run_unit_test(CollectedHeap::test_is_in()); 2.15 run_unit_test(QuickSort::test_quick_sort()); 2.16 run_unit_test(AltHashing::test_alt_hash()); 2.17 +#if INCLUDE_VM_STRUCTS 2.18 + run_unit_test(VMStructs::test()); 2.19 +#endif 2.20 tty->print_cr("All internal VM tests passed"); 2.21 } 2.22 }
3.1 --- a/src/share/vm/runtime/vmStructs.cpp Wed Nov 21 21:26:12 2012 -0500 3.2 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Nov 27 07:57:57 2012 -0800 3.3 @@ -2107,8 +2107,7 @@ 3.4 declare_toplevel_type(FreeList<Metablock>*) \ 3.5 declare_toplevel_type(FreeList<Metablock>) \ 3.6 declare_toplevel_type(MetablockTreeDictionary*) \ 3.7 - declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>) \ 3.8 - declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>) 3.9 + declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>) 3.10 3.11 3.12 /* NOTE that we do not use the last_entry() macro here; it is used */ 3.13 @@ -3215,3 +3214,17 @@ 3.14 void vmStructs_init() { 3.15 debug_only(VMStructs::init()); 3.16 } 3.17 + 3.18 +#ifndef PRODUCT 3.19 +void VMStructs::test() { 3.20 + // Check for duplicate entries in type array 3.21 + for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) { 3.22 + for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) { 3.23 + if (strcmp(localHotSpotVMTypes[i].typeName, localHotSpotVMTypes[j].typeName) == 0) { 3.24 + tty->print_cr("Duplicate entries for '%s'", localHotSpotVMTypes[i].typeName); 3.25 + assert(false, "Duplicate types in localHotSpotVMTypes array"); 3.26 + } 3.27 + } 3.28 + } 3.29 +} 3.30 +#endif
4.1 --- a/src/share/vm/runtime/vmStructs.hpp Wed Nov 21 21:26:12 2012 -0500 4.2 +++ b/src/share/vm/runtime/vmStructs.hpp Tue Nov 27 07:57:57 2012 -0800 4.3 @@ -123,6 +123,11 @@ 4.4 // the data structure (debug build only) 4.5 static void init(); 4.6 4.7 +#ifndef PRODUCT 4.8 + // Execute unit tests 4.9 + static void test(); 4.10 +#endif 4.11 + 4.12 private: 4.13 // Look up a type in localHotSpotVMTypes using strcmp() (debug build only). 4.14 // Returns 1 if found, 0 if not.