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

Commit3893a92

Browse files
authored
gh-100239: specialize long tail of binary operations (#128722)
1 parente81fe94 commit3893a92

21 files changed

+796
-492
lines changed

‎Include/internal/pycore_code.h‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ typedef struct {
100100

101101
typedefstruct {
102102
_Py_BackoffCountercounter;
103+
uint16_texternal_cache[4];
103104
}_PyBinaryOpCache;
104105

105106
#defineINLINE_CACHE_ENTRIES_BINARY_OP CACHE_ENTRIES(_PyBinaryOpCache)
@@ -438,7 +439,7 @@ write_u64(uint16_t *p, uint64_t val)
438439
}
439440

440441
staticinlinevoid
441-
write_obj(uint16_t*p,PyObject*val)
442+
write_ptr(uint16_t*p,void*val)
442443
{
443444
memcpy(p,&val,sizeof(val));
444445
}
@@ -576,6 +577,16 @@ adaptive_counter_backoff(_Py_BackoffCounter counter) {
576577
returnrestart_backoff_counter(counter);
577578
}
578579

580+
/* Specialization Extensions */
581+
582+
/* callbacks for an external specialization */
583+
typedefint (*binaryopguardfunc)(PyObject*lhs,PyObject*rhs);
584+
typedefPyObject*(*binaryopactionfunc)(PyObject*lhs,PyObject*rhs);
585+
586+
typedefstruct {
587+
binaryopguardfuncguard;
588+
binaryopactionfuncaction;
589+
}_PyBinaryOpSpecializationDescr;
579590

580591
/* Comparison bit masks. */
581592

‎Include/internal/pycore_magic_number.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ Known values:
266266
Python 3.14a4 3611 (Add NOT_TAKEN instruction)
267267
Python 3.14a4 3612 (Add POP_ITER and INSTRUMENTED_POP_ITER)
268268
Python 3.14a4 3613 (Add LOAD_CONST_MORTAL instruction)
269+
Python 3.14a5 3614 (Add BINARY_OP_EXTEND)
269270
270271
Python 3.15 will start with 3650
271272
@@ -278,7 +279,7 @@ PC/launcher.c must also be updated.
278279
279280
*/
280281

281-
#definePYC_MAGIC_NUMBER3613
282+
#definePYC_MAGIC_NUMBER3614
282283
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
283284
(little-endian) and then appending b'\r\n'. */
284285
#definePYC_MAGIC_NUMBER_TOKEN \

‎Include/internal/pycore_opcode_metadata.h‎

Lines changed: 29 additions & 16 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp