Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-js

Source of release 0.6.0

0.6.0 / src / engine / opcodes_table.lucb

#==============================================================================================
#
#   opcodes_table - The bytecode opcodes and their shapes
#
#   DESCRIPTION:
#       Generated by tools/engine_tables.py from quickjs-opcode.h; do not edit.
#       `Op` holds the opcodes the interpreter runs, the short forms included.
#       `TempOp` holds the compiler's temporary opcodes of phases 1 and 2: in C
#       their values overlap the short opcodes (OP_TEMP_START = OP_nop + 1), so
#       they live in their own enum and bytecode in those phases is read through
#       `is_temp_op`.
#
#==============================================================================================

## The bytecode operand formats (OPCodeFormat).
enum OpFormat as u8:
    none_ = 0
    none_int = 1
    none_loc = 2
    none_arg = 3
    none_var_ref = 4
    u8_ = 5
    i8_ = 6
    loc8 = 7
    const8 = 8
    label8 = 9
    u16_ = 10
    i16_ = 11
    label16 = 12
    npop = 13
    npopx = 14
    npop_u16 = 15
    loc = 16
    arg = 17
    var_ref = 18
    u32_ = 19
    i32_ = 20
    const_ = 21
    label = 22
    atom = 23
    atom_u8 = 24
    atom_u16 = 25
    atom_label_u8 = 26
    atom_label_u16 = 27
    label_u16 = 28

## The bytecode opcodes (OPCodeEnum, without the temporary ones).
enum Op as u8:
    invalid = 0
    push_i32 = 1
    push_const = 2
    fclosure = 3
    push_atom_value = 4
    private_symbol = 5
    undefined = 6
    null = 7
    push_this = 8
    push_false = 9
    push_true = 10
    object = 11
    special_object = 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
    call_constructor = 33
    call = 34
    tail_call = 35
    call_method = 36
    tail_call_method = 37
    array_from = 38
    apply = 39
    return_ = 40
    return_undef = 41
    check_ctor_return = 42
    check_ctor = 43
    init_ctor = 44
    check_brand = 45
    add_brand = 46
    return_async = 47
    throw = 48
    throw_error = 49
    eval = 50
    apply_eval = 51
    regexp = 52
    get_super = 53
    import_ = 54
    get_var_undef = 55
    get_var = 56
    put_var = 57
    put_var_init = 58
    get_ref_value = 59
    put_ref_value = 60
    get_field = 61
    get_field2 = 62
    put_field = 63
    get_private_field = 64
    put_private_field = 65
    define_private_field = 66
    get_array_el = 67
    get_array_el2 = 68
    get_array_el3 = 69
    put_array_el = 70
    get_super_value = 71
    put_super_value = 72
    define_field = 73
    set_name = 74
    set_name_computed = 75
    set_proto = 76
    set_home_object = 77
    define_array_el = 78
    append = 79
    copy_data_properties = 80
    define_method = 81
    define_method_computed = 82
    define_class = 83
    define_class_computed = 84
    get_loc = 85
    put_loc = 86
    set_loc = 87
    get_arg = 88
    put_arg = 89
    set_arg = 90
    get_var_ref = 91
    put_var_ref = 92
    set_var_ref = 93
    set_loc_uninitialized = 94
    get_loc_check = 95
    put_loc_check = 96
    set_loc_check = 97
    put_loc_check_init = 98
    get_loc_checkthis = 99
    get_var_ref_check = 100
    put_var_ref_check = 101
    put_var_ref_check_init = 102
    close_loc = 103
    if_false = 104
    if_true = 105
    goto_ = 106
    catch_ = 107
    gosub = 108
    ret = 109
    nip_catch = 110
    to_object = 111
    to_propkey = 112
    with_get_var = 113
    with_put_var = 114
    with_delete_var = 115
    with_make_ref = 116
    with_get_ref = 117
    make_loc_ref = 118
    make_arg_ref = 119
    make_var_ref_ref = 120
    make_var_ref = 121
    for_in_start = 122
    for_of_start = 123
    for_await_of_start = 124
    for_in_next = 125
    for_of_next = 126
    for_await_of_next = 127
    iterator_check_object = 128
    iterator_get_value_done = 129
    iterator_close = 130
    iterator_next = 131
    iterator_call = 132
    initial_yield = 133
    yield = 134
    yield_star = 135
    async_yield_star = 136
    await = 137
    neg = 138
    plus = 139
    dec = 140
    inc = 141
    post_dec = 142
    post_inc = 143
    dec_loc = 144
    inc_loc = 145
    add_loc = 146
    not_ = 147
    lnot = 148
    typeof = 149
    delete = 150
    delete_var = 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
    strict_eq = 169
    strict_neq = 170
    and_ = 171
    xor = 172
    or_ = 173
    is_undefined_or_null = 174
    private_in = 175
    push_bigint_i32 = 176
    nop = 177
    push_minus1 = 178
    push_0 = 179
    push_1 = 180
    push_2 = 181
    push_3 = 182
    push_4 = 183
    push_5 = 184
    push_6 = 185
    push_7 = 186
    push_i8 = 187
    push_i16 = 188
    push_const8 = 189
    fclosure8 = 190
    push_empty_string = 191
    get_loc8 = 192
    put_loc8 = 193
    set_loc8 = 194
    get_loc0 = 195
    get_loc1 = 196
    get_loc2 = 197
    get_loc3 = 198
    put_loc0 = 199
    put_loc1 = 200
    put_loc2 = 201
    put_loc3 = 202
    set_loc0 = 203
    set_loc1 = 204
    set_loc2 = 205
    set_loc3 = 206
    get_arg0 = 207
    get_arg1 = 208
    get_arg2 = 209
    get_arg3 = 210
    put_arg0 = 211
    put_arg1 = 212
    put_arg2 = 213
    put_arg3 = 214
    set_arg0 = 215
    set_arg1 = 216
    set_arg2 = 217
    set_arg3 = 218
    get_var_ref0 = 219
    get_var_ref1 = 220
    get_var_ref2 = 221
    get_var_ref3 = 222
    put_var_ref0 = 223
    put_var_ref1 = 224
    put_var_ref2 = 225
    put_var_ref3 = 226
    set_var_ref0 = 227
    set_var_ref1 = 228
    set_var_ref2 = 229
    set_var_ref3 = 230
    get_length = 231
    if_false8 = 232
    if_true8 = 233
    goto8 = 234
    goto16 = 235
    call0 = 236
    call1 = 237
    call2 = 238
    call3 = 239
    is_undefined = 240
    is_null = 241
    typeof_is_undefined = 242
    typeof_is_function = 243

