diff src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 10475:3489047ffea2

Restructure the handling of HotSpotInstalledCode and their link to nmethods.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 21 Jun 2013 18:26:52 +0200
parents 836a62f43af9
children 40b8c383bc31
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Jun 21 17:52:19 2013 +0200
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Jun 21 18:26:52 2013 +0200
@@ -46,6 +46,9 @@
 #include "runtime/vframeArray.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
+#ifdef GRAAL
+#include "graal/graalJavaAccess.hpp"
+#endif
 
 #define __ _masm->
 
@@ -908,20 +911,32 @@
 
   // Move first object argument from interpreter calling convention to compiled
   // code calling convention.
-  __ movq(j_rarg0, Address(r11, Interpreter::stackElementSize*5));
+  __ movq(j_rarg0, Address(r11, Interpreter::stackElementSize*4));
 
   // Move second object argument.
-  __ movq(j_rarg1, Address(r11, Interpreter::stackElementSize*4));
+  __ movq(j_rarg1, Address(r11, Interpreter::stackElementSize*3));
 
   // Move third object argument.
-  __ movq(j_rarg2, Address(r11, Interpreter::stackElementSize*3));
+  __ movq(j_rarg2, Address(r11, Interpreter::stackElementSize*2));
+
+  // Load the raw pointer to the HotSpotInstalledCode object.
+  __ movq(j_rarg3, Address(r11, Interpreter::stackElementSize));
 
-  // Load the raw pointer to the nmethod.
-  __ movq(j_rarg3, Address(r11, Interpreter::stackElementSize));
+  // Load the nmethod pointer from the HotSpotInstalledCode object
+  __ movq(j_rarg3, Address(j_rarg3, sizeof(oopDesc)));
+
+  // Check whether the nmethod was invalidated
+  __ testq(j_rarg3, j_rarg3);
+  Label invalid_nmethod;
+  __ jcc(Assembler::zero, invalid_nmethod);
 
   // Perform a tail call to the verified entry point of the nmethod.
   __ jmp(Address(j_rarg3, nmethod::verified_entry_point_offset()));
 
+  __ bind(invalid_nmethod);
+  __ xorq(rax, rax);
+  __ ret(0);
+
   return entry_point;
 }