Skip to content

Preserve immutable bytecode provenance when cloning code - #9450

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:split/9439-provenance-20261029
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:split/9439-provenance-20261029

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Keep immutable construction provenance separate from mutable execution/cache storage. Clone fresh execution units, export source-backed co_code, and make external/frozen/marshal decoding reject wrappers with unavailable original operation metadata.

This is a functionality-based extraction from #9439, based on main 84d7afc2d59e05c66c92df3ce0854679d2b32b52. The original aggregate is being narrowed to monitoring. The extracted implementation is preserved exactly, except for the explicit provenance/monitoring hunk boundary described below where relevant.

This PR is independent of the dict, CSV, mmap and syslog extractions. #9439’s interpreter-local monitoring implementation depends on it; until this lands, #9439 retains explicit overlapping provenance source. Native lifetime identity, virtual event metadata/dispatch and the successful-yield correction stay in #9439.

Validation and limits

Seven finite compiler-core structural fixtures belong to this unit. This external-wrapper behavior is an intentional narrow compatibility limit, not a claim of full CPython constructor or malformed-bytecode parity. Existing shared monitoring remains supported until the dependent dispatch PR lands.

Fresh standalone check and strict Clippy (-D warnings) passed for compiler-core tests and rustpython-vm --lib --no-default-features --features compiler,threading,host_env,stdio,doc,importlib on the 84d7 base. A freshly built compiler-core test executable from this worktree passed exactly seven existing structural fixtures, one at a time. Source and protected executable hashes were verified; dependencies were locked/offline. No Python concurrency, profiling or crash tests were run locally. Exact-head hosted CI: pending. Old aggregate green checks are historical, not standalone validation of this extraction.

Extract the independent code-source, clone, co_code and fallible decoding foundation from RustPython#9439. Interpreter-local monitoring dispatch remains in the dependent original PR.

Assisted-by: OpenAI Codex: model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:split/9439-provenance-20261029 (eaa75b1) with main (84d7afc)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

pub struct CodeUnits {
// Construction provenance, never updated by runtime specialization. Keep
// original opcode identity: GET_ITER fixup does not apply to its specialized forms.
source: Box<[CodeUnit]>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? disagree to this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants