Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-115999: Implement thread-local bytecode and enable specialization forBINARY_OP#123926

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mpage merged 84 commits intopython:mainfrommpage:gh-115999-thread-local-bytecode
Nov 4, 2024
Merged
Changes from1 commit
Commits
Show all changes
84 commits
Select commitHold shift + click to select a range
776a1e1
Assign threads indices into bytecode copies
mpageAug 15, 2024
2b40870
Replace most usage of PyCode_CODE
mpageAug 27, 2024
344d7ad
Get bytecode copying working
mpageAug 20, 2024
f203d00
Refactor remove_tools
mpageAug 30, 2024
82b456a
Refactor remove_line_tools
mpageAug 30, 2024
b021704
Instrument thread-local bytecode
mpageSep 1, 2024
aea69c5
Use locks for instrumentation
mpageSep 3, 2024
552277d
Add ifdef guards for each specialization family
mpageSep 3, 2024
50a6089
Specialize BINARY_OP
mpageSep 4, 2024
3f1d941
Limit the amount of memory consumed by bytecode copies
mpageSep 6, 2024
7d2eb27
Make thread-local bytecode limits user configurable
mpageSep 7, 2024
d5476b9
Fix a few data races when (de)instrumenting opcodes
mpageSep 8, 2024
e3b367a
Make branch taken recording thread-safe
mpageSep 8, 2024
b2375bf
Lock thread-local bytecode when specializing
mpageSep 9, 2024
2707f8e
Load bytecode on RESUME_CHECK
mpageSep 9, 2024
3fdcb28
Load tlbc on generator.throw()
mpageSep 9, 2024
4a55ce5
Use tlbc instead of thread_local_bytecode
mpageSep 9, 2024
8b3ff60
Use tlbc everywhere
mpageSep 9, 2024
862afa1
Explicitly manage tlbc state
mpageSep 9, 2024
0b4d952
Refactor API for fetching tlbc
mpageSep 9, 2024
7795e99
Add unit tests
mpageSep 10, 2024
693a4cc
Fix initconfig in default build
mpageSep 10, 2024
b43531e
Fix instrumentation in default build
mpageSep 10, 2024
9025f43
Synchronize bytecode modifications between specialization and instrum…
mpageSep 10, 2024
c44c7d9
Add a high-level comment
mpageSep 10, 2024
e2a6656
Fix unused variable warning in default build
mpageSep 10, 2024
e6513d1
Fix test_config in free-threaded builds
mpageSep 10, 2024
a18396f
Fix formatting
mpageSep 10, 2024
81fe1a2
Remove comment
mpageSep 10, 2024
837645e
Fix data race in _PyInstruction_GetLength
mpageSep 10, 2024
f13e132
Fix tier2 optimizer
mpageSep 11, 2024
942f628
Use __VA_ARGS__ for macros
mpageSep 11, 2024
66cb24d
Update vcxproj files to include newly added files
mpageSep 11, 2024
ad12bd4
Mark unused params
mpageSep 11, 2024
1bbbbbc
Keep tier2 and the JIT disabled in free-threaded builds
mpageSep 12, 2024
e63e403
Only allow enabling/disabling tlbc
mpageSep 13, 2024
8b97771
Update libpython for gdb
mpageSep 13, 2024
d34adeb
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 13, 2024
6d4fe73
Handle out of memory errors
mpageSep 13, 2024
c2d8693
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 17, 2024
b104782
Fix warnings on windows
mpageSep 17, 2024
deb5216
Fix another warning
mpageSep 18, 2024
2f11cc7
Ugh actually fix it
mpageSep 18, 2024
04f1ac3
Add high-level comment about index pools
mpageSep 25, 2024
aa330b1
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 25, 2024
7dfd1ca
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 26, 2024
7c9da24
Exclude tlbc from refleak counts
mpageSep 27, 2024
dd144d0
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 28, 2024
ad180d1
Regen files
mpageSep 28, 2024
95d2264
Move `get_tlbc_blocks` into the sys module
mpageSep 30, 2024
b6380de
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageSep 30, 2024
adb59ef
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 5, 2024
39c947d
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 10, 2024
2cc5830
Work around `this_instr` now being const
mpageOct 11, 2024
96ec126
Make RESUME_CHECK cheaper
mpageOct 11, 2024
5ecebd9
Pass tstate to _PyCode_GetTLBCFast
mpageOct 11, 2024
815b2fe
Rename test_tlbc.py to test_thread_local_bytecode.py
mpageOct 11, 2024
fb90d23
Remove per-family defines for specialization
mpageOct 11, 2024
4e42414
Replace bytecode pointer with tlbc_index
mpageOct 13, 2024
814e4ca
Add a test verifying that we clean up tlbc when the code object is de…
mpageOct 14, 2024
ba3930a
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 14, 2024
cb8a774
Fix indentation
mpageOct 14, 2024
0f8a55b
Clarify comment
mpageOct 14, 2024
70ce0fe
Fix TSAN
mpageOct 14, 2024
f512353
Add test for cleaning up tlbc in correct place, not old emacs buffer
mpageOct 14, 2024
4be2b1f
Remove test_tlbc.py
mpageOct 14, 2024
61c7aa9
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 17, 2024
ab6222c
Use int32_t instead of Py_ssize_t for tlbc indices
mpageOct 17, 2024
6bbb220
Use _PyCode_CODE instead of PyFrame_GetBytecode in super_init_without…
mpageOct 17, 2024
4580e3c
Update comment
mpageOct 17, 2024
b992f44
Consolidate _PyCode_{Quicken,DisableSpecialization} into _PyCode_Init…
mpageOct 17, 2024
4c040d3
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 18, 2024
5b7658c
Fix incorrect types
mpageOct 18, 2024
bec5bce
Add command-line tests for enabling TLBC
mpageOct 18, 2024
c9054b7
Update libpython.py for tlbc_index
mpageOct 18, 2024
1a48ab2
Avoid special casing in _PyEval_GetExecutableCode
mpageOct 19, 2024
b16ae5f
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 19, 2024
176b24e
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 23, 2024
c107495
Clear TLBC when other caches are cleared
mpageOct 23, 2024
07f9140
Remove _get_tlbc_blocks
mpageOct 24, 2024
4cbe237
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageOct 30, 2024
38ff315
Rename _PyCode_InitCounters back to _PyCode_Quicken
mpageOct 30, 2024
338f7e5
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageNov 4, 2024
bcd1bb2
Merge branch 'main' into gh-115999-thread-local-bytecode
mpageNov 4, 2024
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
PrevPrevious commit
NextNext commit
Refactor remove_line_tools
  • Loading branch information
