src/cpu/mips/vm/templateInterpreter_mips_64.cpp

changeset 9274
0e232e568230
parent 9254
6453d3a9f18e
child 9454
9f319eefe17b
     1.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Fri Dec 07 14:41:48 2018 +0800
     1.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Fri Dec 07 14:53:37 2018 +0800
     1.3 @@ -302,64 +302,92 @@
     1.4  // Note: checking for negative value instead of overflow
     1.5  //       so we have a 'sticky' overflow test
     1.6  //
     1.7 -// prerequisites : method in T0, invocation counter in T3
     1.8 +// Rmethod: method
     1.9 +// T3     : invocation counter
    1.10 +//
    1.11  void InterpreterGenerator::generate_counter_incr(
    1.12          Label* overflow,
    1.13          Label* profile_method,
    1.14          Label* profile_method_continue) {
    1.15    Label done;
    1.16 -  const Address invocation_counter(FSR, in_bytes(MethodCounters::invocation_counter_offset())
    1.17 -      + in_bytes(InvocationCounter::counter_offset()));
    1.18 -  const Address backedge_counter  (FSR, in_bytes(MethodCounters::backedge_counter_offset())
    1.19 -      + in_bytes(InvocationCounter::counter_offset()));
    1.20 +  if (TieredCompilation) {
    1.21 +    int increment = InvocationCounter::count_increment;
    1.22 +    int mask = ((1 << Tier0InvokeNotifyFreqLog)  - 1) << InvocationCounter::count_shift;
    1.23 +    Label no_mdo;
    1.24 +    if (ProfileInterpreter) {
    1.25 +      // Are we profiling?
    1.26 +      __ ld(FSR, Address(Rmethod, Method::method_data_offset()));
    1.27 +      __ beq(FSR, R0, no_mdo);
    1.28 +      __ delayed()->nop();
    1.29 +      // Increment counter in the MDO
    1.30 +      const Address mdo_invocation_counter(FSR, in_bytes(MethodData::invocation_counter_offset()) +
    1.31 +                                                in_bytes(InvocationCounter::counter_offset()));
    1.32 +      __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, T3, false, Assembler::zero, overflow);
    1.33 +      __ beq(R0, R0, done);
    1.34 +      __ delayed()->nop();
    1.35 +    }
    1.36 +    __ bind(no_mdo);
    1.37 +    // Increment counter in MethodCounters
    1.38 +    const Address invocation_counter(FSR,
    1.39 +                  MethodCounters::invocation_counter_offset() +
    1.40 +                  InvocationCounter::counter_offset());
    1.41 +    __ get_method_counters(Rmethod, FSR, done);
    1.42 +    __ increment_mask_and_jump(invocation_counter, increment, mask, T3, false, Assembler::zero, overflow);
    1.43 +    __ bind(done);
    1.44 +  } else {
    1.45 +    const Address invocation_counter(FSR, in_bytes(MethodCounters::invocation_counter_offset())
    1.46 +        + in_bytes(InvocationCounter::counter_offset()));
    1.47 +    const Address backedge_counter  (FSR, in_bytes(MethodCounters::backedge_counter_offset())
    1.48 +        + in_bytes(InvocationCounter::counter_offset()));
    1.49  
    1.50 -  __ get_method_counters(Rmethod, FSR, done);
    1.51 +    __ get_method_counters(Rmethod, FSR, done);
    1.52  
    1.53 -  if (ProfileInterpreter) { // %%% Merge this into methodDataOop
    1.54 -    __ lw(T9, FSR, in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
    1.55 -    __ incrementl(T9, 1);
    1.56 -    __ sw(T9, FSR, in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
    1.57 -  }
    1.58 -  // Update standard invocation counters
    1.59 -  __ lw(T3, invocation_counter);
    1.60 -  __ increment(T3, InvocationCounter::count_increment);
    1.61 -  __ sw(T3, invocation_counter);  // save invocation count
    1.62 +    if (ProfileInterpreter) { // %%% Merge this into methodDataOop
    1.63 +      __ lw(T9, FSR, in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
    1.64 +      __ incrementl(T9, 1);
    1.65 +      __ sw(T9, FSR, in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
    1.66 +    }
    1.67 +    // Update standard invocation counters
    1.68 +    __ lw(T3, invocation_counter);
    1.69 +    __ increment(T3, InvocationCounter::count_increment);
    1.70 +    __ sw(T3, invocation_counter);  // save invocation count
    1.71  
    1.72 -  __ lw(FSR, backedge_counter);  // load backedge counter
    1.73 -  __ li(AT, InvocationCounter::count_mask_value);   // mask out the status bits
    1.74 -  __ andr(FSR, FSR, AT);
    1.75 +    __ lw(FSR, backedge_counter);  // load backedge counter
    1.76 +    __ li(AT, InvocationCounter::count_mask_value);   // mask out the status bits
    1.77 +    __ andr(FSR, FSR, AT);
    1.78  
    1.79 -  __ dadd(T3, T3, FSR);          // add both counters
    1.80 +    __ dadd(T3, T3, FSR);          // add both counters
    1.81  
    1.82 -  if (ProfileInterpreter && profile_method != NULL) {
    1.83 -    // Test to see if we should create a method data oop
    1.84 -    if (Assembler::is_simm16(InvocationCounter::InterpreterProfileLimit)) {
    1.85 -      __ slti(AT, T3, InvocationCounter::InterpreterProfileLimit);
    1.86 +    if (ProfileInterpreter && profile_method != NULL) {
    1.87 +      // Test to see if we should create a method data oop
    1.88 +      if (Assembler::is_simm16(InvocationCounter::InterpreterProfileLimit)) {
    1.89 +        __ slti(AT, T3, InvocationCounter::InterpreterProfileLimit);
    1.90 +      } else {
    1.91 +        __ li(AT, (long)&InvocationCounter::InterpreterProfileLimit);
    1.92 +        __ lw(AT, AT, 0);
    1.93 +        __ slt(AT, T3, AT);
    1.94 +      }
    1.95 +
    1.96 +      __ bne_far(AT, R0, *profile_method_continue);
    1.97 +      __ delayed()->nop();
    1.98 +
    1.99 +      // if no method data exists, go to profile_method
   1.100 +      __ test_method_data_pointer(FSR, *profile_method);
   1.101 +    }
   1.102 +
   1.103 +    if (Assembler::is_simm16(CompileThreshold)) {
   1.104 +      __ srl(AT, T3, InvocationCounter::count_shift);
   1.105 +      __ slti(AT, AT, CompileThreshold);
   1.106      } else {
   1.107 -      __ li(AT, (long)&InvocationCounter::InterpreterProfileLimit);
   1.108 +      __ li(AT, (long)&InvocationCounter::InterpreterInvocationLimit);
   1.109        __ lw(AT, AT, 0);
   1.110        __ slt(AT, T3, AT);
   1.111      }
   1.112  
   1.113 -    __ bne_far(AT, R0, *profile_method_continue);
   1.114 +    __ beq_far(AT, R0, *overflow);
   1.115      __ delayed()->nop();
   1.116 -
   1.117 -    // if no method data exists, go to profile_method
   1.118 -    __ test_method_data_pointer(FSR, *profile_method);
   1.119 +    __ bind(done);
   1.120    }
   1.121 -
   1.122 -  if (Assembler::is_simm16(CompileThreshold)) {
   1.123 -    __ srl(AT, T3, InvocationCounter::count_shift);
   1.124 -    __ slti(AT, AT, CompileThreshold);
   1.125 -  } else {
   1.126 -    __ li(AT, (long)&InvocationCounter::InterpreterInvocationLimit);
   1.127 -    __ lw(AT, AT, 0);
   1.128 -    __ slt(AT, T3, AT);
   1.129 -  }
   1.130 -
   1.131 -  __ beq_far(AT, R0, *overflow);
   1.132 -  __ delayed()->nop();
   1.133 -  __ bind(done);
   1.134  }
   1.135  
   1.136  void InterpreterGenerator::generate_counter_overflow(Label* do_continue) {

mercurial