From 8254f72aa792e174a0cda66a8f5334d930634ab7 Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Thu, 26 Oct 2023 16:09:08 +0800 Subject: [PATCH 1/2] feat: nocheckptr for `rt.IndexChar` --- internal/rt/fastmem.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/rt/fastmem.go b/internal/rt/fastmem.go index e3bf0db91..a68d98aff 100644 --- a/internal/rt/fastmem.go +++ b/internal/rt/fastmem.go @@ -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) From f9b7398253136b11d55eec10dbf1b19e22e9f113 Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Thu, 26 Oct 2023 16:10:20 +0800 Subject: [PATCH 2/2] add more race flag --- .github/workflows/compatibility_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compatibility_test.yml b/.github/workflows/compatibility_test.yml index 9f89724d0..954f5a2b7 100644 --- a/.github/workflows/compatibility_test.yml +++ b/.github/workflows/compatibility_test.yml @@ -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 \ No newline at end of file