#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OpFormat {
None,
NoneInt,
NoneLoc,
NoneArg,
NoneVarRef,
U8,
I8,
Loc8,
Const8,
Label8,
U16,
I16,
Label16,
Npop,
Npopx,
NpopU16,
Loc,
Arg,
VarRef,
U32,
I32,
Const,
Label,
Atom,
AtomU8,
AtomU16,
AtomLabelU8,
AtomLabelU16,
LabelU16,
}
impl OpFormat {
pub fn as_str(self) -> &'static str {
match self {
OpFormat::None => "none",
OpFormat::NoneInt => "none_int",
OpFormat::NoneLoc => "none_loc",
OpFormat::NoneArg => "none_arg",
OpFormat::NoneVarRef => "none_var_ref",
OpFormat::U8 => "u8",
OpFormat::I8 => "i8",
OpFormat::Loc8 => "loc8",
OpFormat::Const8 => "const8",
OpFormat::Label8 => "label8",
OpFormat::U16 => "u16",
OpFormat::I16 => "i16",
OpFormat::Label16 => "label16",
OpFormat::Npop => "npop",
OpFormat::Npopx => "npopx",
OpFormat::NpopU16 => "npop_u16",
OpFormat::Loc => "loc",
OpFormat::Arg => "arg",
OpFormat::VarRef => "var_ref",
OpFormat::U32 => "u32",
OpFormat::I32 => "i32",
OpFormat::Const => "const",
OpFormat::Label => "label",
OpFormat::Atom => "atom",
OpFormat::AtomU8 => "atom_u8",
OpFormat::AtomU16 => "atom_u16",
OpFormat::AtomLabelU8 => "atom_label_u8",
OpFormat::AtomLabelU16 => "atom_label_u16",
OpFormat::LabelU16 => "label_u16",
}
}
pub fn is_label(self) -> bool {
matches!(
self,
OpFormat::Label
| OpFormat::Label8
| OpFormat::Label16
| OpFormat::AtomLabelU8
| OpFormat::AtomLabelU16
| OpFormat::LabelU16
)
}
}
#[derive(Debug, Clone, Copy)]
pub struct OpInfo {
pub name: &'static str,
pub size: u8,
pub n_pop: u8,
pub n_push: u8,
pub format: OpFormat,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum Opcode {
Invalid = 0,
PushI32 = 1,
PushConst = 2,
Fclosure = 3,
PushAtomValue = 4,
PrivateSymbol = 5,
Undefined = 6,
Null = 7,
PushThis = 8,
PushFalse = 9,
PushTrue = 10,
Object = 11,
SpecialObject = 12,
Rest = 13,
Drop = 14,
Nip = 15,
Nip1 = 16,
Dup = 17,
Dup1 = 18,
Dup2 = 19,
Dup3 = 20,
Insert2 = 21,
Insert3 = 22,
Insert4 = 23,
Perm3 = 24,
Perm4 = 25,
Perm5 = 26,
Swap = 27,
Swap2 = 28,
Rot3l = 29,
Rot3r = 30,
Rot4l = 31,
Rot5l = 32,
CallConstructor = 33,
Call = 34,
TailCall = 35,
CallMethod = 36,
TailCallMethod = 37,
ArrayFrom = 38,
Apply = 39,
Return = 40,
ReturnUndef = 41,
CheckCtorReturn = 42,
CheckCtor = 43,
InitCtor = 44,
CheckBrand = 45,
AddBrand = 46,
ReturnAsync = 47,
Throw = 48,
ThrowError = 49,
Eval = 50,
ApplyEval = 51,
Regexp = 52,
GetSuper = 53,
Import = 54,
GetVarUndef = 55,
GetVar = 56,
PutVar = 57,
PutVarInit = 58,
GetRefValue = 59,
PutRefValue = 60,
GetField = 61,
GetField2 = 62,
PutField = 63,
GetPrivateField = 64,
PutPrivateField = 65,
DefinePrivateField = 66,
GetArrayEl = 67,
GetArrayEl2 = 68,
GetArrayEl3 = 69,
PutArrayEl = 70,
GetSuperValue = 71,
PutSuperValue = 72,
DefineField = 73,
SetName = 74,
SetNameComputed = 75,
SetProto = 76,
SetHomeObject = 77,
DefineArrayEl = 78,
Append = 79,
CopyDataProperties = 80,
DefineMethod = 81,
DefineMethodComputed = 82,
DefineClass = 83,
DefineClassComputed = 84,
GetLoc = 85,
PutLoc = 86,
SetLoc = 87,
GetArg = 88,
PutArg = 89,
SetArg = 90,
GetVarRef = 91,
PutVarRef = 92,
SetVarRef = 93,
SetLocUninitialized = 94,
GetLocCheck = 95,
PutLocCheck = 96,
SetLocCheck = 97,
PutLocCheckInit = 98,
GetLocCheckthis = 99,
GetVarRefCheck = 100,
PutVarRefCheck = 101,
PutVarRefCheckInit = 102,
CloseLoc = 103,
IfFalse = 104,
IfTrue = 105,
Goto = 106,
Catch = 107,
Gosub = 108,
Ret = 109,
NipCatch = 110,
ToObject = 111,
ToPropkey = 112,
WithGetVar = 113,
WithPutVar = 114,
WithDeleteVar = 115,
WithMakeRef = 116,
WithGetRef = 117,
MakeLocRef = 118,
MakeArgRef = 119,
MakeVarRefRef = 120,
MakeVarRef = 121,
ForInStart = 122,
ForOfStart = 123,
ForAwaitOfStart = 124,
ForInNext = 125,
ForOfNext = 126,
ForAwaitOfNext = 127,
IteratorCheckObject = 128,
IteratorGetValueDone = 129,
IteratorClose = 130,
IteratorNext = 131,
IteratorCall = 132,
InitialYield = 133,
Yield = 134,
YieldStar = 135,
AsyncYieldStar = 136,
Await = 137,
Neg = 138,
Plus = 139,
Dec = 140,
Inc = 141,
PostDec = 142,
PostInc = 143,
DecLoc = 144,
IncLoc = 145,
AddLoc = 146,
Not = 147,
Lnot = 148,
Typeof = 149,
Delete = 150,
DeleteVar = 151,
Mul = 152,
Div = 153,
Mod = 154,
Add = 155,
Sub = 156,
Pow = 157,
Shl = 158,
Sar = 159,
Shr = 160,
Lt = 161,
Lte = 162,
Gt = 163,
Gte = 164,
Instanceof = 165,
In = 166,
Eq = 167,
Neq = 168,
StrictEq = 169,
StrictNeq = 170,
And = 171,
Xor = 172,
Or = 173,
IsUndefinedOrNull = 174,
PrivateIn = 175,
PushBigintI32 = 176,
UsingDisposeInit = 177,
UsingDispose = 178,
UsingDisposeAsync = 179,
UsingDisposeMerge = 180,
UsingDisposeEnd = 181,
UsingCheck = 182,
Nop = 183,
PushMinus1 = 184,
Push0 = 185,
Push1 = 186,
Push2 = 187,
Push3 = 188,
Push4 = 189,
Push5 = 190,
Push6 = 191,
Push7 = 192,
PushI8 = 193,
PushI16 = 194,
PushConst8 = 195,
Fclosure8 = 196,
PushEmptyString = 197,
GetLoc8 = 198,
PutLoc8 = 199,
SetLoc8 = 200,
GetLoc0 = 201,
GetLoc1 = 202,
GetLoc2 = 203,
GetLoc3 = 204,
PutLoc0 = 205,
PutLoc1 = 206,
PutLoc2 = 207,
PutLoc3 = 208,
SetLoc0 = 209,
SetLoc1 = 210,
SetLoc2 = 211,
SetLoc3 = 212,
GetArg0 = 213,
GetArg1 = 214,
GetArg2 = 215,
GetArg3 = 216,
PutArg0 = 217,
PutArg1 = 218,
PutArg2 = 219,
PutArg3 = 220,
SetArg0 = 221,
SetArg1 = 222,
SetArg2 = 223,
SetArg3 = 224,
GetVarRef0 = 225,
GetVarRef1 = 226,
GetVarRef2 = 227,
GetVarRef3 = 228,
PutVarRef0 = 229,
PutVarRef1 = 230,
PutVarRef2 = 231,
PutVarRef3 = 232,
SetVarRef0 = 233,
SetVarRef1 = 234,
SetVarRef2 = 235,
SetVarRef3 = 236,
GetLength = 237,
IfFalse8 = 238,
IfTrue8 = 239,
Goto8 = 240,
Goto16 = 241,
Call0 = 242,
Call1 = 243,
Call2 = 244,
Call3 = 245,
IsUndefined = 246,
IsNull = 247,
TypeofIsUndefined = 248,
TypeofIsFunction = 249,
}
pub const OP_COUNT: u8 = 250;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum TempOpcode {
EnterScope = 1,
LeaveScope = 2,
Label = 3,
ScopeGetVarUndef = 4,
ScopeGetVar = 5,
ScopePutVar = 6,
ScopeDeleteVar = 7,
ScopeMakeRef = 8,
ScopeGetRef = 9,
ScopePutVarInit = 10,
ScopeGetVarCheckthis = 11,
ScopeGetPrivateField = 12,
ScopeGetPrivateField2 = 13,
ScopePutPrivateField = 14,
ScopeInPrivateField = 15,
GetFieldOptChain = 16,
GetArrayElOptChain = 17,
SetClassName = 18,
LineNum = 19,
}
impl Opcode {
pub fn info(self) -> OpInfo {
OP_INFO[self as usize]
}
pub fn name(self) -> &'static str {
self.info().name
}
pub fn size(self) -> u8 {
self.info().size
}
pub fn from_u8(byte: u8) -> Option<Opcode> {
OP_BY_BYTE.get(byte as usize).copied().flatten()
}
pub fn by_name(name: &str) -> Option<Opcode> {
OP_INFO
.iter()
.position(|info| info.name == name)
.map(|index| OP_ALL[index])
}
}
impl TempOpcode {
pub fn info(self) -> OpInfo {
TEMP_INFO[self as usize - TEMP_START]
}
pub fn name(self) -> &'static str {
self.info().name
}
}
const TEMP_START: usize = 1;
impl Opcode {
pub fn specialised_index(self) -> Option<i32> {
use Opcode::*;
let byte = self as u32;
let base = |op: Opcode| op as u32;
if (base(PushMinus1)..=base(Push7)).contains(&byte) {
return Some(byte as i32 - base(Push0) as i32);
}
if (base(GetLoc0)..=base(SetLoc3)).contains(&byte) {
return Some(((byte - base(GetLoc0)) % 4) as i32);
}
if (base(GetArg0)..=base(SetArg3)).contains(&byte) {
return Some(((byte - base(GetArg0)) % 4) as i32);
}
if (base(GetVarRef0)..=base(SetVarRef3)).contains(&byte) {
return Some(((byte - base(GetVarRef0)) % 4) as i32);
}
if (base(Call0)..=base(Call3)).contains(&byte) {
return Some((byte - base(Call0)) as i32);
}
None
}
pub fn short_form(self, index: u32) -> Option<Opcode> {
use Opcode::*;
let base = match self {
PushI32 => Push0,
GetLoc => GetLoc0,
PutLoc => PutLoc0,
SetLoc => SetLoc0,
GetArg => GetArg0,
PutArg => PutArg0,
SetArg => SetArg0,
GetVarRef => GetVarRef0,
PutVarRef => PutVarRef0,
SetVarRef => SetVarRef0,
Call => Call0,
_ => return None,
};
if self == PushI32 {
if index == u32::MAX {
return Some(PushMinus1);
}
return if index <= 7 {
Opcode::from_u8(u8::try_from(Push0 as u32 + index).ok()?)
} else {
None
};
}
if index > 3 {
return None;
}
u8::try_from(base as u32 + index)
.ok()
.and_then(Opcode::from_u8)
}
}
static OP_ALL: [Opcode; 250] = [
Opcode::Invalid,
Opcode::PushI32,
Opcode::PushConst,
Opcode::Fclosure,
Opcode::PushAtomValue,
Opcode::PrivateSymbol,
Opcode::Undefined,
Opcode::Null,
Opcode::PushThis,
Opcode::PushFalse,
Opcode::PushTrue,
Opcode::Object,
Opcode::SpecialObject,
Opcode::Rest,
Opcode::Drop,
Opcode::Nip,
Opcode::Nip1,
Opcode::Dup,
Opcode::Dup1,
Opcode::Dup2,
Opcode::Dup3,
Opcode::Insert2,
Opcode::Insert3,
Opcode::Insert4,
Opcode::Perm3,
Opcode::Perm4,
Opcode::Perm5,
Opcode::Swap,
Opcode::Swap2,
Opcode::Rot3l,
Opcode::Rot3r,
Opcode::Rot4l,
Opcode::Rot5l,
Opcode::CallConstructor,
Opcode::Call,
Opcode::TailCall,
Opcode::CallMethod,
Opcode::TailCallMethod,
Opcode::ArrayFrom,
Opcode::Apply,
Opcode::Return,
Opcode::ReturnUndef,
Opcode::CheckCtorReturn,
Opcode::CheckCtor,
Opcode::InitCtor,
Opcode::CheckBrand,
Opcode::AddBrand,
Opcode::ReturnAsync,
Opcode::Throw,
Opcode::ThrowError,
Opcode::Eval,
Opcode::ApplyEval,
Opcode::Regexp,
Opcode::GetSuper,
Opcode::Import,
Opcode::GetVarUndef,
Opcode::GetVar,
Opcode::PutVar,
Opcode::PutVarInit,
Opcode::GetRefValue,
Opcode::PutRefValue,
Opcode::GetField,
Opcode::GetField2,
Opcode::PutField,
Opcode::GetPrivateField,
Opcode::PutPrivateField,
Opcode::DefinePrivateField,
Opcode::GetArrayEl,
Opcode::GetArrayEl2,
Opcode::GetArrayEl3,
Opcode::PutArrayEl,
Opcode::GetSuperValue,
Opcode::PutSuperValue,
Opcode::DefineField,
Opcode::SetName,
Opcode::SetNameComputed,
Opcode::SetProto,
Opcode::SetHomeObject,
Opcode::DefineArrayEl,
Opcode::Append,
Opcode::CopyDataProperties,
Opcode::DefineMethod,
Opcode::DefineMethodComputed,
Opcode::DefineClass,
Opcode::DefineClassComputed,
Opcode::GetLoc,
Opcode::PutLoc,
Opcode::SetLoc,
Opcode::GetArg,
Opcode::PutArg,
Opcode::SetArg,
Opcode::GetVarRef,
Opcode::PutVarRef,
Opcode::SetVarRef,
Opcode::SetLocUninitialized,
Opcode::GetLocCheck,
Opcode::PutLocCheck,
Opcode::SetLocCheck,
Opcode::PutLocCheckInit,
Opcode::GetLocCheckthis,
Opcode::GetVarRefCheck,
Opcode::PutVarRefCheck,
Opcode::PutVarRefCheckInit,
Opcode::CloseLoc,
Opcode::IfFalse,
Opcode::IfTrue,
Opcode::Goto,
Opcode::Catch,
Opcode::Gosub,
Opcode::Ret,
Opcode::NipCatch,
Opcode::ToObject,
Opcode::ToPropkey,
Opcode::WithGetVar,
Opcode::WithPutVar,
Opcode::WithDeleteVar,
Opcode::WithMakeRef,
Opcode::WithGetRef,
Opcode::MakeLocRef,
Opcode::MakeArgRef,
Opcode::MakeVarRefRef,
Opcode::MakeVarRef,
Opcode::ForInStart,
Opcode::ForOfStart,
Opcode::ForAwaitOfStart,
Opcode::ForInNext,
Opcode::ForOfNext,
Opcode::ForAwaitOfNext,
Opcode::IteratorCheckObject,
Opcode::IteratorGetValueDone,
Opcode::IteratorClose,
Opcode::IteratorNext,
Opcode::IteratorCall,
Opcode::InitialYield,
Opcode::Yield,
Opcode::YieldStar,
Opcode::AsyncYieldStar,
Opcode::Await,
Opcode::Neg,
Opcode::Plus,
Opcode::Dec,
Opcode::Inc,
Opcode::PostDec,
Opcode::PostInc,
Opcode::DecLoc,
Opcode::IncLoc,
Opcode::AddLoc,
Opcode::Not,
Opcode::Lnot,
Opcode::Typeof,
Opcode::Delete,
Opcode::DeleteVar,
Opcode::Mul,
Opcode::Div,
Opcode::Mod,
Opcode::Add,
Opcode::Sub,
Opcode::Pow,
Opcode::Shl,
Opcode::Sar,
Opcode::Shr,
Opcode::Lt,
Opcode::Lte,
Opcode::Gt,
Opcode::Gte,
Opcode::Instanceof,
Opcode::In,
Opcode::Eq,
Opcode::Neq,
Opcode::StrictEq,
Opcode::StrictNeq,
Opcode::And,
Opcode::Xor,
Opcode::Or,
Opcode::IsUndefinedOrNull,
Opcode::PrivateIn,
Opcode::PushBigintI32,
Opcode::UsingDisposeInit,
Opcode::UsingDispose,
Opcode::UsingDisposeAsync,
Opcode::UsingDisposeMerge,
Opcode::UsingDisposeEnd,
Opcode::UsingCheck,
Opcode::Nop,
Opcode::PushMinus1,
Opcode::Push0,
Opcode::Push1,
Opcode::Push2,
Opcode::Push3,
Opcode::Push4,
Opcode::Push5,
Opcode::Push6,
Opcode::Push7,
Opcode::PushI8,
Opcode::PushI16,
Opcode::PushConst8,
Opcode::Fclosure8,
Opcode::PushEmptyString,
Opcode::GetLoc8,
Opcode::PutLoc8,
Opcode::SetLoc8,
Opcode::GetLoc0,
Opcode::GetLoc1,
Opcode::GetLoc2,
Opcode::GetLoc3,
Opcode::PutLoc0,
Opcode::PutLoc1,
Opcode::PutLoc2,
Opcode::PutLoc3,
Opcode::SetLoc0,
Opcode::SetLoc1,
Opcode::SetLoc2,
Opcode::SetLoc3,
Opcode::GetArg0,
Opcode::GetArg1,
Opcode::GetArg2,
Opcode::GetArg3,
Opcode::PutArg0,
Opcode::PutArg1,
Opcode::PutArg2,
Opcode::PutArg3,
Opcode::SetArg0,
Opcode::SetArg1,
Opcode::SetArg2,
Opcode::SetArg3,
Opcode::GetVarRef0,
Opcode::GetVarRef1,
Opcode::GetVarRef2,
Opcode::GetVarRef3,
Opcode::PutVarRef0,
Opcode::PutVarRef1,
Opcode::PutVarRef2,
Opcode::PutVarRef3,
Opcode::SetVarRef0,
Opcode::SetVarRef1,
Opcode::SetVarRef2,
Opcode::SetVarRef3,
Opcode::GetLength,
Opcode::IfFalse8,
Opcode::IfTrue8,
Opcode::Goto8,
Opcode::Goto16,
Opcode::Call0,
Opcode::Call1,
Opcode::Call2,
Opcode::Call3,
Opcode::IsUndefined,
Opcode::IsNull,
Opcode::TypeofIsUndefined,
Opcode::TypeofIsFunction,
];
static OP_INFO: [OpInfo; 250] = [
OpInfo {
name: "invalid",
size: 1,
n_pop: 0,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "push_i32",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::I32,
},
OpInfo {
name: "push_const",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Const,
},
OpInfo {
name: "fclosure",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Const,
},
OpInfo {
name: "push_atom_value",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "private_symbol",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "undefined",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "null",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "push_this",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "push_false",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "push_true",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "object",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "special_object",
size: 2,
n_pop: 0,
n_push: 1,
format: OpFormat::U8,
},
OpInfo {
name: "rest",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::U16,
},
OpInfo {
name: "drop",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "nip",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "nip1",
size: 1,
n_pop: 3,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "dup",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "dup1",
size: 1,
n_pop: 2,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "dup2",
size: 1,
n_pop: 2,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "dup3",
size: 1,
n_pop: 3,
n_push: 6,
format: OpFormat::None,
},
OpInfo {
name: "insert2",
size: 1,
n_pop: 2,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "insert3",
size: 1,
n_pop: 3,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "insert4",
size: 1,
n_pop: 4,
n_push: 5,
format: OpFormat::None,
},
OpInfo {
name: "perm3",
size: 1,
n_pop: 3,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "perm4",
size: 1,
n_pop: 4,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "perm5",
size: 1,
n_pop: 5,
n_push: 5,
format: OpFormat::None,
},
OpInfo {
name: "swap",
size: 1,
n_pop: 2,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "swap2",
size: 1,
n_pop: 4,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "rot3l",
size: 1,
n_pop: 3,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "rot3r",
size: 1,
n_pop: 3,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "rot4l",
size: 1,
n_pop: 4,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "rot5l",
size: 1,
n_pop: 5,
n_push: 5,
format: OpFormat::None,
},
OpInfo {
name: "call_constructor",
size: 3,
n_pop: 2,
n_push: 1,
format: OpFormat::Npop,
},
OpInfo {
name: "call",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::Npop,
},
OpInfo {
name: "tail_call",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::Npop,
},
OpInfo {
name: "call_method",
size: 3,
n_pop: 2,
n_push: 1,
format: OpFormat::Npop,
},
OpInfo {
name: "tail_call_method",
size: 3,
n_pop: 2,
n_push: 0,
format: OpFormat::Npop,
},
OpInfo {
name: "array_from",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Npop,
},
OpInfo {
name: "apply",
size: 3,
n_pop: 3,
n_push: 1,
format: OpFormat::U16,
},
OpInfo {
name: "return",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "return_undef",
size: 1,
n_pop: 0,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "check_ctor_return",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "check_ctor",
size: 1,
n_pop: 0,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "init_ctor",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "check_brand",
size: 1,
n_pop: 2,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "add_brand",
size: 1,
n_pop: 2,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "return_async",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "throw",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "throw_error",
size: 6,
n_pop: 0,
n_push: 0,
format: OpFormat::AtomU8,
},
OpInfo {
name: "eval",
size: 5,
n_pop: 1,
n_push: 1,
format: OpFormat::NpopU16,
},
OpInfo {
name: "apply_eval",
size: 3,
n_pop: 2,
n_push: 1,
format: OpFormat::U16,
},
OpInfo {
name: "regexp",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "get_super",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "import",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "get_var_undef",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::VarRef,
},
OpInfo {
name: "get_var",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::VarRef,
},
OpInfo {
name: "put_var",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::VarRef,
},
OpInfo {
name: "put_var_init",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::VarRef,
},
OpInfo {
name: "get_ref_value",
size: 1,
n_pop: 2,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "put_ref_value",
size: 1,
n_pop: 3,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "get_field",
size: 5,
n_pop: 1,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "get_field2",
size: 5,
n_pop: 1,
n_push: 2,
format: OpFormat::Atom,
},
OpInfo {
name: "put_field",
size: 5,
n_pop: 2,
n_push: 0,
format: OpFormat::Atom,
},
OpInfo {
name: "get_private_field",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "put_private_field",
size: 1,
n_pop: 3,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "define_private_field",
size: 1,
n_pop: 3,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "get_array_el",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "get_array_el2",
size: 1,
n_pop: 2,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "get_array_el3",
size: 1,
n_pop: 2,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "put_array_el",
size: 1,
n_pop: 3,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "get_super_value",
size: 1,
n_pop: 3,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "put_super_value",
size: 1,
n_pop: 4,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "define_field",
size: 5,
n_pop: 2,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "set_name",
size: 5,
n_pop: 1,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "set_name_computed",
size: 1,
n_pop: 2,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "set_proto",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "set_home_object",
size: 1,
n_pop: 2,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "define_array_el",
size: 1,
n_pop: 3,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "append",
size: 1,
n_pop: 3,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "copy_data_properties",
size: 2,
n_pop: 3,
n_push: 3,
format: OpFormat::U8,
},
OpInfo {
name: "define_method",
size: 6,
n_pop: 2,
n_push: 1,
format: OpFormat::AtomU8,
},
OpInfo {
name: "define_method_computed",
size: 2,
n_pop: 3,
n_push: 1,
format: OpFormat::U8,
},
OpInfo {
name: "define_class",
size: 6,
n_pop: 2,
n_push: 2,
format: OpFormat::AtomU8,
},
OpInfo {
name: "define_class_computed",
size: 6,
n_pop: 3,
n_push: 3,
format: OpFormat::AtomU8,
},
OpInfo {
name: "get_loc",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "put_loc",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::Loc,
},
OpInfo {
name: "set_loc",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "get_arg",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Arg,
},
OpInfo {
name: "put_arg",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::Arg,
},
OpInfo {
name: "set_arg",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::Arg,
},
OpInfo {
name: "get_var_ref",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::VarRef,
},
OpInfo {
name: "put_var_ref",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::VarRef,
},
OpInfo {
name: "set_var_ref",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::VarRef,
},
OpInfo {
name: "set_loc_uninitialized",
size: 3,
n_pop: 0,
n_push: 0,
format: OpFormat::Loc,
},
OpInfo {
name: "get_loc_check",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "put_loc_check",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::Loc,
},
OpInfo {
name: "set_loc_check",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "put_loc_check_init",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::Loc,
},
OpInfo {
name: "get_loc_checkthis",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "get_var_ref_check",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::VarRef,
},
OpInfo {
name: "put_var_ref_check",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::VarRef,
},
OpInfo {
name: "put_var_ref_check_init",
size: 3,
n_pop: 1,
n_push: 0,
format: OpFormat::VarRef,
},
OpInfo {
name: "close_loc",
size: 3,
n_pop: 0,
n_push: 0,
format: OpFormat::Loc,
},
OpInfo {
name: "if_false",
size: 5,
n_pop: 1,
n_push: 0,
format: OpFormat::Label,
},
OpInfo {
name: "if_true",
size: 5,
n_pop: 1,
n_push: 0,
format: OpFormat::Label,
},
OpInfo {
name: "goto",
size: 5,
n_pop: 0,
n_push: 0,
format: OpFormat::Label,
},
OpInfo {
name: "catch",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Label,
},
OpInfo {
name: "gosub",
size: 5,
n_pop: 0,
n_push: 0,
format: OpFormat::Label,
},
OpInfo {
name: "ret",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "nip_catch",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "to_object",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "to_propkey",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "with_get_var",
size: 10,
n_pop: 1,
n_push: 0,
format: OpFormat::AtomLabelU8,
},
OpInfo {
name: "with_put_var",
size: 10,
n_pop: 2,
n_push: 1,
format: OpFormat::AtomLabelU8,
},
OpInfo {
name: "with_delete_var",
size: 10,
n_pop: 1,
n_push: 0,
format: OpFormat::AtomLabelU8,
},
OpInfo {
name: "with_make_ref",
size: 10,
n_pop: 1,
n_push: 0,
format: OpFormat::AtomLabelU8,
},
OpInfo {
name: "with_get_ref",
size: 10,
n_pop: 1,
n_push: 0,
format: OpFormat::AtomLabelU8,
},
OpInfo {
name: "make_loc_ref",
size: 7,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "make_arg_ref",
size: 7,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "make_var_ref_ref",
size: 7,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "make_var_ref",
size: 5,
n_pop: 0,
n_push: 2,
format: OpFormat::Atom,
},
OpInfo {
name: "for_in_start",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "for_of_start",
size: 1,
n_pop: 1,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "for_await_of_start",
size: 1,
n_pop: 1,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "for_in_next",
size: 1,
n_pop: 1,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "for_of_next",
size: 2,
n_pop: 3,
n_push: 5,
format: OpFormat::U8,
},
OpInfo {
name: "for_await_of_next",
size: 1,
n_pop: 3,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "iterator_check_object",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "iterator_get_value_done",
size: 1,
n_pop: 2,
n_push: 3,
format: OpFormat::None,
},
OpInfo {
name: "iterator_close",
size: 1,
n_pop: 3,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "iterator_next",
size: 1,
n_pop: 4,
n_push: 4,
format: OpFormat::None,
},
OpInfo {
name: "iterator_call",
size: 2,
n_pop: 4,
n_push: 5,
format: OpFormat::U8,
},
OpInfo {
name: "initial_yield",
size: 1,
n_pop: 0,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "yield",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "yield_star",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "async_yield_star",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "await",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "neg",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "plus",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "dec",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "inc",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "post_dec",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "post_inc",
size: 1,
n_pop: 1,
n_push: 2,
format: OpFormat::None,
},
OpInfo {
name: "dec_loc",
size: 2,
n_pop: 0,
n_push: 0,
format: OpFormat::Loc8,
},
OpInfo {
name: "inc_loc",
size: 2,
n_pop: 0,
n_push: 0,
format: OpFormat::Loc8,
},
OpInfo {
name: "add_loc",
size: 2,
n_pop: 1,
n_push: 0,
format: OpFormat::Loc8,
},
OpInfo {
name: "not",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "lnot",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "typeof",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "delete",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "delete_var",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "mul",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "div",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "mod",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "add",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "sub",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "pow",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "shl",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "sar",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "shr",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "lt",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "lte",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "gt",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "gte",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "instanceof",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "in",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "eq",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "neq",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "strict_eq",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "strict_neq",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "and",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "xor",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "or",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "is_undefined_or_null",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "private_in",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "push_bigint_i32",
size: 5,
n_pop: 0,
n_push: 1,
format: OpFormat::I32,
},
OpInfo {
name: "using_dispose_init",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "using_dispose",
size: 3,
n_pop: 1,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "using_dispose_async",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::Loc,
},
OpInfo {
name: "using_dispose_merge",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "using_dispose_end",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "using_check",
size: 2,
n_pop: 1,
n_push: 2,
format: OpFormat::U8,
},
OpInfo {
name: "nop",
size: 1,
n_pop: 0,
n_push: 0,
format: OpFormat::None,
},
OpInfo {
name: "push_minus1",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_0",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_1",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_2",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_3",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_4",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_5",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_6",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_7",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneInt,
},
OpInfo {
name: "push_i8",
size: 2,
n_pop: 0,
n_push: 1,
format: OpFormat::I8,
},
OpInfo {
name: "push_i16",
size: 3,
n_pop: 0,
n_push: 1,
format: OpFormat::I16,
},
OpInfo {
name: "push_const8",
size: 2,
n_pop: 0,
n_push: 1,
format: OpFormat::Const8,
},
OpInfo {
name: "fclosure8",
size: 2,
n_pop: 0,
n_push: 1,
format: OpFormat::Const8,
},
OpInfo {
name: "push_empty_string",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "get_loc8",
size: 2,
n_pop: 0,
n_push: 1,
format: OpFormat::Loc8,
},
OpInfo {
name: "put_loc8",
size: 2,
n_pop: 1,
n_push: 0,
format: OpFormat::Loc8,
},
OpInfo {
name: "set_loc8",
size: 2,
n_pop: 1,
n_push: 1,
format: OpFormat::Loc8,
},
OpInfo {
name: "get_loc0",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "get_loc1",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "get_loc2",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "get_loc3",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "put_loc0",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "put_loc1",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "put_loc2",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "put_loc3",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "set_loc0",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "set_loc1",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "set_loc2",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "set_loc3",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneLoc,
},
OpInfo {
name: "get_arg0",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "get_arg1",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "get_arg2",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "get_arg3",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "put_arg0",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneArg,
},
OpInfo {
name: "put_arg1",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneArg,
},
OpInfo {
name: "put_arg2",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneArg,
},
OpInfo {
name: "put_arg3",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneArg,
},
OpInfo {
name: "set_arg0",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "set_arg1",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "set_arg2",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "set_arg3",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneArg,
},
OpInfo {
name: "get_var_ref0",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "get_var_ref1",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "get_var_ref2",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "get_var_ref3",
size: 1,
n_pop: 0,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "put_var_ref0",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "put_var_ref1",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "put_var_ref2",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "put_var_ref3",
size: 1,
n_pop: 1,
n_push: 0,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "set_var_ref0",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "set_var_ref1",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "set_var_ref2",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "set_var_ref3",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::NoneVarRef,
},
OpInfo {
name: "get_length",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "if_false8",
size: 2,
n_pop: 1,
n_push: 0,
format: OpFormat::Label8,
},
OpInfo {
name: "if_true8",
size: 2,
n_pop: 1,
n_push: 0,
format: OpFormat::Label8,
},
OpInfo {
name: "goto8",
size: 2,
n_pop: 0,
n_push: 0,
format: OpFormat::Label8,
},
OpInfo {
name: "goto16",
size: 3,
n_pop: 0,
n_push: 0,
format: OpFormat::Label16,
},
OpInfo {
name: "call0",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::Npopx,
},
OpInfo {
name: "call1",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::Npopx,
},
OpInfo {
name: "call2",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::Npopx,
},
OpInfo {
name: "call3",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::Npopx,
},
OpInfo {
name: "is_undefined",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "is_null",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "typeof_is_undefined",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "typeof_is_function",
size: 1,
n_pop: 1,
n_push: 1,
format: OpFormat::None,
},
];
static TEMP_INFO: [OpInfo; 19] = [
OpInfo {
name: "enter_scope",
size: 3,
n_pop: 0,
n_push: 0,
format: OpFormat::U16,
},
OpInfo {
name: "leave_scope",
size: 3,
n_pop: 0,
n_push: 0,
format: OpFormat::U16,
},
OpInfo {
name: "label",
size: 5,
n_pop: 0,
n_push: 0,
format: OpFormat::Label,
},
OpInfo {
name: "scope_get_var_undef",
size: 7,
n_pop: 0,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_get_var",
size: 7,
n_pop: 0,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_put_var",
size: 7,
n_pop: 1,
n_push: 0,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_delete_var",
size: 7,
n_pop: 0,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_make_ref",
size: 11,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomLabelU16,
},
OpInfo {
name: "scope_get_ref",
size: 7,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_put_var_init",
size: 7,
n_pop: 0,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_get_var_checkthis",
size: 7,
n_pop: 0,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_get_private_field",
size: 7,
n_pop: 1,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_get_private_field2",
size: 7,
n_pop: 1,
n_push: 2,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_put_private_field",
size: 7,
n_pop: 2,
n_push: 0,
format: OpFormat::AtomU16,
},
OpInfo {
name: "scope_in_private_field",
size: 7,
n_pop: 1,
n_push: 1,
format: OpFormat::AtomU16,
},
OpInfo {
name: "get_field_opt_chain",
size: 5,
n_pop: 1,
n_push: 1,
format: OpFormat::Atom,
},
OpInfo {
name: "get_array_el_opt_chain",
size: 1,
n_pop: 2,
n_push: 1,
format: OpFormat::None,
},
OpInfo {
name: "set_class_name",
size: 5,
n_pop: 1,
n_push: 1,
format: OpFormat::U32,
},
OpInfo {
name: "line_num",
size: 5,
n_pop: 0,
n_push: 0,
format: OpFormat::U32,
},
];
const OP_BY_BYTE: [Option<Opcode>; 256] = [
Some(Opcode::Invalid),
Some(Opcode::PushI32),
Some(Opcode::PushConst),
Some(Opcode::Fclosure),
Some(Opcode::PushAtomValue),
Some(Opcode::PrivateSymbol),
Some(Opcode::Undefined),
Some(Opcode::Null),
Some(Opcode::PushThis),
Some(Opcode::PushFalse),
Some(Opcode::PushTrue),
Some(Opcode::Object),
Some(Opcode::SpecialObject),
Some(Opcode::Rest),
Some(Opcode::Drop),
Some(Opcode::Nip),
Some(Opcode::Nip1),
Some(Opcode::Dup),
Some(Opcode::Dup1),
Some(Opcode::Dup2),
Some(Opcode::Dup3),
Some(Opcode::Insert2),
Some(Opcode::Insert3),
Some(Opcode::Insert4),
Some(Opcode::Perm3),
Some(Opcode::Perm4),
Some(Opcode::Perm5),
Some(Opcode::Swap),
Some(Opcode::Swap2),
Some(Opcode::Rot3l),
Some(Opcode::Rot3r),
Some(Opcode::Rot4l),
Some(Opcode::Rot5l),
Some(Opcode::CallConstructor),
Some(Opcode::Call),
Some(Opcode::TailCall),
Some(Opcode::CallMethod),
Some(Opcode::TailCallMethod),
Some(Opcode::ArrayFrom),
Some(Opcode::Apply),
Some(Opcode::Return),
Some(Opcode::ReturnUndef),
Some(Opcode::CheckCtorReturn),
Some(Opcode::CheckCtor),
Some(Opcode::InitCtor),
Some(Opcode::CheckBrand),
Some(Opcode::AddBrand),
Some(Opcode::ReturnAsync),
Some(Opcode::Throw),
Some(Opcode::ThrowError),
Some(Opcode::Eval),
Some(Opcode::ApplyEval),
Some(Opcode::Regexp),
Some(Opcode::GetSuper),
Some(Opcode::Import),
Some(Opcode::GetVarUndef),
Some(Opcode::GetVar),
Some(Opcode::PutVar),
Some(Opcode::PutVarInit),
Some(Opcode::GetRefValue),
Some(Opcode::PutRefValue),
Some(Opcode::GetField),
Some(Opcode::GetField2),
Some(Opcode::PutField),
Some(Opcode::GetPrivateField),
Some(Opcode::PutPrivateField),
Some(Opcode::DefinePrivateField),
Some(Opcode::GetArrayEl),
Some(Opcode::GetArrayEl2),
Some(Opcode::GetArrayEl3),
Some(Opcode::PutArrayEl),
Some(Opcode::GetSuperValue),
Some(Opcode::PutSuperValue),
Some(Opcode::DefineField),
Some(Opcode::SetName),
Some(Opcode::SetNameComputed),
Some(Opcode::SetProto),
Some(Opcode::SetHomeObject),
Some(Opcode::DefineArrayEl),
Some(Opcode::Append),
Some(Opcode::CopyDataProperties),
Some(Opcode::DefineMethod),
Some(Opcode::DefineMethodComputed),
Some(Opcode::DefineClass),
Some(Opcode::DefineClassComputed),
Some(Opcode::GetLoc),
Some(Opcode::PutLoc),
Some(Opcode::SetLoc),
Some(Opcode::GetArg),
Some(Opcode::PutArg),
Some(Opcode::SetArg),
Some(Opcode::GetVarRef),
Some(Opcode::PutVarRef),
Some(Opcode::SetVarRef),
Some(Opcode::SetLocUninitialized),
Some(Opcode::GetLocCheck),
Some(Opcode::PutLocCheck),
Some(Opcode::SetLocCheck),
Some(Opcode::PutLocCheckInit),
Some(Opcode::GetLocCheckthis),
Some(Opcode::GetVarRefCheck),
Some(Opcode::PutVarRefCheck),
Some(Opcode::PutVarRefCheckInit),
Some(Opcode::CloseLoc),
Some(Opcode::IfFalse),
Some(Opcode::IfTrue),
Some(Opcode::Goto),
Some(Opcode::Catch),
Some(Opcode::Gosub),
Some(Opcode::Ret),
Some(Opcode::NipCatch),
Some(Opcode::ToObject),
Some(Opcode::ToPropkey),
Some(Opcode::WithGetVar),
Some(Opcode::WithPutVar),
Some(Opcode::WithDeleteVar),
Some(Opcode::WithMakeRef),
Some(Opcode::WithGetRef),
Some(Opcode::MakeLocRef),
Some(Opcode::MakeArgRef),
Some(Opcode::MakeVarRefRef),
Some(Opcode::MakeVarRef),
Some(Opcode::ForInStart),
Some(Opcode::ForOfStart),
Some(Opcode::ForAwaitOfStart),
Some(Opcode::ForInNext),
Some(Opcode::ForOfNext),
Some(Opcode::ForAwaitOfNext),
Some(Opcode::IteratorCheckObject),
Some(Opcode::IteratorGetValueDone),
Some(Opcode::IteratorClose),
Some(Opcode::IteratorNext),
Some(Opcode::IteratorCall),
Some(Opcode::InitialYield),
Some(Opcode::Yield),
Some(Opcode::YieldStar),
Some(Opcode::AsyncYieldStar),
Some(Opcode::Await),
Some(Opcode::Neg),
Some(Opcode::Plus),
Some(Opcode::Dec),
Some(Opcode::Inc),
Some(Opcode::PostDec),
Some(Opcode::PostInc),
Some(Opcode::DecLoc),
Some(Opcode::IncLoc),
Some(Opcode::AddLoc),
Some(Opcode::Not),
Some(Opcode::Lnot),
Some(Opcode::Typeof),
Some(Opcode::Delete),
Some(Opcode::DeleteVar),
Some(Opcode::Mul),
Some(Opcode::Div),
Some(Opcode::Mod),
Some(Opcode::Add),
Some(Opcode::Sub),
Some(Opcode::Pow),
Some(Opcode::Shl),
Some(Opcode::Sar),
Some(Opcode::Shr),
Some(Opcode::Lt),
Some(Opcode::Lte),
Some(Opcode::Gt),
Some(Opcode::Gte),
Some(Opcode::Instanceof),
Some(Opcode::In),
Some(Opcode::Eq),
Some(Opcode::Neq),
Some(Opcode::StrictEq),
Some(Opcode::StrictNeq),
Some(Opcode::And),
Some(Opcode::Xor),
Some(Opcode::Or),
Some(Opcode::IsUndefinedOrNull),
Some(Opcode::PrivateIn),
Some(Opcode::PushBigintI32),
Some(Opcode::UsingDisposeInit),
Some(Opcode::UsingDispose),
Some(Opcode::UsingDisposeAsync),
Some(Opcode::UsingDisposeMerge),
Some(Opcode::UsingDisposeEnd),
Some(Opcode::UsingCheck),
Some(Opcode::Nop),
Some(Opcode::PushMinus1),
Some(Opcode::Push0),
Some(Opcode::Push1),
Some(Opcode::Push2),
Some(Opcode::Push3),
Some(Opcode::Push4),
Some(Opcode::Push5),
Some(Opcode::Push6),
Some(Opcode::Push7),
Some(Opcode::PushI8),
Some(Opcode::PushI16),
Some(Opcode::PushConst8),
Some(Opcode::Fclosure8),
Some(Opcode::PushEmptyString),
Some(Opcode::GetLoc8),
Some(Opcode::PutLoc8),
Some(Opcode::SetLoc8),
Some(Opcode::GetLoc0),
Some(Opcode::GetLoc1),
Some(Opcode::GetLoc2),
Some(Opcode::GetLoc3),
Some(Opcode::PutLoc0),
Some(Opcode::PutLoc1),
Some(Opcode::PutLoc2),
Some(Opcode::PutLoc3),
Some(Opcode::SetLoc0),
Some(Opcode::SetLoc1),
Some(Opcode::SetLoc2),
Some(Opcode::SetLoc3),
Some(Opcode::GetArg0),
Some(Opcode::GetArg1),
Some(Opcode::GetArg2),
Some(Opcode::GetArg3),
Some(Opcode::PutArg0),
Some(Opcode::PutArg1),
Some(Opcode::PutArg2),
Some(Opcode::PutArg3),
Some(Opcode::SetArg0),
Some(Opcode::SetArg1),
Some(Opcode::SetArg2),
Some(Opcode::SetArg3),
Some(Opcode::GetVarRef0),
Some(Opcode::GetVarRef1),
Some(Opcode::GetVarRef2),
Some(Opcode::GetVarRef3),
Some(Opcode::PutVarRef0),
Some(Opcode::PutVarRef1),
Some(Opcode::PutVarRef2),
Some(Opcode::PutVarRef3),
Some(Opcode::SetVarRef0),
Some(Opcode::SetVarRef1),
Some(Opcode::SetVarRef2),
Some(Opcode::SetVarRef3),
Some(Opcode::GetLength),
Some(Opcode::IfFalse8),
Some(Opcode::IfTrue8),
Some(Opcode::Goto8),
Some(Opcode::Goto16),
Some(Opcode::Call0),
Some(Opcode::Call1),
Some(Opcode::Call2),
Some(Opcode::Call3),
Some(Opcode::IsUndefined),
Some(Opcode::IsNull),
Some(Opcode::TypeofIsUndefined),
Some(Opcode::TypeofIsFunction),
None,
None,
None,
None,
None,
None,
];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_discriminant_matches_its_index() {
for (index, opcode) in OP_ALL.iter().enumerate() {
assert_eq!(
*opcode as usize, index,
"OP_ALL must be ordered by discriminant"
);
assert!(!opcode.name().is_empty());
assert!(opcode.size() >= 1, "{} has a zero size", opcode.name());
}
assert_eq!(OP_ALL.len(), OP_COUNT as usize);
assert_eq!(OP_INFO.len(), OP_ALL.len());
assert_eq!(TEMP_INFO.len(), 20 - TEMP_START);
}
#[test]
fn opcode_bytes_round_trip() {
for opcode in OP_ALL {
assert_eq!(
Opcode::from_u8(opcode as u8),
Some(opcode),
"{}",
opcode.name()
);
}
assert_eq!(Opcode::from_u8(OP_COUNT), None);
assert_eq!(Opcode::from_u8(255), None);
}
#[test]
fn names_round_trip() {
for opcode in OP_ALL {
assert_eq!(
Opcode::by_name(opcode.name()),
Some(opcode),
"{}",
opcode.name()
);
}
}
#[test]
fn temporary_opcodes_overlap_real_opcodes() {
assert_eq!(TempOpcode::EnterScope as u8, Opcode::PushI32 as u8);
assert_eq!(TempOpcode::LineNum as u8, 19);
assert!(Opcode::from_u8(TempOpcode::EnterScope as u8).is_some());
assert!(Opcode::from_u8(TempOpcode::LineNum as u8).is_some());
}
}