Skip to content

Commit

Permalink
fix: missing write-barrier when truncate empty slice
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Sep 20, 2023
1 parent 4beeb40 commit e0fa3a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/decoder/assembler_regabi_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,8 @@ func (self *_Assembler) _asm_OP_check_empty(p *_Instr) {
self.Emit("CMPB", jit.Sib(_IP, _IC, 1, 0), jit.Imm(int64(rbracket))) // CMPB (IP)(IC), ']'
self.Sjmp("JNE" , "_not_empty_array_{n}") // JNE _not_empty_array_{n}
self.Emit("MOVQ", _AX, _IC) // MOVQ AX, IC
self.Emit("MOVQ", jit.Imm(_Zero_Base), _AX)
self.WritePtrAX(9, jit.Ptr(_VP, 0), false)
self.StorePtr(_Zero_Base, jit.Ptr(_VP, 0), _AX) // MOVQ $zerobase, (VP)
self.Emit("PXOR", _X0, _X0) // PXOR X0, X0
self.Emit("MOVOU", _X0, jit.Ptr(_VP, 8)) // MOVOU X0, 8(VP)
Expand Down
3 changes: 2 additions & 1 deletion internal/decoder/assembler_stkabi_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,8 @@ func (self *_Assembler) _asm_OP_check_empty(p *_Instr) {
self.Emit("CMPB", jit.Sib(_IP, _IC, 1, 0), jit.Imm(int64(rbracket))) // CMPB (IP)(IC), ']'
self.Sjmp("JNE" , "_not_empty_array_{n}") // JNE _not_empty_array_{n}
self.Emit("MOVQ", _AX, _IC) // MOVQ AX, IC
self.StorePtr(_Zero_Base, jit.Ptr(_VP, 0), _AX) // MOVQ $zerobase, (VP)
self.Emit("MOVQ", jit.Imm(_Zero_Base), _AX)
self.WritePtrAX(9, jit.Ptr(_VP, 0), false)
self.Emit("PXOR" , _X0, _X0) // PXOR X0, X0
self.Emit("MOVOU", _X0, jit.Ptr(_VP, 8)) // MOVOU X0, 8(VP)
self.Xjmp("JMP" , p.vi()) // JMP {p.vi()}
Expand Down

0 comments on commit e0fa3a1

Please sign in to comment.