purego: revert "use sync.Pool in syscall_syscall15X" (#286)
This reverts commit 05d8da40782673669b51533ccbfedfa71dd8c437, and add tests to run tests without optimization.
- commit
- 450319b71c523c3716a29e3068ef333583744aea
- author
- Hajime Hoshi · · 2024-10-18 19:17 UTC
- committer
- GitHub · · 2024-10-18 19:17 UTC
- parent
- 05d8da4
- signature
- GPG Unverified
B5690EEEBB952194The key is unknown
2 files · +13 -4
M .github/workflows/test.yml +11 -0
| @@ -93,6 +93,11 @@ jobs: | |||
| 93 | 93 | run: | | |
| 94 | 94 | env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./... | |
| 95 | 95 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | |
| 96 | + | # Compile without optimization to check potential stack overflow. | |
| 97 | + | # The option '-gcflags=all=-N -l' is often used at Visual Studio Code. | |
| 98 | + | # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch. | |
| 99 | + | # TODO: CGO_ENABLED=0 might cause SEGV. Fix this issue. | |
| 100 | + | env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./... | |
| 96 | 101 | ||
| 97 | 102 | - name: go test (Linux arm64) | |
| 98 | 103 | if: runner.os == 'Linux' | |
| @@ -209,6 +214,12 @@ jobs: | |||
| 209 | 214 | echo "=> go test CGO_ENABLED=1" | |
| 210 | 215 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | |
| 211 | 216 | ||
| 217 | + | echo "=> go test CGO_ENABLED=0 w/o optimization" | |
| 218 | + | env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./... | |
| 219 | + | ||
| 220 | + | echo "=> go test CGO_ENABLED=1 w/o optimization" | |
| 221 | + | env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./... | |
| 222 | + | ||
| 212 | 223 | if [ -z "$(echo ${{matrix.go}} | grep '^1.1')" ]; then | |
| 213 | 224 | echo "=> go test race" | |
| 214 | 225 | go test -race -shuffle=on -v -count=10 ./... | |
| @@ -93,6 +93,11 @@ jobs: | |||||
| 93 | run: | | 93 | run: | | ||
| 94 | env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./... | 94 | env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./... | ||
| 95 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | 95 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | ||
| 96 | + | # Compile without optimization to check potential stack overflow. | |||
| 97 | + | # The option '-gcflags=all=-N -l' is often used at Visual Studio Code. | |||
| 98 | + | # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch. | |||
| 99 | + | # TODO: CGO_ENABLED=0 might cause SEGV. Fix this issue. | |||
| 100 | + | env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./... | |||
| 96 | 101 | ||||
| 97 | - name: go test (Linux arm64) | 102 | - name: go test (Linux arm64) | ||
| 98 | if: runner.os == 'Linux' | 103 | if: runner.os == 'Linux' | ||
| @@ -209,6 +214,12 @@ jobs: | |||||
| 209 | echo "=> go test CGO_ENABLED=1" | 214 | echo "=> go test CGO_ENABLED=1" | ||
| 210 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | 215 | env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | ||
| 211 | 216 | ||||
| 217 | + | echo "=> go test CGO_ENABLED=0 w/o optimization" | |||
| 218 | + | env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./... | |||
| 219 | + | ||||
| 220 | + | echo "=> go test CGO_ENABLED=1 w/o optimization" | |||
| 221 | + | env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./... | |||
| 222 | + | ||||
| 212 | if [ -z "$(echo ${{matrix.go}} | grep '^1.1')" ]; then | 223 | if [ -z "$(echo ${{matrix.go}} | grep '^1.1')" ]; then | ||
| 213 | echo "=> go test race" | 224 | echo "=> go test race" | ||
| 214 | go test -race -shuffle=on -v -count=10 ./... | 225 | go test -race -shuffle=on -v -count=10 ./... | ||
M syscall_sysv.go +2 -4
| @@ -16,14 +16,12 @@ var syscall15XABI0 uintptr | |||
| 16 | 16 | ||
| 17 | 17 | //go:nosplit | |
| 18 | 18 | func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { | |
| 19 | - | args := thePool.Get().(*syscall15Args) | |
| 20 | - | defer thePool.Put(args) | |
| 21 | - | *args = syscall15Args{ | |
| 19 | + | args := syscall15Args{ | |
| 22 | 20 | fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, | |
| 23 | 21 | a1, a2, a3, a4, a5, a6, a7, a8, | |
| 24 | 22 | 0, | |
| 25 | 23 | } | |
| 26 | - | runtime_cgocall(syscall15XABI0, unsafe.Pointer(args)) | |
| 24 | + | runtime_cgocall(syscall15XABI0, unsafe.Pointer(&args)) | |
| 27 | 25 | return args.a1, args.a2, 0 | |
| 28 | 26 | } | |
| 29 | 27 | ||
| @@ -16,14 +16,12 @@ var syscall15XABI0 uintptr | |||||
| 16 | 16 | ||||
| 17 | //go:nosplit | 17 | //go:nosplit | ||
| 18 | func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { | 18 | func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { | ||
| 19 | - | args := thePool.Get().(*syscall15Args) | 19 | + | args := syscall15Args{ |
| 20 | - | defer thePool.Put(args) | |||
| 21 | - | *args = syscall15Args{ | |||
| 22 | fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, | 20 | fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, | ||
| 23 | a1, a2, a3, a4, a5, a6, a7, a8, | 21 | a1, a2, a3, a4, a5, a6, a7, a8, | ||
| 24 | 0, | 22 | 0, | ||
| 25 | } | 23 | } | ||
| 26 | - | runtime_cgocall(syscall15XABI0, unsafe.Pointer(args)) | 24 | + | runtime_cgocall(syscall15XABI0, unsafe.Pointer(&args)) |
| 27 | return args.a1, args.a2, 0 | 25 | return args.a1, args.a2, 0 | ||
| 28 | } | 26 | } | ||
| 29 | 27 | ||||