src/cpu/sparc/vm/methodHandles_sparc.cpp

changeset 2204
5beba6174298
parent 2201
d55217dc206f
child 2256
7aff5786cc02
     1.1 --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Oct 12 02:21:06 2010 -0700
     1.2 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Wed Oct 13 01:19:43 2010 -0700
     1.3 @@ -27,6 +27,14 @@
     1.4  
     1.5  #define __ _masm->
     1.6  
     1.7 +#ifdef PRODUCT
     1.8 +#define BLOCK_COMMENT(str) /* nothing */
     1.9 +#else
    1.10 +#define BLOCK_COMMENT(str) __ block_comment(str)
    1.11 +#endif
    1.12 +
    1.13 +#define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
    1.14 +
    1.15  address MethodHandleEntry::start_compiled_entry(MacroAssembler* _masm,
    1.16                                                  address interpreted_entry) {
    1.17    // Just before the actual machine code entry point, allocate space
    1.18 @@ -105,6 +113,7 @@
    1.19  static void verify_argslot(MacroAssembler* _masm, Register argslot_reg, Register temp_reg, const char* error_message) {
    1.20    // Verify that argslot lies within (Gargs, FP].
    1.21    Label L_ok, L_bad;
    1.22 +  BLOCK_COMMENT("{ verify_argslot");
    1.23  #ifdef _LP64
    1.24    __ add(FP, STACK_BIAS, temp_reg);
    1.25    __ cmp(argslot_reg, temp_reg);
    1.26 @@ -119,6 +128,7 @@
    1.27    __ bind(L_bad);
    1.28    __ stop(error_message);
    1.29    __ bind(L_ok);
    1.30 +  BLOCK_COMMENT("} verify_argslot");
    1.31  }
    1.32  #endif
    1.33  
    1.34 @@ -175,6 +185,7 @@
    1.35    //   for (temp = sp + size; temp < argslot; temp++)
    1.36    //     temp[-size] = temp[0]
    1.37    //   argslot -= size;
    1.38 +  BLOCK_COMMENT("insert_arg_slots {");
    1.39    RegisterOrConstant offset = __ regcon_sll_ptr(arg_slots, LogBytesPerWord, temp3_reg);
    1.40  
    1.41    // Keep the stack pointer 2*wordSize aligned.
    1.42 @@ -187,7 +198,7 @@
    1.43  
    1.44    {
    1.45      Label loop;
    1.46 -    __ bind(loop);
    1.47 +    __ BIND(loop);
    1.48      // pull one word down each time through the loop
    1.49      __ ld_ptr(Address(temp_reg, 0), temp2_reg);
    1.50      __ st_ptr(temp2_reg, Address(temp_reg, offset));
    1.51 @@ -199,6 +210,7 @@
    1.52  
    1.53    // Now move the argslot down, to point to the opened-up space.
    1.54    __ add(argslot_reg, offset, argslot_reg);
    1.55 +  BLOCK_COMMENT("} insert_arg_slots");
    1.56  }
    1.57  
    1.58  
    1.59 @@ -235,6 +247,7 @@
    1.60    }
    1.61  #endif // ASSERT
    1.62  
    1.63 +  BLOCK_COMMENT("remove_arg_slots {");
    1.64    // Pull up everything shallower than argslot.
    1.65    // Then remove the excess space on the stack.
    1.66    // The stacked return address gets pulled up with everything else.
    1.67 @@ -246,7 +259,7 @@
    1.68    __ sub(argslot_reg, wordSize, temp_reg);  // source pointer for copy
    1.69    {
    1.70      Label loop;
    1.71 -    __ bind(loop);
    1.72 +    __ BIND(loop);
    1.73      // pull one word up each time through the loop
    1.74      __ ld_ptr(Address(temp_reg, 0), temp2_reg);
    1.75      __ st_ptr(temp2_reg, Address(temp_reg, offset));
    1.76 @@ -265,29 +278,35 @@
    1.77    const int TwoWordAlignmentMask = right_n_bits(LogBytesPerWord + 1);
    1.78    RegisterOrConstant masked_offset = __ regcon_andn_ptr(offset, TwoWordAlignmentMask, temp_reg);
    1.79    __ add(SP, masked_offset, SP);
    1.80 +  BLOCK_COMMENT("} remove_arg_slots");
    1.81  }
    1.82  
    1.83  
    1.84  #ifndef PRODUCT
    1.85  extern "C" void print_method_handle(oop mh);
    1.86  void trace_method_handle_stub(const char* adaptername,
    1.87 -                              oop mh) {
    1.88 -#if 0
    1.89 -                              intptr_t* entry_sp,
    1.90 -                              intptr_t* saved_sp,
    1.91 -                              intptr_t* saved_bp) {
    1.92 -  // called as a leaf from native code: do not block the JVM!
    1.93 -  intptr_t* last_sp = (intptr_t*) saved_bp[frame::interpreter_frame_last_sp_offset];
    1.94 -  intptr_t* base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset];
    1.95 -  printf("MH %s mh="INTPTR_FORMAT" sp=("INTPTR_FORMAT"+"INTX_FORMAT") stack_size="INTX_FORMAT" bp="INTPTR_FORMAT"\n",
    1.96 -         adaptername, (intptr_t)mh, (intptr_t)entry_sp, (intptr_t)(saved_sp - entry_sp), (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp);
    1.97 -  if (last_sp != saved_sp)
    1.98 -    printf("*** last_sp="INTPTR_FORMAT"\n", (intptr_t)last_sp);
    1.99 -#endif
   1.100 -
   1.101 +                              oopDesc* mh) {
   1.102    printf("MH %s mh="INTPTR_FORMAT"\n", adaptername, (intptr_t) mh);
   1.103    print_method_handle(mh);
   1.104  }
   1.105 +void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
   1.106 +  if (!TraceMethodHandles)  return;
   1.107 +  BLOCK_COMMENT("trace_method_handle {");
   1.108 +  // save: Gargs, O5_savedSP
   1.109 +  __ save_frame(16);
   1.110 +  __ set((intptr_t) adaptername, O0);
   1.111 +  __ mov(G3_method_handle, O1);
   1.112 +  __ mov(G3_method_handle, L3);
   1.113 +  __ mov(Gargs, L4);
   1.114 +  __ mov(G5_method_type, L5);
   1.115 +  __ call_VM_leaf(L7, CAST_FROM_FN_PTR(address, trace_method_handle_stub));
   1.116 +
   1.117 +  __ mov(L3, G3_method_handle);
   1.118 +  __ mov(L4, Gargs);
   1.119 +  __ mov(L5, G5_method_type);
   1.120 +  __ restore();
   1.121 +  BLOCK_COMMENT("} trace_method_handle");
   1.122 +}
   1.123  #endif // PRODUCT
   1.124  
   1.125  // which conversion op types are implemented here?
   1.126 @@ -349,16 +368,7 @@
   1.127  
   1.128    address interp_entry = __ pc();
   1.129  
   1.130 -#ifndef PRODUCT
   1.131 -  if (TraceMethodHandles) {
   1.132 -    // save: Gargs, O5_savedSP
   1.133 -    __ save(SP, -16*wordSize, SP);
   1.134 -    __ set((intptr_t) entry_name(ek), O0);
   1.135 -    __ mov(G3_method_handle, O1);
   1.136 -    __ call_VM_leaf(Lscratch, CAST_FROM_FN_PTR(address, trace_method_handle_stub));
   1.137 -    __ restore(SP, 16*wordSize, SP);
   1.138 -  }
   1.139 -#endif // PRODUCT
   1.140 +  trace_method_handle(_masm, entry_name(ek));
   1.141  
   1.142    switch ((int) ek) {
   1.143    case _raise_exception:

mercurial