< prev index next >

src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp

Print this page
rev 50073 : [mq]: cont

@@ -36,10 +36,11 @@
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/continuation.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/synchronizer.hpp"

@@ -171,12 +172,17 @@
   __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
   return entry;
 }
 
 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
+  return generate_return_entry_for(state, step, index_size, false);
+}
+
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size, bool X) {
   address entry = __ pc();
 
+// if(X) __ stop("XXXXXXXX 000");
 #ifndef _LP64
 #ifdef COMPILER2
   // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
   if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
     for (int i = 1; i < 8; i++) {

@@ -197,18 +203,24 @@
   } else if (state == dtos) {
     __ MacroAssembler::verify_FPU(UseSSE >= 2 ? 0 : 1, "generate_return_entry_for in interpreter");
   }
 #endif // _LP64
 
+  // if(X) __ stop("XXXXXXXX 111");
+
   // Restore stack bottom in case i2c adjusted stack
   __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
   // and NULL it as marker that esp is now tos until next java call
   __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
 
+  // if(X) __ stop("XXXXXXXX 222");
+
   __ restore_bcp();
   __ restore_locals();
 
+  // if(X) __ stop("XXXXXXXX 333"); // rbcp = r13 locals = r14
+
   if (state == atos) {
     Register mdp = rbx;
     Register tmp = rcx;
     __ profile_return_type(mdp, rax, tmp);
   }

@@ -230,10 +242,12 @@
    if (JvmtiExport::can_force_early_return()) {
      NOT_LP64(__ get_thread(java_thread));
      __ check_and_handle_earlyret(java_thread);
    }
 
+  if(X) __ stop("XXXXXXXX 444");
+  
   __ dispatch_next(state, step);
 
   return entry;
 }
 

@@ -693,10 +707,59 @@
   __ movptr(Address(rsp, 0), rsp); // set expression stack bottom
 }
 
 // End of helpers
 
+// return current sp
+address TemplateInterpreterGenerator::generate_Continuation_getSP_entry(void) {
+  address entry = __ pc();
+  
+  __ lea(rax, Address(rsp, wordSize)); // skip return address
+  __ ret(0);
+
+  return entry;
+}
+
+// return current fp
+address TemplateInterpreterGenerator::generate_Continuation_getFP_entry(void) {
+  address entry = __ pc();
+  
+  __ movptr(rax, rbp);
+  __ ret(0);
+
+  return entry;
+}
+
+// return current pc
+address TemplateInterpreterGenerator::generate_Continuation_getPC_entry(void) {
+  address entry = __ pc();
+  
+  __ movptr(rax, Address(rsp, 0));
+  __ ret(0);
+
+  return entry;
+}
+
+address TemplateInterpreterGenerator::generate_Continuation_doYield_entry(void) {
+  address entry = __ pc();
+  assert(StubRoutines::cont_doYield() != NULL, "stub not yet generated");
+
+  __ movptr(c_rarg1, Address(rsp, wordSize)); // ContinuationScope
+  __ jump(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::cont_doYield())));
+
+  return entry;
+}
+
+address TemplateInterpreterGenerator::generate_Continuation_doContinue_entry(void) {
+  address entry = __ pc();
+  assert(StubRoutines::cont_thaw(2) != NULL, "stub not yet generated");
+
+  __ jump(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::cont_thaw(2))));
+
+  return entry;
+}
+
 // Method entry for java.lang.ref.Reference.get.
 address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
   // Code: _aload_0, _getfield, _areturn
   // parameter size = 1
   //

@@ -1335,11 +1398,11 @@
 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
   // determine code generation flags
   bool inc_counter  = UseCompiler || CountCompiledCalls || LogTouchedMethods;
 
   // ebx: Method*
-  // rbcp: sender sp
+  // rbcp: sender sp (set in InterpreterMacroAssembler::prepare_to_jump_from_interpreted / generate_call_stub)
   address entry_point = __ pc();
 
   const Address constMethod(rbx, Method::const_offset());
   const Address access_flags(rbx, Method::access_flags_offset());
   const Address size_of_parameters(rdx,
< prev index next >