Skip to content

Commit bff4c45

Browse files
authored
fix: Update Rtrace definitions (#1681)
1 parent 92bc7dd commit bff4c45

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

lib/rtrace/index.d.ts

+29-10
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,45 @@ export declare class Rtrace {
6363
/** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */
6464
check(): number;
6565

66-
/** A function that is called when an allocation occurs. */
66+
/** Obtains information about a block. */
67+
getBlockInfo(ptr: number): BlockInfo;
68+
69+
// Instrumentation
70+
71+
/** Called upon runtime initialization. */
72+
oninit(heapBase: number): void;
73+
74+
/** Called when a new block is allocated. */
6775
onalloc(ptr: number): void;
6876

69-
/** A function that is called when a heap allocation resize occurs. */
77+
/** Called when an existing block is resized. */
7078
onresize(ptr: number, oldSize: number): void;
7179

72-
/** A function that is called when an object is moved on the heap. */
80+
/** Called when an existing block is moved to a new allocation. */
7381
onmove(oldPtr: number, newPtr: number): void;
7482

75-
/** A function that is called when a heap allocation is freed. */
76-
onfree(ptr: number): void;
77-
78-
/** A function that is called when an object is visited by the GC. Should return `true`, unless there's an error. */
83+
/** Called when an object is visited by the GC. Returns `true` unless there is an error and the block should be skipped. */
7984
onvisit(ptr: number): boolean;
8085

81-
/** A function that is called after a collection phase. */
86+
/** Called when an existing block is freed.*/
87+
onfree(ptr: number): void;
88+
89+
/** Called when a collection phase concludes. */
8290
oncollect(total: number): void;
8391

84-
/** Obtains information about a block. */
85-
getBlockInfo(ptr: number): BlockInfo;
92+
/** Called when a collection phase interrupts the program. */
93+
oninterrupt(total: number): void;
94+
95+
/** Called when a collection phase yields from an interrupt. */
96+
onyield(total: number): void;
97+
98+
/** Called when a value is stored to memory. */
99+
onstore(ptr: number, offset: number, bytes: number, isRT: boolean): void;
100+
101+
/** Called when a value is loaded from memory. */
102+
onload(ptr: number, offset: number, bytes: number, isRT: boolean): void;
103+
104+
// Reporting
86105

87106
/** Error message callback. */
88107
onerror: ErrorCallback;

0 commit comments

Comments
 (0)