Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Improve the performance of the Tachyon profiler by avoiding unnecessary remote
reads of the base frame sentinel. Patch by Maurycy Pawłowski-Wieroński.
5 changes: 2 additions & 3 deletions Modules/_remote_debugging/frame_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,8 @@ frame_cache_store(
// Validate we have a complete stack before caching.
// Only cache if last_frame_visited matches base_frame_addr (the sentinel
// at the bottom of the stack). Note: we use last_frame_visited rather than
// addrs[num_addrs-1] because the base frame is visited but not added to the
// addrs array (it returns frame==NULL from is_frame_valid due to
// owner==FRAME_OWNED_BY_INTERPRETER).
// addrs[num_addrs-1] because the base frame's address is not added to the
// addrs array.
if (base_frame_addr != 0 && last_frame_visited != base_frame_addr) {
// Incomplete stack - don't cache (graceful degradation)
return 0;
Expand Down
8 changes: 8 additions & 0 deletions Modules/_remote_debugging/frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ process_frame_chain(
}
assert(frame_count <= MAX_FRAME_CHAIN_DEPTH);

// The base frame is a sentinel with previous == NULL: reaching it is
// enough, no need to read it. Still read it when it is the GC frame
// so the <GC> marker gets emitted.
if (frame_addr == ctx->base_frame_addr

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we add a small comment here explaining why we can stop at the base frame without reading it, and why the <GC> case still needs to go through the read? It is not obvious from the condition alone. The comment in frame_cache_store saying the base frame "returns frame==NULL from is_frame_valid" is also a bit stale now.

@maurycy maurycy Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

1a5fa06

&& !(unwinder->gc && frame_addr == ctx->gc_frame)) {
Comment thread
maurycy marked this conversation as resolved.
break;
}

if (ctx->chunks && ctx->chunks->count > 0) {
parse_result = parse_frame_from_chunks(
unwinder, &frame, frame_addr, &next_frame_addr, &stackpointer, ctx->chunks);
Expand Down
Loading