< prev index next >

src/share/vm/code/nmethod.cpp

Print this page

        

@@ -563,17 +563,22 @@
       // which are dependent on those classes.  The slow way is to
       // check every nmethod for dependencies which makes it linear in
       // the number of methods compiled.  For applications with a lot
       // classes the slow way is too slow.
       for (Dependencies::DepStream deps(nm); deps.next(); ) {
+        if (deps.type() != Dependencies::call_site_target_value) {
         Klass* klass = deps.context_type();
         if (klass == NULL) {
           continue;  // ignore things like evol_method
         }
-
         // record this nmethod as dependent on this klass
         InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
+        } else {
+          // CallSite dependencies are managed on per-CallSite instance basis.
+          oop call_site = deps.argument_oop(0);
+          MethodHandles::add_dependent_nmethod(call_site, nm);
+        }
       }
       NOT_PRODUCT(nmethod_stats.note_nmethod(nm));
       if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) {
         Disassembler::decode(nm);
       }

@@ -1462,18 +1467,25 @@
   assert(Universe::heap()->is_gc_active() == (is_alive != NULL),
   "is_alive is non-NULL if and only if we are called during GC");
   if (!has_flushed_dependencies()) {
     set_has_flushed_dependencies();
     for (Dependencies::DepStream deps(this); deps.next(); ) {
+      if (deps.type() != Dependencies::call_site_target_value) {
       Klass* klass = deps.context_type();
-      if (klass == NULL)  continue;  // ignore things like evol_method
-
+        if (klass == NULL) {
+          continue;  // ignore things like evol_method
+        }
       // During GC the is_alive closure is non-NULL, and is used to
       // determine liveness of dependees that need to be updated.
       if (is_alive == NULL || klass->is_loader_alive(is_alive)) {
         InstanceKlass::cast(klass)->remove_dependent_nmethod(this);
       }
+      } else {
+        // CallSite dependencies are managed on per-CallSite instance basis.
+        oop call_site = deps.argument_oop(0);
+        MethodHandles::remove_dependent_nmethod(call_site, this);
+      }
     }
   }
 }
 
 
< prev index next >