diff options
author | Rahul Kumar <rahku@microsoft.com> | 2016-08-15 18:32:59 -0700 |
---|---|---|
committer | Rahul Kumar <rahku@microsoft.com> | 2016-08-15 18:32:59 -0700 |
commit | 607816f034c9a09effb4831959e767dc2d11baa6 (patch) | |
tree | 3add0d5a204242b4dc664609cea30d13eebc05e6 | |
parent | a521502de086e0f3bb538e86971cd0098b9db828 (diff) | |
download | coreclr-607816f034c9a09effb4831959e767dc2d11baa6.tar.gz coreclr-607816f034c9a09effb4831959e767dc2d11baa6.tar.bz2 coreclr-607816f034c9a09effb4831959e767dc2d11baa6.zip |
update GC shadow heap as part of writebarrier jit helper
-rw-r--r-- | src/vm/arm64/asmhelpers.asm | 51 | ||||
-rw-r--r-- | src/vm/arm64/asmmacros.h | 9 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/vm/arm64/asmhelpers.asm b/src/vm/arm64/asmhelpers.asm index 1b67915abc..2dcfe91e96 100644 --- a/src/vm/arm64/asmhelpers.asm +++ b/src/vm/arm64/asmhelpers.asm @@ -43,6 +43,14 @@ IMPORT g_card_table IMPORT g_TrapReturningThreads IMPORT g_dispatch_cache_chain_success_counter +#ifdef WRITE_BARRIER_CHECK + SETALIAS g_GCShadow, ?g_GCShadow@@3PEAEEA + SETALIAS g_GCShadowEnd, ?g_GCShadowEnd@@3PEAEEA + + IMPORT g_lowest_address + IMPORT $g_GCShadow + IMPORT $g_GCShadowEnd +#endif // WRITE_BARRIER_CHECK TEXTAREA @@ -301,6 +309,49 @@ NotInHeap dmb ST str x15, [x14] +#ifdef WRITE_BARRIER_CHECK + ; Update GC Shadow Heap + + ; need temporary registers. Save them before using. + stp x12, x13, [sp, #-16]! + + ; Compute address of shadow heap location: + ; pShadow = $g_GCShadow + (x14 - g_lowest_address) + adrp x12, g_lowest_address + ldr x12, [x12, g_lowest_address] + sub x12, x14, x12 + adrp x13, $g_GCShadow + ldr x13, [x13, $g_GCShadow] + add x12, x13, x12 + + ; if (pShadow >= $g_GCShadowEnd) goto end + adrp x13, $g_GCShadowEnd + ldr x13, [x13, $g_GCShadowEnd] + cmp x12, x13 + bhs shadowupdateend + + ; *pShadow = x15 + str x15, [x12] + + ; Ensure that the write to the shadow heap occurs before the read from the GC heap so that race + ; conditions are caught by INVALIDGCVALUE. + dmb sy + + ; if ([x14] == x15) goto end + ldr x13, [x14] + cmp x13, x15 + beq shadowupdateend + + ; *pShadow = INVALIDGCVALUE (0xcccccccd) + mov x13, #0 + movk x13, #0xcccd + movk x13, #0xcccc, LSL #16 + str x13, [x12] + +shadowupdateend + ldp x12, x13, [sp],#16 +#endif + ; Branch to Exit if the reference is not in the Gen0 heap ; adrp x12, g_ephemeral_low diff --git a/src/vm/arm64/asmmacros.h b/src/vm/arm64/asmmacros.h index b24c0fd99a..74613daa8f 100644 --- a/src/vm/arm64/asmmacros.h +++ b/src/vm/arm64/asmmacros.h @@ -9,6 +9,15 @@ ;; ==--== ;----------------------------------------------------------------------------- +; Macro used to assign an alternate name to a symbol containing characters normally disallowed in a symbol +; name (e.g. C++ decorated names). + MACRO + SETALIAS $name, $symbol + GBLS $name +$name SETS "|$symbol|" + MEND + +;----------------------------------------------------------------------------- ; Basic extension of Assembler Macros- For Consistency MACRO |