changeset 465:93e8421c14a6

meth: assembler tweaks
author jrose
date Tue, 10 Jul 2012 13:25:34 -0700
parents 851ca5831589
children edfc23d84113
files meth-lazy-7023639.patch
diffstat 1 files changed, 37 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.patch	Tue Jul 10 01:42:34 2012 -0700
+++ b/meth-lazy-7023639.patch	Tue Jul 10 13:25:34 2012 -0700
@@ -860,7 +860,7 @@
    Label L_ok, L_bad;
    BLOCK_COMMENT("verify_klass {");
    __ verify_oop(obj_reg);
-@@ -498,538 +91,413 @@
+@@ -498,538 +91,419 @@
    __ set(ExternalAddress(klass_addr), temp2_reg);
    __ ld_ptr(Address(temp2_reg, 0), temp2_reg);
    __ cmp_and_brx_short(temp_reg, temp2_reg, Assembler::equal, Assembler::pt, L_ok);
@@ -1059,21 +1059,28 @@
 -  Address mh_receiver_slot_addr(O4_argbase, -Interpreter::stackElementSize);
 -  __ ld_ptr(mh_receiver_slot_addr, G3_method_handle);
 +  // First task:  Find out how big the argument list is.
-+  __ load_sized_value(Address(G5_method, methodOopDesc::size_of_parameters_offset()),
-+                      O4_param_size,
-+                      sizeof(u2), /*is_signed*/ false);
-+  // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), "");
-+  Address G4_first_arg_addr = __ argument_address(O4_param_size, O1_scratch, -1);
-+  DEBUG_ONLY(O4_param_size = noreg);
++  Address O4_first_arg_addr;
++  int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
++  assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
++  if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
++    __ load_sized_value(Address(G5_method, methodOopDesc::size_of_parameters_offset()),
++                        O4_param_size,
++                        sizeof(u2), /*is_signed*/ false);
++    // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), "");
++    O4_first_arg_addr = __ argument_address(O4_param_size, O4_param_size, -1);
++  } else {
++    DEBUG_ONLY(O4_param_size = noreg);
++  }
  
 -  trace_method_handle(_masm, "invokeExact");
 +  Register O0_mh = noreg;
 +  if (!is_signature_polymorphic_static(iid)) {
-+    __ ld_ptr(G4_first_arg_addr, O0_mh = O0);
++    __ ld_ptr(O4_first_arg_addr, O0_mh = O0);
++    DEBUG_ONLY(O4_param_size = noreg);
 +  }
  
 -  __ check_method_handle_type(O0_mtype, G3_method_handle, O1_scratch, wrong_method_type);
-+  // G4_first_arg_addr is live!
++  // O4_first_arg_addr is live!
  
 -  // Nobody uses the MH receiver slot after this.  Make sure.
 -  DEBUG_ONLY(__ set((int32_t) 0x999999, O1_scratch); __ st_ptr(O1_scratch, mh_receiver_slot_addr));
@@ -1112,12 +1119,11 @@
 -    __ bind(L);
 +  } else {
 +    // Adjust argument list by popping the trailing MemberName argument.
-+    int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
-+    assert(ref_kind != 0, "must be _invokeBasic or a linkTo intrinsic");
 +    Register O0_recv = noreg;
 +    if (MethodHandles::ref_kind_has_receiver(ref_kind)) {
 +      // Load the receiver (not the MH; the actual MemberName's receiver) up from the interpreter stack.
-+      __ ld_ptr(G4_first_arg_addr, O0_recv = O0);
++      __ ld_ptr(O4_first_arg_addr, O0_recv = O0);
++      DEBUG_ONLY(O4_param_size = noreg);
 +    }
 +    Register G5_member = G5_method;  // MemberName ptr; incoming method ptr is dead now
 +    __ ld_ptr(__ argument_address(constant(0)), G5_member);
@@ -1749,7 +1755,7 @@
  
    if (Verbose) {
      // dumping last frame with frame::describe
-@@ -1090,6 +558,7 @@
+@@ -1090,6 +564,7 @@
  
      // mark saved_sp, if seems valid (may not be valid for some adapters)
      intptr_t *unbiased_sp = (intptr_t *)(STACK_BIAS+(uintptr_t)saved_sp);
@@ -1757,7 +1763,7 @@
      if ((unbiased_sp >= dump_sp - UNREASONABLE_STACK_MOVE) && (unbiased_sp < dump_fp)) {
        values.describe(-1, unbiased_sp, "*saved_sp+STACK_BIAS");
      }
-@@ -1097,10 +566,13 @@
+@@ -1097,10 +572,13 @@
      // Note: the unextended_sp may not be correct
      tty->print_cr("  stack layout:");
      values.print(p);
@@ -1775,7 +1781,7 @@
    }
  }
  
