46 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-03-21 17:34:51 +01:00
// 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
2019-03-26 23:35:08 +01:00
function __ref_register(ref: usize): void {
if (TRACE) trace("dummy.register", 1, ref);
2019-03-21 17:34:51 +01:00
}
// @ts-ignore: decorator
@global @unsafe
2019-03-26 23:35:08 +01:00
function __ref_collect(): void {
if (TRACE) trace("dummy.collect");
2019-03-21 17:34:51 +01:00
}
2019-03-26 23:35:08 +01:00
// Tracing
2019-03-21 17:34:51 +01:00
// @ts-ignore: decorator
@global @unsafe
2019-03-26 23:35:08 +01:00
function __ref_link(ref: usize, parentRef: usize): void {
if (TRACE) trace("dummy.link", 2, ref, parentRef);
2019-03-21 17:34:51 +01:00
}
// @ts-ignore: decorator
@global @unsafe
2019-03-26 23:35:08 +01:00
function __ref_unlink(ref: usize, parentRef: usize): void {
if (TRACE) trace("dummy.unlink", 2, ref, parentRef);
2019-03-21 17:34:51 +01:00
}
2019-03-26 23:35:08 +01:00
// 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);
// }