hotspot/src/share/vm/oops/cpCacheKlass.cpp
changeset 2570 ecc7862946d4
parent 2105 347008ce7984
child 4584 e2a449e8cc6f
--- a/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Mon Apr 20 14:48:03 2009 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Tue Apr 21 23:21:04 2009 -0700
@@ -169,11 +169,47 @@
 void constantPoolCacheKlass::oop_copy_contents(PSPromotionManager* pm,
                                                oop obj) {
   assert(obj->is_constantPoolCache(), "should be constant pool");
+  if (EnableInvokeDynamic) {
+    constantPoolCacheOop cache = (constantPoolCacheOop)obj;
+    // during a scavenge, it is safe to inspect my pool, since it is perm
+    constantPoolOop pool = cache->constant_pool();
+    assert(pool->is_constantPool(), "should be constant pool");
+    if (pool->has_invokedynamic()) {
+      for (int i = 0; i < cache->length(); i++) {
+        ConstantPoolCacheEntry* e = cache->entry_at(i);
+        oop* p = (oop*)&e->_f1;
+        if (e->is_secondary_entry()) {
+          if (PSScavenge::should_scavenge(p))
+            pm->claim_or_forward_breadth(p);
+          assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
+                 "no live oops here");
+        }
+      }
+    }
+  }
 }
 
 void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm,
                                                oop obj) {
   assert(obj->is_constantPoolCache(), "should be constant pool");
+  if (EnableInvokeDynamic) {
+    constantPoolCacheOop cache = (constantPoolCacheOop)obj;
+    // during a scavenge, it is safe to inspect my pool, since it is perm
+    constantPoolOop pool = cache->constant_pool();
+    assert(pool->is_constantPool(), "should be constant pool");
+    if (pool->has_invokedynamic()) {
+      for (int i = 0; i < cache->length(); i++) {
+        ConstantPoolCacheEntry* e = cache->entry_at(i);
+        oop* p = (oop*)&e->_f1;
+        if (e->is_secondary_entry()) {
+          if (PSScavenge::should_scavenge(p))
+            pm->claim_or_forward_depth(p);
+          assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
+                 "no live oops here");
+        }
+      }
+    }
+  }
 }
 
 int