Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ast/api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2022 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion ast/api_compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64,!arm64 go1.26 !go1.17 arm64,!go1.20
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

/*
* Copyright 2022 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions ast/api_native_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2022 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64,!arm64 go1.26 !go1.17 arm64,!go1.20
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

/*
* Copyright 2021 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions decode_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions decoder/decoder_compat.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (!amd64 && !arm64) || go1.26 || !go1.17 || (arm64 && !go1.20)
// +build !amd64,!arm64 go1.26 !go1.17 arm64,!go1.20
//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

/*
* Copyright 2023 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions decoder/decoder_native.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27


/*
Expand Down
4 changes: 2 additions & 2 deletions decoder/decoder_native_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions encode_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion encoder/encoder_compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64,!arm64 go1.26 !go1.17 arm64,!go1.20
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

/*
* Copyright 2023 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion encoder/encoder_native.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2023 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion encoder/encoder_native_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/bytedance/sonic

go 1.18

replace github.com/bytedance/sonic/loader => ./loader

require (
github.com/bytedance/gopkg v0.1.3
github.com/bytedance/sonic/loader v0.4.0
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
Expand All @@ -19,7 +17,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
Expand Down
4 changes: 2 additions & 2 deletions internal/compat/warn.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64,!arm64 go1.26 !go1.17 arm64,!go1.20
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

package compat

Expand All @@ -8,5 +8,5 @@ import (
)

func Warn(prefix string) {
fmt.Fprintf(os.Stderr, "WARNING: %s only supports (go1.17~1.24 && amd64 CPU) or (go1.20~1.24 && arm64 CPU), but your environment is not suitable and will fallback to encoding/json\n", prefix)
fmt.Fprintf(os.Stderr, "WARNING: %s only supports (go1.17~1.26 and amd64 CPU) or (go1.20~1.26 and arm64 CPU), but your environment is not suitable and will fallback to encoding/json\n", prefix)
}
4 changes: 2 additions & 2 deletions internal/decoder/api/decoder_amd64.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.17 && !go1.26
// +build go1.17,!go1.26
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/api/decoder_arm64.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.17,!go1.26
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/jitdec/asm_stubs_amd64_go121.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.21,!go1.26
// +build go1.21,!go1.27

// Copyright 2023 CloudWeGo Authors
//
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/jitdec/assembler_regabi_amd64.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.17 && !go1.26
// +build go1.17,!go1.26
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/jitdec/generic_regabi_amd64.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.17,!go1.26
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/jitdec/generic_regabi_amd64_test.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.17,!go1.26
// +build go1.17

//
// Copyright 2021 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions internal/encoder/alg/spec.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build (amd64 && go1.16 && !go1.26) || (arm64 && go1.20 && !go1.26)
// +build amd64,go1.16,!go1.26 arm64,go1.20,!go1.26
//go:build (amd64 && go1.16 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.16,!go1.27 arm64,go1.20,!go1.27

/**
* Copyright 2024 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/encoder/alg/spec_compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64,!arm64 go1.26 !go1.16 arm64,!go1.20
// +build !amd64,!arm64 go1.27 !go1.16 arm64,!go1.20

/**
* Copyright 2024 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions internal/encoder/x86/asm_stubs_amd64_go121.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.21 && !go1.26
// +build go1.21,!go1.26
//go:build go1.21 && !go1.27
// +build go1.21,!go1.27

// Copyright 2023 CloudWeGo Authors
//
Expand Down
4 changes: 2 additions & 2 deletions internal/encoder/x86/assembler_regabi_amd64.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.17 && !go1.26
// +build go1.17,!go1.26
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
4 changes: 2 additions & 2 deletions internal/encoder/x86/debug_go117.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.17 && !go1.26
// +build go1.17,!go1.26
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
2 changes: 1 addition & 1 deletion internal/rt/base64_amd64.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build amd64,go1.17,!go1.26
// +build amd64,go1.17,!go1.27

package rt

Expand Down
2 changes: 1 addition & 1 deletion internal/rt/base64_compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !amd64 !go1.17 go1.26
// +build !amd64 !go1.17 go1.27

package rt

Expand Down
4 changes: 0 additions & 4 deletions internal/rt/fastvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ func (self *GoType) String() string {
return self.Pack().String()
}

func (self *GoType) Indirect() bool {
return self.KindFlags&F_direct == 0
}

type GoItab struct {
it unsafe.Pointer
Vt *GoType
Expand Down
2 changes: 1 addition & 1 deletion internal/rt/gcwb.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.21,!go1.26
// +build go1.21,!go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
25 changes: 25 additions & 0 deletions internal/rt/gotype_go126.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build go1.26
// +build go1.26

/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package rt

// In Go 1.26+, TFlagDirectIface is in the TFlag (Flags) field, not Kind_.
func (self *GoType) Indirect() bool {
return self.Flags&F_direct == 0
}
25 changes: 25 additions & 0 deletions internal/rt/gotype_legacy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build !go1.26
// +build !go1.26

/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package rt

// In Go < 1.26, KindDirectIface is in the Kind_ (KindFlags) field.
func (self *GoType) Indirect() bool {
return self.KindFlags&F_direct == 0
}
File renamed without changes.
4 changes: 2 additions & 2 deletions internal/rt/map_swiss_go124.go → internal/rt/map_go126.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.24 && !go1.26 && goexperiment.swissmap
// +build go1.24,!go1.26,goexperiment.swissmap
//go:build go1.26 || goexperiment.swissmap
// +build go1.26 goexperiment.swissmap

package rt

Expand Down
4 changes: 2 additions & 2 deletions loader/funcdata_compat.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !go1.17 || go1.26
// +build !go1.17 go1.26
//go:build !go1.17 || go1.27
// +build !go1.17 go1.27

/*
* Copyright 2021 ByteDance Inc.
Expand Down
Loading
Loading