Skip to content

Commit

Permalink
Ensure run is working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
wkwiatek committed Dec 9, 2024
1 parent 26b2511 commit 9154aac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/components/HostCalls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export const HostCalls = ({
const { storage, hasHostCallOpen } = useAppSelector((state) => state.debugger);
const dispatch = useAppDispatch();

console.log("------ hasHostCallOpen", hasHostCallOpen);

// if (
// !currentInstructionEnriched ||
// isInstructionError(currentInstructionEnriched) ||
Expand Down
4 changes: 1 addition & 3 deletions src/packages/web-worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ onmessage = async (e: MessageEvent<WorkerRequestParams>) => {
messageId: e.data.messageId,
});
} else if (e.data.command === Commands.HOST_CALL) {
console.log('---- go go go host call! ')

const data = await commandHandlers.runHostCall({
pvm,
hostCallIdentifier: e.data.payload.hostCallIdentifier,
Expand All @@ -114,7 +112,7 @@ onmessage = async (e: MessageEvent<WorkerRequestParams>) => {

postTypedMessage({
command: Commands.HOST_CALL,
// hostCallIdentifier: data.,
messageId: e.data.messageId,
});
}
};
17 changes: 11 additions & 6 deletions src/store/workers/workersSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ export const refreshPageAllWorkers = createAsyncThunk(
export const handleHostCall = createAsyncThunk("workers/handleHostCall", async (_, { getState, dispatch }) => {
const state = getState() as RootState;

console.log("gimme storage motherfucer ", state.debugger.storage);

if (state.debugger.storage === null) {
console.log("------ no storage");
return dispatch(setHasHostCallOpen(true));
} else {
const previousInstruction = nextInstruction(
Expand All @@ -268,6 +265,12 @@ export const handleHostCall = createAsyncThunk("workers/handleHostCall", async (
payload: { hostCallIdentifier: worker.exitArg as HostCallIdentifiers },
});

// if (resp) {
if (getState().debugger.isRunMode) {
dispatch(continueAllWorkers());
}
// }

// if (hasCommandStatusError(resp)) {
// throw resp.error;
// }
Expand All @@ -284,7 +287,7 @@ export const handleHostCall = createAsyncThunk("workers/handleHostCall", async (
dispatch(continueAllWorkers());
}

return
return;
}
});

Expand Down Expand Up @@ -381,8 +384,10 @@ export const stepAllWorkers = createAsyncThunk("workers/stepAllWorkers", async (
}

if (state.status === Status.HOST) {
console.log("+++======== HOST CALL ========+++");
dispatch(setIsRunMode(false));
if (debuggerState.storage === null) {
dispatch(setIsRunMode(false));
}

await dispatch(handleHostCall());
}

Expand Down

0 comments on commit 9154aac

Please sign in to comment.