remove dupavlue and freevalue

This commit is contained in:
2026-02-25 09:40:58 -06:00
parent c77f1f8639
commit d0bf757d91
16 changed files with 32 additions and 869 deletions

View File

@@ -117,7 +117,6 @@ void actor_free(JSContext *actor)
}
for (int i = 0; i < hmlen(actor->timers); i++) {
JS_FreeValue(actor, actor->timers[i].value);
}
hmfree(actor->timers);
@@ -127,7 +126,6 @@ void actor_free(JSContext *actor)
if (actor->letters[i].type == LETTER_BLOB) {
blob_destroy(actor->letters[i].blob_data);
} else if (actor->letters[i].type == LETTER_CALLBACK) {
JS_FreeValue(actor, actor->letters[i].callback);
}
}
@@ -289,7 +287,6 @@ void actor_loop()
JSValue cb = t.actor->timers[idx].value;
hmdel(t.actor->timers, t.timer_id);
actor_clock(t.actor, cb);
JS_FreeValue(t.actor, cb);
}
}
continue; // Loop again
@@ -385,11 +382,9 @@ void actor_turn(JSContext *actor)
blob_destroy(l.blob_data);
result = JS_Call(actor, actor->message_handle_ref.val, JS_NULL, 1, &arg);
uncaught_exception(actor, result);
JS_FreeValue(actor, arg);
} else if (l.type == LETTER_CALLBACK) {
result = JS_Call(actor, l.callback, JS_NULL, 0, NULL);
uncaught_exception(actor, result);
JS_FreeValue(actor, l.callback);
}
if (actor->disrupt) goto ENDTURN;
@@ -405,7 +400,7 @@ void actor_clock(JSContext *actor, JSValue fn)
{
letter l;
l.type = LETTER_CALLBACK;
l.callback = JS_DupValue(actor, fn);
l.callback = fn;
arrput(actor->letters, l);
set_actor_state(actor);
}
@@ -415,7 +410,7 @@ uint32_t actor_delay(JSContext *actor, JSValue fn, double seconds)
static uint32_t global_timer_id = 1;
uint32_t id = global_timer_id++;
JSValue cb = JS_DupValue(actor, fn);
JSValue cb = fn;
hmput(actor->timers, id, cb);
uint64_t now = cell_ns();