src/cpu/x86/vm/x86_64.ad
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/cpu/x86/vm

src/cpu/x86/vm/x86_64.ad

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


11360     Label* l = $labl$$label;
11361     if ($cop$$cmpcode == Assembler::notEqual) {
11362       __ jccb(Assembler::parity, *l);
11363       __ jccb(Assembler::notEqual, *l);
11364     } else if ($cop$$cmpcode == Assembler::equal) {
11365       Label done;
11366       __ jccb(Assembler::parity, done);
11367       __ jccb(Assembler::equal, *l);
11368       __ bind(done);
11369     } else {
11370        ShouldNotReachHere();
11371     }
11372   %}
11373   ins_pipe(pipe_jcc);
11374   ins_short_branch(1);
11375 %}
11376 
11377 // ============================================================================
11378 // inlined locking and unlocking
11379 
















11380 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{

11381   match(Set cr (FastLock object box));
11382   effect(TEMP tmp, TEMP scr, USE_KILL box);
11383   ins_cost(300);
11384   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
11385   ins_encode %{
11386     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, $scr$$Register, _counters);

11387   %}
11388   ins_pipe(pipe_slow);
11389 %}
11390 
11391 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
11392   match(Set cr (FastUnlock object box));
11393   effect(TEMP tmp, USE_KILL box);
11394   ins_cost(300);
11395   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
11396   ins_encode %{
11397     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register);
11398   %}
11399   ins_pipe(pipe_slow);
11400 %}
11401 
11402 
11403 // ============================================================================
11404 // Safepoint Instructions
11405 instruct safePoint_poll(rFlagsReg cr)
11406 %{
11407   predicate(!Assembler::is_polling_page_far());
11408   match(SafePoint);
11409   effect(KILL cr);
11410 
11411   format %{ "testl  rax, [rip + #offset_to_poll_page]\t"
11412             "# Safepoint: poll for GC" %}
11413   ins_cost(125);
11414   ins_encode %{
11415     AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type);
11416     __ testl(rax, addr);
11417   %}




11360     Label* l = $labl$$label;
11361     if ($cop$$cmpcode == Assembler::notEqual) {
11362       __ jccb(Assembler::parity, *l);
11363       __ jccb(Assembler::notEqual, *l);
11364     } else if ($cop$$cmpcode == Assembler::equal) {
11365       Label done;
11366       __ jccb(Assembler::parity, done);
11367       __ jccb(Assembler::equal, *l);
11368       __ bind(done);
11369     } else {
11370        ShouldNotReachHere();
11371     }
11372   %}
11373   ins_pipe(pipe_jcc);
11374   ins_short_branch(1);
11375 %}
11376 
11377 // ============================================================================
11378 // inlined locking and unlocking
11379 
11380 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
11381   predicate(Compile::current()->use_rtm());
11382   match(Set cr (FastLock object box));
11383   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
11384   ins_cost(300);
11385   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
11386   ins_encode %{
11387     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
11388                  $scr$$Register, $cx1$$Register, $cx2$$Register,
11389                  _counters, _rtm_counters, _stack_rtm_counters,
11390                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
11391                  true, ra_->C->profile_rtm());
11392   %}
11393   ins_pipe(pipe_slow);
11394 %}
11395 
11396 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{
11397   predicate(!Compile::current()->use_rtm());
11398   match(Set cr (FastLock object box));
11399   effect(TEMP tmp, TEMP scr, USE_KILL box);
11400   ins_cost(300);
11401   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
11402   ins_encode %{
11403     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
11404                  $scr$$Register, noreg, noreg, _counters, NULL, NULL, NULL, false, false);
11405   %}
11406   ins_pipe(pipe_slow);
11407 %}
11408 
11409 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
11410   match(Set cr (FastUnlock object box));
11411   effect(TEMP tmp, USE_KILL box);
11412   ins_cost(300);
11413   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
11414   ins_encode %{
11415     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
11416   %}
11417   ins_pipe(pipe_slow);
11418 %}
11419 
11420 
11421 // ============================================================================
11422 // Safepoint Instructions
11423 instruct safePoint_poll(rFlagsReg cr)
11424 %{
11425   predicate(!Assembler::is_polling_page_far());
11426   match(SafePoint);
11427   effect(KILL cr);
11428 
11429   format %{ "testl  rax, [rip + #offset_to_poll_page]\t"
11430             "# Safepoint: poll for GC" %}
11431   ins_cost(125);
11432   ins_encode %{
11433     AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type);
11434     __ testl(rax, addr);
11435   %}


src/cpu/x86/vm/x86_64.ad
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File