< prev index next >
src/cpu/x86/vm/x86_64.ad
Print this page
@@ -524,10 +524,16 @@
// Singleton class for instruction pointer
// reg_class ip_reg(RIP);
%}
+source_hpp %{
+#if INCLUDE_ALL_GCS
+#include "shenandoahBarrierSetAssembler_x86.hpp"
+#endif
+%}
+
//----------SOURCE BLOCK-------------------------------------------------------
// This is a block of C++ code which provides values, functions, and
// definitions necessary in the rest of the architecture description
source %{
#define RELOC_IMM64 Assembler::imm_operand
@@ -7268,11 +7274,11 @@
instruct compareAndSwapP(rRegI res,
memory mem_ptr,
rax_RegP oldval, rRegP newval,
rFlagsReg cr)
%{
- predicate(VM_Version::supports_cx8());
+ predicate(VM_Version::supports_cx8() && (!UseShenandoahGC || !ShenandoahCASBarrier || n->in(3)->in(1)->bottom_type() == TypePtr::NULL_PTR));
match(Set res (CompareAndSwapP mem_ptr (Binary oldval newval)));
effect(KILL cr, KILL oldval);
format %{ "cmpxchgq $mem_ptr,$newval\t# "
"If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
@@ -7287,10 +7293,31 @@
REX_reg_breg(res, res), // movzbl
Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndSwapP_shenandoah(rRegI res,
+ memory mem_ptr,
+ rRegP tmp1, rRegP tmp2,
+ rax_RegP oldval, rRegP newval,
+ rFlagsReg cr)
+%{
+ predicate(VM_Version::supports_cx8() && UseShenandoahGC && ShenandoahCASBarrier && n->in(3)->in(1)->bottom_type() != TypePtr::NULL_PTR);
+ match(Set res (CompareAndSwapP mem_ptr (Binary oldval newval)));
+ effect(TEMP tmp1, TEMP tmp2, KILL cr, KILL oldval);
+
+ format %{ "shenandoah_cas_oop $mem_ptr,$newval" %}
+
+ ins_encode %{
+ ShenandoahBarrierSetAssembler::bsasm()->cmpxchg_oop(&_masm, $res$$Register, $mem_ptr$$Address, $oldval$$Register, $newval$$Register,
+ false, // swap
+ $tmp1$$Register, $tmp2$$Register
+ );
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct compareAndSwapL(rRegI res,
memory mem_ptr,
rax_RegL oldval, rRegL newval,
rFlagsReg cr)
%{
@@ -7339,10 +7366,11 @@
instruct compareAndSwapN(rRegI res,
memory mem_ptr,
rax_RegN oldval, rRegN newval,
rFlagsReg cr) %{
+ predicate(!UseShenandoahGC || !ShenandoahCASBarrier || n->in(3)->in(1)->bottom_type() == TypeNarrowOop::NULL_PTR);
match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
effect(KILL cr, KILL oldval);
format %{ "cmpxchgl $mem_ptr,$newval\t# "
"If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
@@ -7357,10 +7385,30 @@
REX_reg_breg(res, res), // movzbl
Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndSwapN_shenandoah(rRegI res,
+ memory mem_ptr,
+ rRegP tmp1, rRegP tmp2,
+ rax_RegN oldval, rRegN newval,
+ rFlagsReg cr) %{
+ predicate(UseShenandoahGC && ShenandoahCASBarrier && n->in(3)->in(1)->bottom_type() != TypeNarrowOop::NULL_PTR);
+ match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
+ effect(TEMP tmp1, TEMP tmp2, KILL cr, KILL oldval);
+
+ format %{ "shenandoah_cas_oop $mem_ptr,$newval" %}
+
+ ins_encode %{
+ ShenandoahBarrierSetAssembler::bsasm()->cmpxchg_oop(&_masm, $res$$Register, $mem_ptr$$Address, $oldval$$Register, $newval$$Register,
+ false, // swap
+ $tmp1$$Register, $tmp2$$Register
+ );
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct xaddI_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
predicate(n->as_LoadStore()->result_not_used());
match(Set dummy (GetAndAddI mem add));
effect(KILL cr);
format %{ "ADDL [$mem],$add" %}
@@ -11165,10 +11213,36 @@
opcode(0x85);
ins_encode(REX_reg_reg_wide(src, src), OpcP, reg_reg(src, src));
ins_pipe(ialu_cr_reg_imm);
%}
+instruct compB_mem_imm(rFlagsReg cr, memory mem, immI8 imm)
+%{
+ // This match is actually generic, but protect with Shenandoah flag,
+ // because it is not tested upstream.
+ predicate(UseShenandoahGC);
+ match(Set cr (CmpI (LoadB mem) imm));
+
+ ins_cost(125);
+ format %{ "cmpb $mem, $imm" %}
+ ins_encode %{ __ cmpb($mem$$Address, $imm$$constant); %}
+ ins_pipe(ialu_cr_reg_mem);
+%}
+
+instruct testB_mem_imm(rFlagsReg cr, memory mem, immI8 imm, immI0 zero)
+%{
+ // This match is actually generic, but protect with Shenandoah flag,
+ // because it is not tested upstream
+ predicate(UseShenandoahGC);
+ match(Set cr (CmpI (AndI (LoadB mem) imm) zero));
+
+ ins_cost(125);
+ format %{ "testb $mem, $imm" %}
+ ins_encode %{ __ testb($mem$$Address, $imm$$constant); %}
+ ins_pipe(ialu_cr_reg_mem);
+%}
+
//----------Max and Min--------------------------------------------------------
// Min Instructions
instruct cmovI_reg_g(rRegI dst, rRegI src, rFlagsReg cr)
%{
< prev index next >