Skip to content

Commit

Permalink
feat(tvm):reduce repeated pop opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Apr 12, 2024
1 parent 122cedb commit 3b8b46e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
5 changes: 0 additions & 5 deletions libcore/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ pub enum Opcode {
EqCharWithoutPop,
EqBoolWithoutPop,
PopData,
PopDataInt,
PopDataFloat,
PopDataStr,
PopDataChar,
PopDataBool,
}

impl Display for Opcode {
Expand Down
18 changes: 2 additions & 16 deletions src/tvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,22 +565,8 @@ impl<'a> Vm<'a> {
self.dynadata.dydata.push_data(first == second);
}
Opcode::PopData => {
self.dynadata.dydata.pop_data::<*mut dyn TrcObj>();
}
Opcode::PopDataInt => {
self.dynadata.dydata.pop_data::<TrcIntInternal>();
}
Opcode::PopDataFloat => {
self.dynadata.dydata.pop_data::<TrcFloatInternal>();
}
Opcode::PopDataStr => {
self.dynadata.dydata.pop_data::<TrcStrInternal>();
}
Opcode::PopDataChar => {
self.dynadata.dydata.pop_data::<TrcCharInternal>();
}
Opcode::PopDataBool => {
self.dynadata.dydata.pop_data::<bool>();
let bytes = self.static_data.inst[*pc].operand.0;
self.dynadata.dydata.pop_n_bytes_data(bytes);
}
Opcode::JumpIfTrue => {
let condit = impl_opcode!(bool, self, 1);
Expand Down

0 comments on commit 3b8b46e

Please sign in to comment.