Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/coreclr/nativeaot/Runtime/amd64/GetThread.asm

This file was deleted.

32 changes: 0 additions & 32 deletions src/coreclr/nativeaot/Runtime/arm/GetThread.asm

This file was deleted.

7 changes: 0 additions & 7 deletions src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ RhpNewFast_RarePath
b RhpNewObject
LEAF_END RhpNewFast

INLINE_GETTHREAD_CONSTANT_POOL

;; Allocate non-array object with finalizer.
;; x0 == MethodTable
LEAF_ENTRY RhpNewFinalizable
Expand Down Expand Up @@ -149,9 +147,6 @@ StringSizeOverflow
b RhExceptionHandling_FailedAllocation
LEAF_END RhNewString

INLINE_GETTHREAD_CONSTANT_POOL


;; Allocate one dimensional, zero based array (SZARRAY).
;; x0 == MethodTable
;; x1 == element count
Expand Down Expand Up @@ -213,8 +208,6 @@ ArraySizeOverflow
b RhExceptionHandling_FailedAllocation
LEAF_END RhpNewArray

INLINE_GETTHREAD_CONSTANT_POOL

;; Allocate one dimensional, zero based array (SZARRAY) using the slow path that calls a runtime helper.
;; x0 == MethodTable
;; x1 == element count
Expand Down
45 changes: 19 additions & 26 deletions src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,51 +200,44 @@ CodeLbl SETS "$Name":CC:"Lbl"

;; -----------------------------------------------------------------------------
;;
;; Macro to get a pointer to the Thread* object for the currently executing thread
;; Macro to get a pointer to a threadlocal symbol for the currently executing thread
;;

__tls_array equ 0x58 ;; offsetof(TEB, ThreadLocalStoragePointer)

EXTERN _tls_index

GBLS __SECTIONREL_tls_CurrentThread
__SECTIONREL_tls_CurrentThread SETS "SECTIONREL_tls_CurrentThread"

MACRO
INLINE_GETTHREAD $destReg, $trashReg
INLINE_GET_TLS_VAR $destReg, $trashReg, $variable

EXTERN _tls_index
EXTERN $variable

;; The following macro variables are just some assembler magic to get the name of the 32-bit version
;; of $trashReg. It does it by string manipulation. Replaces something like x3 with w3.
LCLS TrashRegister32Bit
TrashRegister32Bit SETS "$trashReg"
TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister32Bit) - 1))

ldr $trashReg, =_tls_index
ldr $TrashRegister32Bit, [$trashReg]
adrp $destReg, _tls_index
ldr $TrashRegister32Bit, [$destReg, _tls_index]
ldr $destReg, [xpr, #__tls_array]
ldr $destReg, [$destReg, $trashReg lsl #3]
ldr $trashReg, =$__SECTIONREL_tls_CurrentThread
ldr $trashReg, [$trashReg]
add $destReg, $destReg, $trashReg
ldr $destReg, [$destReg, $TrashRegister32Bit uxtw #3]
add $destReg, $destReg, #0, lsl #0xC
RELOC 0xA, $variable ;; IMAGE_REL_ARM64_SECREL_HIGH12A
add $destReg, $destReg, #0, lsl #0
RELOC 0x9, $variable ;; IMAGE_REL_ARM64_SECREL_LOW12A
MEND

;; INLINE_GETTHREAD_CONSTANT_POOL macro has to be used after the last function in the .asm file that used
;; INLINE_GETTHREAD. Optionally, it can be also used after any function that used INLINE_GETTHREAD
;; to improve density, or to reduce distance between the constant pool and its use.
;; -----------------------------------------------------------------------------
;;
;; Macro to get a pointer to the Thread* object for the currently executing thread
;;
MACRO
INLINE_GETTHREAD_CONSTANT_POOL
EXTERN tls_CurrentThread

;; Section relocs are 32 bits. Using an extra DCD initialized to zero for 8-byte alignment.
$__SECTIONREL_tls_CurrentThread
DCD tls_CurrentThread
RELOC 8, tls_CurrentThread ;; SECREL
DCD 0

__SECTIONREL_tls_CurrentThread SETS "$__SECTIONREL_tls_CurrentThread":CC:"_"
INLINE_GETTHREAD $destReg, $trashReg

INLINE_GET_TLS_VAR $destReg, $trashReg, tls_CurrentThread
MEND


MACRO
INLINE_THREAD_UNHIJACK $threadReg, $trashReg1, $trashReg2
;;
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,4 @@ SetSuccess

NESTED_END RhpCallFilterFunclet

INLINE_GETTHREAD_CONSTANT_POOL

end
2 changes: 0 additions & 2 deletions src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,5 @@ Success
LEAF_END RhpSuppressGcStress
#endif ;; FEATURE_GC_STRESS

INLINE_GETTHREAD_CONSTANT_POOL

end

29 changes: 0 additions & 29 deletions src/coreclr/nativeaot/Runtime/arm64/GetThread.asm

This file was deleted.

2 changes: 0 additions & 2 deletions src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
ret
NESTED_END RhpPInvoke

INLINE_GETTHREAD_CONSTANT_POOL


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
Expand Down
31 changes: 0 additions & 31 deletions src/coreclr/nativeaot/Runtime/i386/GetThread.asm

This file was deleted.