## The number of real opcodes (OP_COUNT).
let op_count: u32 = 244
## The first temporary opcode's value (OP_TEMP_START).
let op_temp_start: u32 = 178
## One past the last temporary opcode's value (OP_TEMP_END).
let op_temp_end: u32 = 197

## The compiler's temporary opcodes; values overlap the short opcodes.
enum TempOp as u8:
    enter_scope = 178
    leave_scope = 179
    label = 180
    scope_get_var_undef = 181
    scope_get_var = 182
    scope_put_var = 183
    scope_delete_var = 184
    scope_make_ref = 185
    scope_get_ref = 186
    scope_put_var_init = 187
    scope_get_var_checkthis = 188
    scope_get_private_field = 189
    scope_get_private_field2 = 190
    scope_put_private_field = 191
    scope_in_private_field = 192
    get_field_opt_chain = 193
    get_array_el_opt_chain = 194
    set_class_name = 195
    line_num = 196

## Whether byte `op` of phase 1 or 2 bytecode is a temporary opcode.
func is_temp_op(op: u8) -> bool:
    return (u32)op >= op_temp_start and (u32)op < op_temp_end

## An opcode's encoded size in bytes, its stack effect and its operand format (JSOpCode).
struct OpCodeInfo:
    let size: u8
    let n_pop: u8
    let n_push: u8
    let fmt: OpFormat

