make it test again

This commit is contained in:
dcode 2019-03-09 01:06:45 +01:00
parent 0ad9d560e0
commit 4f1a971a61
5 changed files with 20 additions and 4 deletions

View File

@ -12,6 +12,7 @@
@inline export const HEADER_SIZE: usize = (offsetof<ManagedObject>() + AL_MASK) & ~AL_MASK;
import { AL_MASK, MAX_SIZE_32 } from "../internal/allocator";
import { __rt_iterateroots } from "../builtins";
/** Collector states. */
const enum State {

View File

@ -1,4 +1,5 @@
import { AL_MASK } from "./allocator";
import { __rt_classid } from "../builtins";
/** Common runtime header of all objects. */
@unmanaged
@ -100,7 +101,7 @@ export function FREE(ref: usize): void {
export function REGISTER<T>(ref: usize, parentRef: usize): void {
var header = UNREF(ref);
header.classId = __rt_classid<T>();
if (GC) __REGISTER_IMPL(ref, parentRef);
if (GC) __REGISTER_IMPL(ref, parentRef); // tslint:disable-line
}
/** ArrayBuffer base class. */

View File

@ -28,7 +28,7 @@
i32.const 0
i32.const 8
i32.const 18
i32.const 37
i32.const 42
call $~lib/env/abort
unreachable
end

View File

@ -15,5 +15,7 @@ var a_ref: A | null = changetype<A>(24); // global root, nullable
var b_ref: B = changetype<B>(32); // global root, non-nullable
var i: i32 = 0;
iterateRoots((ref: usize): void => { assert(<u32>ref == ++i << 3); });
__rt_iterateroots((ref: usize): void => { assert(<u32>ref == ++i << 3); });
assert(i == 4);
assert(__rt_classid<A>() != __rt_classid<B>());

View File

@ -34,7 +34,7 @@
i32.const 0
i32.const 8
i32.const 18
i32.const 37
i32.const 42
call $~lib/env/abort
unreachable
end
@ -58,6 +58,18 @@
call $~lib/env/abort
unreachable
end
i32.const 43
i32.const 44
i32.ne
i32.eqz
if
i32.const 0
i32.const 8
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $start (; 3 ;) (type $FUNCSIG$v)
call $start:std/gc-integration