detached 64c381b

all: drop 1.16 and 1.17 (#55)

Closes #55
commit
64c381bcf9c524bab94b2cbdc3619ad3053ef2c4
author
TotallyGamerJet · · 2022-10-30 02:05 UTC
committer
GitHub · · 2022-10-30 02:05 UTC
parent
d863f55
signature
GPG Unverified4AEE18F83AFDEB23 The key is unknown
8 files · +14 -74
M .github/workflows/test.yml +5 -11
@@ -7,7 +7,7 @@ jobs:
77 strategy:
88 matrix:
99 os: [ubuntu-latest, macos-latest, windows-latest]
10- go: ['1.16.x', '1.17.x', '1.18.x', '1.19.x']
10+ go: ['1.18.x', '1.19.x']
1111 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
1212 runs-on: ${{ matrix.os }}
1313 defaults:
@@ -45,17 +45,11 @@ jobs:
4545 env GOOS=windows GOARCH=386 go build -v ./...
4646 env GOOS=windows GOARCH=amd64 go build -v ./...
4747 env GOOS=windows GOARCH=arm go build -v ./...
48-
48+ env GOOS=windows GOARCH=arm64 go build -v ./...
49+
4950 # Check cross-compiling macOS binaries.
5051 env GOOS=darwin GOARCH=amd64 go build -v ./...
51- env GOOS=darwin GOARCH=arm64 go build -v ./...
52-
53- - name: go build (Windows, ARM64)
54- # Go 1.16 and older don't support the pair GOOS=windows and GOARCH=arm64.
55- if: ${{ !startsWith(matrix.go, '1.16.') }}
56- run: |
57- # Check cross-compiling Windows binaries.
58- env GOOS=windows GOARCH=arm64 go build -v ./...
52+ env GOOS=darwin GOARCH=arm64 go build -v ./...
5953
6054 - name: go mod vendor
6155 if: ${{ !startsWith(matrix.os, 'ubuntu-') }}
@@ -75,4 +69,4 @@ jobs:
7569
7670 - name: go test
7771 run: |
78- go test ${{ !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v -count=10 ./...
72+ go test -shuffle=on -v -count=10 ./...
@@ -7,7 +7,7 @@ jobs:
7 strategy:7 strategy:
8 matrix:8 matrix:
9 os: [ubuntu-latest, macos-latest, windows-latest]9 os: [ubuntu-latest, macos-latest, windows-latest]
10- go: ['1.16.x', '1.17.x', '1.18.x', '1.19.x']10+ go: ['1.18.x', '1.19.x']
11 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}11 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
12 runs-on: ${{ matrix.os }}12 runs-on: ${{ matrix.os }}
13 defaults:13 defaults:
@@ -45,17 +45,11 @@ jobs:
45 env GOOS=windows GOARCH=386 go build -v ./...45 env GOOS=windows GOARCH=386 go build -v ./...
46 env GOOS=windows GOARCH=amd64 go build -v ./...46 env GOOS=windows GOARCH=amd64 go build -v ./...
47 env GOOS=windows GOARCH=arm go build -v ./...47 env GOOS=windows GOARCH=arm go build -v ./...
48-48+ env GOOS=windows GOARCH=arm64 go build -v ./...
49+
49 # Check cross-compiling macOS binaries.50 # Check cross-compiling macOS binaries.
50 env GOOS=darwin GOARCH=amd64 go build -v ./...51 env GOOS=darwin GOARCH=amd64 go build -v ./...
51- env GOOS=darwin GOARCH=arm64 go build -v ./...52+ env GOOS=darwin GOARCH=arm64 go build -v ./...
52-
53- - name: go build (Windows, ARM64)
54- # Go 1.16 and older don't support the pair GOOS=windows and GOARCH=arm64.
55- if: ${{ !startsWith(matrix.go, '1.16.') }}
56- run: |
57- # Check cross-compiling Windows binaries.
58- env GOOS=windows GOARCH=arm64 go build -v ./...
59 53
60 - name: go mod vendor54 - name: go mod vendor
61 if: ${{ !startsWith(matrix.os, 'ubuntu-') }}55 if: ${{ !startsWith(matrix.os, 'ubuntu-') }}
@@ -75,4 +69,4 @@ jobs:
75 69
76 - name: go test70 - name: go test
77 run: |71 run: |
78- go test ${{ !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v -count=10 ./...72+ go test -shuffle=on -v -count=10 ./...
M go.mod +1 -1
@@ -1,3 +1,3 @@
11 module github.com/ebitengine/purego
22
3-go 1.16
3+go 1.18
@@ -1,3 +1,3 @@
1 module github.com/ebitengine/purego1 module github.com/ebitengine/purego
2 2
3-go 1.163+go 1.18
M internal/strings/strings.go +2 -12
@@ -4,7 +4,6 @@
44 package strings
55
66 import (
7- "reflect"
87 "unsafe"
98 )
109
@@ -32,19 +31,10 @@ func GoString(c uintptr) string {
3231 }
3332 var length int
3433 for {
35- // use unsafe.Add once we reach 1.17
36- if *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(length))) == '\x00' {
34+ if *(*byte)(unsafe.Add(ptr, uintptr(length))) == '\x00' {
3735 break
3836 }
3937 length++
4038 }
41- // use unsafe.Slice once we reach 1.17
42- s := make([]byte, length)
43- var src []byte
44- h := (*reflect.SliceHeader)(unsafe.Pointer(&src))
45- h.Data = uintptr(ptr)
46- h.Len = length
47- h.Cap = length
48- copy(s, src)
49- return string(s)
39+ return string(unsafe.Slice((*byte)(ptr), length))
5040 }
@@ -4,7 +4,6 @@
4 package strings4 package strings
5 5
6 import (6 import (
7- "reflect"
8 "unsafe"7 "unsafe"
9 )8 )
10 9
@@ -32,19 +31,10 @@ func GoString(c uintptr) string {
32 }31 }
33 var length int32 var length int
34 for {33 for {
35- // use unsafe.Add once we reach 1.1734+ if *(*byte)(unsafe.Add(ptr, uintptr(length))) == '\x00' {
36- if *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(length))) == '\x00' {
37 break35 break
38 }36 }
39 length++37 length++
40 }38 }
41- // use unsafe.Slice once we reach 1.1739+ return string(unsafe.Slice((*byte)(ptr), length))
42- s := make([]byte, length)
43- var src []byte
44- h := (*reflect.SliceHeader)(unsafe.Pointer(&src))
45- h.Data = uintptr(ptr)
46- h.Len = length
47- h.Cap = length
48- copy(s, src)
49- return string(s)
50 }40 }
D registercc_darwin.go +0 -12
@@ -1,12 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build (arm64 && go1.18) || (amd64 && go1.17)
5-// +build arm64,go1.18 amd64,go1.17
6-
7-package purego
8-
9-// stackCallingConvention represents whether the stacks or the
10-// registers are used to pass parameters to functions. This is used to circumvent
11-// the need for ABIInternal tag which is only allowed in the runtime.
12-const stackCallingConvention = false
@@ -1,12 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build (arm64 && go1.18) || (amd64 && go1.17)
5-// +build arm64,go1.18 amd64,go1.17
6-
7-package purego
8-
9-// stackCallingConvention represents whether the stacks or the
10-// registers are used to pass parameters to functions. This is used to circumvent
11-// the need for ABIInternal tag which is only allowed in the runtime.
12-const stackCallingConvention = false
D stackcc_darwin.go +0 -12
@@ -1,12 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build (arm64 && !go1.18) || (amd64 && !go1.17)
5-// +build arm64,!go1.18 amd64,!go1.17
6-
7-package purego
8-
9-// stackCallingConvention represents whether the stacks or the
10-// registers are used to pass parameters to functions. This is used to circumvent
11-// the need for ABIInternal tag which is only allowed in the runtime.
12-const stackCallingConvention = true
@@ -1,12 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3-
4-//go:build (arm64 && !go1.18) || (amd64 && !go1.17)
5-// +build arm64,!go1.18 amd64,!go1.17
6-
7-package purego
8-
9-// stackCallingConvention represents whether the stacks or the
10-// registers are used to pass parameters to functions. This is used to circumvent
11-// the need for ABIInternal tag which is only allowed in the runtime.
12-const stackCallingConvention = true
M sys_darwin_amd64.s +2 -6
@@ -74,13 +74,9 @@ TEXT syscall9X(SB), NOSPLIT, $0
7474
7575 // runtime·cgocallback expects a call to the ABIInternal function
7676 // However, the tag <ABIInternal> is only available in the runtime :(
77-// This is a small wrapper function that copies both whatever is in the register
78-// and is on the stack and places both on the stack. It then calls callbackWrapPicker
79-// which will choose which parameter should be used depending on the version of Go.
80-// It then calls the real version of callbackWrap
8177 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-0
82- MOVQ AX, arg+16(SP)
83- JMP ·callbackWrapPicker(SB)
78+ MOVQ AX, arg+8(SP)
79+ JMP ·callbackWrap(SB)
8480 RET
8581
8682 TEXT callbackasm1(SB), NOSPLIT, $0
@@ -74,13 +74,9 @@ TEXT syscall9X(SB), NOSPLIT, $0
74 74
75 // runtime·cgocallback expects a call to the ABIInternal function75 // runtime·cgocallback expects a call to the ABIInternal function
76 // However, the tag <ABIInternal> is only available in the runtime :(76 // However, the tag <ABIInternal> is only available in the runtime :(
77-// This is a small wrapper function that copies both whatever is in the register
78-// and is on the stack and places both on the stack. It then calls callbackWrapPicker
79-// which will choose which parameter should be used depending on the version of Go.
80-// It then calls the real version of callbackWrap
81 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-077 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-0
82- MOVQ AX, arg+16(SP)78+ MOVQ AX, arg+8(SP)
83- JMP ·callbackWrapPicker(SB)79+ JMP ·callbackWrap(SB)
84 RET80 RET
85 81
86 TEXT callbackasm1(SB), NOSPLIT, $082 TEXT callbackasm1(SB), NOSPLIT, $0
M sys_darwin_arm64.s +4 -6
@@ -65,13 +65,11 @@ TEXT syscall9X(SB), NOSPLIT, $0
6565
6666 // runtime·cgocallback expects a call to the ABIInternal function
6767 // However, the tag <ABIInternal> is only available in the runtime :(
68-// This is a small wrapper function that copies both whatever is in the register
69-// and is on the stack and places both on the stack. It then calls callbackWrapPicker
70-// which will choose which parameter should be used depending on the version of Go.
71-// It then calls the real version of callbackWrap
68+// This is a small wrapper function that moves the parameter from R0 to the stack
69+// where the Go function can find it. It then branches without link.
7270 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-0
73- MOVD R0, 16(RSP)
74- B ·callbackWrapPicker(SB)
71+ MOVD R0, 8(RSP)
72+ B ·callbackWrap(SB)
7573 RET
7674
7775 TEXT callbackasm1(SB), NOSPLIT, $208-0
@@ -65,13 +65,11 @@ TEXT syscall9X(SB), NOSPLIT, $0
65 65
66 // runtime·cgocallback expects a call to the ABIInternal function66 // runtime·cgocallback expects a call to the ABIInternal function
67 // However, the tag <ABIInternal> is only available in the runtime :(67 // However, the tag <ABIInternal> is only available in the runtime :(
68-// This is a small wrapper function that copies both whatever is in the register68+// This is a small wrapper function that moves the parameter from R0 to the stack
69-// and is on the stack and places both on the stack. It then calls callbackWrapPicker69+// where the Go function can find it. It then branches without link.
70-// which will choose which parameter should be used depending on the version of Go.
71-// It then calls the real version of callbackWrap
72 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-070 TEXT callbackWrapInternal<>(SB), NOSPLIT, $0-0
73- MOVD R0, 16(RSP)71+ MOVD R0, 8(RSP)
74- B ·callbackWrapPicker(SB)72+ B ·callbackWrap(SB)
75 RET73 RET
76 74
77 TEXT callbackasm1(SB), NOSPLIT, $208-075 TEXT callbackasm1(SB), NOSPLIT, $208-0
M syscall_darwin.go +0 -14
@@ -95,20 +95,6 @@ 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-
11298 // callbackWrap is called by assembly code which determines which Go function to call.
11399 // This function takes the arguments and passes them to the Go function and returns the result.
114100 func callbackWrap(a *callbackArgs) {
@@ -95,20 +95,6 @@ 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-
112 // callbackWrap is called by assembly code which determines which Go function to call.98 // callbackWrap is called by assembly code which determines which Go function to call.
113 // This function takes the arguments and passes them to the Go function and returns the result.99 // This function takes the arguments and passes them to the Go function and returns the result.
114 func callbackWrap(a *callbackArgs) {100 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