< prev index next >

src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp

Print this page

        

@@ -688,10 +688,90 @@
   __ movptr(Address(rsp, 0), rsp); // set expression stack bottom
 }
 
 // End of helpers
 
+// Method entry for java.lang.Continuation.run.
+address TemplateInterpreterGenerator::generate_Continuation_run_entry(void) {
+  address entry = __ pc();
+
+  const Address constMethod(rbx, Method::const_offset());
+  // const Address access_flags(rbx, Method::access_flags_offset());
+
+  __ movptr(rdx, constMethod);
+
+  const Address size_of_parameters(rdx,
+                                   ConstMethod::size_of_parameters_offset());
+  // const Address size_of_locals(rdx, ConstMethod::size_of_locals_offset());
+
+  __ load_unsigned_short(rcx, size_of_parameters);
+  __ subl(rdx, rdx);// rdx = 0 = no. of additional locals
+
+  // __ stop("333");
+  // rbx: Method*
+  // rcx: size of parameters
+  // rbcp: sender_sp (could differ from sp+wordSize if we were called via c2i )
+
+  // see if we've got enough room on the stack for locals plus overhead.
+  generate_stack_overflow_check();
+
+  // rbx: Method*
+  // rcx: size of parameters
+  // rbcp: sender sp
+  
+  __ pop(rax); // get return address
+
+  // compute beginning of parameters
+  __ lea(rlocals, Address(rsp, rcx, Interpreter::stackElementScale(), -wordSize));
+
+  // add 2 zero-initialized slots for native calls
+  // initialize result_handler slot
+  __ push((int) NULL_WORD);
+  // slot for oop temp
+  // (static native method holder mirror/jni oop result)
+  __ push((int) NULL_WORD);
+
+  // initialize fixed part of activation frame
+  generate_fixed_frame(false);
+
+  __ movptr(rax, Address(rlocals, 0)); // Address(rsp, wordSize)
+
+  // rax: local 0
+  
+  // const int target_offset = java_lang_Continuation::target_offset;
+  // guarantee(target_offset > 0, "target offset not initialized");
+
+  // Load the value of the referent field.
+  // const Address field_address(rax, target_offset);
+  // __ load_heap_oop(rcx, field_address);
+
+  // const Register thread = rcx;
+  // __ get_thread(thread);
+  // __ set_last_Java_frame(thread, noreg, noreg, NULL /* __ pc()*/ );
+  // __ reset_last_Java_frame(thread, false);
+
+  Register rarg1 = rax;
+  __ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::enter_continuation), rarg1);
+
+  // __ get_thread(thread);
+  // __ reset_last_Java_frame(thread, false);
+
+  __ remove_activation(vtos, rbcp);
+  __ jmp(rbcp);
+
+  return entry;
+}
+
+// address TemplateInterpreterGenerator::generate_Continuation_run_return_entry(void) {
+//   address entry = __ pc();
+
+//   __ remove_activation(state, rbcp);
+//   __ jmp(rbcp);
+
+//   return entry;
+// }
+
 // Method entry for java.lang.ref.Reference.get.
 address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
 #if INCLUDE_ALL_GCS
   // Code: _aload_0, _getfield, _areturn
   // parameter size = 1
< prev index next >