Skip to content

Commit ba64a3e

Browse files
Merge branch 'main' into 145247-pytuple-from-pair
2 parents 9fd4cff + 171133a commit ba64a3e

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

Doc/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ htmlhelp: build
8888
"build/htmlhelp/pydoc.hhp project file."
8989

9090
.PHONY: latex
91+
latex: _ensure-sphinxcontrib-svg2pdfconverter
9192
latex: BUILDER = latex
9293
latex: build
9394
@echo "Build finished; the LaTeX files are in build/latex."
@@ -231,7 +232,7 @@ dist-text:
231232
@echo "Build finished and archived!"
232233

233234
.PHONY: dist-pdf
234-
dist-pdf:
235+
dist-pdf: _ensure-sphinxcontrib-svg2pdfconverter
235236
# archive the A4 latex
236237
@echo "Building LaTeX (A4 paper)..."
237238
mkdir -p dist
@@ -292,6 +293,10 @@ _ensure-pre-commit:
292293
_ensure-sphinx-autobuild:
293294
$(MAKE) _ensure-package PACKAGE=sphinx-autobuild
294295

296+
.PHONY: _ensure-sphinxcontrib-svg2pdfconverter
297+
_ensure-sphinxcontrib-svg2pdfconverter:
298+
$(MAKE) _ensure-package PACKAGE=sphinxcontrib-svg2pdfconverter
299+
295300
.PHONY: check
296301
check: _ensure-pre-commit
297302
$(VENVDIR)/bin/python3 -m pre_commit run --all-files

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
'linklint.ext',
4747
'notfound.extension',
4848
'sphinxext.opengraph',
49+
'sphinxcontrib.rsvgconverter',
4950
)
5051
for optional_ext in _OPTIONAL_EXTENSIONS:
5152
try:

Doc/library/concurrent.futures.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ And::
156156
print(f.result())
157157

158158
executor = ThreadPoolExecutor(max_workers=1)
159-
executor.submit(wait_on_future)
159+
future = executor.submit(wait_on_future)
160+
# Note: calling future.result() would also cause a deadlock because
161+
# the single worker thread is already waiting for wait_on_future().
160162

161163

162164
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())

Doc/library/profiling.sampling.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,10 +1194,12 @@ data, similar to the ``top`` command for system processes::
11941194
python -m profiling.sampling run --live script.py
11951195
python -m profiling.sampling attach --live 12345
11961196

1197-
.. figure:: tachyon-live-mode-2.gif
1198-
:alt: Tachyon live mode showing all threads
1199-
:align: center
1200-
:width: 100%
1197+
.. only:: not latex
1198+
1199+
.. figure:: tachyon-live-mode-2.gif
1200+
:alt: Tachyon live mode showing all threads
1201+
:align: center
1202+
:width: 100%
12011203

12021204
Live mode displays real-time profiling statistics, showing combined
12031205
data from multiple threads in a multi-threaded application.
@@ -1217,10 +1219,12 @@ main table, showing instruction-level statistics for the currently selected
12171219
function. This panel displays which bytecode instructions are executing most
12181220
frequently, including specialized variants and their base opcodes.
12191221

1220-
.. figure:: tachyon-live-mode-1.gif
1221-
:alt: Tachyon live mode with opcode panel
1222-
:align: center
1223-
:width: 100%
1222+
.. only:: not latex
1223+
1224+
.. figure:: tachyon-live-mode-1.gif
1225+
:alt: Tachyon live mode with opcode panel
1226+
:align: center
1227+
:width: 100%
12241228

12251229
Live mode with ``--opcodes`` enabled shows an opcode panel with a bytecode
12261230
instruction breakdown for the selected function.

Python/optimizer.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,19 @@ _PyJit_FinalizeTracing(PyThreadState *tstate, int err)
10761076
exit->temperature = initial_temperature_backoff_counter(&tstate->interp->opt_config);
10771077
}
10781078
}
1079+
// Clear all recorded values
1080+
_PyJitUopBuffer *buffer = &tracer->code_buffer;
1081+
for (_PyUOpInstruction *inst = buffer->start; inst < buffer->next; inst++) {
1082+
if (_PyUop_Flags[inst->opcode] & HAS_RECORDS_VALUE_FLAG) {
1083+
Py_XDECREF((PyObject *)(uintptr_t)inst->operand0);
1084+
}
1085+
}
10791086
Py_CLEAR(tracer->initial_state.code);
10801087
Py_CLEAR(tracer->initial_state.func);
10811088
Py_CLEAR(tracer->initial_state.executor);
10821089
Py_CLEAR(tracer->prev_state.instr_code);
10831090
Py_CLEAR(tracer->prev_state.recorded_value);
1084-
uop_buffer_init(&tracer->code_buffer, &tracer->uop_array[0], UOP_MAX_TRACE_LENGTH);
1091+
uop_buffer_init(buffer, &tracer->uop_array[0], UOP_MAX_TRACE_LENGTH);
10851092
tracer->is_tracing = false;
10861093
}
10871094

@@ -1521,6 +1528,11 @@ uop_optimize(
15211528
}
15221529
assert(_PyOpcode_uop_name[buffer[pc].opcode]);
15231530
}
1531+
// We've cleaned up the references in the buffer, so discard the code buffer
1532+
// to avoid doing it again during tracer cleanup
1533+
_PyJitUopBuffer *code_buffer = &_tstate->jit_tracer_state->code_buffer;
1534+
code_buffer->next = code_buffer->start;
1535+
15241536
OPT_HIST(effective_trace_length(buffer, length), optimized_trace_length_hist);
15251537
_PyUOpInstruction *output = &_tstate->jit_tracer_state->uop_array[0];
15261538
length = stack_allocate(buffer, output, length);

0 commit comments

Comments
 (0)