src/cpu/sparc/vm/interp_masm_sparc.cpp

changeset 3037
3d42f82cd811
parent 2698
38fea01eb669
child 3050
fdb992d83a87
     1.1 --- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Jul 21 08:38:25 2011 -0700
     1.2 +++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Jul 21 11:25:07 2011 -0700
     1.3 @@ -236,17 +236,13 @@
     1.4      Label L;
     1.5      Register thr_state = G3_scratch;
     1.6      ld_ptr(G2_thread, JavaThread::jvmti_thread_state_offset(), thr_state);
     1.7 -    tst(thr_state);
     1.8 -    br(zero, false, pt, L); // if (thread->jvmti_thread_state() == NULL) exit;
     1.9 -    delayed()->nop();
    1.10 +    br_null_short(thr_state, pt, L); // if (thread->jvmti_thread_state() == NULL) exit;
    1.11  
    1.12      // Initiate earlyret handling only if it is not already being processed.
    1.13      // If the flag has the earlyret_processing bit set, it means that this code
    1.14      // is called *during* earlyret handling - we don't want to reenter.
    1.15      ld(thr_state, JvmtiThreadState::earlyret_state_offset(), G4_scratch);
    1.16 -    cmp(G4_scratch, JvmtiThreadState::earlyret_pending);
    1.17 -    br(Assembler::notEqual, false, pt, L);
    1.18 -    delayed()->nop();
    1.19 +    cmp_and_br_short(G4_scratch, JvmtiThreadState::earlyret_pending, Assembler::notEqual, pt, L);
    1.20  
    1.21      // Call Interpreter::remove_activation_early_entry() to get the address of the
    1.22      // same-named entrypoint in the generated interpreter code
    1.23 @@ -566,9 +562,7 @@
    1.24  #ifdef _LP64
    1.25    sub(Rtemp, STACK_BIAS, Rtemp);  // Bias Rtemp before cmp to FP
    1.26  #endif
    1.27 -  cmp(Rtemp, FP);
    1.28 -  brx(Assembler::greaterUnsigned, false, Assembler::pn, Bad);
    1.29 -  delayed()->nop();
    1.30 +  cmp_and_brx_short(Rtemp, FP, Assembler::greaterUnsigned, Assembler::pn, Bad);
    1.31  
    1.32    // Saved SP must not be ridiculously below current SP.
    1.33    size_t maxstack = MAX2(JavaThread::stack_size_at_create(), (size_t) 4*K*K);
    1.34 @@ -577,12 +571,9 @@
    1.35  #ifdef _LP64
    1.36    add(Rtemp, STACK_BIAS, Rtemp);  // Unbias Rtemp before cmp to Rsp
    1.37  #endif
    1.38 -  cmp(Rsp, Rtemp);
    1.39 -  brx(Assembler::lessUnsigned, false, Assembler::pn, Bad);
    1.40 -  delayed()->nop();
    1.41 -
    1.42 -  br(Assembler::always, false, Assembler::pn, OK);
    1.43 -  delayed()->nop();
    1.44 +  cmp_and_brx_short(Rsp, Rtemp, Assembler::lessUnsigned, Assembler::pn, Bad);
    1.45 +
    1.46 +  ba_short(OK);
    1.47  
    1.48    bind(Bad);
    1.49    stop("on return to interpreted call, restored SP is corrupted");
    1.50 @@ -630,8 +621,7 @@
    1.51  
    1.52      const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
    1.53      ld(interp_only, scratch);
    1.54 -    tst(scratch);
    1.55 -    br(Assembler::notZero, true, Assembler::pn, skip_compiled_code);
    1.56 +    cmp_zero_and_br(Assembler::notZero, scratch, skip_compiled_code, true, Assembler::pn);
    1.57      delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target);
    1.58      bind(skip_compiled_code);
    1.59    }
    1.60 @@ -641,8 +631,7 @@
    1.61  #ifdef ASSERT
    1.62    {
    1.63      Label ok;
    1.64 -    br_notnull(target, false, Assembler::pt, ok);
    1.65 -    delayed()->nop();
    1.66 +    br_notnull_short(target, Assembler::pt, ok);
    1.67      stop("null entry point");
    1.68      bind(ok);
    1.69    }
    1.70 @@ -982,8 +971,7 @@
    1.71  
    1.72    // Don't unlock anything if the _do_not_unlock_if_synchronized flag
    1.73    // is set.
    1.74 -  tstbool(G1_scratch);
    1.75 -  br(Assembler::notZero, false, pn, no_unlock);
    1.76 +  cmp_zero_and_br(Assembler::notZero, G1_scratch, no_unlock);
    1.77    delayed()->nop();
    1.78  
    1.79    // BasicObjectLock will be first in list, since this is a synchronized method. However, need
    1.80 @@ -997,8 +985,7 @@
    1.81    add( top_most_monitor(), O1 );
    1.82  
    1.83    ld_ptr(O1, BasicObjectLock::obj_offset_in_bytes(), G3_scratch);
    1.84 -  br_notnull(G3_scratch, false, pt, unlock);
    1.85 -  delayed()->nop();
    1.86 +  br_notnull_short(G3_scratch, pt, unlock);
    1.87  
    1.88    if (throw_monitor_exception) {
    1.89      // Entry already unlocked need to throw an exception
    1.90 @@ -1011,8 +998,7 @@
    1.91      if (install_monitor_exception) {
    1.92        MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
    1.93      }
    1.94 -    ba(false, unlocked);
    1.95 -    delayed()->nop();
    1.96 +    ba_short(unlocked);
    1.97    }
    1.98  
    1.99    bind(unlock);
   1.100 @@ -1037,15 +1023,13 @@
   1.101      add(top_most_monitor(), Rmptr, delta);
   1.102      { Label L;
   1.103        // ensure that Rmptr starts out above (or at) Rlimit
   1.104 -      cmp(Rmptr, Rlimit);
   1.105 -      brx(Assembler::greaterEqualUnsigned, false, pn, L);
   1.106 -      delayed()->nop();
   1.107 +      cmp_and_brx_short(Rmptr, Rlimit, Assembler::greaterEqualUnsigned, pn, L);
   1.108        stop("monitor stack has negative size");
   1.109        bind(L);
   1.110      }
   1.111      #endif
   1.112      bind(restart);
   1.113 -    ba(false, entry);
   1.114 +    ba(entry);
   1.115      delayed()->
   1.116      add(top_most_monitor(), Rmptr, delta);      // points to current entry, starting with bottom-most entry
   1.117  
   1.118 @@ -1061,8 +1045,7 @@
   1.119        if (install_monitor_exception) {
   1.120          MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
   1.121        }
   1.122 -      ba(false, restart);
   1.123 -      delayed()->nop();
   1.124 +      ba_short(restart);
   1.125      }
   1.126  
   1.127      bind(loop);
   1.128 @@ -1073,9 +1056,7 @@
   1.129      #ifdef ASSERT
   1.130      { Label L;
   1.131        // ensure that Rmptr has not somehow stepped below Rlimit
   1.132 -      cmp(Rmptr, Rlimit);
   1.133 -      brx(Assembler::greaterEqualUnsigned, false, pn, L);
   1.134 -      delayed()->nop();
   1.135 +      cmp_and_brx_short(Rmptr, Rlimit, Assembler::greaterEqualUnsigned, pn, L);
   1.136        stop("ran off the end of the monitor stack");
   1.137        bind(L);
   1.138      }
   1.139 @@ -1196,9 +1177,7 @@
   1.140        (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr());
   1.141  
   1.142      // if the compare and exchange succeeded we are done (we saw an unlocked object)
   1.143 -    cmp(mark_reg, temp_reg);
   1.144 -    brx(Assembler::equal, true, Assembler::pt, done);
   1.145 -    delayed()->nop();
   1.146 +    cmp_and_brx_short(mark_reg, temp_reg, Assembler::equal, Assembler::pt, done);
   1.147  
   1.148      // We did not see an unlocked object so try the fast recursive case
   1.149  
   1.150 @@ -1324,13 +1303,7 @@
   1.151  
   1.152  void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) {
   1.153    assert(ProfileInterpreter, "must be profiling interpreter");
   1.154 -#ifdef _LP64
   1.155 -  bpr(Assembler::rc_z, false, Assembler::pn, ImethodDataPtr, zero_continue);
   1.156 -#else
   1.157 -  tst(ImethodDataPtr);
   1.158 -  br(Assembler::zero, false, Assembler::pn, zero_continue);
   1.159 -#endif
   1.160 -  delayed()->nop();
   1.161 +  br_null_short(ImethodDataPtr, Assembler::pn, zero_continue);
   1.162  }
   1.163  
   1.164  void InterpreterMacroAssembler::verify_method_data_pointer() {
   1.165 @@ -1376,31 +1349,18 @@
   1.166    Label done;
   1.167  
   1.168    // if no method data exists, and the counter is high enough, make one
   1.169 -#ifdef _LP64
   1.170 -  bpr(Assembler::rc_nz, false, Assembler::pn, ImethodDataPtr, done);
   1.171 -#else
   1.172 -  tst(ImethodDataPtr);
   1.173 -  br(Assembler::notZero, false, Assembler::pn, done);
   1.174 -#endif
   1.175 +  br_notnull_short(ImethodDataPtr, Assembler::pn, done);
   1.176  
   1.177    // Test to see if we should create a method data oop
   1.178    AddressLiteral profile_limit((address) &InvocationCounter::InterpreterProfileLimit);
   1.179 -#ifdef _LP64
   1.180 -  delayed()->nop();
   1.181    sethi(profile_limit, Rtmp);
   1.182 -#else
   1.183 -  delayed()->sethi(profile_limit, Rtmp);
   1.184 -#endif
   1.185    ld(Rtmp, profile_limit.low10(), Rtmp);
   1.186 -  cmp(invocation_count, Rtmp);
   1.187 -  br(Assembler::lessUnsigned, false, Assembler::pn, profile_continue);
   1.188 -  delayed()->nop();
   1.189 +  cmp_and_br_short(invocation_count, Rtmp, Assembler::lessUnsigned, Assembler::pn, profile_continue);
   1.190  
   1.191    // Build it now.
   1.192    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
   1.193    set_method_data_pointer_for_bcp();
   1.194 -  ba(false, profile_continue);
   1.195 -  delayed()->nop();
   1.196 +  ba_short(profile_continue);
   1.197    bind(done);
   1.198  }
   1.199  
   1.200 @@ -1632,13 +1592,10 @@
   1.201      Label skip_receiver_profile;
   1.202      if (receiver_can_be_null) {
   1.203        Label not_null;
   1.204 -      tst(receiver);
   1.205 -      brx(Assembler::notZero, false, Assembler::pt, not_null);
   1.206 -      delayed()->nop();
   1.207 +      br_notnull_short(receiver, Assembler::pt, not_null);
   1.208        // We are making a call.  Increment the count for null receiver.
   1.209        increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
   1.210 -      ba(false, skip_receiver_profile);
   1.211 -      delayed()->nop();
   1.212 +      ba_short(skip_receiver_profile);
   1.213        bind(not_null);
   1.214      }
   1.215  
   1.216 @@ -1682,8 +1639,7 @@
   1.217      // The receiver is receiver[n].  Increment count[n].
   1.218      int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row));
   1.219      increment_mdp_data_at(count_offset, scratch);
   1.220 -    ba(false, done);
   1.221 -    delayed()->nop();
   1.222 +    ba_short(done);
   1.223      bind(next_test);
   1.224  
   1.225      if (test_for_null_also) {
   1.226 @@ -1697,8 +1653,7 @@
   1.227            // Receiver did not match any saved receiver and there is no empty row for it.
   1.228            // Increment total counter to indicate polymorphic case.
   1.229            increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
   1.230 -          ba(false, done);
   1.231 -          delayed()->nop();
   1.232 +          ba_short(done);
   1.233            bind(found_null);
   1.234          } else {
   1.235            brx(Assembler::notZero, false, Assembler::pt, done);
   1.236 @@ -1729,8 +1684,7 @@
   1.237    mov(DataLayout::counter_increment, scratch);
   1.238    set_mdp_data_at(count_offset, scratch);
   1.239    if (start_row > 0) {
   1.240 -    ba(false, done);
   1.241 -    delayed()->nop();
   1.242 +    ba_short(done);
   1.243    }
   1.244  }
   1.245  
   1.246 @@ -1772,8 +1726,7 @@
   1.247  
   1.248        // The method data pointer needs to be updated to reflect the new target.
   1.249        update_mdp_by_offset(in_bytes(RetData::bci_displacement_offset(row)), scratch);
   1.250 -      ba(false, profile_continue);
   1.251 -      delayed()->nop();
   1.252 +      ba_short(profile_continue);
   1.253        bind(next_test);
   1.254      }
   1.255  
   1.256 @@ -1922,8 +1875,8 @@
   1.257  
   1.258      // untested("monitor stack expansion");
   1.259      compute_stack_base(Rtemp);
   1.260 -    ba( false, start_copying );
   1.261 -    delayed()->cmp( Rtemp, Rlimit); // done? duplicated below
   1.262 +    ba(start_copying);
   1.263 +    delayed()->cmp(Rtemp, Rlimit); // done? duplicated below
   1.264  
   1.265      // note: must copy from low memory upwards
   1.266      // On entry to loop,
   1.267 @@ -2010,9 +1963,7 @@
   1.268    // untested("reg area corruption");
   1.269    add(Rindex, offset, Rscratch);
   1.270    add(Rlimit, 64 + STACK_BIAS, Rscratch1);
   1.271 -  cmp(Rscratch, Rscratch1);
   1.272 -  brx(Assembler::greaterEqualUnsigned, false, pn, L);
   1.273 -  delayed()->nop();
   1.274 +  cmp_and_brx_short(Rscratch, Rscratch1, Assembler::greaterEqualUnsigned, pn, L);
   1.275    stop("regsave area is being clobbered");
   1.276    bind(L);
   1.277  }
   1.278 @@ -2174,9 +2125,7 @@
   1.279  
   1.280    AddressLiteral limit(&InvocationCounter::InterpreterBackwardBranchLimit);
   1.281    load_contents(limit, Rtmp);
   1.282 -  cmp(backedge_count, Rtmp);
   1.283 -  br(Assembler::lessUnsigned, false, Assembler::pt, did_not_overflow);
   1.284 -  delayed()->nop();
   1.285 +  cmp_and_br_short(backedge_count, Rtmp, Assembler::lessUnsigned, Assembler::pt, did_not_overflow);
   1.286  
   1.287    // When ProfileInterpreter is on, the backedge_count comes from the
   1.288    // methodDataOop, which value does not get reset on the call to
   1.289 @@ -2196,15 +2145,11 @@
   1.290  
   1.291    // Was an OSR adapter generated?
   1.292    // O0 = osr nmethod
   1.293 -  tst(O0);
   1.294 -  brx(Assembler::zero, false, Assembler::pn, overflow_with_error);
   1.295 -  delayed()->nop();
   1.296 +  br_null_short(O0, Assembler::pn, overflow_with_error);
   1.297  
   1.298    // Has the nmethod been invalidated already?
   1.299    ld(O0, nmethod::entry_bci_offset(), O2);
   1.300 -  cmp(O2, InvalidOSREntryBci);
   1.301 -  br(Assembler::equal, false, Assembler::pn, overflow_with_error);
   1.302 -  delayed()->nop();
   1.303 +  cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, overflow_with_error);
   1.304  
   1.305    // migrate the interpreter frame off of the stack
   1.306  
   1.307 @@ -2270,8 +2215,7 @@
   1.308    mov(reg, Rtmp);
   1.309    const int log2_bytecode_size_limit = 16;
   1.310    srl(Rtmp, log2_bytecode_size_limit, Rtmp);
   1.311 -  br_notnull( Rtmp, false, pt, test );
   1.312 -  delayed()->nop();
   1.313 +  br_notnull_short( Rtmp, pt, test );
   1.314  
   1.315    // %%% should use call_VM_leaf here?
   1.316    save_frame_and_mov(0, Lmethod, O0, reg, O1);
   1.317 @@ -2320,9 +2264,7 @@
   1.318      Register temp_reg = O5;
   1.319      const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
   1.320      ld(interp_only, temp_reg);
   1.321 -    tst(temp_reg);
   1.322 -    br(zero, false, pt, L);
   1.323 -    delayed()->nop();
   1.324 +    cmp_and_br_short(temp_reg, 0, equal, pt, L);
   1.325      call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry));
   1.326      bind(L);
   1.327    }
   1.328 @@ -2372,9 +2314,7 @@
   1.329      Register temp_reg = O5;
   1.330      const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
   1.331      ld(interp_only, temp_reg);
   1.332 -    tst(temp_reg);
   1.333 -    br(zero, false, pt, L);
   1.334 -    delayed()->nop();
   1.335 +    cmp_and_br_short(temp_reg, 0, equal, pt, L);
   1.336  
   1.337      // Note: frame::interpreter_frame_result has a dependency on how the
   1.338      // method result is saved across the call to post_method_exit. For

mercurial