# HG changeset patch # User mikael # Date 1354031877 28800 # Node ID 7c15faa95ce72afa40b6a3008e180552ee2a1d43 # Parent ca1be5fbe6ff78ad9bf5120480a2950791e05cc0 8003879: Duplicate definitions in vmStructs Summary: Removed duplicate entries Reviewed-by: dholmes, sspitsyn diff -r ca1be5fbe6ff -r 7c15faa95ce7 src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Wed Nov 21 21:26:12 2012 -0500 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Tue Nov 27 07:57:57 2012 -0800 @@ -65,8 +65,7 @@ declare_toplevel_type(AFLBinaryTreeDictionary*) \ declare_toplevel_type(LinearAllocBlock) \ declare_toplevel_type(FreeBlockDictionary) \ - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) \ - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) \ + declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) #define VM_INT_CONSTANTS_CMS(declare_constant) \ declare_constant(Generation::ConcurrentMarkSweep) \ diff -r ca1be5fbe6ff -r 7c15faa95ce7 src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Wed Nov 21 21:26:12 2012 -0500 +++ b/src/share/vm/prims/jni.cpp Tue Nov 27 07:57:57 2012 -0800 @@ -5044,6 +5044,9 @@ #include "gc_interface/collectedHeap.hpp" #include "utilities/quickSort.hpp" +#if INCLUDE_VM_STRUCTS +#include "runtime/vmStructs.hpp" +#endif #define run_unit_test(unit_test_function_call) \ tty->print_cr("Running test: " #unit_test_function_call); \ @@ -5056,6 +5059,9 @@ run_unit_test(CollectedHeap::test_is_in()); run_unit_test(QuickSort::test_quick_sort()); run_unit_test(AltHashing::test_alt_hash()); +#if INCLUDE_VM_STRUCTS + run_unit_test(VMStructs::test()); +#endif tty->print_cr("All internal VM tests passed"); } } diff -r ca1be5fbe6ff -r 7c15faa95ce7 src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp Wed Nov 21 21:26:12 2012 -0500 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Nov 27 07:57:57 2012 -0800 @@ -2107,8 +2107,7 @@ declare_toplevel_type(FreeList*) \ declare_toplevel_type(FreeList) \ declare_toplevel_type(MetablockTreeDictionary*) \ - declare_type(MetablockTreeDictionary, FreeBlockDictionary) \ - declare_type(MetablockTreeDictionary, FreeBlockDictionary) + declare_type(MetablockTreeDictionary, FreeBlockDictionary) /* NOTE that we do not use the last_entry() macro here; it is used */ @@ -3215,3 +3214,17 @@ void vmStructs_init() { debug_only(VMStructs::init()); } + +#ifndef PRODUCT +void VMStructs::test() { + // Check for duplicate entries in type array + for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) { + for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) { + if (strcmp(localHotSpotVMTypes[i].typeName, localHotSpotVMTypes[j].typeName) == 0) { + tty->print_cr("Duplicate entries for '%s'", localHotSpotVMTypes[i].typeName); + assert(false, "Duplicate types in localHotSpotVMTypes array"); + } + } + } +} +#endif diff -r ca1be5fbe6ff -r 7c15faa95ce7 src/share/vm/runtime/vmStructs.hpp --- a/src/share/vm/runtime/vmStructs.hpp Wed Nov 21 21:26:12 2012 -0500 +++ b/src/share/vm/runtime/vmStructs.hpp Tue Nov 27 07:57:57 2012 -0800 @@ -123,6 +123,11 @@ // the data structure (debug build only) static void init(); +#ifndef PRODUCT + // Execute unit tests + static void test(); +#endif + private: // Look up a type in localHotSpotVMTypes using strcmp() (debug build only). // Returns 1 if found, 0 if not.