You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dynamically allocates a GC object of at least the specified size and returns its address.
25
13
Alignment is guaranteed to be 16 bytes to fit up to v128 values naturally.
26
14
GC-allocated objects cannot be used with `__realloc` and `__free`.
27
15
16
+
***__pin**(ptr: `usize`): `usize`<br />
17
+
Pins the object pointed to by `ptr` externally so it and its directly reachable members and indirectly reachable objects do not become garbage collected.
18
+
19
+
***__unpin**(ptr: `usize`): `void`<br />
20
+
Unpins the object pointed to by `ptr` externally so it can become garbage collected.
21
+
28
22
***__collect**(): `void`<br />
29
-
Performs a full garbage collection cycle.
23
+
Performs a full garbage collection.
30
24
31
25
### Internals
32
26
27
+
***__alloc**(size: `usize`): `usize`<br />
28
+
Dynamically allocates a chunk of memory of at least the specified size and returns its address.
29
+
Alignment is guaranteed to be 16 bytes to fit up to v128 values naturally.
Concrete visitor implementation called during traversal. Cookie can be used to indicate one of multiple operations.
41
45
42
-
### Built-ins
43
-
44
-
***__typeinfo**(id: `u32`): `RTTIFlags`<br />
45
-
Obtains the runtime type information for objects with the specified runtime id. Runtime type information is a set of flags indicating whether a type is managed, an array or similar, and what the relevant alignments when creating an instance externally are etc.
46
-
47
-
***__instanceof**
48
-
49
46
***__visit_globals**(cookie: `u32`): `void`<br />
50
47
Calls `__visit` on each global that is of a managed type.
Calls `__visit` on each member of the object pointed to by `ptr`.
54
51
55
-
### Related
52
+
***__typeinfo**(id: `u32`): `RTTIFlags`<br />
53
+
Obtains the runtime type information for objects with the specified runtime id. Runtime type information is a set of flags indicating whether a type is managed, an array or similar, and what the relevant alignments when creating an instance externally are etc.
56
54
57
-
***idof**<`T`>(): `u32`<br />
58
-
Obtains the unique internal class id of a managed type.
Tests if the object pointed to by `ptr` is an instance of the specified class id.
59
57
60
58
ITCMS / `--runtime incremental`
61
59
-----
@@ -84,3 +82,5 @@ STUB / `--runtime stub`
84
82
----
85
83
86
84
The stub is a maximally minimal runtime substitute, consisting of a simple and fast bump allocator with no means of freeing up memory again, except when freeing the respective most recently allocated object on top of the bump. Useful where memory is not a concern, and/or where it is sufficient to destroy the whole module including any potential garbage after execution.
85
+
86
+
See also: [Garbage collection](https://www.assemblyscript.org/garbage-collection.html)
0 commit comments