Commit 3476ca34 by Antonio Maiorano

Subzero: fix invalid arg access on Windows x86 for split variables

See the first bug I fixed related to this: 7fefd483. That bug fix ensured that arguments are accessed relative to 'ebp' rather than 'esp' on Windows x86. However, when an arg Variable gets split (see LocalVariableSplitter), the new Variable that's linked to the original arg Variable must also use 'ebp' in the same way. This is now fixed by making sure to set its "isArg" state to match that of the "linked stack root" Variable at the same time as we set its "stackOffset" in the same way. Thus, when stackVarToAsmOperand is called during emitIAS, split Variables are properly addressed using the correct frame pointer. See the detailed design doc: https://docs.google.com/document/d/1IBsWg2V9_arWGYkpuwlKdne4lkA6XwSQ8fp99l8BmnA This fixes the intermittent crash reported here: https://bugs.chromium.org/p/angleproject/issues/detail?id=4482#c15 Bug: angleproject:4482 Change-Id: Ibc089f3a5b9a44f40f130a3db8656011212d2983 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/50008 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent f14f6c46
...@@ -1287,6 +1287,11 @@ void TargetX86Base<TraitsType>::addProlog(CfgNode *Node) { ...@@ -1287,6 +1287,11 @@ void TargetX86Base<TraitsType>::addProlog(CfgNode *Node) {
const Variable *Root = Var->getLinkedToStackRoot(); const Variable *Root = Var->getLinkedToStackRoot();
assert(Root != nullptr); assert(Root != nullptr);
Var->setStackOffset(Root->getStackOffset()); Var->setStackOffset(Root->getStackOffset());
// If the stack root variable is an arg, make this variable an arg too so
// that stackVarToAsmOperand uses the correct base pointer (e.g. ebp on
// x86).
Var->setIsArg(Root->getIsArg());
} }
this->HasComputedFrame = true; this->HasComputedFrame = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment