Skip to content

Update Rtrace definitions #1681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions lib/rtrace/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,45 @@ export declare class Rtrace {
/** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */
check(): number;

/** A function that is called when an allocation occurs. */
/** Obtains information about a block. */
getBlockInfo(ptr: number): BlockInfo;

// Instrumentation

/** Called upon runtime initialization. */
oninit(heapBase: number): void;

/** Called when a new block is allocated. */
onalloc(ptr: number): void;

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

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

/** A function that is called when a heap allocation is freed. */
onfree(ptr: number): void;

/** A function that is called when an object is visited by the GC. Should return `true`, unless there's an error. */
/** Called when an object is visited by the GC. Returns `true` unless there is an error and the block should be skipped. */
onvisit(ptr: number): boolean;

/** A function that is called after a collection phase. */
/** Called when an existing block is freed.*/
onfree(ptr: number): void;

/** Called when a collection phase concludes. */
oncollect(total: number): void;

/** Obtains information about a block. */
getBlockInfo(ptr: number): BlockInfo;
/** Called when a collection phase interrupts the program. */
oninterrupt(total: number): void;

/** Called when a collection phase yields from an interrupt. */
onyield(total: number): void;

/** Called when a value is stored to memory. */
onstore(ptr: number, offset: number, bytes: number, isRT: boolean): void;

/** Called when a value is loaded from memory. */
onload(ptr: number, offset: number, bytes: number, isRT: boolean): void;

// Reporting

/** Error message callback. */
onerror: ErrorCallback;
Expand Down