< prev index next >

src/cpu/ppc/vm/macroAssembler_ppc.cpp

Print this page




2504 
2505   const Register tmpReg = rtm_counters_Reg;
2506   ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg);
2507   mulli(tmpReg, tmpReg, RTMTotalCountIncrRate);
2508   mulli(tmpReg, tmpReg, RTMAbortRatio);
2509   cmpd(CCR0, R0, tmpReg);
2510   blt(CCR0, L_check_always_rtm1); // jump to reload
2511   if (method_data != NULL) {
2512     // Set rtm_state to "no rtm" in MDO.
2513     // Not using a metadata relocation. Method and Class Loader are kept alive anyway.
2514     // (See nmethod::metadata_do and CodeBuffer::finalize_oop_references.)
2515     load_const(R0, (address)method_data + MethodData::rtm_state_offset_in_bytes(), tmpReg);
2516     atomic_ori_int(R0, tmpReg, NoRTM);
2517   }
2518   b(L_done);
2519 
2520   bind(L_check_always_rtm1);
2521   load_const_optimized(rtm_counters_Reg, (address)rtm_counters, R0); // reload
2522   bind(L_check_always_rtm2);
2523   ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg);
2524   cmpdi(CCR0, tmpReg, RTMLockingThreshold / RTMTotalCountIncrRate);






2525   blt(CCR0, L_done);
2526   if (method_data != NULL) {
2527     // Set rtm_state to "always rtm" in MDO.
2528     // Not using a metadata relocation. See above.
2529     load_const(R0, (address)method_data + MethodData::rtm_state_offset_in_bytes(), tmpReg);
2530     atomic_ori_int(R0, tmpReg, UseRTM);
2531   }
2532   bind(L_done);
2533 }
2534 
2535 // Update counters and perform abort ratio calculation.
2536 // input: abort_status_Reg
2537 void MacroAssembler::rtm_profiling(Register abort_status_Reg, Register temp_Reg,
2538                                    RTMLockingCounters* rtm_counters,
2539                                    Metadata* method_data,
2540                                    bool profile_rtm) {
2541 
2542   assert(rtm_counters != NULL, "should not be NULL when profiling RTM");
2543   // Update rtm counters based on state at abort.
2544   // Reads abort_status_Reg, updates flags.




2504 
2505   const Register tmpReg = rtm_counters_Reg;
2506   ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg);
2507   mulli(tmpReg, tmpReg, RTMTotalCountIncrRate);
2508   mulli(tmpReg, tmpReg, RTMAbortRatio);
2509   cmpd(CCR0, R0, tmpReg);
2510   blt(CCR0, L_check_always_rtm1); // jump to reload
2511   if (method_data != NULL) {
2512     // Set rtm_state to "no rtm" in MDO.
2513     // Not using a metadata relocation. Method and Class Loader are kept alive anyway.
2514     // (See nmethod::metadata_do and CodeBuffer::finalize_oop_references.)
2515     load_const(R0, (address)method_data + MethodData::rtm_state_offset_in_bytes(), tmpReg);
2516     atomic_ori_int(R0, tmpReg, NoRTM);
2517   }
2518   b(L_done);
2519 
2520   bind(L_check_always_rtm1);
2521   load_const_optimized(rtm_counters_Reg, (address)rtm_counters, R0); // reload
2522   bind(L_check_always_rtm2);
2523   ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg);
2524   int64_t thresholdValue = RTMLockingThreshold / RTMTotalCountIncrRate;
2525   if (is_simm(thresholdValue, 16)) {   // cmpdi can handle 16bit immediate only.
2526     cmpdi(CCR0, tmpReg, thresholdValue);
2527   } else {
2528     load_const_optimized(R0, thresholdValue);
2529     cmpd(CCR0, tmpReg, R0);
2530   }
2531   blt(CCR0, L_done);
2532   if (method_data != NULL) {
2533     // Set rtm_state to "always rtm" in MDO.
2534     // Not using a metadata relocation. See above.
2535     load_const(R0, (address)method_data + MethodData::rtm_state_offset_in_bytes(), tmpReg);
2536     atomic_ori_int(R0, tmpReg, UseRTM);
2537   }
2538   bind(L_done);
2539 }
2540 
2541 // Update counters and perform abort ratio calculation.
2542 // input: abort_status_Reg
2543 void MacroAssembler::rtm_profiling(Register abort_status_Reg, Register temp_Reg,
2544                                    RTMLockingCounters* rtm_counters,
2545                                    Metadata* method_data,
2546                                    bool profile_rtm) {
2547 
2548   assert(rtm_counters != NULL, "should not be NULL when profiling RTM");
2549   // Update rtm counters based on state at abort.
2550   // Reads abort_status_Reg, updates flags.


< prev index next >