diff src/share/vm/code/nmethod.cpp @ 7154:5d0bb7d52783

changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Dec 2012 21:36:40 +0100
parents 1baf7f1e3f23
children 0b646334c5f7
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Wed Dec 12 15:46:11 2012 +0100
+++ b/src/share/vm/code/nmethod.cpp	Wed Dec 12 21:36:40 2012 +0100
@@ -868,27 +868,28 @@
 
 #ifdef GRAAL
     _graal_installed_code = installed_code();
-
-    // Graal might not produce any stub sections
-    if (offsets->value(CodeOffsets::Exceptions) != -1) {
-      _exception_offset        = code_offset()          + offsets->value(CodeOffsets::Exceptions);
-    } else {
-      _exception_offset = -1;
-    }
-    if (offsets->value(CodeOffsets::Deopt) != -1) {
-      _deoptimize_offset       = code_offset()          + offsets->value(CodeOffsets::Deopt);
+#endif
+    if (compiler->is_graal()) {
+      // Graal might not produce any stub sections
+      if (offsets->value(CodeOffsets::Exceptions) != -1) {
+        _exception_offset        = code_offset()          + offsets->value(CodeOffsets::Exceptions);
+      } else {
+        _exception_offset = -1;
+      }
+      if (offsets->value(CodeOffsets::Deopt) != -1) {
+        _deoptimize_offset       = code_offset()          + offsets->value(CodeOffsets::Deopt);
+      } else {
+        _deoptimize_offset = -1;
+      }
+      if (offsets->value(CodeOffsets::DeoptMH) != -1) {
+        _deoptimize_mh_offset  = code_offset()          + offsets->value(CodeOffsets::DeoptMH);
+      } else {
+        _deoptimize_mh_offset  = -1;
+      }
     } else {
-      _deoptimize_offset = -1;
-    }
-    if (offsets->value(CodeOffsets::DeoptMH) != -1) {
-      _deoptimize_mh_offset  = code_offset()          + offsets->value(CodeOffsets::DeoptMH);
-    } else {
-      _deoptimize_mh_offset  = -1;
-    }
-#else
-    // Exception handler and deopt handler are in the stub section
-    assert(offsets->value(CodeOffsets::Exceptions) != -1, "must be set");
-    assert(offsets->value(CodeOffsets::Deopt     ) != -1, "must be set");
+      // Exception handler and deopt handler are in the stub section
+      assert(offsets->value(CodeOffsets::Exceptions) != -1, "must be set");
+      assert(offsets->value(CodeOffsets::Deopt     ) != -1, "must be set");
 
       _exception_offset        = _stub_offset          + offsets->value(CodeOffsets::Exceptions);
       _deoptimize_offset       = _stub_offset          + offsets->value(CodeOffsets::Deopt);
@@ -897,7 +898,7 @@
       } else {
         _deoptimize_mh_offset  = -1;
       }
-#endif
+    }
     if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
       _unwind_handler_offset = code_offset()         + offsets->value(CodeOffsets::UnwindHandler);
     } else {
@@ -1241,9 +1242,7 @@
 }
 
 void nmethod::inc_decompile_count() {
-#ifndef GRAAL
-  if (!is_compiled_by_c2()) return;
-#endif
+  if (!is_compiled_by_c2() && !is_compiled_by_graal()) return;
   // Could be gated by ProfileTraps, but do not bother...
   Method* m = method();
   if (m == NULL)  return;