[aarch64-port-dev ] JVMTI earlyreturn support

Andrew Haley aph at redhat.com
Tue Oct 1 08:18:53 PDT 2013


changeset:   5315:2ce0fb54933f
tag:         tip
user:        aph
date:        Tue Oct 01 16:17:58 2013 +0100
files:       src/cpu/aarch64/vm/interp_masm_aarch64.cpp src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
description:
JVMTI earlyreturn support


diff -r c2d6e3b390e8 -r 2ce0fb54933f src/cpu/aarch64/vm/interp_masm_aarch64.cpp
--- a/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Tue Oct 01 15:01:30 2013 +0100
+++ b/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Tue Oct 01 16:17:58 2013 +0100
@@ -71,12 +71,33 @@
    }
  }

+
  void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
-  if (JvmtiExport::can_force_early_return()) {
-    Unimplemented();
+  ldr(r2, Address(rthread, JavaThread::jvmti_thread_state_offset()));
+  const Address tos_addr(r2, JvmtiThreadState::earlyret_tos_offset());
+  const Address oop_addr(r2, JvmtiThreadState::earlyret_oop_offset());
+  const Address val_addr(r2, JvmtiThreadState::earlyret_value_offset());
+  switch (state) {
+    case atos: ldr(r0, oop_addr);
+               str(zr, oop_addr);
+               verify_oop(r0, state);               break;
+    case ltos: ldr(r0, val_addr);                   break;
+    case btos:                                   // fall through
+    case ctos:                                   // fall through
+    case stos:                                   // fall through
+    case itos: ldrw(r0, val_addr);                  break;
+    case ftos: ldrs(v0, val_addr);                  break;
+    case dtos: ldrd(v0, val_addr);                  break;
+    case vtos: /* nothing to do */                  break;
+    default  : ShouldNotReachHere();
    }
+  // Clean up tos value in the thread object
+  movw(rscratch1, (int) ilgl);
+  strw(rscratch1, tos_addr);
+  strw(zr, val_addr);
  }

+
  void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) {
    if (JvmtiExport::can_force_early_return()) {
      Label L;
diff -r c2d6e3b390e8 -r 2ce0fb54933f src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Oct 01 15:01:30 2013 +0100
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Oct 01 16:17:58 2013 +0100
@@ -1752,8 +1752,30 @@
  //
  // JVMTI ForceEarlyReturn support
  //
-address TemplateInterpreterGenerator::generate_earlyret_entry_for(TosState state) { __ call_Unimplemented(); return 0; }
-// end of ForceEarlyReturn support
+address TemplateInterpreterGenerator::generate_earlyret_entry_for(TosState state) {
+  address entry = __ pc();
+
+  __ restore_bcp();
+  __ restore_locals();
+  __ empty_expression_stack();
+  __ load_earlyret_value(state);
+
+  __ ldr(rscratch1, Address(rthread, JavaThread::jvmti_thread_state_offset()));
+  Address cond_addr(rscratch1, JvmtiThreadState::earlyret_state_offset());
+
+  // Clear the earlyret state
+  assert(JvmtiThreadState::earlyret_inactive == 0, "should be");
+  __ str(zr, cond_addr);
+
+  __ remove_activation(state,
+                       false, /* throw_monitor_exception */
+                       false, /* install_monitor_exception */
+                       true); /* notify_jvmdi */
+  __ ret(lr);
+
+  return entry;
+} // end of ForceEarlyReturn support
+


  //-----------------------------------------------------------------------------




More information about the aarch64-port-dev mailing list