warpo 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assemblyscript/std/README.md +5 -0
- package/assemblyscript/std/assembly/array.ts +542 -0
- package/assemblyscript/std/assembly/arraybuffer.ts +72 -0
- package/assemblyscript/std/assembly/builtins.ts +2312 -0
- package/assemblyscript/std/assembly/compat.ts +2 -0
- package/assemblyscript/std/assembly/dataview.ts +144 -0
- package/assemblyscript/std/assembly/date.ts +383 -0
- package/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/assemblyscript/std/assembly/error.ts +39 -0
- package/assemblyscript/std/assembly/function.ts +44 -0
- package/assemblyscript/std/assembly/iterator.ts +24 -0
- package/assemblyscript/std/assembly/map.ts +304 -0
- package/assemblyscript/std/assembly/math.ts +3401 -0
- package/assemblyscript/std/assembly/memory.ts +110 -0
- package/assemblyscript/std/assembly/number.ts +388 -0
- package/assemblyscript/std/assembly/object.ts +30 -0
- package/assemblyscript/std/assembly/polyfills.ts +24 -0
- package/assemblyscript/std/assembly/process.ts +7 -0
- package/assemblyscript/std/assembly/promise.ts +172 -0
- package/assemblyscript/std/assembly/reference.ts +48 -0
- package/assemblyscript/std/assembly/regexp.ts +16 -0
- package/assemblyscript/std/assembly/rt/common.ts +79 -0
- package/assemblyscript/std/assembly/rt/index-incremental.ts +4 -0
- package/assemblyscript/std/assembly/rt/index-radical.ts +4 -0
- package/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/assemblyscript/std/assembly/rt/itcms.ts +415 -0
- package/assemblyscript/std/assembly/rt/tcms.ts +276 -0
- package/assemblyscript/std/assembly/rt/tlsf.ts +564 -0
- package/assemblyscript/std/assembly/rt.ts +71 -0
- package/assemblyscript/std/assembly/set.ts +261 -0
- package/assemblyscript/std/assembly/shared/feature.ts +69 -0
- package/assemblyscript/std/assembly/shared/host.ts +12 -0
- package/assemblyscript/std/assembly/shared/runtime.ts +9 -0
- package/assemblyscript/std/assembly/shared/target.ts +9 -0
- package/assemblyscript/std/assembly/shared/tsconfig.json +9 -0
- package/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/assemblyscript/std/assembly/staticarray.ts +446 -0
- package/assemblyscript/std/assembly/string.ts +892 -0
- package/assemblyscript/std/assembly/symbol.ts +61 -0
- package/assemblyscript/std/assembly/table.ts +15 -0
- package/assemblyscript/std/assembly/tsconfig.json +4 -0
- package/assemblyscript/std/assembly/tuple.ts +36 -0
- package/assemblyscript/std/assembly/typedarray.ts +2000 -0
- package/assemblyscript/std/assembly/uri.ts +17 -0
- package/assemblyscript/std/assembly/util/bytes.ts +90 -0
- package/assemblyscript/std/assembly/util/casemap.ts +264 -0
- package/assemblyscript/std/assembly/util/error.ts +54 -0
- package/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/assemblyscript/std/assembly/util/memory.ts +309 -0
- package/assemblyscript/std/assembly/util/number.ts +884 -0
- package/assemblyscript/std/assembly/util/sort.ts +282 -0
- package/assemblyscript/std/assembly/util/string.ts +1075 -0
- package/assemblyscript/std/assembly/util/uri.ts +251 -0
- package/assemblyscript/std/assembly/vector.ts +3 -0
- package/dist/debug_server/debugSession.d.ts +1 -0
- package/dist/debug_server/debugSession.js +15 -6
- package/dist/debug_server/debugSession.js.map +1 -1
- package/dist/debug_server/debuggerWasmModule.d.ts +3 -0
- package/dist/debug_server/debuggerWasmModule.js +47 -2
- package/dist/debug_server/debuggerWasmModule.js.map +1 -1
- package/dist/debug_server/tests/debugSession.test.js +96 -0
- package/dist/debug_server/tests/debugSession.test.js.map +1 -1
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.js +12 -0
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.js +6 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.js +9 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.js.map +1 -0
- package/package.json +7 -7
- package/warpo_extension/std/tsconfig.json +4 -0
- package/warpo_extension/std/warpo/ffi.ts +16 -0
- package/warpo_extension/std/warpo/test/comparison.ts +122 -0
- package/warpo_extension/std/warpo/test/env.ts +33 -0
- package/warpo_extension/std/warpo/test/expect.ts +101 -0
- package/warpo_extension/std/warpo/test/formatPrint.ts +99 -0
- package/warpo_extension/std/warpo/test/implement.ts +41 -0
- package/warpo_extension/std/warpo/test/index.d.ts +0 -0
- package/warpo_extension/std/warpo/test/index.ts +39 -0
- package/warpo_extension/std/warpo/test/mockInstrument.ts +26 -0
- package/warpo_extension/std/warpo/utf8/const_str.ts +17 -0
- package/warpo_extension/std/wasi_snapshot_preview1/LICENSE +202 -0
- package/warpo_extension/std/wasi_snapshot_preview1/README.md +1 -0
- package/warpo_extension/std/wasi_snapshot_preview1/bindings/wasi_snapshot_preview1.ts +1731 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_console.ts +96 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_crypto.ts +8 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_date.ts +13 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_internal.ts +119 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_performance.ts +11 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_process.ts +191 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
enum _AsPromiseState {
|
|
2
|
+
Pending,
|
|
3
|
+
Fulfilled,
|
|
4
|
+
Rejected,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class _AsPromiseBase {
|
|
8
|
+
private onThen: ((value: Object | null) => void) | null = null;
|
|
9
|
+
private onCatch: ((reason: Object | null) => void) | null = null;
|
|
10
|
+
private state: _AsPromiseState = _AsPromiseState.Pending;
|
|
11
|
+
private fulfilledValue: Object | null = null;
|
|
12
|
+
private rejectedReason: Object | null = null;
|
|
13
|
+
constructor(executor: (resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => void) {
|
|
14
|
+
const handleResolve = (value: Object | null): void => {
|
|
15
|
+
if (this.state == _AsPromiseState.Pending) {
|
|
16
|
+
this.state = _AsPromiseState.Fulfilled;
|
|
17
|
+
this.fulfilledValue = value;
|
|
18
|
+
if (this.onThen) {
|
|
19
|
+
this.onThen(value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const handleReject = (reason: Object | null): void => {
|
|
25
|
+
if (this.state == _AsPromiseState.Pending) {
|
|
26
|
+
this.state = _AsPromiseState.Rejected;
|
|
27
|
+
this.rejectedReason = reason;
|
|
28
|
+
if (this.onCatch) {
|
|
29
|
+
this.onCatch(reason);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
executor(handleResolve, handleReject);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
thenBase(
|
|
38
|
+
onFulfilled: ((value: Object | null) => Object | null) | null,
|
|
39
|
+
onRejected: ((reason: Object | null) => Object | null) | null = null
|
|
40
|
+
): _AsPromiseBase {
|
|
41
|
+
return new _AsPromiseBase((resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
42
|
+
this.onThen = (value: Object | null) => {
|
|
43
|
+
if (onFulfilled) {
|
|
44
|
+
const result = onFulfilled(value);
|
|
45
|
+
if (result instanceof _AsPromiseBase) {
|
|
46
|
+
(result as _AsPromiseBase).thenBase(
|
|
47
|
+
(v: Object | null): Object | null => {
|
|
48
|
+
resolve(v);
|
|
49
|
+
return null;
|
|
50
|
+
},
|
|
51
|
+
(reason: Object | null): Object | null => {
|
|
52
|
+
reject(reason);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
} else {
|
|
57
|
+
//returns a value, resolve it
|
|
58
|
+
resolve(result);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
resolve(value);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
this.onCatch = (reason: Object | null) => {
|
|
66
|
+
if (onRejected) {
|
|
67
|
+
const result = onRejected(reason);
|
|
68
|
+
if (result instanceof _AsPromiseBase) {
|
|
69
|
+
(result as _AsPromiseBase).thenBase(
|
|
70
|
+
(v: Object | null): Object | null => {
|
|
71
|
+
resolve(v);
|
|
72
|
+
return null;
|
|
73
|
+
},
|
|
74
|
+
(newReason: Object | null): Object | null => {
|
|
75
|
+
reject(newReason);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
resolve(result);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
reject(reason);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (this.state === _AsPromiseState.Fulfilled) {
|
|
88
|
+
this.onThen(this.fulfilledValue);
|
|
89
|
+
} else if (this.state === _AsPromiseState.Rejected) {
|
|
90
|
+
this.onCatch(this.rejectedReason);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export class Promise<T> extends _AsPromiseBase {
|
|
97
|
+
then<U>(
|
|
98
|
+
onFulfilled: ((value: T | null) => Object | null) | null,
|
|
99
|
+
onRejected: ((reason: Object | null) => Object | null) | null = null
|
|
100
|
+
): Promise<U> {
|
|
101
|
+
const onFulfilledWrapper = (value: Object | null): Object | null => {
|
|
102
|
+
return onFulfilled ? onFulfilled(value as T | null) : value;
|
|
103
|
+
};
|
|
104
|
+
const p: _AsPromiseBase = super.thenBase(onFulfilledWrapper, onRejected);
|
|
105
|
+
return new Promise<U>((resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
106
|
+
p.thenBase(
|
|
107
|
+
(value: Object | null): Object | null => {
|
|
108
|
+
resolve(value);
|
|
109
|
+
return null;
|
|
110
|
+
},
|
|
111
|
+
(reason: Object | null): Object | null => {
|
|
112
|
+
reject(reason);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
catch<U>(onRejected: (reason: Object | null) => Object | null): Promise<U> {
|
|
120
|
+
return this.then<U>(null, onRejected);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static all(promiseArr: _AsPromiseBase[]): Promise<(Object | null)[]> {
|
|
124
|
+
return new Promise<(Object | null)[]>(
|
|
125
|
+
(resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
126
|
+
let counter = 0;
|
|
127
|
+
const length = promiseArr.length;
|
|
128
|
+
const values: (Object | null)[] = new Array<Object | null>(length);
|
|
129
|
+
for (let i = 0; i < length; i++) {
|
|
130
|
+
const index = i;
|
|
131
|
+
promiseArr[i].thenBase((value: Object | null): Object | null => {
|
|
132
|
+
values[index] = value;
|
|
133
|
+
counter++;
|
|
134
|
+
if (counter == length) {
|
|
135
|
+
resolve(values);
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static any(promiseArr: _AsPromiseBase[]): Promise<Object | null> {
|
|
145
|
+
let resolved = false;
|
|
146
|
+
return new Promise<Object | null>(
|
|
147
|
+
(resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
148
|
+
for (let i = 0; i < promiseArr.length; i++) {
|
|
149
|
+
promiseArr[i].thenBase((value: Object | null): Object | null => {
|
|
150
|
+
if (!resolved) {
|
|
151
|
+
resolved = true;
|
|
152
|
+
resolve(value);
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static resolve<U>(value: U | null): Promise<U> {
|
|
162
|
+
return new Promise<U>((resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
163
|
+
resolve(value);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static reject<U>(reason: Object | null): Promise<U> {
|
|
168
|
+
return new Promise<U>((resolve: (value: Object | null) => void, reject: (reason: Object | null) => void) => {
|
|
169
|
+
reject(reason);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Canonical aliases
|
|
2
|
+
export type funcref = ref_func | null;
|
|
3
|
+
export type externref = ref_extern | null;
|
|
4
|
+
export type anyref = ref_any | null;
|
|
5
|
+
export type eqref = ref_eq | null;
|
|
6
|
+
export type i31ref = ref_i31 | null;
|
|
7
|
+
export type structref = ref_struct | null;
|
|
8
|
+
export type arrayref = ref_array | null;
|
|
9
|
+
export type stringref = ref_string | null;
|
|
10
|
+
export type stringview_wtf8 = ref_stringview_wtf8 | null;
|
|
11
|
+
export type stringview_wtf16 = ref_stringview_wtf16 | null;
|
|
12
|
+
export type stringview_iter = ref_stringview_iter | null;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@unmanaged
|
|
16
|
+
abstract class Ref {}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@final @unmanaged
|
|
20
|
+
export abstract class RefFunc extends Ref {}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@final @unmanaged
|
|
24
|
+
export abstract class RefExtern extends Ref {}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@final @unmanaged
|
|
28
|
+
export abstract class RefAny extends Ref {}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@final @unmanaged
|
|
32
|
+
export abstract class RefEq extends Ref {}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@final @unmanaged
|
|
36
|
+
export abstract class RefI31 extends Ref {}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@final @unmanaged
|
|
40
|
+
export abstract class RefStruct extends Ref {}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@final @unmanaged
|
|
44
|
+
export abstract class RefArray extends Ref {}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@final @unmanaged
|
|
48
|
+
export abstract class RefString extends Ref {}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class RegExp {
|
|
2
|
+
// @binding(CALL_NEW, [ STRING, STRING], OBJECT_HANDLE)
|
|
3
|
+
constructor(pattern: string, flags: string = "") {
|
|
4
|
+
throw new Error("unreachable");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// @binding(CALL_THIS, [ STRING ], PASS_THRU)
|
|
8
|
+
test(search: string): bool {
|
|
9
|
+
throw new Error("unreachable");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// @binding(CALL_THIS, [], STRING)
|
|
13
|
+
toString(): string {
|
|
14
|
+
throw new Error("unreachable");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Alignment guarantees
|
|
2
|
+
|
|
3
|
+
// @ts-ignore: decorator
|
|
4
|
+
@inline export const AL_BITS: u32 = 4; // 16 bytes to fit up to v128
|
|
5
|
+
// @ts-ignore: decorator
|
|
6
|
+
@inline export const AL_SIZE: usize = 1 << (<usize>AL_BITS);
|
|
7
|
+
// @ts-ignore: decorator
|
|
8
|
+
@inline export const AL_MASK: usize = AL_SIZE - 1;
|
|
9
|
+
|
|
10
|
+
// Extra debugging
|
|
11
|
+
|
|
12
|
+
// @ts-ignore: decorator
|
|
13
|
+
@inline export const DEBUG = true;
|
|
14
|
+
// @ts-ignore: decorator
|
|
15
|
+
@inline export const TRACE = false;
|
|
16
|
+
// @ts-ignore: decorator
|
|
17
|
+
@inline export const RTRACE = isDefined(ASC_RTRACE);
|
|
18
|
+
|
|
19
|
+
// Memory manager
|
|
20
|
+
|
|
21
|
+
// ╒════════════ Memory manager block layout (32-bit) ═════════════╕
|
|
22
|
+
// 3 2 1
|
|
23
|
+
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
|
|
24
|
+
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤
|
|
25
|
+
// │ MM info │ -4
|
|
26
|
+
// ╞>ptr═══════════════════════════════════════════════════════════╡
|
|
27
|
+
// │ ... │
|
|
28
|
+
@unmanaged export class BLOCK {
|
|
29
|
+
/** @ts-ignore:no initializer. Memory manager info. */
|
|
30
|
+
mmInfo: usize;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Overhead of a memory manager block. */
|
|
34
|
+
// @ts-ignore: decorator
|
|
35
|
+
@inline export const BLOCK_OVERHEAD: usize = offsetof<BLOCK>();
|
|
36
|
+
|
|
37
|
+
/** Maximum size of a memory manager block's payload. */
|
|
38
|
+
// @ts-ignore: decorator
|
|
39
|
+
@inline export const BLOCK_MAXSIZE: usize = (1 << 30) - BLOCK_OVERHEAD;
|
|
40
|
+
|
|
41
|
+
// Garbage collector
|
|
42
|
+
|
|
43
|
+
// ╒══════════ Garbage collector object layout (32-bit) ═══════════╕
|
|
44
|
+
// 3 2 1
|
|
45
|
+
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
|
|
46
|
+
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤
|
|
47
|
+
// │ Memory manager block │ -20
|
|
48
|
+
// ╞═══════════════════════════════════════════════════════════════╡
|
|
49
|
+
// │ GC info │ -16
|
|
50
|
+
// ├───────────────────────────────────────────────────────────────┤
|
|
51
|
+
// │ GC info │ -12
|
|
52
|
+
// ├───────────────────────────────────────────────────────────────┤
|
|
53
|
+
// │ RT id │ -8
|
|
54
|
+
// ├───────────────────────────────────────────────────────────────┤
|
|
55
|
+
// │ RT size │ -4
|
|
56
|
+
// ╞>ptr═══════════════════════════════════════════════════════════╡
|
|
57
|
+
// │ ... │
|
|
58
|
+
@unmanaged export class OBJECT extends BLOCK {
|
|
59
|
+
/** @ts-ignore:no initializer. Garbage collector info. */
|
|
60
|
+
gcInfo: u32;
|
|
61
|
+
/** @ts-ignore:no initializer. Garbage collector info. */
|
|
62
|
+
gcInfo2: u32;
|
|
63
|
+
/** @ts-ignore:no initializer. Runtime class id. */
|
|
64
|
+
rtId: u32;
|
|
65
|
+
/** @ts-ignore:no initializer. Runtime object size. */
|
|
66
|
+
rtSize: u32;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Overhead of a garbage collector object. Excludes memory manager block overhead. */
|
|
70
|
+
// @ts-ignore: decorator
|
|
71
|
+
@inline export const OBJECT_OVERHEAD: usize = (offsetof<OBJECT>() - BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK;
|
|
72
|
+
|
|
73
|
+
/** Maximum size of a garbage collector object's payload. */
|
|
74
|
+
// @ts-ignore: decorator
|
|
75
|
+
@inline export const OBJECT_MAXSIZE: usize = BLOCK_MAXSIZE - OBJECT_OVERHEAD;
|
|
76
|
+
|
|
77
|
+
/** Total of memory manager and garbage collector overhead. */
|
|
78
|
+
// @ts-ignore: decorator
|
|
79
|
+
@inline export const TOTAL_OVERHEAD: usize = BLOCK_OVERHEAD + OBJECT_OVERHEAD;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Memory manager
|
|
2
|
+
declare function __alloc(size: usize): usize;
|
|
3
|
+
declare function __realloc(ptr: usize, size: usize): usize;
|
|
4
|
+
declare function __free(ptr: usize): void;
|
|
5
|
+
declare function __reset(): void;
|
|
6
|
+
|
|
7
|
+
// Garbage collector
|
|
8
|
+
declare function __new(size: usize, id: u32): usize;
|
|
9
|
+
declare function __renew(ptr: usize, size: usize): usize;
|
|
10
|
+
declare function __link(parentPtr: usize, childPtr: usize, expectMultiple: bool): void;
|
|
11
|
+
declare function __collect(): void;
|
|
12
|
+
|
|
13
|
+
// Runtime type info
|
|
14
|
+
declare function __typeinfo(id: u32): u32;
|
|
15
|
+
|
|
16
|
+
// Visitors
|
|
17
|
+
declare function __visit(ptr: usize, cookie: i32): void;
|
|
18
|
+
declare function __visit_globals(cookie: u32): void;
|
|
19
|
+
declare function __visit_members(ptr: usize, cookie: u32): void;
|
|
20
|
+
|
|
21
|
+
// Allocation helpers
|
|
22
|
+
declare function __newBuffer(size: usize, id: u32, data?: usize): usize;
|
|
23
|
+
declare function __newArray(length: i32, alignLog2: usize, id: u32, data?: usize): usize;
|
|
24
|
+
declare function __newTuple(elementSize: usize, bitmap: u64): usize;
|
|
25
|
+
|
|
26
|
+
// Finalization
|
|
27
|
+
declare function __finalize(ptr: usize): void;
|
|
28
|
+
|
|
29
|
+
// Debugging
|
|
30
|
+
declare const ASC_GC_TESTING: bool;
|
|
31
|
+
|
|
32
|
+
// Incremental GC constants
|
|
33
|
+
declare const ASC_GC_GRANULARITY: i32;
|
|
34
|
+
declare const ASC_GC_SWEEPFACTOR: i32;
|
|
35
|
+
declare const ASC_GC_IDLEFACTOR: i32;
|
|
36
|
+
declare const ASC_GC_MARKCOST: i32;
|
|
37
|
+
declare const ASC_GC_SWEEPCOST: i32;
|