summaryrefslogtreecommitdiff
path: root/src/vm/arm64/asmhelpers.asm
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2015-12-11 16:16:44 -0800
committerBrian Sullivan <briansul@microsoft.com>2015-12-11 16:16:44 -0800
commit121d095ed0b0076fb1c7ff59e6446fd19d506b32 (patch)
tree4a690f67e0117dd346a9de1937f018918a970ae9 /src/vm/arm64/asmhelpers.asm
parentf05270a77a9782c5960d1bdff82b8521b1e3fa5d (diff)
downloadcoreclr-121d095ed0b0076fb1c7ff59e6446fd19d506b32.tar.gz
coreclr-121d095ed0b0076fb1c7ff59e6446fd19d506b32.tar.bz2
coreclr-121d095ed0b0076fb1c7ff59e6446fd19d506b32.zip
Port of all JIT changes for .NET Framework 4.6.1 changes
http://blogs.msdn.com/b/dotnet/archive/2015/11/30/net-framework-4-6-1-is-now-available.aspx .NET Framework list of changes in 4.6.1 https://github.com/Microsoft/dotnet/blob/master/releases/net461/dotnet461-changes.md Additional changes including - Working ARM64 JIT compiler - Additional JIT Optimizations o Tail call recursion optimization o Array length tracking optimization o CSE for widening casts o Smaller encoding for RIP relative and absolute addresses in addressing modes o Tracked Local Variable increased to 512 o Improved handling of Intrinsics System.GetType() o Improved handling of Math intrinsics - Work for the X86 Ryu-JIT compiler [tfs-changeset: 1557101]
Diffstat (limited to 'src/vm/arm64/asmhelpers.asm')
-rw-r--r--src/vm/arm64/asmhelpers.asm123
1 files changed, 92 insertions, 31 deletions
diff --git a/src/vm/arm64/asmhelpers.asm b/src/vm/arm64/asmhelpers.asm
index 9c9cc70d1c..b3cc54a2db 100644
--- a/src/vm/arm64/asmhelpers.asm
+++ b/src/vm/arm64/asmhelpers.asm
@@ -38,6 +38,7 @@
IMPORT g_highest_address
IMPORT g_card_table
IMPORT g_TrapReturningThreads
+ IMPORT g_dispatch_cache_chain_success_counter
TEXTAREA
@@ -133,8 +134,8 @@
#endif
; If machine state is invalid, then simply exit
- ldr x1, [x0, #MachState__isValid]
- cmp x1, #0
+ ldr w1, [x0, #MachState__isValid]
+ cmp w1, #0
beq Done
RestoreRegMS 19, X19
@@ -212,35 +213,6 @@ ThePreStubPatchLabel
ret lr
LEAF_END
-
-;; ------------------------------------------------------------------
-;; void ResolveWorkerAsmStub(args in regs x0-x7 & stack, x11:IndirectionCellAndFlags, x12:DispatchToken)
-;;
-;; The stub dispatch thunk which transfers control to VSD_ResolveWorker.
- NESTED_ENTRY ResolveWorkerAsmStub
-
- PROLOG_WITH_TRANSITION_BLOCK
-
- add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
- and x1, x11, #-4 ; Indirection cell
- mov x2, x12 ; DispatchToken
- and x3, x11, #3 ; flag
- bl VSD_ResolveWorker
- mov x9, x0
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
-
- EPILOG_BRANCH_REG x9
-
- NESTED_END
-
- NESTED_ENTRY ResolveWorkerChainLookupAsmStub
-
- // ARMSTUB TODO: implement chained lookup
- b ResolveWorkerAsmStub
-
- NESTED_END
-
;-----------------------------------------------------------------------------
; The following Macros help in WRITE_BARRIER Implemetations
; WRITE_BARRIER_ENTRY
@@ -1026,6 +998,95 @@ FaultingExceptionFrame_FrameOffset SETA SIZEOF__GSCookie
GenerateRedirectedStubWithFrame NakedThrowHelper, NakedThrowHelper2
+; ------------------------------------------------------------------
+; ResolveWorkerChainLookupAsmStub
+;
+; This method will perform a quick chained lookup of the entry if the
+; initial cache lookup fails.
+;
+; On Entry:
+; x9 contains the pointer to the current ResolveCacheElem
+; x11 contains the address of the indirection (and the flags in the low two bits)
+; x12 contains our contract the DispatchToken
+; Must be preserved:
+; x0 contains the instance object ref that we are making an interface call on
+; [x1-x7] contains any additional register arguments for the interface method
+;
+; Loaded from x0
+; x13 contains our type the MethodTable (from object ref in x0)
+;
+; On Exit:
+; x0, [x1-x7] arguments for the interface implementation target
+;
+; On Exit (to ResolveWorkerAsmStub):
+; x11 contains the address of the indirection and the flags in the low two bits.
+; x12 contains our contract (DispatchToken)
+;
+ GBLA BACKPATCH_FLAG ; two low bit flags used by ResolveWorkerAsmStub
+ GBLA PROMOTE_CHAIN_FLAG ; two low bit flags used by ResolveWorkerAsmStub
+BACKPATCH_FLAG SETA 1
+PROMOTE_CHAIN_FLAG SETA 2
+
+ NESTED_ENTRY ResolveWorkerChainLookupAsmStub
+
+ tst x11, #BACKPATCH_FLAG ; First we check if x11 has the BACKPATCH_FLAG set
+ bne Fail ; If the BACKPATCH_FLAGS is set we will go directly to the ResolveWorkerAsmStub
+
+ ldr x13, [x0] ; retrieve the MethodTable from the object ref in x0
+MainLoop
+ ldr x9, [x9, #24] ; x9 <= the next entry in the chain
+ cmp x9, #0
+ beq Fail
+
+ ldr x9, [x9, #0]
+ cmp x9, x13 ; compare our MT with the one in the ResolveCacheElem
+ bne MainLoop
+
+ ldr x9, [x9, #8]
+ cmp x8, x12 ; compare our DispatchToken with one in the ResolveCacheElem
+ bne MainLoop
+
+Success
+ ldr x13, =g_dispatch_cache_chain_success_counter
+ ldr x9, [x13]
+ subs x9, x9, #1
+ str x9, [x13]
+ blt Promote
+
+ ldr x16, [x9, #16] ; get the ImplTarget
+ br x16 ; branch to interface implemenation target
+
+Promote
+ ; Move this entry to head postion of the chain
+ mov x9, #256
+ str x9, [x13] ; be quick to reset the counter so we don't get a bunch of contending threads
+ orr x11, x11, #PROMOTE_CHAIN_FLAG ; set PROMOTE_CHAIN_FLAG
+
+Fail
+ b ResolveWorkerAsmStub ; call the ResolveWorkerAsmStub method to transition into the VM
+
+ NESTED_END ResolveWorkerChainLookupAsmStub
+
+;; ------------------------------------------------------------------
+;; void ResolveWorkerAsmStub(args in regs x0-x7 & stack, x11:IndirectionCellAndFlags, x12:DispatchToken)
+;;
+;; The stub dispatch thunk which transfers control to VSD_ResolveWorker.
+ NESTED_ENTRY ResolveWorkerAsmStub
+
+ PROLOG_WITH_TRANSITION_BLOCK
+
+ add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
+ and x1, x11, #-4 ; Indirection cell
+ mov x2, x12 ; DispatchToken
+ and x3, x11, #3 ; flag
+ bl VSD_ResolveWorker
+ mov x9, x0
+
+ EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
+
+ EPILOG_BRANCH_REG x9
+
+ NESTED_END
; Must be at very end of file
END