Minify program after hitting score
This commit is contained in:
17
vm/state.go
17
vm/state.go
@@ -68,6 +68,15 @@ func (state *State) setHandlers() {
|
||||
}
|
||||
|
||||
func (state *State) processInstruction() {
|
||||
for state.functionIndex < 0 ||
|
||||
state.functionIndex >= int64(len(state.program.Functions)) ||
|
||||
state.instructionIndex < 0 ||
|
||||
state.instructionIndex >= int64(len(state.function().Instructions)) {
|
||||
|
||||
state.ret()
|
||||
return
|
||||
}
|
||||
|
||||
fnc := state.function()
|
||||
instr := fnc.Instructions[state.instructionIndex]
|
||||
state.instructionIndex += 1
|
||||
@@ -77,14 +86,6 @@ func (state *State) processInstruction() {
|
||||
if state.program.InstructionLimit > 0 && state.instructionCount > state.program.InstructionLimit {
|
||||
state.setError(fmt.Errorf("Instruction limit (%d) exceeded", state.program.InstructionLimit))
|
||||
}
|
||||
|
||||
for state.functionIndex < 0 ||
|
||||
state.functionIndex >= int64(len(state.program.Functions)) ||
|
||||
state.instructionIndex < 0 ||
|
||||
state.instructionIndex >= int64(len(state.function().Instructions)) {
|
||||
|
||||
state.ret()
|
||||
}
|
||||
}
|
||||
|
||||
func (state *State) readUnsigned(op *Operand) uint64 {
|
||||
|
||||
Reference in New Issue
Block a user