## Every real opcode's shape, then every temporary opcode's (opcode_info).
let opcode_info: OpCodeInfo[263] = [
    OpCodeInfo(size = 1, n_pop = 0, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.i32_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.const_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.const_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 1, fmt = OpFormat.u8_),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.u16_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 6, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 5, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 5, n_push = 5, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 5, n_push = 5, fmt = OpFormat.none_),
    OpCodeInfo(size = 3, n_pop = 2, n_push = 1, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 1, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 2, n_push = 1, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 2, n_push = 0, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.npop),
    OpCodeInfo(size = 3, n_pop = 3, n_push = 1, fmt = OpFormat.u16_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 6, n_pop = 0, n_push = 0, fmt = OpFormat.atom_u8),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 1, fmt = OpFormat.npop_u16),
    OpCodeInfo(size = 3, n_pop = 2, n_push = 1, fmt = OpFormat.u16_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 2, fmt = OpFormat.atom),
    OpCodeInfo(size = 5, n_pop = 2, n_push = 0, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 2, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 3, n_push = 3, fmt = OpFormat.u8_),
    OpCodeInfo(size = 6, n_pop = 2, n_push = 1, fmt = OpFormat.atom_u8),
    OpCodeInfo(size = 2, n_pop = 3, n_push = 1, fmt = OpFormat.u8_),
    OpCodeInfo(size = 6, n_pop = 2, n_push = 2, fmt = OpFormat.atom_u8),
    OpCodeInfo(size = 6, n_pop = 3, n_push = 3, fmt = OpFormat.atom_u8),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 1, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.arg),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.arg),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 1, fmt = OpFormat.arg),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 1, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 0, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 1, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.loc),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 1, n_push = 0, fmt = OpFormat.var_ref),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 0, fmt = OpFormat.loc),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 0, fmt = OpFormat.label),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 0, fmt = OpFormat.label),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 0, fmt = OpFormat.label),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.label),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 0, fmt = OpFormat.label),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 10, n_pop = 1, n_push = 0, fmt = OpFormat.atom_label_u8),
    OpCodeInfo(size = 10, n_pop = 2, n_push = 1, fmt = OpFormat.atom_label_u8),
    OpCodeInfo(size = 10, n_pop = 1, n_push = 0, fmt = OpFormat.atom_label_u8),
    OpCodeInfo(size = 10, n_pop = 1, n_push = 0, fmt = OpFormat.atom_label_u8),
    OpCodeInfo(size = 10, n_pop = 1, n_push = 0, fmt = OpFormat.atom_label_u8),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 2, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 3, n_push = 5, fmt = OpFormat.u8_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 3, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 3, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 4, n_push = 4, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 4, n_push = 5, fmt = OpFormat.u8_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 2, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 0, fmt = OpFormat.loc8),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 0, fmt = OpFormat.loc8),
    OpCodeInfo(size = 2, n_pop = 1, n_push = 0, fmt = OpFormat.loc8),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 1, fmt = OpFormat.i32_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 0, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_int),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 1, fmt = OpFormat.i8_),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 1, fmt = OpFormat.i16_),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 1, fmt = OpFormat.const8),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 1, fmt = OpFormat.const8),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 1, fmt = OpFormat.loc8),
    OpCodeInfo(size = 2, n_pop = 1, n_push = 0, fmt = OpFormat.loc8),
    OpCodeInfo(size = 2, n_pop = 1, n_push = 1, fmt = OpFormat.loc8),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_loc),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_arg),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 0, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 0, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_var_ref),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 2, n_pop = 1, n_push = 0, fmt = OpFormat.label8),
    OpCodeInfo(size = 2, n_pop = 1, n_push = 0, fmt = OpFormat.label8),
    OpCodeInfo(size = 2, n_pop = 0, n_push = 0, fmt = OpFormat.label8),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 0, fmt = OpFormat.label16),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.npopx),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.npopx),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.npopx),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.npopx),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 1, n_pop = 1, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 0, fmt = OpFormat.u16_),
    OpCodeInfo(size = 3, n_pop = 0, n_push = 0, fmt = OpFormat.u16_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 0, fmt = OpFormat.label),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 1, n_push = 0, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 11, n_pop = 0, n_push = 2, fmt = OpFormat.atom_label_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 0, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 1, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 1, n_push = 2, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 2, n_push = 0, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 7, n_pop = 1, n_push = 1, fmt = OpFormat.atom_u16),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 1, fmt = OpFormat.atom),
    OpCodeInfo(size = 1, n_pop = 2, n_push = 1, fmt = OpFormat.none_),
    OpCodeInfo(size = 5, n_pop = 1, n_push = 1, fmt = OpFormat.u32_),
    OpCodeInfo(size = 5, n_pop = 0, n_push = 0, fmt = OpFormat.u32_),
]

## The shape of opcode byte `op`, reading the temporary opcodes' values as temporary.
func op_info(op: u8, temporary: bool) -> const OpCodeInfo*:
    if temporary and is_temp_op(op):
        return &opcode_info[(usize)op - op_temp_start + op_count]
    return &opcode_info[(usize)op]

