2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00

fix:(encoder) keep arguement buf alive (#166)

This commit is contained in:
Yi Duan 2021-12-31 17:15:35 +08:00 committed by GitHub
parent 1443eb3bcf
commit fcfe1c4317
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 3 deletions

View file

@ -84,7 +84,6 @@ var _KeepAlive struct {
var errCallShadow = errors.New("DON'T CALL THIS!")
//go:nosplit
// Faker func of _Decoder, used to export its stackmap as _Decoder's
func _Decoder_Shadow(s string, i int, vp unsafe.Pointer, sb *_Stack, fv uint64, sv string, vk unsafe.Pointer) (ret int, err error) {
// align to assembler_amd64.go: _FP_offs
@ -105,7 +104,6 @@ func _Decoder_Shadow(s string, i int, vp unsafe.Pointer, sb *_Stack, fv uint64,
return 0, errCallShadow
}
//go:nosplit
// Faker func of _Decoder_Generic, used to export its stackmap
func _Decoder_Generic_Shadow(sb *_Stack) {
// align to generic_amd64.go: _VD_offs

View file

@ -109,6 +109,7 @@ func EncodeInto(buf *[]byte, val interface{}, opts Options) error {
freeStack(stk)
/* avoid GC ahead */
runtime.KeepAlive(buf)
runtime.KeepAlive(efv)
return err
}

View file

@ -71,7 +71,6 @@ var _KeepAlive struct {
var errCallShadow = errors.New("DON'T CALL THIS!")
// Faker func of _Encoder, used to export its stackmap as _Encoder's
//go:nosplit
func _Encoder_Shadow(rb *[]byte, vp unsafe.Pointer, sb *_Stack, fv uint64) (err error) {
// align to assembler_amd64.go: _FP_offs
var frame [_FP_offs]byte