--- old/src/share/vm/oops/instanceRefKlass.cpp 2016-01-24 11:21:55.448738958 +0100 +++ new/src/share/vm/oops/instanceRefKlass.cpp 2016-01-24 11:21:55.369740318 +0100 @@ -44,7 +44,7 @@ // Check that we have the right class debug_only(static bool first_time = true); assert(k == SystemDictionary::Reference_klass() && first_time, - "Invalid update of maps"); + "Invalid update of Reference maps"); debug_only(first_time = false); assert(ik->nonstatic_oop_map_count() == 1, "just checking"); @@ -69,6 +69,35 @@ } } +void InstanceRefKlass::update_nonstatic_ephemeron_oop_maps(Klass* k) { + // Clear the nonstatic oop-map entry corresponding to value field. + // It is treated specially by the garbage collector. + InstanceKlass* ik = InstanceKlass::cast(k); + + // Check that we have the right class + debug_only(static bool first_time = true); + assert(k == SystemDictionary::Ephemeron_klass() && first_time, + "Invalid update of Ephemeron maps"); + debug_only(first_time = false); + assert(ik->nonstatic_oop_map_count() == 2, "just checking"); + + // skip 1st map as it's the copy of the augmented Reference's map + OopMapBlock* map = ik->start_of_nonstatic_oop_maps() + 1; + + debug_only(int offset = java_lang_ref_Ephemeron::value_offset); + + if (UseSharedSpaces) { + assert(map->offset() == offset && map->count() == 0, + "just checking"); + } else { + assert(map->offset() == offset && map->count() == 1, + "just checking"); + + // Update map to have 0 oops. + map->set_count(0); + } +} + // Verification