refactor: replace finalizer fiber with raw data pointer callback
Remove the dedicated finalizer fiber from WrenVM and change finalizer functions to accept a void* data pointer instead of a full WrenVM reference. This prevents user code from interacting with the VM during garbage collection, simplifying the GC path and eliminating the need for pre-allocated fiber infrastructure. Update the WrenForeignClassMethods struct, all built-in finalizers (file, test), and the binding/calling logic accordingly.
This commit is contained in:
+2
-2
@@ -144,9 +144,9 @@ void fileAllocate(WrenVM* vm)
|
||||
*fd = (int)wrenGetSlotDouble(vm, 1);
|
||||
}
|
||||
|
||||
void fileFinalize(WrenVM* vm)
|
||||
void fileFinalize(void* data)
|
||||
{
|
||||
int fd = *(int*)wrenGetSlotForeign(vm, 0);
|
||||
int fd = *(int*)data;
|
||||
|
||||
// Already closed.
|
||||
if (fd == -1) return;
|
||||
|
||||
Reference in New Issue
Block a user