detached 02d7b30

Drop 1.15 Support (#45)

* Revert "fix arm64 (#35)"

This reverts commit cf3e27c364c7cdd4ddc620984df246a84a87e477.

* Revert "fix callbacks on go 1.15 (#34)"

This reverts commit 3aa994fcbff60ba81dc1120e4fd38dd6d8546c24.

* match test with current version

the test file changed when I reverted the Go 1.15 changes. It should now match that of what is currently on the tree.

* renamed isios_darwin.go to is_ios.go

1.16 has support for _ios in the filename

Closes #43
commit
02d7b30ab071867225afcd60714c65bc6abf5dc1
author
TotallyGamerJet · · 2022-09-13 15:26 UTC
committer
GitHub · · 2022-09-13 15:26 UTC
parent
1865347
signature
GPG Unverified4AEE18F83AFDEB23 The key is unknown
6 files · +25 -76
D callback_go1_15_darwin_amd64.go +0 -16
@@ -1,16 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build !go1.16
5-// +build !go1.16
6-
7-package purego
8-
9-// callbackWrapPicker is here because Go 1.16+ needs it
10-// to decide between stack and register arguments.
11-// This only has a single pointer because Go 1.15 runtime.cgocallback
12-// dereferences the argument once before passing it to this
13-// function.
14-func callbackWrapPicker(stack, _ *callbackArgs) {
15- callbackWrap(stack)
16-}
@@ -1,16 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build !go1.16
5-// +build !go1.16
6-
7-package purego
8-
9-// callbackWrapPicker is here because Go 1.16+ needs it
10-// to decide between stack and register arguments.
11-// This only has a single pointer because Go 1.15 runtime.cgocallback
12-// dereferences the argument once before passing it to this
13-// function.
14-func callbackWrapPicker(stack, _ *callbackArgs) {
15- callbackWrap(stack)
16-}
D callback_go1_16_darwin_amd64.go +0 -24
@@ -1,24 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build go1.16
5-// +build go1.16
6-
7-package purego
8-
9-// callbackWrapPicker gets called with whatever is on the stack and in the first register.
10-// Depending on which version of Go that uses stack or register-based
11-// calling it passes the respective argument to the real calbackWrap function.
12-// The other argument is therefore invalid and points to undefined memory so don't use it.
13-// This function is necessary since we can't use the ABIInternal selector which is only
14-// valid in the runtime.
15-//
16-// the double indirection is because Go 1.15 will do that in runtime.cgocallback
17-// but in 1.16+ it doesn't so we do it here.
18-func callbackWrapPicker(stack, register **callbackArgs) {
19- if stackCallingConvention {
20- callbackWrap(*stack)
21- } else {
22- callbackWrap(*register)
23- }
24-}
@@ -1,24 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build go1.16
5-// +build go1.16
6-
7-package purego
8-
9-// callbackWrapPicker gets called with whatever is on the stack and in the first register.
10-// Depending on which version of Go that uses stack or register-based
11-// calling it passes the respective argument to the real calbackWrap function.
12-// The other argument is therefore invalid and points to undefined memory so don't use it.
13-// This function is necessary since we can't use the ABIInternal selector which is only
14-// valid in the runtime.
15-//
16-// the double indirection is because Go 1.15 will do that in runtime.cgocallback
17-// but in 1.16+ it doesn't so we do it here.
18-func callbackWrapPicker(stack, register **callbackArgs) {
19- if stackCallingConvention {
20- callbackWrap(*stack)
21- } else {
22- callbackWrap(*register)
23- }
24-}
D callback_go1_16_darwin_arm64.go +0 -21
@@ -1,21 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build go1.16
5-// +build go1.16
6-
7-package purego
8-
9-// callbackWrapPicker gets called with whatever is on the stack and in the first register.
10-// Depending on which version of Go that uses stack or register-based
11-// calling it passes the respective argument to the real calbackWrap function.
12-// The other argument is therefore invalid and points to undefined memory so don't use it.
13-// This function is necessary since we can't use the ABIInternal selector which is only
14-// valid in the runtime.
15-func callbackWrapPicker(stack, register *callbackArgs) {
16- if stackCallingConvention {
17- callbackWrap(stack)
18- } else {
19- callbackWrap(register)
20- }
21-}
@@ -1,21 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build go1.16
5-// +build go1.16
6-
7-package purego
8-
9-// callbackWrapPicker gets called with whatever is on the stack and in the first register.
10-// Depending on which version of Go that uses stack or register-based
11-// calling it passes the respective argument to the real calbackWrap function.
12-// The other argument is therefore invalid and points to undefined memory so don't use it.
13-// This function is necessary since we can't use the ABIInternal selector which is only
14-// valid in the runtime.
15-func callbackWrapPicker(stack, register *callbackArgs) {
16- if stackCallingConvention {
17- callbackWrap(stack)
18- } else {
19- callbackWrap(register)
20- }
21-}
R isios_darwin.go → is_ios.go +2 -2 renamed, 89% similar
@@ -1,8 +1,8 @@
11 // SPDX-License-Identifier: Apache-2.0
22 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33
4-//go:build !cgo && ios
5-// +build !cgo,ios
4+//go:build !cgo
5+// +build !cgo
66
77 package purego
88
@@ -1,8 +1,8 @@
1 // SPDX-License-Identifier: Apache-2.01 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3 3
4-//go:build !cgo && ios4+//go:build !cgo
5-// +build !cgo,ios5+// +build !cgo
6 6
7 package purego7 package purego
8 8
M sys_darwin_amd64.s +9 -13
@@ -115,27 +115,23 @@ TEXT callbackasm1(SB), NOSPLIT, $0
115115
116116 // Create a struct callbackArgs on our stack to be passed as
117117 // the "frame" to cgocallback and on to callbackWrap.
118- // $32 to make enough room for the arguments to runtime.cgocallback
119- // and on Go 1.15 to take a pointer to the pointer to callbackArgs
120- SUBQ $(32+callbackArgs__size), SP
121- MOVQ AX, (32+callbackArgs_index)(SP) // callback index
122- MOVQ R8, (32+callbackArgs_args)(SP) // address of args vector
123- MOVQ $0, (32+callbackArgs_result)(SP) // result
124- LEAQ 32(SP), AX // take the address of callbackArgs
125-
126- MOVQ AX, 24(SP) // get a **callbackArgs for go 1.15
127- LEAQ 24(SP), AX // ^^^^
118+ // $24 to make enough room for the arguments to runtime.cgocallback
119+ SUBQ $(24+callbackArgs__size), SP
120+ MOVQ AX, (24+callbackArgs_index)(SP) // callback index
121+ MOVQ R8, (24+callbackArgs_args)(SP) // address of args vector
122+ MOVQ $0, (24+callbackArgs_result)(SP) // result
123+ LEAQ 24(SP), AX // take the address of callbackArgs
128124
129125 // Call cgocallback, which will call callbackWrap(frame).
130- MOVQ $8, 16(SP) // context is 0 or argsize (including return value) for Go 1.15
126+ MOVQ $0, 16(SP) // context
131127 MOVQ AX, 8(SP) // frame (address of callbackArgs)
132128 MOVQ $callbackWrapInternal<>(SB), BX
133129 MOVQ BX, 0(SP) // PC of function value to call (callbackWrap)
134130 CALL runtime·cgocallback(SB) // runtime.cgocallback(fn, frame, ctxt uintptr)
135131
136132 // Get callback result.
137- MOVQ (32+callbackArgs_result)(SP), AX
138- ADDQ $(32+callbackArgs__size), SP // remove callbackArgs struct
133+ MOVQ (24+callbackArgs_result)(SP), AX
134+ ADDQ $(24+callbackArgs__size), SP // remove callbackArgs struct
139135
140136 POP_REGS_HOST_TO_ABI0()
141137
@@ -115,27 +115,23 @@ TEXT callbackasm1(SB), NOSPLIT, $0
115 115
116 // Create a struct callbackArgs on our stack to be passed as116 // Create a struct callbackArgs on our stack to be passed as
117 // the "frame" to cgocallback and on to callbackWrap.117 // the "frame" to cgocallback and on to callbackWrap.
118- // $32 to make enough room for the arguments to runtime.cgocallback118+ // $24 to make enough room for the arguments to runtime.cgocallback
119- // and on Go 1.15 to take a pointer to the pointer to callbackArgs119+ SUBQ $(24+callbackArgs__size), SP
120- SUBQ $(32+callbackArgs__size), SP120+ MOVQ AX, (24+callbackArgs_index)(SP) // callback index
121- MOVQ AX, (32+callbackArgs_index)(SP) // callback index121+ MOVQ R8, (24+callbackArgs_args)(SP) // address of args vector
122- MOVQ R8, (32+callbackArgs_args)(SP) // address of args vector122+ MOVQ $0, (24+callbackArgs_result)(SP) // result
123- MOVQ $0, (32+callbackArgs_result)(SP) // result123+ LEAQ 24(SP), AX // take the address of callbackArgs
124- LEAQ 32(SP), AX // take the address of callbackArgs
125-
126- MOVQ AX, 24(SP) // get a **callbackArgs for go 1.15
127- LEAQ 24(SP), AX // ^^^^
128 124
129 // Call cgocallback, which will call callbackWrap(frame).125 // Call cgocallback, which will call callbackWrap(frame).
130- MOVQ $8, 16(SP) // context is 0 or argsize (including return value) for Go 1.15126+ MOVQ $0, 16(SP) // context
131 MOVQ AX, 8(SP) // frame (address of callbackArgs)127 MOVQ AX, 8(SP) // frame (address of callbackArgs)
132 MOVQ $callbackWrapInternal<>(SB), BX128 MOVQ $callbackWrapInternal<>(SB), BX
133 MOVQ BX, 0(SP) // PC of function value to call (callbackWrap)129 MOVQ BX, 0(SP) // PC of function value to call (callbackWrap)
134 CALL runtime·cgocallback(SB) // runtime.cgocallback(fn, frame, ctxt uintptr)130 CALL runtime·cgocallback(SB) // runtime.cgocallback(fn, frame, ctxt uintptr)
135 131
136 // Get callback result.132 // Get callback result.
137- MOVQ (32+callbackArgs_result)(SP), AX133+ MOVQ (24+callbackArgs_result)(SP), AX
138- ADDQ $(32+callbackArgs__size), SP // remove callbackArgs struct134+ ADDQ $(24+callbackArgs__size), SP // remove callbackArgs struct
139 135
140 POP_REGS_HOST_TO_ABI0()136 POP_REGS_HOST_TO_ABI0()
141 137
M syscall_darwin.go +14 -0
@@ -95,6 +95,20 @@ const callbackMaxFrame = 64 * ptrSize
9595 // callbackasmABI0 is implemented in zcallback_GOOS_GOARCH.s
9696 var callbackasmABI0 uintptr
9797
98+// callbackWrapPicker gets whatever is on the stack and in the first register.
99+// Depending on which version of Go that uses stack or register-based
100+// calling it passes the respective argument to the real calbackWrap function.
101+// The other argument is therefore invalid and points to undefined memory so don't use it.
102+// This function is necessary since we can't use the ABIInternal selector which is only
103+// valid in the runtime.
104+func callbackWrapPicker(stack, register *callbackArgs) {
105+ if stackCallingConvention {
106+ callbackWrap(stack)
107+ } else {
108+ callbackWrap(register)
109+ }
110+}
111+
98112 // callbackWrap is called by assembly code which determines which Go function to call.
99113 // This function takes the arguments and passes them to the Go function and returns the result.
100114 func callbackWrap(a *callbackArgs) {
@@ -95,6 +95,20 @@ const callbackMaxFrame = 64 * ptrSize
95 // callbackasmABI0 is implemented in zcallback_GOOS_GOARCH.s95 // callbackasmABI0 is implemented in zcallback_GOOS_GOARCH.s
96 var callbackasmABI0 uintptr96 var callbackasmABI0 uintptr
97 97
98+// callbackWrapPicker gets whatever is on the stack and in the first register.
99+// Depending on which version of Go that uses stack or register-based
100+// calling it passes the respective argument to the real calbackWrap function.
101+// The other argument is therefore invalid and points to undefined memory so don't use it.
102+// This function is necessary since we can't use the ABIInternal selector which is only
103+// valid in the runtime.
104+func callbackWrapPicker(stack, register *callbackArgs) {
105+ if stackCallingConvention {
106+ callbackWrap(stack)
107+ } else {
108+ callbackWrap(register)
109+ }
110+}
111+
98 // callbackWrap is called by assembly code which determines which Go function to call.112 // callbackWrap is called by assembly code which determines which Go function to call.
99 // This function takes the arguments and passes them to the Go function and returns the result.113 // This function takes the arguments and passes them to the Go function and returns the result.
100 func callbackWrap(a *callbackArgs) {114 func callbackWrap(a *callbackArgs) {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close