diff options
| author | Austin Clements <austin@google.com> | 2021-04-13 08:44:56 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2021-04-13 21:13:12 +0000 |
| commit | c19759aa487f7d6f479daa00e7462425f4efc481 (patch) | |
| tree | a580e1b01eeb2ecdb81d383e922ad8bb155095b5 /src/runtime/sys_windows_arm.s | |
| parent | e69f02265c74529a368a2ff27fdce4aeb3483e8b (diff) | |
| download | go-c19759aa487f7d6f479daa00e7462425f4efc481.tar.xz | |
runtime: eliminate externalthreadhandler
This function is no longer used.
Eliminating this actually fixes several problems:
- It made assumptions about what registers memclrNoHeapPointers would
preserve. Besides being an abstraction violation and lurking
maintenance issue, this actively became a problem for regabi because
the call to memclrNoHeapPointers now happens through an ABI wrapper,
which is generated by the compiler and hence we can't easily control
what registers it clobbers.
- The amd64 implementation (at least), does not interact with the host
ABI correctly. Notably, it doesn't save many of the registers that
are callee-save in the host ABI but caller-save in the Go ABI.
- It interacts strangely with the NOSPLIT checker because it allocates
an entire M and G on its stack. It worked around this on arm64, and
happened to do things the NOSPLIT checker couldn't track on 386 and
amd64, and happened to be *4 bytes* below the limit on arm (so any
addition to the m or g structs would cause a NOSPLIT failure). See
CL 309031 for a more complete explanation.
Fixes #45530.
Updates #40724.
Change-Id: Ic70d4d7e1c17f1d796575b3377b8529449e93576
Reviewed-on: https://go-review.googlesource.com/c/go/+/309634
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/sys_windows_arm.s')
| -rw-r--r-- | src/runtime/sys_windows_arm.s | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 8914a2688f..8073fc0198 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -233,73 +233,6 @@ TEXT runtime·lastcontinuetramp<ABIInternal>(SB),NOSPLIT|NOFRAME,$0 MOVW $runtime·lastcontinuehandler(SB), R1 B sigtramp<>(SB) -// int32 externalthreadhandler(uint32 arg, int (*func)(uint32)) -// stack layout: -// +----------------+ -// | callee-save | -// | registers | -// +----------------+ -// | m | -// +----------------+ -// 20| g | -// +----------------+ -// 16| func ptr (r1) | -// +----------------+ -// 12| argument (r0) | -//---+----------------+ -// 8 | param1 | (also return value for called Go function) -// +----------------+ -// 4 | param0 | -// +----------------+ -// 0 | slot for LR | -// +----------------+ -// -TEXT runtime·externalthreadhandler<ABIInternal>(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 - MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} - SUB $(m__size + g__size + 20), R13 // space for locals - MOVW R14, 0(R13) // push LR again for anything unwinding the stack - MOVW R0, 12(R13) - MOVW R1, 16(R13) - - // zero out m and g structures - ADD $20, R13, R0 // compute pointer to g - MOVW R0, 4(R13) - MOVW $(m__size + g__size), R0 - MOVW R0, 8(R13) - BL runtime·memclrNoHeapPointers(SB) - - // initialize m and g structures - ADD $20, R13, R2 // R2 = g - ADD $(20 + g__size), R13, R3 // R3 = m - MOVW R2, m_g0(R3) // m->g0 = g - MOVW R3, g_m(R2) // g->m = m - MOVW R2, m_curg(R3) // m->curg = g - - MOVW R2, g - BL runtime·save_g(SB) - - // set up stackguard stuff - MOVW R13, R0 - MOVW R0, g_stack+stack_hi(g) - SUB $(32*1024), R0 - MOVW R0, (g_stack+stack_lo)(g) - MOVW R0, g_stackguard0(g) - MOVW R0, g_stackguard1(g) - - // move argument into position and call function - MOVW 12(R13), R0 - MOVW R0, 4(R13) - MOVW 16(R13), R1 - BL (R1) - - // clear g - MOVW $0, g - BL runtime·save_g(SB) - - MOVW 8(R13), R0 // load return value - ADD $(m__size + g__size + 20), R13 // free locals - MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} - GLOBL runtime·cbctxts(SB), NOPTR, $4 TEXT runtime·callbackasm1<ABIInternal>(SB),NOSPLIT|NOFRAME,$0 |
