FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

LoadClassDeref -> LoadFromDictOrDeref by ShaharNaveh · Pull Request #6692 · RustPython/RustPython · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rs  (4) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 0 additions & 1 deletion Lib/_opcode_metadata.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
'JUMP_IF_FALSE_OR_POP': 129,
'JUMP_IF_TRUE_OR_POP': 130,
'JUMP_IF_NOT_EXC_MATCH': 131,
'LOAD_CLASS_DEREF': 132,
'SET_EXC_INFO': 134,
'SUBSCRIPT': 135,
'RESUME': 149,
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/src/compile.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ impl Compiler {
NameUsage::Load => {
// Special case for class scope
if self.ctx.in_class && !self.ctx.in_func() {
Instruction::LoadClassDeref
Instruction::LoadFromDictOrDeref
} else {
Instruction::LoadDeref
}
Expand Down
38 changes: 31 additions & 7 deletions crates/compiler-core/src/bytecode.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ pub enum Instruction {
LoadFastLoadFast {
arg: Arg<u32>,
} = 88, // Placeholder
LoadFromDictOrDeref(Arg<NameIdx>) = 89, // Placeholder
LoadFromDictOrDeref(Arg<NameIdx>) = 89,
LoadFromDictOrGlobals(Arg<NameIdx>) = 90, // Placeholder
LoadGlobal(Arg<NameIdx>) = 91,
LoadName(Arg<NameIdx>) = 92,
Expand Down Expand Up @@ -945,7 +945,6 @@ pub enum Instruction {
target: Arg<Label>,
} = 130,
JumpIfNotExcMatch(Arg<Label>) = 131,
LoadClassDeref(Arg<NameIdx>) = 132,
SetExcInfo = 134,
Subscript = 135,
// ===== Pseudo Opcodes (252+) ======
Expand Down Expand Up @@ -1010,7 +1009,6 @@ impl TryFrom<u8> for Instruction {
target: Arg::marker(),
}),
u8::from(Self::JumpIfNotExcMatch(Arg::marker())),
u8::from(Self::LoadClassDeref(Arg::marker())),
u8::from(Self::SetExcInfo),
u8::from(Self::Subscript),
];
Expand Down Expand Up @@ -1805,14 +1803,14 @@ impl Instruction {
Nop => 0,
ImportName { .. } => -1,
ImportFrom { .. } => 1,
LoadFast(_) | LoadFastAndClear(_) | LoadName(_) | LoadGlobal(_) | LoadDeref(_)
| LoadClassDeref(_) => 1,
LoadFast(_) | LoadFastAndClear(_) | LoadName(_) | LoadGlobal(_) | LoadDeref(_) => 1,
StoreFast(_) | StoreName(_) | StoreGlobal(_) | StoreDeref(_) => -1,
StoreFastLoadFast { .. } => 0, // pop 1, push 1
DeleteFast(_) | DeleteName(_) | DeleteGlobal(_) | DeleteDeref(_) => 0,
LoadClosure(_) => 1,
Subscript => -1,
StoreSubscr => -3,
LoadFromDictOrDeref(_) => 1,
DeleteSubscr => -2,
LoadAttr { .. } => 0,
// LoadAttrMethod: pop obj, push method + self_or_null
Expand Down Expand Up @@ -1950,7 +1948,33 @@ impl Instruction {
UnaryNot => 0,
GetYieldFromIter => 0,
PushNull => 1, // Push NULL for call protocol
_ => 0,
Cache => 0,
BinarySlice => 0,
BinaryOpInplaceAddUnicode => 0,
EndFor => 0,
ExitInitCheck => 0,
InterpreterExit => 0,
LoadAssertionError => 0,
LoadLocals => 0,
ReturnGenerator => 0,
StoreSlice => 0,
DictMerge { .. } => 0,
BuildConstKeyMap { .. } => 0,
CopyFreeVars { .. } => 0,
EnterExecutor => 0,
JumpBackwardNoInterrupt { .. } => 0,
JumpBackward { .. } => 0,
JumpForward { .. } => 0,
ListExtend { .. } => 0,
LoadFastCheck(_) => 0,
LoadFastLoadFast { .. } => 0,
LoadFromDictOrGlobals(_) => 0,
SetUpdate { .. } => 0,
MakeCell(_) => 0,
LoadSuperAttr { .. } => 0,
StoreFastStoreFast { .. } => 0,
PopJumpIfNone { .. } => 0,
PopJumpIfNotNone { .. } => 0,
}
}

Expand Down Expand Up @@ -2096,7 +2120,7 @@ impl Instruction {
}
LoadAttrMethod { idx } => w!(LOAD_ATTR_METHOD, name = idx),
LoadBuildClass => w!(LOAD_BUILD_CLASS),
LoadClassDeref(idx) => w!(LOAD_CLASSDEREF, cell_name = idx),
LoadFromDictOrDeref(i) => w!(LOAD_FROM_DICT_OR_DEREF, cell_name = i),
LoadClosure(i) => w!(LOAD_CLOSURE, cell_name = i),
LoadConst { idx } => fmt_const("LOAD_CONST", arg, f, idx),
LoadDeref(idx) => w!(LOAD_DEREF, cell_name = idx),
Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/opcode.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod opcode {
&& matches!(
Instruction::try_from(opcode as u8),
Ok(Instruction::DeleteDeref(_)
| Instruction::LoadClassDeref(_)
| Instruction::LoadFromDictOrDeref(_)
| Instruction::LoadClosure(_)
| Instruction::LoadDeref(_)
| Instruction::StoreDeref(_))
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/frame.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ impl ExecutingFrame<'_> {
self.push_value(vm.builtins.get_attr(identifier!(vm, __build_class__), vm)?);
Ok(None)
}
bytecode::Instruction::LoadClassDeref(i) => {
bytecode::Instruction::LoadFromDictOrDeref(i) => {
let i = i.get(arg) as usize;
let name = if i < self.code.cellvars.len() {
self.code.cellvars[i]
Expand Down
Loading

Back | FazBrowse Home | New Git URL