未验证 提交 c26a6534 编写于 作者: A Andy Ayers 提交者: GitHub

JIT: check that constant handles are not OK2_CONST_LONGs (#1831)

Follow-up from #1788.

Add padding to `AssertionDsc` so that the `iconFlags` no longer overlap with `lconVal`. Assert that `iconFlags` is never set for an O2K_CONST_LONG assertion.

Also remove an arm-only handle block that should now be redundant.
上级 bca2191e
...@@ -1081,11 +1081,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1, ...@@ -1081,11 +1081,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
if (op2->gtOper == GT_CNS_INT) if (op2->gtOper == GT_CNS_INT)
{ {
#ifdef _TARGET_ARM_ #ifdef _TARGET_ARM_
// Do not Constant-Prop immediate values that require relocation
if (op2->AsIntCon()->ImmedValNeedsReloc(this))
{
goto DONE_ASSERTION;
}
// Do not Constant-Prop large constants for ARM // Do not Constant-Prop large constants for ARM
// TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had // TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had
// target_ssize_t type. // target_ssize_t type.
...@@ -1643,6 +1638,14 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion) ...@@ -1643,6 +1638,14 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
} }
break; break;
case O2K_CONST_LONG:
{
// All handles should be represented by O2K_CONST_INT,
// so no handle bits should be set here.
assert((assertion->op2.u1.iconFlags & GTF_ICON_HDL_MASK) == 0);
}
break;
default: default:
// for all other 'assertion->op2.kind' values we don't check anything // for all other 'assertion->op2.kind' values we don't check anything
break; break;
......
...@@ -6492,6 +6492,7 @@ public: ...@@ -6492,6 +6492,7 @@ public:
struct IntVal struct IntVal
{ {
ssize_t iconVal; // integer ssize_t iconVal; // integer
unsigned padding; // unused; ensures iconFlags does not overlap lconVal
unsigned iconFlags; // gtFlags unsigned iconFlags; // gtFlags
}; };
struct Range // integer subrange struct Range // integer subrange
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册