Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fad76c6
save
ShaharNaveh Jan 11, 2026
af70361
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 11, 2026
ea53cec
save
ShaharNaveh Jan 11, 2026
1ca20a9
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 12, 2026
6f09ebe
Base compiler-core
ShaharNaveh Jan 12, 2026
6805175
save
ShaharNaveh Jan 12, 2026
046e17a
Codegen compile
ShaharNaveh Jan 12, 2026
d627623
Move LoadCloure back to RealInstruction
ShaharNaveh Jan 12, 2026
697fe41
Fix opcode.rs
ShaharNaveh Jan 12, 2026
11fc63f
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 13, 2026
33b4554
Fix `TryFrom<u8>` for RealInstruction
ShaharNaveh Jan 13, 2026
6140186
Fix script
ShaharNaveh Jan 13, 2026
7acdc1a
Fix jit
ShaharNaveh Jan 13, 2026
0fad43f
Fix typo
ShaharNaveh Jan 13, 2026
24f5161
Fix typo
ShaharNaveh Jan 13, 2026
6e91410
Remove popblock
ShaharNaveh Jan 13, 2026
8751953
Fix docs
ShaharNaveh Jan 13, 2026
8b73441
Fix more docs
ShaharNaveh Jan 13, 2026
d6e46f8
ok word `argty`
ShaharNaveh Jan 13, 2026
0872cb6
Revert "ok word `argty`"
ShaharNaveh Jan 13, 2026
0c7880d
Rename argty -> arg_ty
ShaharNaveh Jan 13, 2026
1a5c72b
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 13, 2026
761fa4a
Simplify `emit` macro
ShaharNaveh Jan 13, 2026
4eed137
Trigger CI
ShaharNaveh Jan 13, 2026
8f777d2
Trigger CI
ShaharNaveh Jan 13, 2026
bff25eb
Trigger CI
ShaharNaveh Jan 13, 2026
91c01e6
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 14, 2026
f6a0b26
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 14, 2026
118ecf3
Move docs
ShaharNaveh Jan 14, 2026
c517585
Fix oparg docs
ShaharNaveh Jan 14, 2026
78958aa
Revert "Move docs"
ShaharNaveh Jan 14, 2026
a405cca
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 14, 2026
8ae98b2
Remove `Eq` & `ParitalEq` for RealInstruction
ShaharNaveh Jan 14, 2026
1453726
Simplify `match` arms
ShaharNaveh Jan 14, 2026
f207284
Trigger CI
ShaharNaveh Jan 14, 2026
a1555dc
Trigger CI
ShaharNaveh Jan 14, 2026
c443f8e
Remove `repr(u16)` for `Instruction`
ShaharNaveh Jan 14, 2026
453212e
Fix doc
ShaharNaveh Jan 14, 2026
1f8722a
Rename the enums
ShaharNaveh Jan 14, 2026
0096a65
Restore fmt_dis for LoadClousure
ShaharNaveh Jan 14, 2026
045d576
Fix script
ShaharNaveh Jan 14, 2026
b00f81f
Fix commet
ShaharNaveh Jan 14, 2026
4823d17
Merge remote-tracking branch 'upstream/main' into bytecode-pseudo-opc…
ShaharNaveh Jan 14, 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
Move LoadCloure back to RealInstruction
  • Loading branch information
ShaharNaveh committed Jan 12, 2026
commit d6276230a1691b7e2c0d80173eaaee3a2756024c
4 changes: 2 additions & 2 deletions crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3617,7 +3617,7 @@ impl Compiler {
}
};

emit!(self, PseudoInstruction::LoadClosure(idx.to_u32()));
emit!(self, RealInstruction::LoadClosure(idx.to_u32()));
}

// Build tuple of closure variables
Expand Down Expand Up @@ -3809,7 +3809,7 @@ impl Compiler {
.position(|var| *var == "__class__");

if let Some(classcell_idx) = classcell_idx {
emit!(self, PseudoInstruction::LoadClosure(classcell_idx.to_u32()));
emit!(self, RealInstruction::LoadClosure(classcell_idx.to_u32()));
emit!(self, RealInstruction::Copy { index: 1_u32 });
let classcell = self.name("__classcell__");
emit!(self, RealInstruction::StoreName(classcell));
Expand Down
7 changes: 5 additions & 2 deletions crates/compiler-core/src/bytecode/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ pub enum RealInstruction {
JumpIfNotExcMatch(Arg<Label>) = 131,
SetExcInfo = 134,
Subscript = 135,
LoadClosure(Arg<NameIdx>) = 253, // TODO: Move to pseudos
}
Comment on lines +282 to 284
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Comment typo / unfinished paren in “Pseudos … enum.”

Line 282 reads like it’s missing a closing ) and could be tightened since the enum name is already Instruction.

🤖 Prompt for AI Agents
In `@crates/compiler-core/src/bytecode/instruction.rs` around lines 282 - 284, The
comment above the LoadClosure variant has a typo/unfinished parenthesis; update
the comment to a clean, concise note (e.g., "Pseudos — should be moved to
PseudoInstruction enum.") and remove the stray parenthesis so it reads properly,
and keep the existing TODO about moving LoadClosure(Arg<NameIdx>) = 253 into the
PseudoInstruction enum.


const _: () = assert!(mem::size_of::<RealInstruction>() == 1);
Expand Down Expand Up @@ -578,6 +579,7 @@ impl InstructionMetadata for RealInstruction {
Self::StoreFastStoreFast { .. } => 0,
Self::PopJumpIfNone { .. } => 0,
Self::PopJumpIfNotNone { .. } => 0,
Self::LoadClosure(_) => 1,
}
}

Expand Down Expand Up @@ -771,6 +773,7 @@ impl InstructionMetadata for RealInstruction {
Self::UnaryNot => w!(UNARY_NOT),
Self::YieldValue { arg } => w!(YIELD_VALUE, arg),
Self::GetYieldFromIter => w!(GET_YIELD_FROM_ITER),
Self::LoadClosure(_) => w!(LOAD_CLOSURE),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
_ => w!(RUSTPYTHON_PLACEHOLDER),
}
}
Expand All @@ -785,7 +788,7 @@ pub enum PseudoInstruction {
JumpNoInterrupt {
target: Arg<Label>,
} = 257, // Placeholder
LoadClosure(Arg<NameIdx>) = 258,
Reserved258 = 258,
LoadAttrMethod {
idx: Arg<NameIdx>,
} = 259,
Expand Down Expand Up @@ -850,7 +853,6 @@ impl InstructionMetadata for PseudoInstruction {
match self {
Self::Jump { .. } => 0,
Self::JumpNoInterrupt { .. } => 0,
Self::LoadClosure(_) => 1,
Self::LoadAttrMethod { .. } => 1, // pop obj, push method + self_or_null
Self::LoadSuperMethod { .. } => -3 + 2, // pop 3, push [method, self_or_null]
Self::LoadZeroSuperAttr { .. } => -3 + 1, // pop 3, push [attr]
Expand All @@ -860,6 +862,7 @@ impl InstructionMetadata for PseudoInstruction {
Self::SetupFinally => 0,
Self::SetupWith => 0,
Self::StoreFastMaybeNull => 0,
Self::Reserved258 => 0,
}
}

Expand Down
Loading