Reduced memory usage

This commit is contained in:
2024-06-28 10:28:23 +02:00
parent 668971808b
commit c8b25dd5b7
5 changed files with 42 additions and 36 deletions

View File

@ -10,7 +10,7 @@ import (
type Result struct {
Used []*Function
Unused map[string]*Function
instructionCount int
InstructionCount int
}
// Finalize generates the final machine code.
@ -20,7 +20,7 @@ func (r Result) Finalize() ([]byte, []byte) {
// The reason we call `main` instead of using `main` itself is to place
// a return address on the stack, which allows return statements in `main`.
final := asm.Assembler{
Instructions: make([]asm.Instruction, 0, r.instructionCount+4),
Instructions: make([]asm.Instruction, 0, r.InstructionCount+4),
}
final.Call("main")