@mpage
mpage committedSep 10, 2024
commit82b456a301e29f9daaf053694a0f1079f5962a5b
29 changes: 15 additions & 14 deletionsPython/instrumentation.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -650,17 +650,17 @@ de_instrument(_PyCoMonitoringData *monitoring, _Py_CODEUNIT *bytecode, int i, in
}

static void
de_instrument_line(PyCodeObject *code, int i)
de_instrument_line(_PyCoMonitoringData *monitoring, _Py_CODEUNIT *bytecode, int i)
{
_Py_CODEUNIT *instr = &_PyCode_CODE(code)[i];
_Py_CODEUNIT *instr = &bytecode[i];
int opcode = instr->op.code;
if (opcode != INSTRUMENTED_LINE) {
return;
}
_PyCoLineInstrumentationData *lines = &code->_co_monitoring->lines[i];
_PyCoLineInstrumentationData *lines = &monitoring->lines[i];
int original_opcode = lines->original_opcode;
if (original_opcode == INSTRUMENTED_INSTRUCTION) {
lines->original_opcode =code->_co_monitoring->per_instruction_opcodes[i];
lines->original_opcode =monitoring->per_instruction_opcodes[i];
}
CHECK(original_opcode != 0);
CHECK(original_opcode == _PyOpcode_Deopt[original_opcode]);
Expand DownExpand Up@@ -810,22 +810,23 @@ remove_line_tools(PyCodeObject * code, int offset, int tools)
{
ASSERT_WORLD_STOPPED_OR_LOCKED(code);

assert(code->_co_monitoring);
if (code->_co_monitoring->line_tools)
_PyCoMonitoringData *monitoring = code->_co_monitoring;
assert(monitoring);
bool should_deinstrument;
if (monitoring->line_tools)
{
uint8_t *toolsptr = &code->_co_monitoring->line_tools[offset];
uint8_t *toolsptr = &monitoring->line_tools[offset];
*toolsptr &= ~tools;
if (*toolsptr == 0 ) {
de_instrument_line(code, offset);
}
should_deinstrument = (*toolsptr == 0);
}
else {
/* Single tool */
uint8_t single_tool =code->_co_monitoring->active_monitors.tools[PY_MONITORING_EVENT_LINE];
uint8_t single_tool =monitoring->active_monitors.tools[PY_MONITORING_EVENT_LINE];
assert(_Py_popcount32(single_tool) <= 1);
if (((single_tool & tools) == single_tool)) {
de_instrument_line(code, offset);
}
should_deinstrument = ((single_tool & tools) == single_tool);
}
if (should_deinstrument) {
de_instrument_line(monitoring, _PyCode_CODE(code), offset);
}
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp