hotspot/src/share/vm/code/nmethod.cpp

Print this page

        

@@ -63,10 +63,15 @@
 bool nmethod::is_compiled_by_c2() const {
   if (compiler() == NULL || method() == NULL)  return false;  // can happen during debug printing
   if (is_native_method()) return false;
   return compiler()->is_c2();
 }
+bool nmethod::is_compiled_by_shark() const {
+  if (is_native_method()) return false;
+  assert(compiler() != NULL, "must be");
+  return compiler()->is_shark();
+}
 
 
 
 //---------------------------------------------------------------------------------
 // NMethod statistics

@@ -1403,10 +1408,14 @@
 
   if (is_speculatively_disconnected()) {
     CodeCache::remove_saved_code(this);
   }
 
+#ifdef SHARK
+  ((SharkCompiler *) compiler())->free_compiled_method(instructions_begin());
+#endif // SHARK
+  
   ((CodeBlob*)(this))->flush();
 
   CodeCache::free(this);
 }
 

@@ -1800,17 +1809,19 @@
 }
 
 // Method that knows how to preserve outgoing arguments at call. This method must be
 // called with a frame corresponding to a Java invoke
 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
+#ifndef SHARK
   if (!method()->is_native()) {
     SimpleScopeDesc ssd(this, fr.pc());
     Bytecode_invoke* call = Bytecode_invoke_at(ssd.method(), ssd.bci());
     bool has_receiver = call->has_receiver();
     symbolOop signature = call->signature();
     fr.oops_compiled_arguments_do(signature, has_receiver, reg_map, f);
   }
+#endif // !SHARK
 }
 
 
 oop nmethod::embeddedOop_at(u_char* p) {
   RelocIterator iter(this, p, p + oopSize);

@@ -2311,10 +2322,12 @@
 
   if (is_compiled_by_c1()) {
     tty->print("(c1) ");
   } else if (is_compiled_by_c2()) {
     tty->print("(c2) ");
+  } else if (is_compiled_by_shark()) {
+    tty->print("(shark) ");
   } else {
     tty->print("(nm) ");
   }
 
   print_on(tty, "nmethod");