## Each real opcode's name, for bytecode dumps.
let opcode_names: str[244] = [
    "invalid",
    "push_i32",
    "push_const",
    "fclosure",
    "push_atom_value",
    "private_symbol",
    "undefined",
    "null",
    "push_this",
    "push_false",
    "push_true",
    "object",
    "special_object",
    "rest",
    "drop",
    "nip",
    "nip1",
    "dup",
    "dup1",
    "dup2",
    "dup3",
    "insert2",
    "insert3",
    "insert4",
    "perm3",
    "perm4",
    "perm5",
    "swap",
    "swap2",
    "rot3l",
    "rot3r",
    "rot4l",
    "rot5l",
    "call_constructor",
    "call",
    "tail_call",
    "call_method",
    "tail_call_method",
    "array_from",
    "apply",
    "return",
    "return_undef",
    "check_ctor_return",
    "check_ctor",
    "init_ctor",
    "check_brand",
    "add_brand",
    "return_async",
    "throw",
    "throw_error",
    "eval",
    "apply_eval",
    "regexp",
    "get_super",
    "import",
    "get_var_undef",
    "get_var",
    "put_var",
    "put_var_init",
    "get_ref_value",
    "put_ref_value",
    "get_field",
    "get_field2",
    "put_field",
    "get_private_field",
    "put_private_field",
    "define_private_field",
    "get_array_el",
    "get_array_el2",
    "get_array_el3",
    "put_array_el",
    "get_super_value",
    "put_super_value",
    "define_field",
    "set_name",
    "set_name_computed",
    "set_proto",
    "set_home_object",
    "define_array_el",
    "append",
    "copy_data_properties",
    "define_method",
    "define_method_computed",
    "define_class",
    "define_class_computed",
    "get_loc",
    "put_loc",
    "set_loc",
    "get_arg",
    "put_arg",
    "set_arg",
    "get_var_ref",
    "put_var_ref",
    "set_var_ref",
    "set_loc_uninitialized",
    "get_loc_check",
    "put_loc_check",
    "set_loc_check",
    "put_loc_check_init",
    "get_loc_checkthis",
    "get_var_ref_check",
    "put_var_ref_check",
    "put_var_ref_check_init",
    "close_loc",
    "if_false",
    "if_true",
    "goto",
    "catch",
    "gosub",
    "ret",
    "nip_catch",
    "to_object",
    "to_propkey",
    "with_get_var",
    "with_put_var",
    "with_delete_var",
    "with_make_ref",
    "with_get_ref",
    "make_loc_ref",
    "make_arg_ref",
    "make_var_ref_ref",
    "make_var_ref",
    "for_in_start",
    "for_of_start",
    "for_await_of_start",
    "for_in_next",
    "for_of_next",
    "for_await_of_next",
    "iterator_check_object",
    "iterator_get_value_done",
    "iterator_close",
    "iterator_next",
    "iterator_call",
    "initial_yield",
    "yield",
    "yield_star",
    "async_yield_star",
    "await",
    "neg",
    "plus",
    "dec",
    "inc",
    "post_dec",
    "post_inc",
    "dec_loc",
    "inc_loc",
    "add_loc",
    "not",
    "lnot",
    "typeof",
    "delete",
    "delete_var",
    "mul",
    "div",
    "mod",
    "add",
    "sub",
    "pow",
    "shl",
    "sar",
    "shr",
    "lt",
    "lte",
    "gt",
    "gte",
    "instanceof",
    "in",
    "eq",
    "neq",
    "strict_eq",
    "strict_neq",
    "and",
    "xor",
    "or",
    "is_undefined_or_null",
    "private_in",
    "push_bigint_i32",
    "nop",
    "push_minus1",
    "push_0",
    "push_1",
    "push_2",
    "push_3",
    "push_4",
    "push_5",
    "push_6",
    "push_7",
    "push_i8",
    "push_i16",
    "push_const8",
    "fclosure8",
    "push_empty_string",
    "get_loc8",
    "put_loc8",
    "set_loc8",
    "get_loc0",
    "get_loc1",
    "get_loc2",
    "get_loc3",
    "put_loc0",
    "put_loc1",
    "put_loc2",
    "put_loc3",
    "set_loc0",
    "set_loc1",
    "set_loc2",
    "set_loc3",
    "get_arg0",
    "get_arg1",
    "get_arg2",
    "get_arg3",
    "put_arg0",
    "put_arg1",
    "put_arg2",
    "put_arg3",
    "set_arg0",
    "set_arg1",
    "set_arg2",
    "set_arg3",
    "get_var_ref0",
    "get_var_ref1",
    "get_var_ref2",
    "get_var_ref3",
    "put_var_ref0",
    "put_var_ref1",
    "put_var_ref2",
    "put_var_ref3",
    "set_var_ref0",
    "set_var_ref1",
    "set_var_ref2",
    "set_var_ref3",
    "get_length",
    "if_false8",
    "if_true8",
    "goto8",
    "goto16",
    "call0",
    "call1",
    "call2",
    "call3",
    "is_undefined",
    "is_null",
    "typeof_is_undefined",
    "typeof_is_function",
]