-@@ -1143,1260 +615,3 @@
+@@ -1143,1260 +621,3 @@
    BLOCK_COMMENT("} trace_method_handle");
  }
  #endif // PRODUCT
@@ -5210,7 +5216,7 @@
      Label run_compiled_code;
      // JVMTI events, such as single-stepping, are implemented partly by avoiding running
      // compiled code in threads for which the event is enabled.  Check here for
-@@ -567,462 +138,370 @@
+@@ -567,462 +138,376 @@
      __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0);
      __ jccb(Assembler::zero, run_compiled_code);
      __ jmp(Address(method, methodOopDesc::interpreter_entry_offset()));
@@ -5344,15 +5350,23 @@
 -  Address mh_receiver_slot_addr = __ argument_address(rdx_vmslots);
 -  __ movptr(rcx_recv, mh_receiver_slot_addr);
 +  // First task:  Find out how big the argument list is.
-+  __ load_sized_value(rdx_argp,
-+                      Address(rbx_method, methodOopDesc::size_of_parameters_offset()),
-+                      sizeof(u2), /*is_signed*/ false);
-+  // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), "");
-+  Address rdx_first_arg_addr = __ argument_address(rdx_argp, -1);
++  Address rdx_first_arg_addr;
++  int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
++  assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
++  if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
++    __ load_sized_value(rdx_argp,
++                        Address(rbx_method, methodOopDesc::size_of_parameters_offset()),
++                        sizeof(u2), /*is_signed*/ false);
++    // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), "");
++    rdx_first_arg_addr = __ argument_address(rdx_argp, -1);
++  } else {
++    DEBUG_ONLY(rdx_argp = noreg);
++  }
  
 -  trace_method_handle(_masm, "invokeExact");
 +  if (!is_signature_polymorphic_static(iid)) {
 +    __ movptr(rcx_mh, rdx_first_arg_addr);
++    DEBUG_ONLY(rdx_argp = noreg);
 +  }
  
 -  __ check_method_handle_type(rax_mtype, rcx_recv, rdi_temp, wrong_method_type);
@@ -5389,8 +5403,6 @@
 -  __ pushptr(Address(rdi, 0));  // Pick up the return address
 +  } else {
 +    // Adjust argument list by popping the trailing MemberName argument.
-+    int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
-+    assert(ref_kind != 0, "must be _invokeBasic or a linkTo intrinsic");
 +    Register rcx_recv = noreg;
 +    if (MethodHandles::ref_kind_has_receiver(ref_kind)) {
 +      // Load the receiver (not the MH; the actual MemberName's receiver) up from the interpreter stack.
@@ -5997,7 +6009,7 @@
  
    if (Verbose) {
      tty->print_cr("Registers:");
-@@ -1086,12 +565,18 @@
+@@ -1086,12 +571,18 @@
          values.describe(-1, dump_fp, "fp for #1 <not parsed, cannot trust pc>");
          values.describe(-1, dump_sp, "sp for #1");
        }
@@ -6018,7 +6030,7 @@
    }
  }
  
-@@ -1159,1363 +644,3 @@
+@@ -1159,1363 +650,3 @@
  }
  #endif //PRODUCT