diff src/share/vm/code/nmethod.cpp @ 3683:345c3bbf9c3c

store RiCompiledMethod in nmethod and: * invalidate RiCompiledMethod when the nmethod is invalidated * invalidate the nmethod when the RiCompiledMethod object is GC'ed
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 18 Nov 2011 11:54:07 +0100
parents be4ca325525a
children 04b9a2566eec
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Fri Nov 18 11:52:59 2011 +0100
+++ b/src/share/vm/code/nmethod.cpp	Fri Nov 18 11:54:07 2011 +0100
@@ -44,6 +44,9 @@
 #ifdef SHARK
 #include "shark/sharkCompiler.hpp"
 #endif
+#ifdef GRAAL
+#include "graal/graalJavaAccess.hpp"
+#endif
 
 #ifdef DTRACE_ENABLED
 
@@ -463,6 +466,8 @@
   _saved_nmethod_link      = NULL;
   _compiler                = NULL;
 
+  _graal_compiled_method   = NULL;
+
 #ifdef HAVE_DTRACE_H
   _trap_offset             = 0;
 #endif // def HAVE_DTRACE_H
@@ -1295,6 +1300,13 @@
       return false;
     }
 
+#ifdef GRAAL
+    if (_graal_compiled_method != NULL) {
+      HotSpotCompiledMethod::set_nmethod(_graal_compiled_method, 0);
+      _graal_compiled_method = NULL;
+    }
+#endif
+
     // The caller can be calling the method statically or through an inline
     // cache call.
     if (!is_osr_method() && !is_not_entrant()) {
@@ -1593,6 +1605,10 @@
     return;
   }
 
+  if (_graal_compiled_method != NULL && can_unload(is_alive, keep_alive, (oop*)&_graal_compiled_method, unloading_occurred)) {
+    return;
+  }
+
   // Exception cache
   ExceptionCache* ec = exception_cache();
   while (ec != NULL) {
@@ -1707,6 +1723,7 @@
 
   // Compiled code
   f->do_oop((oop*) &_method);
+  f->do_oop((oop*) &_graal_compiled_method);
   if (!do_strong_roots_only) {
     // weak roots processing phase -- update ExceptionCache oops
     ExceptionCache* ec = exception_cache();