#[repr(u8)]pub enum Opcode {
Show 200 variants
Nop = 0,
Mov = 1,
LoadConst = 2,
DLoadConst = 3,
LoadInt = 4,
DLoadInt = 5,
LoadBool = 6,
LoadNil = 7,
LoadImport = 8,
GetGlobal = 9,
SetGlobal = 10,
IAdd = 16,
ISub = 17,
IMul = 18,
IDiv = 19,
IRem = 20,
IFloorDiv = 21,
IFloorMod = 22,
IAnd = 23,
IOr = 24,
IXor = 25,
IShl = 26,
IShr = 27,
IMin = 28,
IMax = 29,
INeg = 30,
IBitNot = 31,
IAbs = 32,
IPow = 39,
IEq = 33,
INe = 34,
ILt = 35,
ILe = 36,
IGt = 37,
IGe = 38,
FAdd = 48,
FSub = 49,
FMul = 50,
FDiv = 51,
FRem = 52,
FIeeeRem = 53,
FMin = 54,
FMax = 55,
FFma = 56,
FNeg = 57,
FAbs = 58,
FSqrt = 59,
FFloor = 60,
FCeil = 61,
FTrunc = 62,
FRound = 63,
FRoundEven = 64,
FEq = 65,
FNe = 66,
FLt = 67,
FLe = 68,
FGt = 69,
FGe = 70,
FPow = 72,
FTotalCmp = 71,
BNot = 80,
BAnd = 81,
BOr = 82,
BXor = 83,
CEq = 84,
CNe = 85,
CLt = 86,
CLe = 87,
CGt = 88,
CGe = 89,
RefEq = 90,
IntCast = 96,
Zext = 97,
Sext = 98,
Trunc = 99,
IntToF32 = 100,
IntToF64 = 101,
F32ToInt = 102,
F64ToInt = 103,
F32ToF64 = 104,
F64ToF32 = 105,
FloatToBits = 106,
BitsToFloat = 107,
CharFromU32 = 108,
CharToU32 = 109,
BoolToInt = 110,
DAdd = 112,
DSub = 113,
DMul = 114,
DDiv = 115,
DRem = 116,
DFloorDiv = 117,
DFloorMod = 118,
DAnd = 119,
DOr = 120,
DXor = 121,
DShl = 122,
DShr = 123,
DNeg = 124,
DBitNot = 125,
DEq = 126,
DNe = 127,
DLt = 128,
DLe = 129,
DGt = 130,
DGe = 131,
DTruthy = 132,
DConcat = 133,
ToDyn = 134,
FromDyn = 135,
TypeOf = 136,
IsKind = 137,
IsType = 138,
Cast = 139,
DGetIndex = 140,
DSetIndex = 141,
GetProp = 142,
SetProp = 143,
HasProp = 144,
DCall = 145,
DIterNew = 146,
DLen = 147,
DNot = 148,
DPow = 149,
DAbs = 150,
DSepIndex = 151,
DSepProp = 152,
DCallShape = 153,
DParamRef = 154,
DParamRefNamed = 155,
ErrPayload = 156,
Jmp = 160,
JmpIf = 161,
JmpIfNot = 162,
Switch = 163,
Call = 164,
CallIndirect = 165,
CallImport = 166,
TailCall = 167,
TailCallIndirect = 168,
Ret = 169,
RetVoid = 170,
Throw = 171,
ErrCode = 172,
Safepoint = 173,
Unreachable = 174,
Raise = 175,
MakeClosure = 176,
GetUpval = 177,
NewCell = 178,
CellGet = 179,
CellSet = 180,
NewRef = 181,
DRefIndex = 182,
DRefProp = 183,
DBindIndex = 184,
DBindProp = 185,
DUnrefIndex = 186,
DUnrefProp = 187,
NewStruct = 192,
GetField = 193,
SetField = 194,
NewArray = 195,
ArrayLen = 196,
ArrayGet = 197,
ArraySet = 198,
ArrayPush = 199,
ArrayPop = 200,
NewMap = 201,
MapLen = 202,
MapGet = 203,
MapFind = 204,
MapHas = 205,
MapSet = 206,
MapDel = 207,
MapPush = 208,
IterNew = 209,
IterNext = 210,
IterKey = 211,
Dup = 212,
StrLen = 224,
StrConcat = 225,
StrConcatN = 226,
StrEq = 227,
StrCmp = 228,
StrSlice = 229,
StrByte = 230,
CoroNew = 240,
CoroNewIndirect = 241,
Yield = 242,
Await = 243,
Resume = 244,
ResumeThrow = 245,
CoroStatus = 246,
CoroCurrent = 247,
YieldKv = 249,
CoroClose = 250,
CoroKey = 251,
CoroResult = 252,
Spawn = 248,
}Expand description
Variants§
Nop = 0
Does nothing.
Mov = 1
dst = src. Both registers have the same declared type; the 64-bit
slot is copied as is.
LoadConst = 2
dst = constants[k] in the destination’s typed representation (an
int constant into an integer register it fits, a str or bytes
constant into a str register, an aggregate into a matching ref).
DLoadConst = 3
dst = constants[k] boxed as a dyn value (integers become dynamic
ints and must fit i64; floats become dynamic floats; aggregates
become dynamic arrays and maps).
LoadInt = 4
dst = val as an integer of type ty; the immediate is
sign-extended and must be representable in ty.
DLoadInt = 5
dst = val as a dynamic integer.
LoadBool = 6
dst = val.
LoadNil = 7
dst = nil: the dynamic nil, or the null str/ref.
LoadImport = 8
dst = a callable reference to a host function: a first-class value
every dynamic call form accepts, bound by the import’s parameter
list if it has one.
GetGlobal = 9
dst = globals[global].
SetGlobal = 10
globals[global] = src; the global must be mutable.
IAdd = 16
dst = lhs + rhs; overflow per op.policy().overflow().
ISub = 17
dst = lhs - rhs; overflow per policy.
IMul = 18
dst = lhs * rhs; overflow per policy.
IDiv = 19
dst = lhs / rhs, truncating toward zero; rhs == 0 per div_zero,
signed MIN / -1 per overflow (wrap gives MIN).
IRem = 20
dst = lhs rem rhs, the sign following the dividend; rhs == 0 per
div_zero; signed MIN rem -1 is 0, never an error.
IFloorDiv = 21
dst = floor(lhs / rhs) (Python //); zero and overflow rules as
idiv.
IFloorMod = 22
dst = lhs - rhs * floor_div(lhs, rhs), the sign following the
divisor; rhs == 0 per div_zero; signed MIN floor_mod -1 is 0.
IAnd = 23
dst = lhs & rhs.
IOr = 24
dst = lhs | rhs.
IXor = 25
dst = lhs ^ rhs.
IShl = 26
dst = lhs << rhs; bits shifted out are discarded; an amount at least
the width (or negative, for a signed type) per shift.
IShr = 27
dst = lhs >> rhs, arithmetic for signed types and logical for
unsigned; amount rule as ishl.
IMin = 28
dst = min(lhs, rhs).
IMax = 29
dst = max(lhs, rhs).
INeg = 30
dst = 0 - src; neg(MIN) per overflow.
IBitNot = 31
dst = !src (bitwise complement; HIR’s bit_not on integers).
IAbs = 32
dst = |src|; abs(MIN) per overflow.
IPow = 39
dst = lhs ** rhs (OPS v2 pow): the exact power by repeated
squaring, 0 ** 0 = 1; a result that does not fit per overflow
(wrap keeps the low bits); a negative exponent of a signed type
raises NegativeExponent (E0006) under every policy (promote is
never valid here). The exponent has the operand type.
IEq = 33
dst = lhs == rhs (bool).
INe = 34
dst = lhs != rhs (bool).
ILt = 35
dst = lhs < rhs (bool), signed or unsigned per ty.
ILe = 36
dst = lhs <= rhs (bool).
IGt = 37
dst = lhs > rhs (bool).
IGe = 38
dst = lhs >= rhs (bool).
FAdd = 48
dst = lhs + rhs (round to nearest, ties to even).
FSub = 49
dst = lhs - rhs.
FMul = 50
dst = lhs * rhs.
FDiv = 51
dst = lhs / rhs; division by zero gives ±inf or NaN.
FRem = 52
dst = fmod(lhs, rhs): the truncated remainder, sign of the dividend.
FIeeeRem = 53
dst = remainder(lhs, rhs): IEEE 754 remainder (nearest quotient).
FMin = 54
dst = min(lhs, rhs); NaN if either is NaN; min(-0, +0) = -0.
FMax = 55
dst = max(lhs, rhs); NaN if either is NaN; max(-0, +0) = +0.
FFma = 56
dst = fma(lhs, rhs, dst): fused multiply-add, correctly rounded.
dst is both the addend and the result.
FNeg = 57
dst = -src (sign flip; payload preserved).
FAbs = 58
dst = |src| (sign clear; payload preserved).
FSqrt = 59
dst = sqrt(src), correctly rounded.
FFloor = 60
dst = floor(src).
FCeil = 61
dst = ceil(src).
FTrunc = 62
dst = trunc(src) (toward zero).
FRound = 63
dst = round(src), ties away from zero.
FRoundEven = 64
dst = round(src), ties to even.
FEq = 65
dst = lhs == rhs (bool); false if either is NaN.
FNe = 66
dst = lhs != rhs (bool); true if either is NaN.
FLt = 67
dst = lhs < rhs (bool); false if either is NaN.
FLe = 68
dst = lhs <= rhs (bool); false if either is NaN.
FGt = 69
dst = lhs > rhs (bool); false if either is NaN.
FGe = 70
dst = lhs >= rhs (bool); false if either is NaN.
FPow = 72
dst = pow(lhs, rhs) (OPS v2 float pow): C99 Annex F special
cases, finite results by the family’s shared ls_pow routine so every
tier is bit-identical; f32 computes ls_pow on the operands widened
to f64 and rounds once. Never an error.
FTotalCmp = 71
dst = totalOrder(lhs, rhs) as an i8 of -1, 0, or 1 (IEEE 754
total order: -NaN < -inf < ... < -0 < +0 < ... < +inf < +NaN).
BNot = 80
dst = !src (logical).
BAnd = 81
dst = lhs & rhs (both evaluated; short-circuit is control flow).
BOr = 82
dst = lhs | rhs.
BXor = 83
dst = lhs ^ rhs (also boolean inequality).
CEq = 84
dst = lhs == rhs on char scalar values.
CNe = 85
dst = lhs != rhs on char scalar values.
CLt = 86
dst = lhs < rhs on char scalar values.
CLe = 87
dst = lhs <= rhs on char scalar values.
CGt = 88
dst = lhs > rhs on char scalar values.
CGe = 89
dst = lhs >= rhs on char scalar values.
RefEq = 90
dst = lhs and rhs are the same object (or both nil). Operands
are str or ref; string contents are not compared.
IntCast = 96
dst = src converted between integer types: exact if it fits, else
per the conversion’s overflow (wrap truncates or sign-extends).
Zext = 97
Zero-extends a narrower integer to a wider one; never an error.
Sext = 98
Sign-extends a narrower integer to a wider one; never an error.
Trunc = 99
Keeps the low bits of a wider integer; never an error.
IntToF32 = 100
dst = src as f32, rounded to nearest, ties to even.
IntToF64 = 101
dst = src as f64, rounded to nearest, ties to even.
F32ToInt = 102
dst = src truncated toward zero to the integer type conv.ty();
NaN or out of range per conv.float_to_int().
F64ToInt = 103
dst = src truncated toward zero to the integer type conv.ty();
NaN or out of range per conv.float_to_int().
F32ToF64 = 104
dst = src widened to f64 (exact).
F64ToF32 = 105
dst = src narrowed to f32, rounded to nearest, ties to even.
FloatToBits = 106
dst = the IEEE bits of src as an integer of the same width
(ty is a 32- or 64-bit integer type).
BitsToFloat = 107
dst = the float whose IEEE bits are src (ty is a 32- or 64-bit
integer type; the float has the same width).
CharFromU32 = 108
dst = char(src); InvalidChar (E0005) if src (a u32) is not a
Unicode scalar value.
CharToU32 = 109
dst = src as its u32 scalar value. Total; an LSB addition to OPS.
BoolToInt = 110
dst = 1 if src is true, else 0.
DAdd = 112
Dynamic +.
DSub = 113
Dynamic -.
DMul = 114
Dynamic *.
DDiv = 115
Dynamic division: truncating for two ints, IEEE otherwise.
DRem = 116
Dynamic remainder: irem for two ints, frem otherwise.
DFloorDiv = 117
Dynamic floor division (Python //).
DFloorMod = 118
Dynamic floor modulo (Python %).
DAnd = 119
Dynamic bitwise and (ints only, else hook).
DOr = 120
Dynamic bitwise or.
DXor = 121
Dynamic bitwise xor.
DShl = 122
Dynamic shift left (64-bit; amount rule per shift, saturate for
PHP).
DShr = 123
Dynamic arithmetic shift right.
DNeg = 124
Dynamic negation.
DBitNot = 125
Dynamic bitwise complement (PHP/Python ~; HIR’s bit_not): ints
only, else the bit_not hook.
DEq = 126
Dynamic equality into a bool register (numbers exactly, strings by
content, other kinds through the eq hook or by identity).
DNe = 127
Dynamic inequality: the negation of deq.
DLt = 128
Dynamic < into a bool register (numbers, strings bytewise, chars;
else the lt hook or TypeError).
DLe = 129
Dynamic <=.
DGt = 130
Dynamic > (lt with the operands swapped).
DGe = 131
Dynamic >= (le with the operands swapped).
DTruthy = 132
dst = the truthiness of src as a bool: nil is false, bools are
themselves, numbers are true unless zero; other kinds go to the
truthy hook, or are true unless an empty string, array, or map.
DConcat = 133
Dynamic string concatenation (two strings, else the concat hook).
ToDyn = 134
dst = src boxed into a dyn (from names src’s static type;
u64 above i64::MAX raises ArithOverflow; str/ref are a no-op).
FromDyn = 135
dst = src unboxed to the static type to; TypeError if the kind
does not match, ArithOverflow if an int does not fit. (ref targets
use cast.)
TypeOf = 136
dst = the Kind code of src, as a u8.
IsKind = 137
dst = whether src is of kind kind.
IsType = 138
dst = whether src is a non-nil instance of struct type ty or of
a type that has it as an ancestor.
Cast = 139
dst = src as ref ty; TypeError if src is not nil and not an
instance of ty (or a descendant).
DGetIndex = 140
Dynamic indexing dst = obj[key]: arrays by int, maps by key, strings
by int (the byte); misses and other kinds go to the get_index hook.
A reference slot reads as its reference’s value.
DSetIndex = 141
Dynamic indexed store obj[key] = src; a reference slot is written
through, and a reference src stores its value.
GetProp = 142
Dynamic property read dst = obj.name: a struct field or method by
name, a map entry with a string key, else the get_prop hook.
SetProp = 143
Dynamic property write obj.name = src.
HasProp = 144
dst = whether obj has property name.
DCall = 145
Dynamic call: dst = callee(dst+1, ..., dst+argc) with positional
dyn arguments, bound to the callee’s parameter list (exactly
dcall_shape with an all-positional shape): ArgumentError (E0114)
when they do not bind, TypeError when one does not convert to its
parameter’s type; non-callables go to the call hook.
DIterNew = 146
dst = a dynamic iterator over src (array or map; else the iter
hook).
DLen = 147
dst = the length of src as an i64 (string bytes, array or map
entries; else the len hook).
DNot = 148
Dynamic logical not (PHP !, Python not; HIR’s not): dst = !truthy(src) as a bool, with exactly the truthiness rules of
dtruthy (the truthy hook included). dbit_not is the bitwise ~.
DPow = 149
Dynamic ** (OPS v2 pow): two ints → integer pow at i64 under
pol (promote gives the nearest f64 of the exact power, and the
f64 power for a negative exponent; other policies raise
NegativeExponent for one); numbers with a float → fpow in f64;
else the pow hook, else TypeError.
DAbs = 150
Dynamic absolute value: an int → abs at i64 (abs(MIN) per
overflow; promote gives 9.223372036854775808e18); a float →
fabs; else the abs hook, else TypeError.
DSepIndex = 151
Separate an element for a nested write (PHP $a[k][] = v): obj
(an array or map) is written, so its own copy-on-write store is made
unique first; then if obj[key] is an array or map that another
container may share, it is replaced by a copy (O(1), copy-on-write);
dst = the element, safe to write in place. A reference slot
separates the container inside the reference. An absent key gives
nil (nothing is stored); other kinds of obj behave exactly as
dget_index.
DSepProp = 152
dsep_index for a property (PHP $o->items[] = v): a struct field
of type dyn or a map entry with that string key; an absent map
entry gives nil; other cases behave exactly as get_prop.
DCallShape = 153
Dynamic call with a call shape: dst = callee(...) with the window
dst+1 ..= dst+n laid out by shapes[shape] (positional, named,
spread, named spread), bound to the callee’s parameter list
(ArgumentError E0114 when they do not bind); non-callables go to
the call_shape hook, or to call when no argument is named.
DParamRef = 154
dst = whether a positional argument at position pos (an i64)
would be taken by reference by callee, so a code generator can
send a reference or a value (PHP decides per argument at run time).
False for non-callables, callees without a parameter list, and
negative positions. Never raises.
DParamRefNamed = 155
dst = whether a named argument name would be taken by reference
by callee. Never raises.
ErrPayload = 156
dst = the payload of a runtime error value (what raise gave it;
nil for errors raised by instructions), or nil for any other value.
Jmp = 160
Continue at target.
JmpIf = 161
Continue at target if cond is true, else fall through.
JmpIfNot = 162
Continue at target if cond is false, else fall through.
Switch = 163
Continue at tables[table].targets[src] if 0 <= src < len, else at
the table’s default.
Call = 164
dst = func(dst+1, ..., dst+argc); a call to a function with no
result leaves dst untouched.
CallIndirect = 165
dst = callee(dst+1, ..., dst+argc) through a typed function
reference (ref of a function type).
CallImport = 166
dst = import(dst+1, ..., dst+argc): a host call.
TailCall = 167
Replaces the running frame with a call to func(args, ..., args+argc-1); the callee’s results equal the caller’s.
TailCallIndirect = 168
Tail call through a typed function reference.
Ret = 169
Return src to the caller.
RetVoid = 170
Return with no result.
Throw = 171
Raise src as an error: control moves to the innermost covering
handler, in this frame or a caller’s.
ErrCode = 172
dst = the numeric ErrorKind code of a caught
runtime error, or 0 for any other value.
Safepoint = 173
A point where the garbage collector may run and fuel is charged. Calls and allocations are safepoints too; every loop must pass one.
Unreachable = 174
Abort the run with Unreachable (E0109).
Raise = 175
Raise the runtime error kind (any catchable kind) with src as its
payload, at this pc: how a code generator raises HIR’s NoMatch
(E0200) with the scrutinee, or an ArgumentError from a prologue.
MakeClosure = 176
dst = a closure of func capturing, by value, the registers
dst+1 ..= dst+n (n = the function’s capture count).
GetUpval = 177
dst = the running closure’s captured value idx.
NewCell = 178
dst = a new cell of type ty holding src.
CellGet = 179
dst = the value in cell (a ref to a cell type, or a dyn
holding a cell or a reference; TypeError otherwise).
CellSet = 180
Store src into cell (operand rules as cell_get).
NewRef = 181
dst = a new reference holding src (a variable taken by reference,
PHP $r = &$x when $x is not yet one). (A)
DRefIndex = 182
dst = a reference to the slot obj[key] (PHP &$a[k]): the slot’s
reference if it holds one; else the slot (created with nil if
absent in a map) is separated as by dsep_index and replaced by a
new reference holding its value. (A)
DRefProp = 183
dst = a reference to the property obj.name (PHP &$o->p): a
struct field of type dyn, or a map entry with that string key
(created with nil if absent). (A)
DBindIndex = 184
Make the slot obj[key] the reference src (PHP $a[k] = &$x),
replacing what the slot held (a previous reference is unbound, not
written through). TypeError if src is not a reference. (A)
DBindProp = 185
Make the property obj.name the reference src (PHP $o->p = &$x). (A)
DUnrefIndex = 186
If the slot obj[key] holds a reference, replace it by the
reference’s current value (a container value separated as by dup);
else nothing. Lets a code generator end a reference’s hold on a slot
it can prove no other holder uses (PHP drops such references when it
copies the array).
DUnrefProp = 187
dunref_index for a property.
NewStruct = 192
dst = a new instance of struct type ty, every field at its
type’s default.
GetField = 193
dst = obj.field.
SetField = 194
obj.field = src.
NewArray = 195
dst = a new array of type ty with len (an i64, at least 0)
default elements.
ArrayLen = 196
dst = the array’s length (i64).
ArrayGet = 197
dst = arr[idx]; IndexOutOfBounds unless 0 <= idx < len.
ArraySet = 198
arr[idx] = src; IndexOutOfBounds unless 0 <= idx < len.
ArrayPush = 199
Append src to the array.
ArrayPop = 200
dst = the removed last element; IndexOutOfBounds if empty.
NewMap = 201
dst = a new, empty map of type ty.
MapLen = 202
dst = the number of entries (i64).
MapGet = 203
dst = map[key]; KeyNotFound if absent.
MapFind = 204
dst = map[key], or nil if absent (value type dyn, str, or
ref).
MapHas = 205
dst = whether key is present.
MapSet = 206
map[key] = src: a new key goes last; an existing key keeps its
position.
MapDel = 207
Remove key if present; the other entries keep their order.
MapPush = 208
Append src under the next integer key (PHP $a[] = v): one more
than the largest integer key ever inserted, or 0.
IterNew = 209
dst = a typed iterator over the array or map src.
IterNext = 210
Advance: if another element exists, val = its value and has =
true; else has = false and val is untouched.
IterKey = 211
dst = the key of the element the last iter_next produced.
Dup = 212
dst = a shallow copy of src (array, map, struct, or cell; a new
identity, so value semantics such as PHP’s array assignment are
explicit; O(1), the contents copied on the first write). Reference
slots stay shared between the copies. Strings and callables are
returned as is; iterators, coroutines, and references raise
TypeError.
StrLen = 224
dst = the length in bytes (i64).
StrConcat = 225
dst = lhs ++ rhs.
StrConcatN = 226
dst = the concatenation of the count strings in first .. first+count (the empty string if count is 0).
StrEq = 227
dst = whether the strings have equal bytes.
StrCmp = 228
dst = -1, 0, or 1 (i8) by bytewise lexicographic order.
StrSlice = 229
dst = s[start..end] by byte offset, start in range and end in
range+1 (both i64); IndexOutOfBounds unless 0 <= start <= end <= len; with utf8, InvalidStrIndex if a bound splits a character.
StrByte = 230
dst = the byte at idx (u8); IndexOutOfBounds unless 0 <= idx < len.
CoroNew = 240
dst = a new coroutine, state created, that will run
func(dst+1, ..., dst+argc) when first resumed. The arguments are
copied now. (A)
CoroNewIndirect = 241
dst = a new coroutine running the closure or function reference
callee with the arguments dst+1 ..= dst+argc (converted from
dyn as dcall does when callee is dyn). (A)
Yield = 242
Suspend the running coroutine in state yielded, handing src to
its resumer under the next automatic key (PHP’s generator rule: one
more than the largest integer key yielded so far, never below 0, so
after only yield -5 => x it is 0); when resumed,
dst = the value sent. The yield is an unwind point: resume_throw
and coro_close raise here. CannotSuspend (E0111) outside a
coroutine or across a host frame.
Await = 243
Suspend the running coroutine in state awaiting, handing the
awaitable src to its resumer (the scheduler); when resumed, dst =
the value sent (the awaited result), or the error sent by
resume_throw is raised here. CannotSuspend as yield.
Resume = 244
Resume coro (state created, yielded, or awaiting), sending
src; when it next suspends or finishes, dst = the value it
yielded, the awaitable it awaits, or its return value (nil for a void
body). An error escaping its body marks it failed and is raised
here. InvalidCoroState (E0110) for any other state.
ResumeThrow = 245
Resume coro by raising src at its suspension point (in a
created coroutine: before its first instruction, where no handler
covers it). Otherwise as resume.
CoroStatus = 246
dst = the CoroState code of coro, as a
u8.
CoroCurrent = 247
dst = the running coroutine, or nil on the main stack.
YieldKv = 249
As yield, with an explicit key (PHP yield $k => $v); an integer
key larger than any before it moves the automatic-key counter.
CoroClose = 250
Close coro (Python close()/aclose(), PHP generator
destruction): created → returned without running; returned or
failed → nothing. A suspended coroutine is marked closing and
src (the close signal, e.g. GeneratorExit) is raised at its
suspension point, so its finally blocks run. If the body then
returns, or the error escaping it is src itself, the close
succeeds (returned; dst = the return value or nil). Another
error marks it failed and is raised here. An await while closing
suspends normally (dst = the awaitable; drive it with resume); a
yield while closing leaves it suspended there and raises
CloseIgnored (E0113) here.
CoroKey = 251
dst = the key of the value coro most recently yielded, or nil
before its first yield (PHP Generator::key()).
CoroResult = 252
dst = the return value of a returned coroutine (Python’s
StopIteration.value, PHP Generator::getReturn()), nil for a void
body. InvalidCoroState (E0110) in any other state.
Spawn = 248
Start a task: make a coroutine as coro_new_indirect does and pass
it to the module’s spawn hook (the host scheduler); dst = the
hook’s result (a task handle). NoScheduler (E0112) without the hook.
(A)
Implementations§
Source§impl Opcode
impl Opcode
Sourcepub const fn from_u8(byte: u8) -> Option<Opcode>
pub const fn from_u8(byte: u8) -> Option<Opcode>
The opcode with this byte, or None.
§Examples
use bytecode_lang::Opcode;
assert_eq!(Opcode::from_u8(0xa0), Some(Opcode::Jmp));
assert_eq!(Opcode::from_u8(0xff), None);