mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-28 00:12:15 +00:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
// A dummy GC for looking at generated GC code without actually implementing it.
|
|
|
|
// @ts-ignore: decorator
|
|
@inline
|
|
const TRACE = false;
|
|
|
|
// @ts-ignore: decorator
|
|
@global @unsafe
|
|
function __ref_register(ref: usize): void {
|
|
if (TRACE) trace("dummy.register", 1, ref);
|
|
}
|
|
|
|
// @ts-ignore: decorator
|
|
@global @unsafe
|
|
function __ref_collect(): void {
|
|
if (TRACE) trace("dummy.collect");
|
|
}
|
|
|
|
// Tracing
|
|
|
|
// @ts-ignore: decorator
|
|
@global @unsafe
|
|
function __ref_link(ref: usize, parentRef: usize): void {
|
|
if (TRACE) trace("dummy.link", 2, ref, parentRef);
|
|
}
|
|
|
|
// @ts-ignore: decorator
|
|
@global @unsafe
|
|
function __ref_unlink(ref: usize, parentRef: usize): void {
|
|
if (TRACE) trace("dummy.unlink", 2, ref, parentRef);
|
|
}
|
|
|
|
// Reference counting
|
|
|
|
// // @ts-ignore: decorator
|
|
// @global @unsafe
|
|
// function __ref_retain(ref: usize): void {
|
|
// if (TRACE) trace("dummy.retain", 1, ref);
|
|
// }
|
|
|
|
// // @ts-ignore: decorator
|
|
// @global @unsafe
|
|
// function __ref_release(ref: usize): void {
|
|
// if (TRACE) trace("dummy.release", 1, ref);
|
|
// }
|