import "allocator/arena"; import { gc } from "collector/itcm"; // a class to test with class MyObject { a: u32; } function MyObject_visit(ref: usize): void { } // allocate a managed instance var obj = changetype(gc.alloc(offsetof(), MyObject_visit)); obj.a = 123; var head = changetype(obj) - 16; // header assert(load(head, 0) == 0); // nextWithFlags assert(load(head, 4) == 0); // prev assert(load(head, 8) == changetype(MyObject_visit)); // visitFn assert(load(head, 12) == 0); // unused // contents assert(load(head, 16) == 123); // Obj#a // gc.collect(); // FIXME: endless loop