Skip to content

Commit

Permalink
pulley: Fix trap opcode encoding (#9643)
Browse files Browse the repository at this point in the history
This was a copy/paste typo and needs updating.
  • Loading branch information
alexcrichton authored Nov 21, 2024
1 parent 642ee73 commit 5f1f914
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cranelift/codegen/src/isa/pulley_shared/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ where
type LabelUse = LabelUse;
type ABIMachineSpec = PulleyMachineDeps<P>;

const TRAP_OPCODE: &'static [u8] = &[0];
const TRAP_OPCODE: &'static [u8] = TRAP_OPCODE;

fn gen_dummy_use(_reg: Reg) -> Self {
todo!()
Expand Down Expand Up @@ -468,6 +468,19 @@ where
}
}

const TRAP_OPCODE: &'static [u8] = &[
pulley_interpreter::opcode::Opcode::ExtendedOp as u8,
((pulley_interpreter::opcode::ExtendedOpcode::Trap as u16) >> 0) as u8,
((pulley_interpreter::opcode::ExtendedOpcode::Trap as u16) >> 8) as u8,
];

#[test]
fn test_trap_encoding() {
let mut dst = std::vec::Vec::new();
pulley_interpreter::encode::trap(&mut dst);
assert_eq!(dst, TRAP_OPCODE);
}

//=============================================================================
// Pretty-printing of instructions.

Expand Down

0 comments on commit 5f1f914

Please sign in to comment.