create executable function which identifies and loads a cache if available

This commit is contained in:
2025-07-07 04:03:11 +01:00
parent 5c0ced5e45
commit 72cc87f5b6
6 changed files with 48 additions and 30 deletions

View File

@@ -79,13 +79,18 @@ void run_instruction(Translated *translated, RuntimeState *state,
}
}
void runtime(Translated translated) {
RuntimeState init_runtime_state(Translated translated) {
RuntimeState state = {
checked_malloc(translated.registerCount * sizeof(ArgonObject *)), 0};
struct Stack stack = {};
return state;
}
ArgonObject *runtime(Translated translated, RuntimeState state) {
struct Stack stack = {NULL,NULL};
state.head = 0;
while (state.head < translated.bytecode.size) {
run_instruction(&translated, &state, stack);
}
free(state.registers);
return stack.scope;
}

View File

@@ -19,6 +19,8 @@ uint64_t pop_bytecode(Translated *translated, RuntimeState *state);
void run_instruction(Translated *translated, RuntimeState *state, struct Stack stack);
void runtime(Translated translated);
RuntimeState init_runtime_state(Translated translated);
ArgonObject *runtime(Translated translated, RuntimeState state);
#endif // RUNTIME_H