diff options
| author | LLLL Colonq <llll@colonq> | 2026-09-25 17:36:15 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-09-25 17:36:15 -0400 |
| commit | 17df4b1ff7f4cbcf3b3218fea68f65d3cb60c984 (patch) | |
| tree | 5e0b2b81a3ac9c7e506303e8570c16c742072d5d /pit/include | |
| parent | c1a6dfb43efca52cacae738ce3d9648c4981906e (diff) | |
pit: Add fuel economy
Diffstat (limited to 'pit/include')
| -rw-r--r-- | pit/include/lcq/pit/runtime.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pit/include/lcq/pit/runtime.h b/pit/include/lcq/pit/runtime.h index feeb267..96d0351 100644 --- a/pit/include/lcq/pit/runtime.h +++ b/pit/include/lcq/pit/runtime.h @@ -98,6 +98,7 @@ typedef struct pit_runtime { pit_vec(pit_traversal_entry) *traversal; /* intermediate stack used during tree traversal */ pit_vec(pit_callstack_entry) *callstack; /* stack of enclosing function calls */ /* bookkeeping */ + i64 fuel; /* fuel total - ignored if negative. decrements on each instruction executed. */ /* "frozen" values offsets: values before these offsets are immutable, and we can reset here later */ i64 frozen_values, frozen_symtab; pit_value error; /* error value - if this is non-nil, an error has occured! only tracks the first error */ @@ -108,6 +109,7 @@ typedef struct pit_runtime { } pit_runtime; pit_runtime *pit_runtime_new(u8 *buf, i64 len); +void pit_runtime_set_fuel(pit_runtime *rt, i64 fuel); void pit_runtime_freeze(pit_runtime *rt); /* freeze the runtime at the current point - everything currently defined becomes immutable */ void pit_runtime_reset(pit_runtime *rt); /* restore the runtime to the frozen point, resetting everything that has happened since */ bool pit_runtime_print_error(pit_runtime *rt); /* return true if an error has occured, and print to stderr */ |
