diff options
| author | eunhhu <[email protected]> | 2026-10-13 06:22:49 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-13 06:22:49 +0100 |
| commit | e38cb1ceb8c37d9b168ee2dfac66afa7ad3708e3 (patch) | |
| tree | 9bcf90c07a82b4fbf20ec020884b39a7179d70d4 | |
| parent | e0276bfa9fd4bb418d0f82e12f09069629185863 (diff) | |
| download | pure-e38cb1ceb8c37d9b168ee2dfac66afa7ad3708e3.tar.gz pure-e38cb1ceb8c37d9b168ee2dfac66afa7ad3708e3.zip | |
Module executor: events and views empty the values held by name only in a module that holds some (PureModule.held, set at load): the bank's queries had paid for the 32 slots each (field +0.80%, found +0.50%, large +0.54% from s22 to s24)
| -rw-r--r-- | core/module.c | 5 | ||||
| -rw-r--r-- | core/module.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/module.c b/core/module.c index 76a6821..efa6547 100644 --- a/core/module.c +++ b/core/module.c @@ -1821,6 +1821,7 @@ PURE_COLD PureResult pure_module_load(const void *bytes, size_t size, PureModule } } free(landed); + for (uint32_t pc = 0; pc < out->code_count; ++pc) out->held = out->held || out->code[pc].op == PURE_OP_BYTES_STORE; /* The lists an index state refers to: their inserts tell where (move_indices). */ for (uint32_t i = 0; i < out->states; ++i) if (out->state_type[i] == PURE_STATE_INDEX) out->state_indexed[out->state_ref[i]] = true; @@ -4184,7 +4185,7 @@ static PureResult dispatch(PureApp *app, uint32_t event, Event *ev) { * holds for it the default room, or the budget when that is larger. */ app->grown = app->spent = 0; app->room = app->memory > PURE_GROWTH_DEFAULT ? app->memory : PURE_GROWTH_DEFAULT; - for (unsigned i = 0; i < PURE_MODULE_HELD; ++i) app->held[i].size = 0; + for (unsigned i = 0; m->held && i < PURE_MODULE_HELD; ++i) app->held[i].size = 0; Mark mark; mark_event(app, &mark); memcpy(pending, app->values, sizeof(app->values)); @@ -4532,7 +4533,7 @@ static PureResult evaluate(PureApp *app, uint32_t view, size_t row, Slot *out) { if (!own_lists(app, m->view_lists[view])) return PURE_ALLOCATION; app->grown = app->spent = 0; app->room = app->memory > PURE_GROWTH_DEFAULT ? app->memory : PURE_GROWTH_DEFAULT; - for (unsigned i = 0; i < PURE_MODULE_HELD; ++i) app->held[i].size = 0; + for (unsigned i = 0; m->held && i < PURE_MODULE_HELD; ++i) app->held[i].size = 0; } PureFault fault = app->fault; uint32_t fault_pc = app->fault_pc; diff --git a/core/module.h b/core/module.h index 8477b86..01bbb53 100644 --- a/core/module.h +++ b/core/module.h @@ -298,6 +298,7 @@ typedef struct { uint32_t batch_plan_count; /* in their loops' order */ struct PureJit *jit; /* its blocks compiled (module-jit.c, docs/design/021), or NULL */ bool batches; /* a loop of it is planned to run in batches (module-batch.c, docs/design/024) */ + bool held; /* it holds bytes or texts by name (BYTES_STORE): events and views empty them as they begin */ PureInputShape input[PURE_MODULE_INPUTS]; PureField field[PURE_MODULE_FIELDS]; PureValue initial[PURE_MODULE_STATES]; |
