asm: reuses the slice on SetBranchTargetOnNextNodes (#1303)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
@@ -310,7 +310,8 @@ func (a *AssemblerImpl) addNode(node *nodeImpl) {
|
||||
origin := o.(*nodeImpl)
|
||||
origin.jumpTarget = node
|
||||
}
|
||||
a.SetBranchTargetOnNextNodes = nil
|
||||
// Reuse the underlying slice to avoid re-allocations.
|
||||
a.SetBranchTargetOnNextNodes = a.SetBranchTargetOnNextNodes[:0]
|
||||
}
|
||||
|
||||
// EncodeNode encodes the given node into writer.
|
||||
|
||||
@@ -308,7 +308,8 @@ func (a *AssemblerImpl) addNode(node *nodeImpl) {
|
||||
origin := o.(*nodeImpl)
|
||||
origin.jumpTarget = node
|
||||
}
|
||||
a.SetBranchTargetOnNextNodes = nil
|
||||
// Reuse the underlying slice to avoid re-allocations.
|
||||
a.SetBranchTargetOnNextNodes = a.SetBranchTargetOnNextNodes[:0]
|
||||
}
|
||||
|
||||
// Assemble implements asm.AssemblerBase
|
||||
|
||||
Reference in New Issue
Block a user