Skip to content

Commit 3d5295d

Browse files
committed
revert #[repr(...)] changes
1 parent ab5cfda commit 3d5295d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/compiler-core/src/bytecode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ use rustpython_wtf8::{Wtf8, Wtf8Buf};
2121

2222
pub use crate::bytecode::{
2323
instruction::{
24-
AnyInstruction, Arg, Instruction, InstructionMetadata, PseudoInstruction, StackEffect,
24+
AnyInstruction, Arg, Instruction, InstructionMetadata, Opcode, PseudoInstruction,
25+
PseudoOpcode, StackEffect,
2526
},
2627
oparg::{
2728
BinaryOperator, BuildSliceArgCount, CommonConstant, ComparisonOperator, ConvertValueOparg,

crates/compiler-core/src/bytecode/instruction.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ macro_rules! define_opcodes {
8080
}
8181

8282
#[derive(Clone, Copy, Debug)]
83+
#[repr($typ)]
8384
pub enum $instr_name {
8485
$(
85-
$op_name $({ $arg_name: Arg<$arg_type> })?
86+
$op_name $({ $arg_name: Arg<$arg_type> })? = $op_id
8687
),*
8788
}
8889

@@ -1626,3 +1627,8 @@ impl<T: OpArgType> fmt::Debug for Arg<T> {
16261627
write!(f, "Arg<{}>", core::any::type_name::<T>())
16271628
}
16281629
}
1630+
1631+
// TODO: Can probably remove these asserts and remove the `repr($typ)` from the macro. but this
1632+
// breaks the VM:/
1633+
const _: () = assert!(core::mem::size_of::<Instruction>() == 1);
1634+
const _: () = assert!(core::mem::size_of::<PseudoInstruction>() == 2);

0 commit comments

Comments
 (0)