Added missing register deallocation

This commit is contained in:
2025-01-26 14:31:38 +01:00
parent e62eaba6e6
commit fb40059113
3 changed files with 14 additions and 5 deletions

View File

@ -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
}