Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fef345f
Base conf
ShaharNaveh May 5, 2026
09eb0b0
Basic layout
ShaharNaveh May 5, 2026
1ddf444
to from numeric
ShaharNaveh May 5, 2026
1e0c01b
generate has attr
ShaharNaveh May 5, 2026
c66eaf6
Basic instrumented
ShaharNaveh May 5, 2026
d1f0982
sort instrumeneted
ShaharNaveh May 5, 2026
5f07a17
deopt
ShaharNaveh May 5, 2026
bea434e
Cache entries
ShaharNaveh May 5, 2026
8768c9f
simplify
ShaharNaveh May 5, 2026
b9f1941
stack effect
ShaharNaveh May 5, 2026
566c0cf
Simplify conf structure
ShaharNaveh May 6, 2026
0b93378
Switch to numeric_repr
ShaharNaveh May 6, 2026
9ff0a7a
Add oparg conf
ShaharNaveh May 6, 2026
9c74715
`as_opcode()`
ShaharNaveh May 6, 2026
9e6382a
as_{opcode,instruction}
ShaharNaveh May 7, 2026
9f88f88
save progress
ShaharNaveh May 7, 2026
7669f0c
label_arg
ShaharNaveh May 7, 2026
e6d07b1
Compiler core compiles
ShaharNaveh May 7, 2026
99ba1db
More things to compile
ShaharNaveh May 7, 2026
9ce43ac
codegen compiles
ShaharNaveh May 7, 2026
d662a99
add must_use
ShaharNaveh May 7, 2026
0e35818
Overridable stack_effect
ShaharNaveh May 7, 2026
b58d736
fix stack_effect
ShaharNaveh May 7, 2026
74addfd
fix more in frame.rs
ShaharNaveh May 7, 2026
606a5aa
vm compiles
ShaharNaveh May 8, 2026
4ed7659
stdlib compile
ShaharNaveh May 8, 2026
0bc0d9b
_opcode `has_X` ignore deopt
ShaharNaveh May 8, 2026
a42b005
Align methods
ShaharNaveh May 8, 2026
09925bb
save
ShaharNaveh May 8, 2026
428ad29
fix `has_exc`
ShaharNaveh May 8, 2026
92e43e3
clippy
ShaharNaveh May 8, 2026
34268ce
Align script
ShaharNaveh May 8, 2026
9d909a3
clippy
ShaharNaveh May 8, 2026
f9358bf
Simplify code
ShaharNaveh May 9, 2026
d90b993
Fix compiles
ShaharNaveh May 9, 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
20 changes: 10 additions & 10 deletions crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5971,7 +5971,7 @@ impl Compiler {
if self.ctx.func != FunctionContext::AsyncFunction {
return Err(self.error(CodegenErrorType::InvalidAsyncFor));
}
emit!(self, Instruction::GetAIter);
emit!(self, Instruction::GetAiter);

self.switch_to_block(for_block);

Expand All @@ -5980,7 +5980,7 @@ impl Compiler {

// SETUP_FINALLY to guard the __anext__ call
emit!(self, PseudoInstruction::SetupFinally { delta: else_block });
emit!(self, Instruction::GetANext);
emit!(self, Instruction::GetAnext);
self.emit_load_const(ConstantData::None);
end_async_for_target = self.compile_yield_from_sequence(true)?;
// POP_BLOCK for SETUP_FINALLY - only GetANext/yield_from are protected
Expand Down Expand Up @@ -9445,7 +9445,7 @@ impl Compiler {

// Get iterator / turn item into an iterator
if generator.is_async {
emit!(self, Instruction::GetAIter);
emit!(self, Instruction::GetAiter);
} else {
emit!(self, Instruction::GetIter);
}
Expand All @@ -9455,7 +9455,7 @@ impl Compiler {
let mut end_async_for_target = BlockIdx::NULL;
if generator.is_async {
emit!(self, PseudoInstruction::SetupFinally { delta: after_block });
emit!(self, Instruction::GetANext);
emit!(self, Instruction::GetAnext);
self.push_fblock(
FBlockType::AsyncComprehensionGenerator,
loop_block,
Expand Down Expand Up @@ -9565,7 +9565,7 @@ impl Compiler {
// Get iterator / turn item into an iterator
// Use is_async from the first generator, not has_an_async_gen which covers ALL generators
if outermost.is_async {
emit!(self, Instruction::GetAIter);
emit!(self, Instruction::GetAiter);
} else {
emit!(self, Instruction::GetIter);
};
Expand Down Expand Up @@ -9646,7 +9646,7 @@ impl Compiler {
}
}
if has_async && generators[0].is_async {
emit!(self, Instruction::GetAIter);
emit!(self, Instruction::GetAiter);
} else {
emit!(self, Instruction::GetIter);
}
Expand Down Expand Up @@ -9822,7 +9822,7 @@ impl Compiler {
if i > 0 {
self.compile_for_iterable_expression(&generator.iter, generator.is_async)?;
if generator.is_async {
emit!(self, Instruction::GetAIter);
emit!(self, Instruction::GetAiter);
} else {
emit!(self, Instruction::GetIter);
}
Expand All @@ -9833,7 +9833,7 @@ impl Compiler {
let mut end_async_for_target = BlockIdx::NULL;
if generator.is_async {
emit!(self, PseudoInstruction::SetupFinally { delta: after_block });
emit!(self, Instruction::GetANext);
emit!(self, Instruction::GetAnext);
self.push_fblock(
FBlockType::AsyncComprehensionGenerator,
loop_block,
Expand Down Expand Up @@ -18406,7 +18406,7 @@ async def f(items):
"async dict comprehension should be inlined"
);
assert!(
ops.iter().any(|op| matches!(op, Instruction::GetAIter)),
ops.iter().any(|op| matches!(op, Instruction::GetAiter)),
"inlined async dict comprehension should keep GET_AITER in outer code, got ops={ops:?}"
);
assert!(
Expand Down Expand Up @@ -23486,7 +23486,7 @@ async def name_4():
let Some(get_aiter_pos) = name_4
.instructions
.iter()
.position(|unit| matches!(unit.op, Instruction::GetAIter))
.position(|unit| matches!(unit.op, Instruction::GetAiter))
else {
panic!("missing GET_AITER in name_4");
};
Expand Down
11 changes: 5 additions & 6 deletions crates/codegen/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ use rustpython_compiler_core::{
bytecode::{
AnyInstruction, AnyOpcode, Arg, CO_FAST_CELL, CO_FAST_FREE, CO_FAST_HIDDEN, CO_FAST_LOCAL,
CodeFlags, CodeObject, CodeUnit, CodeUnits, ConstantData, ExceptionTableEntry,
InstrDisplayContext, Instruction, InstructionMetadata, IntrinsicFunction1, Label, OpArg,
Opcode, PseudoInstruction, PseudoOpcode, PyCodeLocationInfoKind, encode_exception_table,
oparg,
InstrDisplayContext, Instruction, IntrinsicFunction1, Label, OpArg, Opcode,
PseudoInstruction, PseudoOpcode, PyCodeLocationInfoKind, encode_exception_table, oparg,
},
varint::{write_signed_varint, write_varint},
};
Expand Down Expand Up @@ -3227,7 +3226,7 @@ impl CodeInfo {
}
AnyInstruction::Real(
Instruction::FormatSimple
| Instruction::GetANext
| Instruction::GetAnext
| Instruction::GetLen
| Instruction::GetYieldFromIter
| Instruction::ImportFrom { .. }
Expand Down Expand Up @@ -6896,7 +6895,7 @@ impl CodeInfo {
block
.instructions
.iter()
.any(|info| matches!(info.instr.real(), Some(Instruction::GetANext)))
.any(|info| matches!(info.instr.real(), Some(Instruction::GetAnext)))
}

fn block_has_return(block: &Block) -> bool {
Expand Down Expand Up @@ -11624,7 +11623,7 @@ fn block_contains_suspension_point(block: &Block) -> bool {
instr,
Instruction::YieldValue { .. }
| Instruction::GetAwaitable { .. }
| Instruction::GetANext
| Instruction::GetAnext
| Instruction::EndAsyncFor
)
})
Expand Down
Loading
Loading