Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: eliminate race test errors #545

Merged
merged 4 commits into from
Nov 7, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/compatibility_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
${{ runner.os }}-go-

- name: main
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic
run: GOMAXPROCS=4 go test -v -gcflags="all=-l" -race github.com/bytedance/sonic

- name: ast
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast
run: GOMAXPROCS=4 go test -v -gcflags="all=-l" -race github.com/bytedance/sonic/ast

- name: qemu
run: sh scripts/qemu.sh
3 changes: 2 additions & 1 deletion internal/rt/fastmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ func FuncAddr(f interface{}) unsafe.Pointer {
}
}

//go:nocheckptr
func IndexChar(src string, index int) unsafe.Pointer {
return unsafe.Pointer(uintptr((*GoString)(unsafe.Pointer(&src)).Ptr) + uintptr(index))
}

//go:nocheckptr
func IndexByte(ptr []byte, index int) unsafe.Pointer {
return unsafe.Pointer(uintptr((*GoSlice)(unsafe.Pointer(&ptr)).Ptr) + uintptr(index))
}

//go:nosplit
func GuardSlice(buf *[]byte, n int) {
c := cap(*buf)
l := len(*buf)
Expand Down