Skip to content

Commit

Permalink
Shuffle around where we set the PC
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Feb 15, 2024
1 parent 57c1a49 commit b25b17d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/squiddev/cobalt/debug/DebugState.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.squiddev.cobalt.*;
import org.squiddev.cobalt.function.Dispatch;
import org.squiddev.cobalt.function.LuaFunction;

import java.util.Arrays;

Expand Down Expand Up @@ -328,7 +327,7 @@ private void returnHook(DebugFrame frame, Varargs result) throws LuaError, Unwin
* @throws UnwindThrowable If the hook transfers control to another coroutine.
*/
public void onInstruction(DebugFrame frame, int pc) throws LuaError, UnwindThrowable {
frame.pc = pc;
// TODO: Can we avoid the inhook here?
if (inhook || (hookMask & (HOOK_LINE | HOOK_COUNT)) != 0) onInstructionWorker(frame, pc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ static Varargs execute(final LuaState state, DebugFrame di, LuaInterpretedFuncti

// process instructions
while (true) {
if (state.isInterrupted()) {
di.pc = pc;
state.handleInterrupt();
}
di.pc = pc;
if (state.isInterrupted()) state.handleInterrupt();
ds.onInstruction(di, pc);

// pull out instruction
Expand Down

0 comments on commit b25b17d

Please sign in to comment.