Restrict global and function references to memory size

This commit is contained in:
Ian Gulliver
2021-11-20 18:12:17 -10:00
parent bdb6b17187
commit bd84a5b969
6 changed files with 35 additions and 11 deletions

View File

@@ -1,5 +1,7 @@
package vm
const FunctionMemorySize = 16
type stackFrame struct {
previousFunctionIndex int64
previousInstructionIndex int64
@@ -10,6 +12,6 @@ func newStackFrame(state *State) *stackFrame {
return &stackFrame{
previousFunctionIndex: state.functionIndex,
previousInstructionIndex: state.instructionIndex,
functionMemory: NewMemory(16),
functionMemory: NewMemory(FunctionMemorySize),
}
}