#7808 Save return values on the top of the stack when calling notify_method_exit

Wed, 09 Jan 2019 14:47:56 +0800

author
aoqi
date
Wed, 09 Jan 2019 14:47:56 +0800
changeset 9454
9f319eefe17b
parent 9453
dca904de5de5
child 9455
f37981eef203

#7808 Save return values on the top of the stack when calling notify_method_exit
Contributed-by: wanghaomin, aoqi

src/cpu/mips/vm/frame_mips.cpp file | annotate | diff | comparison | revisions
src/cpu/mips/vm/templateInterpreter_mips_64.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/mips/vm/frame_mips.cpp	Sat Dec 29 17:09:30 2018 +0800
     1.2 +++ b/src/cpu/mips/vm/frame_mips.cpp	Wed Jan 09 14:47:56 2019 +0800
     1.3 @@ -432,14 +432,7 @@
     1.4      // then ST0 is saved before EAX/EDX. See the note in generate_native_result
     1.5      tos_addr = (intptr_t*)sp();
     1.6      if (type == T_FLOAT || type == T_DOUBLE) {
     1.7 -    // QQQ seems like this code is equivalent on the two platforms
     1.8 -#ifdef AMD64
     1.9 -      // This is times two because we do a push(ltos) after pushing XMM0
    1.10 -      // and that takes two interpreter stack slots.
    1.11 -      tos_addr += 2 * Interpreter::stackElementWords();
    1.12 -#else
    1.13        tos_addr += 2;
    1.14 -#endif // AMD64
    1.15      }
    1.16    } else {
    1.17      tos_addr = (intptr_t*)interpreter_frame_tos_address();
    1.18 @@ -469,19 +462,7 @@
    1.19      case T_SHORT   : value_result->s = *(jshort*)tos_addr; break;
    1.20      case T_INT     : value_result->i = *(jint*)tos_addr; break;
    1.21      case T_LONG    : value_result->j = *(jlong*)tos_addr; break;
    1.22 -    case T_FLOAT   : {
    1.23 -#ifdef AMD64
    1.24 -      value_result->f = *(jfloat*)tos_addr;
    1.25 -#else
    1.26 -      if (method->is_native()) {
    1.27 -        jdouble d = *(jdouble*)tos_addr;  // Result was in ST0 so need to convert to jfloat
    1.28 -        value_result->f = (jfloat)d;
    1.29 -      } else {
    1.30 -        value_result->f = *(jfloat*)tos_addr;
    1.31 -      }
    1.32 -#endif // AMD64
    1.33 -      break;
    1.34 -    }
    1.35 +    case T_FLOAT   : value_result->f = *(jfloat*)tos_addr; break;
    1.36      case T_DOUBLE  : value_result->d = *(jdouble*)tos_addr; break;
    1.37      case T_VOID    : /* Nothing to do */ break;
    1.38      default        : ShouldNotReachHere();
     2.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Sat Dec 29 17:09:30 2018 +0800
     2.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Wed Jan 09 14:47:56 2019 +0800
     2.3 @@ -1268,7 +1268,7 @@
     2.4    // call native method
     2.5    __ jalr(T9);
     2.6    __ delayed()->nop();
     2.7 -  // result potentially in V2:V1 or F0:F1
     2.8 +  // result potentially in V0 or F0
     2.9  
    2.10  
    2.11    // via _last_native_pc and not via _last_jave_sp
    2.12 @@ -1277,10 +1277,8 @@
    2.13    // interpreter_frame_result will have to be changed.
    2.14    //FIXME, should modify here
    2.15    // save return value to keep the value from being destroyed by other calls
    2.16 -  __ move(S1, V0);
    2.17 -  __ move(S3, V1);
    2.18 -  __ dmfc1(S4, F0);
    2.19 -  __ dmfc1(S2, F1);
    2.20 +  __ push(dtos);
    2.21 +  __ push(ltos);
    2.22  
    2.23    // change thread state
    2.24    __ get_thread(thread);
    2.25 @@ -1338,7 +1336,7 @@
    2.26      __ li(T0, AbstractInterpreter::result_handler(T_OBJECT));
    2.27      __ bne(AT, T0, no_oop);
    2.28      __ delayed()->nop();
    2.29 -    __ move(V0, S1);
    2.30 +    __ pop(ltos);
    2.31      __ beq(V0, R0, store_result);
    2.32      __ delayed()->nop();
    2.33      // unbox
    2.34 @@ -1346,6 +1344,7 @@
    2.35      __ bind(store_result);
    2.36      __ sd(V0, FP, (frame::interpreter_frame_oop_temp_offset)*wordSize);
    2.37      // keep stack depth as expected by pushing oop which will eventually be discarded
    2.38 +    __ push(ltos);
    2.39      __ bind(no_oop);
    2.40    }
    2.41    {
    2.42 @@ -1425,19 +1424,14 @@
    2.43    //       the exception handler code notifies the runtime of method exits
    2.44    //       too. If this happens before, method entry/exit notifications are
    2.45    //       not properly paired (was bug - gri 11/22/99).
    2.46 -  __ notify_method_exit(false, vtos, InterpreterMacroAssembler::NotifyJVMTI );
    2.47 +  __ notify_method_exit(false, vtos, InterpreterMacroAssembler::NotifyJVMTI);
    2.48  
    2.49 -  // restore potential result in V0:V1,
    2.50 +  // restore potential result in V0,
    2.51    // call result handler to restore potential result in ST0 & handle result
    2.52 -  //__ lw(V0, SP, 3 * wordSize);
    2.53 -  //__ lw(V1, SP, 2 * wordSize);
    2.54 -  //__ lwc1(F0, SP, 1 * wordSize);
    2.55 -  //__ lwc1(F1, SP, 0 * wordSize);
    2.56 -  //__ addi(SP, SP, 4 * wordSize);
    2.57 -  __ move(V0, S1);
    2.58 -  __ move(V1, S3);
    2.59 -  __ dmtc1(S4, F0);
    2.60 -  __ dmtc1(S2, F1);
    2.61 +
    2.62 +  __ pop(ltos);
    2.63 +  __ pop(dtos);
    2.64 +
    2.65    __ ld(t, FP, (frame::interpreter_frame_result_handler_offset) * wordSize);
    2.66    __ jalr(t);
    2.67    __ delayed()->nop();
    2.68 @@ -2135,22 +2129,21 @@
    2.69  #ifndef OPT_THREAD
    2.70    __ get_thread(TREG);
    2.71  #endif
    2.72 -   __ ld_ptr(T9, TREG, in_bytes(JavaThread::jvmti_thread_state_offset()));
    2.73 -  //const Address cond_addr(ecx, JvmtiThreadState::earlyret_state_offset());
    2.74 +  __ ld_ptr(T9, TREG, in_bytes(JavaThread::jvmti_thread_state_offset()));
    2.75    const Address cond_addr(T9, in_bytes(JvmtiThreadState::earlyret_state_offset()));
    2.76    // Clear the earlyret state
    2.77 -    __ move(AT,JvmtiThreadState::earlyret_inactive);
    2.78 -    __ sw(AT,cond_addr);
    2.79 -    __ sync();
    2.80 +  __ move(AT, JvmtiThreadState::earlyret_inactive);
    2.81 +  __ sw(AT, cond_addr);
    2.82 +  __ sync();
    2.83  
    2.84  
    2.85 -    __ remove_activation(state, T0,
    2.86 +  __ remove_activation(state, T0,
    2.87                           false, /* throw_monitor_exception */
    2.88                           false, /* install_monitor_exception */
    2.89                           true); /* notify_jvmdi */
    2.90 -    __ sync();
    2.91 -    __ jr(T0);
    2.92 -    __ delayed()->nop();
    2.93 +  __ sync();
    2.94 +  __ jr(T0);
    2.95 +  __ delayed()->nop();
    2.96    return entry;
    2.97  } // end of ForceEarlyReturn support
    2.98  

mercurial