Added missing register deallocation
This commit is contained in:
@ -29,7 +29,7 @@ func (f *Function) CompileAssignDivision(node *ast.Assign) error {
|
||||
}
|
||||
|
||||
dividend := right.Children[0]
|
||||
_, dividendRegister, err := f.Evaluate(dividend)
|
||||
_, dividendRegister, isTemporary, err := f.Evaluate(dividend)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -39,5 +39,10 @@ func (f *Function) CompileAssignDivision(node *ast.Assign) error {
|
||||
err = f.Execute(right.Token, dividendRegister, divisor)
|
||||
f.RegisterRegister(asm.MOVE, quotientVariable.Register, x64.RAX)
|
||||
f.RegisterRegister(asm.MOVE, remainderVariable.Register, x64.RDX)
|
||||
|
||||
if isTemporary {
|
||||
f.FreeRegister(dividendRegister)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user