Fix INVALIDGCVALUE on Unix
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 16 Feb 2016 22:22:42 +0000 (23:22 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 16 Feb 2016 22:22:42 +0000 (23:22 +0100)
The INVALIDGCVALUE value loaded into the R11 in the JIT_WriteBarrier_Debug
and JIT_ByRefWriteBarrier is sign extended to 0xFFFFFFFFCCCCCCCD instead of
being the 0x00000000CCCCCCCD.
It was introduced during the early days of CoreCLR porting when I have
misread the error message that I was getting from Clang when compiling
mov R11, 0xCCCCCCCD and didn't know yet that loading 64 bit number requires
using the movabs mnemonics.

src/pal/inc/unixasmmacros.inc
src/vm/amd64/jithelpers_fast.S
src/vm/amd64/jithelpers_slow.S

index 566c282..b372666 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-#define INVALIDGCVALUE -0x33333333 // 0CCCCCCCDh - the assembler considers it to be a signed integer constant
+#define INVALIDGCVALUE 0CCCCCCCDh
 
 #if defined(__APPLE__)
 #define C_FUNC(name) _##name
index 9fa35a9..22f21bb 100644 (file)
@@ -186,7 +186,7 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
         mov     rax, [r10]
         cmp     rax, r11
         je      DoneShadow_ByRefWriteBarrier
-        mov     r11, INVALIDGCVALUE
+        movabs  r11, INVALIDGCVALUE
         mov     [r10], r11
 
         jmp     DoneShadow_ByRefWriteBarrier
index 5b67d14..4d18e43 100644 (file)
@@ -45,7 +45,7 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT
         mov     rax, [r10]
         cmp     rax, r11
         je      DoneShadow
-        mov     r11, INVALIDGCVALUE
+        movabs  r11, INVALIDGCVALUE
         mov     [r10], r11
 
         jmp     DoneShadow