[Arm64] Revise GTF_IND_VOLATILE per comments
authorSteve MacLean, Qualcomm Datacenter Technologies, Inc <sdmaclea@qti.qualcomm.com>
Wed, 10 May 2017 16:30:45 +0000 (16:30 +0000)
committerSteve MacLean, Qualcomm Datacenter Technologies, Inc <sdmaclea@qti.qualcomm.com>
Wed, 10 May 2017 16:58:36 +0000 (16:58 +0000)
src/jit/codegenarm64.cpp
src/jit/codegenarmarch.cpp

index fa45e7c..4d7d360 100644 (file)
@@ -2522,6 +2522,12 @@ void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* initBlkNode)
 
     genConsumeOperands(initBlkNode);
 
+    if (initBlkNode->gtFlags & GTF_BLK_VOLATILE)
+    {
+        // issue a full memory barrier before volatile an initBlockUnroll operation
+        instGen_MemoryBarrier();
+    }
+
     regNumber valReg = initVal->IsIntegralConst(0) ? REG_ZR : initVal->gtRegNum;
 
     assert(!initVal->IsIntegralConst(0) || (valReg == REG_ZR));
@@ -2664,8 +2670,9 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode)
 
     emitter* emit = getEmitter();
 
-    if (cpBlkNode->gtFlags & GTF_IND_VOLATILE)
+    if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before & after a volatile CpBlkUnroll operation
         instGen_MemoryBarrier();
     }
 
@@ -2748,8 +2755,9 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode)
         }
     }
 
-    if (cpBlkNode->gtFlags & GTF_IND_VOLATILE)
+    if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before & after a volatile CpBlkUnroll operation
         instGen_MemoryBarrier();
     }
 }
@@ -2830,8 +2838,9 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
         assert(tmpReg2 != REG_WRITE_BARRIER_SRC_BYREF);
     }
 
-    if (cpObjNode->gtFlags & GTF_IND_VOLATILE)
+    if (cpObjNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before & after a volatile CpObj operation
         instGen_MemoryBarrier();
     }
 
@@ -2907,15 +2916,16 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
         assert(gcPtrCount == 0);
     }
 
+    if (cpObjNode->gtFlags & GTF_BLK_VOLATILE)
+    {
+        // issue a full memory barrier before & after a volatile CpObj operation
+        instGen_MemoryBarrier();
+    }
+
     // Clear the gcInfo for REG_WRITE_BARRIER_SRC_BYREF and REG_WRITE_BARRIER_DST_BYREF.
     // While we normally update GC info prior to the last instruction that uses them,
     // these actually live into the helper call.
     gcInfo.gcMarkRegSetNpt(RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF);
-
-    if (cpObjNode->gtFlags & GTF_IND_VOLATILE)
-    {
-        instGen_MemoryBarrier();
-    }
 }
 
 // generate code do a switch statement based on a table of ip-relative offsets
@@ -3586,6 +3596,7 @@ void CodeGen::genCodeForStoreInd(GenTreeStoreInd* tree)
 
         if (tree->gtFlags & GTF_IND_VOLATILE)
         {
+            // issue a full memory barrier a before volatile StInd
             instGen_MemoryBarrier();
         }
 
index a8758e5..58e07fe 100644 (file)
@@ -1362,6 +1362,7 @@ void CodeGen::genCodeForIndir(GenTreeIndir* tree)
 
     if (tree->gtFlags & GTF_IND_VOLATILE)
     {
+        // issue a full memory barrier after a volatile LdInd operation
         instGen_MemoryBarrier();
     }
 }
@@ -1386,15 +1387,17 @@ void CodeGen::genCodeForCpBlk(GenTreeBlk* cpBlkNode)
     }
 #endif // _TARGET_ARM64_
 
-    if (cpBlkNode->gtFlags & GTF_IND_VOLATILE)
+    if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before & after a volatile CpBlkUnroll operation
         instGen_MemoryBarrier();
     }
 
     genEmitHelperCall(CORINFO_HELP_MEMCPY, 0, EA_UNKNOWN);
 
-    if (cpBlkNode->gtFlags & GTF_IND_VOLATILE)
+    if (cpBlkNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before & after a volatile CpBlkUnroll operation
         instGen_MemoryBarrier();
     }
 }
@@ -1434,8 +1437,9 @@ void CodeGen::genCodeForInitBlk(GenTreeBlk* initBlkNode)
 
     genConsumeBlockOp(initBlkNode, REG_ARG_0, REG_ARG_1, REG_ARG_2);
 
-    if (initBlkNode->gtFlags & GTF_IND_VOLATILE)
+    if (initBlkNode->gtFlags & GTF_BLK_VOLATILE)
     {
+        // issue a full memory barrier before a volatile initBlock Operation
         instGen_MemoryBarrier();
     }