< prev index next >

src/cpu/aarch64/vm/aarch64.ad

Print this page
rev 10243 : 8150394: aarch64: add support for 8.1 LSE CAS instructions
Reviewed-by: aph
Contributed-by: ananth.jasty@caviumnetworks.com, edward.nevill@linaro.org

*** 4260,4297 **** %} enc_class aarch64_enc_cmpxchg(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, ! &Assembler::ldxr, &MacroAssembler::cmp, &Assembler::stlxr); %} enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, ! &Assembler::ldxrw, &MacroAssembler::cmpw, &Assembler::stlxrw); %} // The only difference between aarch64_enc_cmpxchg and // aarch64_enc_cmpxchg_acq is that we use load-acquire in the // CompareAndSwap sequence to serve as a barrier on acquiring a // lock. enc_class aarch64_enc_cmpxchg_acq(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, ! &Assembler::ldaxr, &MacroAssembler::cmp, &Assembler::stlxr); %} enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, ! &Assembler::ldaxrw, &MacroAssembler::cmpw, &Assembler::stlxrw); %} // auxiliary used for CompareAndSwapX to set result register enc_class aarch64_enc_cset_eq(iRegINoSp res) %{ --- 4260,4301 ---- %} enc_class aarch64_enc_cmpxchg(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg(Assembler::xword, ! $oldval$$Register, $newval$$Register, $mem$$base$$Register, ! /*acquire*/ false, /*release*/ true); %} enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg(Assembler::word, ! $oldval$$Register, $newval$$Register, $mem$$base$$Register, ! /*acquire*/ false, /*release*/ true); %} // The only difference between aarch64_enc_cmpxchg and // aarch64_enc_cmpxchg_acq is that we use load-acquire in the // CompareAndSwap sequence to serve as a barrier on acquiring a // lock. enc_class aarch64_enc_cmpxchg_acq(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg(Assembler::xword, ! $oldval$$Register, $newval$$Register, $mem$$base$$Register, ! /*acquire*/ true, /*release*/ true); %} enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); ! __ cmpxchg(Assembler::word, ! $oldval$$Register, $newval$$Register, $mem$$base$$Register, ! /*acquire*/ true, /*release*/ true); %} // auxiliary used for CompareAndSwapX to set result register enc_class aarch64_enc_cset_eq(iRegINoSp res) %{
*** 4805,4815 **** // Initialize the box. (Must happen before we update the object mark!) __ str(disp_hdr, Address(box, BasicLock::displaced_header_offset_in_bytes())); // Compare object markOop with mark and if equal exchange scratch1 // with object markOop. ! { Label retry_load; __ bind(retry_load); __ ldaxr(tmp, oop); __ cmp(tmp, disp_hdr); __ br(Assembler::NE, cas_failed); --- 4809,4824 ---- // Initialize the box. (Must happen before we update the object mark!) __ str(disp_hdr, Address(box, BasicLock::displaced_header_offset_in_bytes())); // Compare object markOop with mark and if equal exchange scratch1 // with object markOop. ! if (UseLSE) { ! __ mov(tmp, disp_hdr); ! __ casal(Assembler::xword, tmp, box, oop); ! __ cmp(tmp, disp_hdr); ! __ br(Assembler::EQ, cont); ! } else { Label retry_load; __ bind(retry_load); __ ldaxr(tmp, oop); __ cmp(tmp, disp_hdr); __ br(Assembler::NE, cas_failed);
*** 4855,4865 **** // // Try to CAS m->owner from NULL to current thread. __ add(tmp, disp_hdr, (ObjectMonitor::owner_offset_in_bytes()-markOopDesc::monitor_value)); __ mov(disp_hdr, zr); ! { Label retry_load, fail; __ bind(retry_load); __ ldaxr(rscratch1, tmp); __ cmp(disp_hdr, rscratch1); __ br(Assembler::NE, fail); --- 4864,4878 ---- // // Try to CAS m->owner from NULL to current thread. __ add(tmp, disp_hdr, (ObjectMonitor::owner_offset_in_bytes()-markOopDesc::monitor_value)); __ mov(disp_hdr, zr); ! if (UseLSE) { ! __ mov(rscratch1, disp_hdr); ! __ casal(Assembler::xword, rscratch1, rthread, tmp); ! __ cmp(rscratch1, disp_hdr); ! } else { Label retry_load, fail; __ bind(retry_load); __ ldaxr(rscratch1, tmp); __ cmp(disp_hdr, rscratch1); __ br(Assembler::NE, fail);
*** 4944,4954 **** // Check if it is still a light weight lock, this is is true if we // see the stack address of the basicLock in the markOop of the // object. ! { Label retry_load; __ bind(retry_load); __ ldxr(tmp, oop); __ cmp(box, tmp); __ br(Assembler::NE, cas_failed); --- 4957,4971 ---- // Check if it is still a light weight lock, this is is true if we // see the stack address of the basicLock in the markOop of the // object. ! if (UseLSE) { ! __ mov(tmp, box); ! __ casl(Assembler::xword, tmp, disp_hdr, oop); ! __ cmp(tmp, box); ! } else { Label retry_load; __ bind(retry_load); __ ldxr(tmp, oop); __ cmp(box, tmp); __ br(Assembler::NE, cas_failed);
< prev index next >