src/cpu/x86/vm/x86_32.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_32.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


12898   ins_encode();
12899   ins_pipe( empty );
12900 %}
12901 
12902 
12903 // Rethrow exception:
12904 // The exception oop will come in the first argument position.
12905 // Then JUMP (not call) to the rethrow stub code.
12906 instruct RethrowException()
12907 %{
12908   match(Rethrow);
12909 
12910   // use the following format syntax
12911   format %{ "JMP    rethrow_stub" %}
12912   ins_encode(enc_rethrow);
12913   ins_pipe( pipe_jmp );
12914 %}
12915 
12916 // inlined locking and unlocking
12917 
















12918 instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr) %{

12919   match(Set cr (FastLock object box));
12920   effect(TEMP tmp, TEMP scr, USE_KILL box);
12921   ins_cost(300);
12922   format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr" %}
12923   ins_encode %{
12924     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, $scr$$Register, _counters);

12925   %}
12926   ins_pipe(pipe_slow);
12927 %}
12928 
12929 instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{
12930   match(Set cr (FastUnlock object box));
12931   effect(TEMP tmp, USE_KILL box);
12932   ins_cost(300);
12933   format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %}
12934   ins_encode %{
12935     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register);
12936   %}
12937   ins_pipe(pipe_slow);
12938 %}
12939 
12940 
12941 
12942 // ============================================================================
12943 // Safepoint Instruction
12944 instruct safePoint_poll(eFlagsReg cr) %{
12945   match(SafePoint);
12946   effect(KILL cr);
12947 
12948   // TODO-FIXME: we currently poll at offset 0 of the safepoint polling page.
12949   // On SPARC that might be acceptable as we can generate the address with
12950   // just a sethi, saving an or.  By polling at offset 0 we can end up
12951   // putting additional pressure on the index-0 in the D$.  Because of
12952   // alignment (just like the situation at hand) the lower indices tend
12953   // to see more traffic.  It'd be better to change the polling address
12954   // to offset 0 of the last $line in the polling page.
12955 




12898   ins_encode();
12899   ins_pipe( empty );
12900 %}
12901 
12902 
12903 // Rethrow exception:
12904 // The exception oop will come in the first argument position.
12905 // Then JUMP (not call) to the rethrow stub code.
12906 instruct RethrowException()
12907 %{
12908   match(Rethrow);
12909 
12910   // use the following format syntax
12911   format %{ "JMP    rethrow_stub" %}
12912   ins_encode(enc_rethrow);
12913   ins_pipe( pipe_jmp );
12914 %}
12915 
12916 // inlined locking and unlocking
12917 
12918 instruct cmpFastLockRTM(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eDXRegI scr, rRegI cx1, rRegI cx2) %{
12919   predicate(Compile::current()->use_rtm());
12920   match(Set cr (FastLock object box));
12921   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
12922   ins_cost(300);
12923   format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
12924   ins_encode %{
12925     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12926                  $scr$$Register, $cx1$$Register, $cx2$$Register,
12927                  _counters, _rtm_counters, _stack_rtm_counters,
12928                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
12929                  true, ra_->C->profile_rtm());
12930   %}
12931   ins_pipe(pipe_slow);
12932 %}
12933 
12934 instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr) %{
12935   predicate(!Compile::current()->use_rtm());
12936   match(Set cr (FastLock object box));
12937   effect(TEMP tmp, TEMP scr, USE_KILL box);
12938   ins_cost(300);
12939   format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr" %}
12940   ins_encode %{
12941     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12942                  $scr$$Register, noreg, noreg, _counters, NULL, NULL, NULL, false, false);
12943   %}
12944   ins_pipe(pipe_slow);
12945 %}
12946 
12947 instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{
12948   match(Set cr (FastUnlock object box));
12949   effect(TEMP tmp, USE_KILL box);
12950   ins_cost(300);
12951   format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %}
12952   ins_encode %{
12953     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
12954   %}
12955   ins_pipe(pipe_slow);
12956 %}
12957 
12958 
12959 
12960 // ============================================================================
12961 // Safepoint Instruction
12962 instruct safePoint_poll(eFlagsReg cr) %{
12963   match(SafePoint);
12964   effect(KILL cr);
12965 
12966   // TODO-FIXME: we currently poll at offset 0 of the safepoint polling page.
12967   // On SPARC that might be acceptable as we can generate the address with
12968   // just a sethi, saving an or.  By polling at offset 0 we can end up
12969   // putting additional pressure on the index-0 in the D$.  Because of
12970   // alignment (just like the situation at hand) the lower indices tend
12971   // to see more traffic.  It'd be better to change the polling address
12972   // to offset 0 of the last $line in the polling page.
12973 


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