feat(python): decode CPython 3.14 and 3.15 pyc code objects

Decode marshal slice constants from magic 3608 onward and pin the 3.11 code
layout and inline-cache tables for the 3.14 and 3.15 magics.

Refs #8206
This commit is contained in:
Abhishek Sharma authored and Ysopwnable committed 2026-11-14 13:37:55 +01:00
1 parent 5451d3cb2d
commit 1d08253ff2
14 files changed
+471 -69

No files matched your search

+87
View File
@@ -40,6 +40,16 @@ const inlineCacheProfiles = (
* profile only where their source changes do not alter cache widths or IDs.
* Final 3.13 magic 3571 matches the opcode IDs and cache widths in CPython
* v3.13.17's Lib/_opcode_metadata.py and Lib/opcode.py.
* The 3.14 and 3.15 tables are pinned only to magics checked against real
* CPython: 3627 (final 3.14, matches v3.14.4) and 3663 (3.15.0a8) were read
* back from those builds; 3666 (final 3.15, matches v3.15.0) was checked with
* real 3.15.2 release bytes, not by running 3.15.2. Each is the generated
* _PyOpcode_Caches and opmap from CPython's Include/internal/pycore_magic_number.h
* history at the last cache-changing bump commit at or before it:
* 60202609a2c2d0971aadfa4729ba30b50e89c6ea (3623, shared by 3624 to 3627),
* 879c85f6e4ca8424ff6b4fddfbc946889572bf13 (3663) and
* 600f4dbd54bb35f56ecf1430134d2072b0520aa3 (3665, shared by 3666). Other 3.14
* and 3.15 pre-release magics have no table here and are not decoded.
*/
const INLINE_CACHE_ENTRIES_BY_MAGIC: ReadonlyMap<
number,
@@ -416,6 +426,83 @@ const INLINE_CACHE_ENTRIES_BY_MAGIC: ReadonlyMap<
[117, 1],
],
),
...inlineCacheProfiles(
[3627],
[
[38, 1],
[39, 3],
[44, 5],
[52, 3],
[55, 3],
[56, 1],
[57, 1],
[70, 1],
[75, 1],
[80, 9],
[92, 4],
[96, 1],
[100, 1],
[101, 1],
[102, 1],
[103, 1],
[106, 1],
[110, 4],
[119, 1],
],
),
...inlineCacheProfiles(
[3663],
[
[4, 1],
[36, 1],
[37, 3],
[42, 5],
[50, 3],
[53, 3],
[54, 1],
[55, 1],
[68, 1],
[74, 1],
[79, 9],
[91, 4],
[95, 1],
[99, 1],
[100, 1],
[101, 1],
[102, 1],
[105, 1],
[109, 4],
[118, 1],
[128, 1],
],
),
...inlineCacheProfiles(
[3666],
[
[4, 1],
[36, 1],
[37, 3],
[42, 5],
[50, 3],
[53, 3],
[54, 1],
[55, 1],
[68, 1],
[70, 1],
[74, 1],
[79, 9],
[91, 4],
[95, 1],
[99, 1],
[100, 1],
[101, 1],
[102, 1],
[105, 1],
[109, 4],
[118, 1],
[128, 1],
],
),
]);
/** Preserve CPython's bytecode-size check and omit only cache code units. */