ReviewOS

also looking at this

zig-utils/zig-js

fix(compat): stop describing ArrayList's layout, and read it instead

#876
Merged glennmichael123 wants to merge fix/zig-1963-arraylist-compat into main
5 files +88 -42
src/gc.zigmodified+20-20
Changes to src/gc.zig
@@ -1888,11 +1888,11 @@ test "Function marking and relocation cover every managed field" {
18881888 var generator_constants = [_]Value{Value.obj(&old_objects[11])};
18891889 var async_constants = [_]Value{Value.obj(&old_objects[12])};
18901890 var plain_chunk = bytecode.Chunk.init(std.testing.allocator);
1891 plain_chunk.consts = .{ .items = &plain_constants, .capacity = plain_constants.len };
1891 plain_chunk.consts = .fromOwnedSlice(&plain_constants);
18921892 var generator_chunk = bytecode.Chunk.init(std.testing.allocator);
1893 generator_chunk.consts = .{ .items = &generator_constants, .capacity = generator_constants.len };
1893 generator_chunk.consts = .fromOwnedSlice(&generator_constants);
18941894 var async_chunk = bytecode.Chunk.init(std.testing.allocator);
1895 async_chunk.consts = .{ .items = &async_constants, .capacity = async_constants.len };
1895 async_chunk.consts = .fromOwnedSlice(&async_constants);
18961896 var parent_frame_slots = [_]Value{Value.obj(&old_objects[13])};
18971897 var parent_frame = vm.Frame{ .slots = &parent_frame_slots, .parent = null };
18981898 var captured_frame_slots = [_]Value{Value.obj(&old_objects[14])};
@@ -2092,8 +2092,8 @@ test "Promise relocation rewrites inline and overflow reaction graphs" {
20922092 .resolve = Value.obj(&old_objects[6]),
20932093 .reject = Value.obj(&old_objects[7]),
20942094 },
2095 .on_fulfill = .{ .items = &fulfill_overflow, .capacity = fulfill_overflow.len },
2096 .on_reject = .{ .items = &reject_overflow, .capacity = reject_overflow.len },
2095 .on_fulfill = .fromOwnedSlice(&fulfill_overflow),
2096 .on_reject = .fromOwnedSlice(&reject_overflow),
20972097 };
20982098
20992099 const Plan = struct {
@@ -2353,7 +2353,7 @@ test "Generator and IteratorHelper marking and relocation cover every managed sl
23532353 .stack = .{ .items = &stack, .capacity = stack.len },
23542354 .acc = Value.obj(&old_objects[2]),
23552355 .frame = &child_frame,
2356 .handlers = .{ .items = &handlers, .capacity = handlers.len },
2356 .handlers = .fromOwnedSlice(&handlers),
23572357 },
23582358 .env = &old_environment,
23592359 .this_value = Value.obj(&old_objects[5]),
@@ -2362,7 +2362,7 @@ test "Generator and IteratorHelper marking and relocation cover every managed sl
23622362 .import_meta_slot = &import_meta,
23632363 .result = &old_objects[9],
23642364 .async_parent_promise = &old_promise,
2365 .requests = .{ .items = &requests, .capacity = requests.len },
2365 .requests = .fromOwnedSlice(&requests),
23662366 };
23672367 var helper = value.IterHelper{
23682368 .src = Value.obj(&old_objects[14]),
@@ -3395,9 +3395,9 @@ test "realm root relocation rewrites Context registries and embedder handles" {
33953395 context.next_ticks.items = saved_next_ticks;
33963396 context.next_ticks.head = saved_next_tick_head;
33973397 }
3398 context.microtasks.items = .{ .items = &microtask_items, .capacity = microtask_items.len };
3398 context.microtasks.items = .fromOwnedSlice(&microtask_items);
33993399 context.microtasks.head = 0;
3400 context.next_ticks.items = .{ .items = &next_tick_items, .capacity = next_tick_items.len };
3400 context.next_ticks.items = .fromOwnedSlice(&next_tick_items);
34013401 context.next_ticks.head = 0;
34023402
34033403 var unhandled = [_]*promise.Promise{&old_promises[0]};
@@ -3453,15 +3453,15 @@ test "realm root relocation rewrites Context registries and embedder handles" {
34533453 context.private_strong_roots = saved_strong_roots;
34543454 context.private_weak_roots = saved_weak_roots;
34553455 }
3456 context.unhandled_rejections = .{ .items = &unhandled, .capacity = unhandled.len };
3457 context.handled_rejections = .{ .items = &handled, .capacity = handled.len };
3458 context.async_waiters = .{ .items = &async_waiters, .capacity = async_waiters.len };
3459 context.timers = .{ .items = &timers, .capacity = timers.len };
3460 context.finalization_cleanup_jobs = .{ .items = &finalization_jobs, .capacity = finalization_jobs.len };
3461 context.c_api_class_prototypes = .{ .items = &prototypes, .capacity = prototypes.len };
3462 context.c_api_handles = .{ .items = &handles, .capacity = handles.len };
3463 context.private_strong_roots = .{ .items = &strong_roots, .capacity = strong_roots.len };
3464 context.private_weak_roots = .{ .items = &weak_roots, .capacity = weak_roots.len };
3456 context.unhandled_rejections = .fromOwnedSlice(&unhandled);
3457 context.handled_rejections = .fromOwnedSlice(&handled);
3458 context.async_waiters = .fromOwnedSlice(&async_waiters);
3459 context.timers = .fromOwnedSlice(&timers);
3460 context.finalization_cleanup_jobs = .fromOwnedSlice(&finalization_jobs);
3461 context.c_api_class_prototypes = .fromOwnedSlice(&prototypes);
3462 context.c_api_handles = .fromOwnedSlice(&handles);
3463 context.private_strong_roots = .fromOwnedSlice(&strong_roots);
3464 context.private_weak_roots = .fromOwnedSlice(&weak_roots);
34653465
34663466 const Plan = struct {
34673467 old_objects: *[18]Object,
@@ -4511,7 +4511,7 @@ test "precise heap realm registry traces relocates and retires one sibling exact
45114511 const saved_cleanup_jobs = sibling.finalization_cleanup_jobs;
45124512 defer sibling.finalization_cleanup_jobs = saved_cleanup_jobs;
45134513 var pending_cleanup = [_]*Object{&relocated_sibling_root};
4514 sibling.finalization_cleanup_jobs = .{ .items = &pending_cleanup, .capacity = pending_cleanup.len };
4514 sibling.finalization_cleanup_jobs = .fromOwnedSlice(&pending_cleanup);
45154515 try std.testing.expectError(error.RealmNotQuiescent, state.realms.retireQuiescent(sibling));
45164516 sibling.finalization_cleanup_jobs = .empty;
45174517 try std.testing.expectError(error.OwnerCannotRetire, state.realms.retireQuiescent(owner));
@@ -4700,7 +4700,7 @@ test "precise sibling realm shares one heap and retires only after cross-realm h
47004700 const moving_handle = try sibling.protectValue(moving_value);
47014701 const saved_cleanup_jobs = sibling.finalization_cleanup_jobs;
47024702 var pending_cleanup = [_]*Object{moving_handle.get().asObj()};
4703 sibling.finalization_cleanup_jobs = .{ .items = &pending_cleanup, .capacity = pending_cleanup.len };
4703 sibling.finalization_cleanup_jobs = .fromOwnedSlice(&pending_cleanup);
47044704 try std.testing.expectEqual(.unsupported, owner.compactGarbage().status);
47054705 sibling.finalization_cleanup_jobs = saved_cleanup_jobs;
47064706 const compaction = owner.compactGarbage();