Skip to content

Commit 0730393

Browse files
fixup! Store Tachyon samples in bounded columnar blocks
The reader copied every reconstructed stack into a temporary reversed array before creating the collector's frame list. Walk the block's outermost-first stack backwards while building the list instead. This removes the copy while preserving innermost-first frame lookup and frame-cache behavior.
1 parent 76f0126 commit 0730393

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎Modules/_remote_debugging/binary_io_reader.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@ reader_get_frame_info(RemoteDebuggingState *state, BinaryReader *reader,
778778
return frame_info;
779779
}
780780

781-
/* Build a Python list of FrameInfo objects from frame indices */
781+
/* Build a Python list of FrameInfo objects from frame indices. Stacks are
782+
* kept outermost first, but collectors expect innermost first. */
782783
static PyObject *
783784
build_frame_list(RemoteDebuggingState *state, BinaryReader *reader,
784785
const uint32_t *frame_indices, size_t stack_depth)
@@ -790,7 +791,7 @@ build_frame_list(RemoteDebuggingState *state, BinaryReader *reader,
790791

791792
for (size_t k = 0; k < stack_depth; k++) {
792793
PyObject *frame_info = reader_get_frame_info(
793-
state, reader, frame_indices[k]);
794+
state, reader, frame_indices[stack_depth - 1 - k]);
794795
if (frame_info == NULL) {
795796
goto error;
796797
}
@@ -1366,14 +1367,10 @@ flush_stream_batch(BinaryReader *reader, RemoteDebuggingState *state,
13661367
if (stream->batch == NULL) {
13671368
return 0;
13681369
}
1369-
/* Stacks are kept outermost first; collectors expect innermost first */
1370-
uint32_t stack[MAX_STACK_DEPTH];
1371-
for (size_t i = 0; i < stream->current_stack_depth; i++) {
1372-
stack[i] = stream->current_stack[stream->current_stack_depth - 1 - i];
1373-
}
13741370
int result = emit_sample(state, collector, stream->thread_id,
13751371
stream->interpreter_id, stream->batch_status,
1376-
stack, stream->current_stack_depth, reader,
1372+
stream->current_stack,
1373+
stream->current_stack_depth, reader,
13771374
stream->batch);
13781375
Py_CLEAR(stream->batch);
13791376
return result;

0 commit comments

Comments
 (0)