summaryrefslogtreecommitdiff
path: root/src/jit/lower.cpp
diff options
context:
space:
mode:
authorMike Danes <onemihaid@hotmail.com>2018-06-05 19:29:22 +0300
committerMike Danes <onemihaid@hotmail.com>2018-06-05 19:29:22 +0300
commitd4b0e61396a5f80d65555f7fd422a72b9762136c (patch)
tree334a929a5708a3a203584b23e68d5676faa133b8 /src/jit/lower.cpp
parent73369eb914dc7df2118727a36f23e8c5e5d119f5 (diff)
downloadcoreclr-d4b0e61396a5f80d65555f7fd422a72b9762136c.tar.gz
coreclr-d4b0e61396a5f80d65555f7fd422a72b9762136c.tar.bz2
coreclr-d4b0e61396a5f80d65555f7fd422a72b9762136c.zip
Use the actual type of LOCKADD's data operand
The data operand can theoretically be a small int so we need to use its actual type to determine instruction size. In practice this issue does not seem to happen as the importer is pretty insistent in spilling interlocked arguments to lclvars that have the proper type. Even when the data argument is already a small int lclvar (e.g. short method argument) this still doesn't cause problems because there's a cast between the method argument and LOCKADD.
Diffstat (limited to 'src/jit/lower.cpp')
-rw-r--r--src/jit/lower.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index 7341e81dc3..6671aa6d6e 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -320,7 +320,8 @@ GenTree* Lowering::LowerNode(GenTree* node)
node->ClearUnusedValue();
// Make sure the types are identical, since the node type is changed to VOID
// CodeGen relies on op2's type to determine the instruction size.
- assert(node->gtGetOp2()->TypeGet() == node->TypeGet());
+ // Note that the node type cannot be a small int but the data operand can.
+ assert(genActualType(node->gtGetOp2()->TypeGet()) == node->TypeGet());
node->SetOper(GT_LOCKADD);
node->gtType = TYP_VOID;
CheckImmedAndMakeContained(node, node->gtGetOp2());