< prev index next >

src/share/vm/oops/instanceRefKlass.cpp

Print this page

        

@@ -42,11 +42,11 @@
   InstanceKlass* ik = InstanceKlass::cast(k);
 
   // 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");
 
   OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
 

@@ -67,10 +67,39 @@
     map->set_offset(java_lang_ref_Reference::queue_offset);
     map->set_count(1);
   }
 }
 
+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
 
 void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
   InstanceKlass::oop_verify_on(obj, st);
< prev index next >