diff options
author | Kyungwoo Lee <kyulee@microsoft.com> | 2016-03-13 13:11:18 -0700 |
---|---|---|
committer | Kyungwoo Lee <kyulee@microsoft.com> | 2016-03-14 07:53:43 -0700 |
commit | 59ea8565227343b3d5c5035ea7abdd4fb4fcc67d (patch) | |
tree | c5f2280b48cf7a00ee47082fa628afb1824b6ec8 /src/jit | |
parent | 7fbb95d2eb98f87c7a2563b37eed004df37a3d0a (diff) | |
download | coreclr-59ea8565227343b3d5c5035ea7abdd4fb4fcc67d.tar.gz coreclr-59ea8565227343b3d5c5035ea7abdd4fb4fcc67d.tar.bz2 coreclr-59ea8565227343b3d5c5035ea7abdd4fb4fcc67d.zip |
ARM64: Fix ZeroInit of Locals
When zero-initializing locals, JIT emits wrong instruction sequence --
e.g, 28 byte zero-intialization as shown below.
The issue was JIT passed wrong arguments to emitIns_R_R_I.
Before (Fail)
```
stp xzr, xzr, [x2],#16
str xzr, [x2,#2] --> just two byte offset (no x2 post-increment)
str wzr, [x2]
```
After (Pass)
```
stp xzr, xzr, [x2],#16
str xzr, [x2],#8
str wzr, [x2]
```
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/codegencommon.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp index 9376666762..c7e0d6120e 100644 --- a/src/jit/codegencommon.cpp +++ b/src/jit/codegencommon.cpp @@ -6727,7 +6727,14 @@ void CodeGen::genZeroInitFrame(int untrLclHi, #ifdef _TARGET_ARM_ getEmitter()->emitIns_R_R_I(INS_str, EA_PTRSIZE, rZero1, rAddr, 0); #else // _TARGET_ARM_ - getEmitter()->emitIns_R_R_I(INS_str, EA_PTRSIZE, REG_ZR, rAddr, (uCntBytes - REGSIZE_BYTES) == 0 ? 0 : INS_OPTS_POST_INDEX); + if ((uCntBytes - REGSIZE_BYTES) == 0) + { + getEmitter()->emitIns_R_R_I(INS_str, EA_PTRSIZE, REG_ZR, rAddr, 0); + } + else + { + getEmitter()->emitIns_R_R_I(INS_str, EA_PTRSIZE, REG_ZR, rAddr, REGSIZE_BYTES, INS_OPTS_POST_INDEX); + } #endif // !_TARGET_ARM_ uCntBytes -= REGSIZE_BYTES; } |