From 442ce696fb072cc912ee090b319e9c80fd92cc74 Mon Sep 17 00:00:00 2001 From: Yi Duan Date: Tue, 9 Nov 2021 11:50:40 +0800 Subject: [PATCH] fix: use stackmap of shadow func as jit func's (#127) * fix: use stackmap of shadow func as jit func's * fix: use LoadWithFaker in decoder * fix: LoadWithFaker support go115 * add 'runtime.' prefix on jit funcname to prevent preempt * add parallel GC tests * remove no_stack_pointer() Co-authored-by: duanyi.aster Co-authored-by: liuqiang --- .licenserc.yaml | 1 + ast/encode_test.go | 41 +- ast/parser_test.go | 37 + ast/search_test.go | 26 + decoder/assembler_amd64.go | 3 +- decoder/debug.go | 68 + decoder/decoder_test.go | 45 + decoder/pools.go | 21 +- encode_test.go | 14 + encoder/assembler_amd64.go | 15 +- encoder/debug.go | 68 + encoder/encoder_test.go | 41 + encoder/pools.go | 20 + internal/jit/assembler_amd64.go | 5 + internal/loader/asm.s | 0 internal/loader/funcdata.go | 32 +- internal/loader/funcdata_go115.go | 6 +- internal/loader/funcdata_go116.go | 8 +- internal/loader/loader.go | 11 +- internal/loader/loader_test.go | 74 + internal/loader/stackmap_amd64.s | 25 - internal/native/avx/native_amd64.s | 4488 ++++++------ internal/native/avx/native_subr_amd64.go | 37 +- internal/native/avx2/native_amd64.s | 7632 +++++++++++---------- internal/native/avx2/native_subr_amd64.go | 37 +- tools/asm2asm | 2 +- 26 files changed, 7204 insertions(+), 5553 deletions(-) create mode 100644 decoder/debug.go create mode 100644 encoder/debug.go create mode 100644 internal/loader/asm.s delete mode 100644 internal/loader/stackmap_amd64.s diff --git a/.licenserc.yaml b/.licenserc.yaml index 0b3d562..1cb993e 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -19,5 +19,6 @@ header: - 'internal/native/avx2/native_subr_amd64.go' # auto-generated by asm2asm - 'internal/resolver/asm.s' # empty file - 'internal/rt/asm.s' # empty file + - 'internal/loader/asm.s' # empty file comment: on-failure \ No newline at end of file diff --git a/ast/encode_test.go b/ast/encode_test.go index 533d2de..614a9d4 100644 --- a/ast/encode_test.go +++ b/ast/encode_test.go @@ -17,12 +17,47 @@ package ast import ( - `encoding/json` - `testing` + `encoding/json` + `testing` + `runtime` + `runtime/debug` + `sync` - `github.com/bytedance/sonic/internal/native/types` + `github.com/bytedance/sonic/internal/native/types` ) +func TestGC_Encode(t *testing.T) { + root, err := NewSearcher(_TwitterJson).GetByPath() + if err != nil { + t.Fatal(err) + } + root.LoadAll() + _, err = root.MarshalJSON() + if err != nil { + t.Fatal(err) + } + wg := &sync.WaitGroup{} + N := 10000 + for i:=0; i