[x86/Linux] Relax inst_JMP assert condition (dotnet/coreclr#11062)
authorJonghyun Park <parjong@gmail.com>
Fri, 21 Apr 2017 05:42:25 +0000 (14:42 +0900)
committerBruce Forstall <brucefo@microsoft.com>
Fri, 21 Apr 2017 05:42:25 +0000 (22:42 -0700)
* [x86/Linux] Do NOT use exception-throwing block on ESP framed method

* Fix format error

* Relax assert condition

* Fix format error

* Revert changes in codegencommon.cpp

* Add parentheses

Commit migrated from https://github.com/dotnet/coreclr/commit/97d07aec271e4e0f0f0127fbbf2240eb5b951c9b

src/coreclr/src/jit/instr.cpp

index e2435ca..5bbfdde 100644 (file)
@@ -244,8 +244,15 @@ void CodeGen::inst_JMP(emitJumpKind jmp, BasicBlock* tgtBlock)
     //
     // Thus only on x86 do we need to assert that the stack level at the target block matches the current stack level.
     //
-    assert(tgtBlock->bbTgtStkDepth * sizeof(int) == genStackLevel || compiler->rpFrameType != FT_ESP_FRAME);
+    CLANG_FORMAT_COMMENT_ANCHOR;
+
+#ifdef UNIX_X86_ABI
+    // bbTgtStkDepth is a (pure) argument count (stack alignment padding should be excluded).
+    assert((tgtBlock->bbTgtStkDepth * sizeof(int) == (genStackLevel - curNestedAlignment)) || isFramePointerUsed());
+#else
+    assert((tgtBlock->bbTgtStkDepth * sizeof(int) == genStackLevel) || isFramePointerUsed());
 #endif
+#endif // !FEATURE_FIXED_OUT_ARGS
 
     getEmitter()->emitIns_J(emitter::emitJumpKindToIns(jmp), tgtBlock);
 }