diff options
author | Steve MacLean <sdmaclea@qti.qualcomm.com> | 2017-05-12 12:44:08 -0400 |
---|---|---|
committer | Russ Keldorph <russ.keldorph@microsoft.com> | 2017-06-01 09:39:20 -0700 |
commit | 6179b52eb1d48933675f4bd319448d02c7cef0c4 (patch) | |
tree | 3da8a8efcf8fd174e9f8f3e5bc01ad6ca89e7591 /src | |
parent | 1d2e6f8b131af5c4f684c35418ee6c14b417b316 (diff) | |
download | coreclr-6179b52eb1d48933675f4bd319448d02c7cef0c4.tar.gz coreclr-6179b52eb1d48933675f4bd319448d02c7cef0c4.tar.bz2 coreclr-6179b52eb1d48933675f4bd319448d02c7cef0c4.zip |
[Arm64] Use half barriers for IL Volatile implementation
Diffstat (limited to 'src')
-rw-r--r-- | src/jit/codegen.h | 4 | ||||
-rw-r--r-- | src/jit/codegenarm64.cpp | 14 | ||||
-rw-r--r-- | src/jit/codegenarmarch.cpp | 14 | ||||
-rw-r--r-- | src/jit/instr.cpp | 6 |
4 files changed, 28 insertions, 10 deletions
diff --git a/src/jit/codegen.h b/src/jit/codegen.h index 30a84e038d..b1b073862d 100644 --- a/src/jit/codegen.h +++ b/src/jit/codegen.h @@ -959,7 +959,11 @@ public: void instGen_Return(unsigned stkArgSize); +#ifdef _TARGET_ARM64_ + void instGen_MemoryBarrier(insBarrier barrierType = INS_BARRIER_SY); +#else void instGen_MemoryBarrier(); +#endif void instGen_Set_Reg_To_Zero(emitAttr size, regNumber reg, insFlags flags = INS_FLAGS_DONT_CARE); diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp index c7c350ef3b..4ef7ef3c46 100644 --- a/src/jit/codegenarm64.cpp +++ b/src/jit/codegenarm64.cpp @@ -2565,7 +2565,7 @@ void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* initBlkNode) if (initBlkNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before volatile an initBlockUnroll operation + // issue a full memory barrier before a volatile an initBlockUnroll operation instGen_MemoryBarrier(); } @@ -2714,7 +2714,7 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode) if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpBlkUnroll operation + // issue a full memory barrier before a volatile CpBlkUnroll operation instGen_MemoryBarrier(); } @@ -2794,8 +2794,8 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode) if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpBlkUnroll operation - instGen_MemoryBarrier(); + // issue a INS_BARRIER_LD after a volatile CpBlkUnroll operation + instGen_MemoryBarrier(INS_BARRIER_LD); } } @@ -2877,7 +2877,7 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode) if (cpObjNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpObj operation + // issue a full memory barrier before a volatile CpObj operation instGen_MemoryBarrier(); } @@ -2955,8 +2955,8 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode) if (cpObjNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpObj operation - instGen_MemoryBarrier(); + // issue a INS_BARRIER_LD after a volatile CpObj operation + instGen_MemoryBarrier(INS_BARRIER_LD); } // Clear the gcInfo for REG_WRITE_BARRIER_SRC_BYREF and REG_WRITE_BARRIER_DST_BYREF. diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp index e8391d1512..911f07e2cc 100644 --- a/src/jit/codegenarmarch.cpp +++ b/src/jit/codegenarmarch.cpp @@ -1343,8 +1343,13 @@ void CodeGen::genCodeForIndir(GenTreeIndir* tree) if (tree->gtFlags & GTF_IND_VOLATILE) { +#ifdef _TARGET_ARM64_ + // issue a INS_BARRIER_LD after a volatile LdInd operation + instGen_MemoryBarrier(INS_BARRIER_LD); +#else // issue a full memory barrier after a volatile LdInd operation instGen_MemoryBarrier(); +#endif // _TARGET_ARM64_ } } @@ -1370,7 +1375,7 @@ void CodeGen::genCodeForCpBlk(GenTreeBlk* cpBlkNode) if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpBlkUnroll operation + // issue a full memory barrier before a volatile CpBlk operation instGen_MemoryBarrier(); } @@ -1378,8 +1383,13 @@ void CodeGen::genCodeForCpBlk(GenTreeBlk* cpBlkNode) if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE) { - // issue a full memory barrier before & after a volatile CpBlkUnroll operation +#ifdef _TARGET_ARM64_ + // issue a INS_BARRIER_LD after a volatile CpBlk operation + instGen_MemoryBarrier(INS_BARRIER_LD); +#else + // issue a full memory barrier after a volatile CpBlk operation instGen_MemoryBarrier(); +#endif // _TARGET_ARM64_ } } diff --git a/src/jit/instr.cpp b/src/jit/instr.cpp index bbfca1d7e8..4d30fdea1c 100644 --- a/src/jit/instr.cpp +++ b/src/jit/instr.cpp @@ -3852,7 +3852,11 @@ void CodeGen::instGen_Return(unsigned stkArgSize) * Note: all MemoryBarriers instructions can be removed by * SET COMPlus_JitNoMemoryBarriers=1 */ +#ifdef _TARGET_ARM64_ +void CodeGen::instGen_MemoryBarrier(insBarrier barrierType) +#else void CodeGen::instGen_MemoryBarrier() +#endif { #ifdef DEBUG if (JitConfig.JitNoMemoryBarriers() == 1) @@ -3867,7 +3871,7 @@ void CodeGen::instGen_MemoryBarrier() #elif defined(_TARGET_ARM_) getEmitter()->emitIns_I(INS_dmb, EA_4BYTE, 0xf); #elif defined(_TARGET_ARM64_) - getEmitter()->emitIns_BARR(INS_dmb, INS_BARRIER_SY); + getEmitter()->emitIns_BARR(INS_dmb, barrierType); #else #error "Unknown _TARGET_" #endif |