Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
40cbc39
Emit TO_BOOL before conditional jumps, fix class/module prologue
youknowone Mar 20, 2026
f52276e
Emit MAKE_CELL and COPY_FREE_VARS before RESUME
youknowone Mar 20, 2026
7a9c29d
Emit __static_attributes__ at end of class bodies
youknowone Mar 20, 2026
f8f7fbf
Remove expectedFailure from DictProxyTests iter tests
youknowone Mar 20, 2026
e3fa83e
Use 1-based stack indexing for LIST_EXTEND, SET_UPDATE, etc.
youknowone Mar 20, 2026
18c23e5
Use plain LOAD_ATTR + PUSH_NULL for calls on imported names
youknowone Mar 20, 2026
b2995bc
Duplicate return-None epilogue for fall-through blocks
youknowone Mar 20, 2026
35ac45d
Run cargo fmt on ir.rs
youknowone Mar 20, 2026
1092110
Remove expectedFailure from test_intrinsic_1 in test_dis
youknowone Mar 20, 2026
cc23051
Emit TO_BOOL before conditional jumps for all expressions including C…
youknowone Mar 20, 2026
643861b
Add __classdict__ cell for classes with function definitions
youknowone Mar 21, 2026
a4753e8
Emit __classdictcell__ store in class body epilogue
youknowone Mar 21, 2026
50eaae4
Always run DCE to remove dead code after terminal instructions
youknowone Mar 21, 2026
fdcccad
Restrict LOAD_ATTR plain mode to module/class scope imports
youknowone Mar 21, 2026
83a548e
Eliminate unreachable blocks after jump normalization
youknowone Mar 21, 2026
6a592dd
Fold BUILD_TUPLE 0 into LOAD_CONST empty tuple
youknowone Mar 21, 2026
1d83df2
Handle __classcell__ and __classdictcell__ in type.__new__
youknowone Mar 21, 2026
e1bf8d1
Revert __classdict__ cell and __classdictcell__ changes
youknowone Mar 21, 2026
add881c
Fix unreachable block elimination with fixpoint reachability
youknowone Mar 21, 2026
3181725
Check enclosing scopes for IMPORTED flag in LOAD_ATTR mode
youknowone Mar 22, 2026
c345999
Add __classdict__ cell for classes with function definitions
youknowone Mar 22, 2026
11b4b18
Store __classdictcell__ in class body epilogue
youknowone Mar 22, 2026
0793cb2
Fix clippy collapsible_if warnings and cargo fmt
youknowone Mar 22, 2026
d29b2a9
Revert __classdict__ and __classdictcell__ changes (cause import fail…
youknowone Mar 22, 2026
d5afad9
Revert type.__new__ __classcell__ removal and __classdictcell__ handling
youknowone Mar 22, 2026
c921c8b
Re-add __classdict__ cell and __classdictcell__ store
youknowone Mar 22, 2026
60103dc
Reorder MakeFunctionFlag to match CPython's SET_FUNCTION_ATTRIBUTE
youknowone Mar 22, 2026
560d8ae
Use CPython-compatible power-of-two encoding for SET_FUNCTION_ATTRIBUTE
youknowone Mar 22, 2026
16ce7fb
Remove expectedFailure from test_elim_jump_after_return1 and test_no_…
youknowone Mar 22, 2026
9820993
Remove __classcell__ and __classdictcell__ from class dict in type.__…
youknowone Mar 22, 2026
35a8f7e
Remove expectedFailure from test___classcell___expected_behaviour, ca…
youknowone Mar 22, 2026
e0c7326
Handle MakeCell and CopyFreeVars as no-ops in JIT
youknowone Mar 22, 2026
c958739
Remove expectedFailure from test_load_fast_known_simple
youknowone Mar 23, 2026
926a984
Restore expectedFailure for test_load_fast_known_simple
youknowone Mar 23, 2026
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
Prev Previous commit
Next Next commit
Emit MAKE_CELL and COPY_FREE_VARS before RESUME
Emit MAKE_CELL for each cell variable and COPY_FREE_VARS N for
free variables at the start of each code object, before RESUME.
These instructions are no-ops in the VM but align the bytecode
with CPython 3.14's output.
  • Loading branch information
youknowone committed Mar 22, 2026
commit f52276ec7902aa9b501a254ceae9feec08f2e7a8
16 changes: 10 additions & 6 deletions crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,16 @@ impl Compiler {
self.set_qualname();
}

// Emit COPY_FREE_VARS and MAKE_CELL prolog before RESUME
// Emit MAKE_CELL for each cell variable (before RESUME)
{
let ncells = self.code_stack.last().unwrap().metadata.cellvars.len();
for i in 0..ncells {
let i_varnum: oparg::VarNum = u32::try_from(i).expect("too many cellvars").into();
emit!(self, Instruction::MakeCell { i: i_varnum });
}
}

// Emit COPY_FREE_VARS if there are free variables (before RESUME)
{
let nfrees = self.code_stack.last().unwrap().metadata.freevars.len();
if nfrees > 0 {
Expand All @@ -1162,11 +1171,6 @@ impl Compiler {
}
);
}
let ncells = self.code_stack.last().unwrap().metadata.cellvars.len();
for i in 0..ncells {
let i_varnum: oparg::VarNum = u32::try_from(i).expect("too many cellvars").into();
emit!(self, Instruction::MakeCell { i: i_varnum });
}
}

// Emit RESUME (handles async preamble and module lineno 0)
Expand Down