# Duktape opcode metadata for debugger.
# - See duk_debug.js for the argument formats (A_R etc).
# - Flag bits are for the whole instruction as a 32-bit integer,
#   they are not field shifted
#
# NOTE: Use YAML comments only on comment-only lines (not trailing content):
# Node.js 'yamljs' seems to refuse parsing trailing comments in some cases.

opcodes:
  - name: LDREG
    args:
      - A_R
      - BC_R
  - name: STREG
    args:
      - A_R
      - BC_R
  - name: JUMP
    args:
      - ABC_JUMP
  - name: LDCONST
    args:
      - A_R
      - BC_C
  - name: LDINT
    args:
      - A_R
      - BC_LDINT
  - name: LDINTX
    args:
      - A_R
      - BC_LDINTX
  - name: LDTHIS
    args:
      - BC_R
  - name: LDUNDEF
    args:
      - BC_R
  - name: LDNULL
    args:
      - BC_R
  - name: LDTRUE
    args:
      - BC_R
  - name: LDFALSE
    args:
      - BC_R
  - name: GETVAR
    args:
      - A_R
      - BC_C
  - name: BNOT
    args:
      - A_R
      - BC_R
  - name: LNOT
    args:
      - A_R
      - BC_R
  - name: UNM
    args:
      - A_R
      - BC_R
  - name: UNP
    args:
      - A_R
      - BC_R
  - name: EQ_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: EQ_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: EQ_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: EQ_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: NEQ_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: NEQ_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: NEQ_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: NEQ_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: SEQ_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: SEQ_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: SEQ_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: SEQ_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: SNEQ_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: SNEQ_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: SNEQ_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: SNEQ_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: GT_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: GT_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: GT_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: GT_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: GE_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: GE_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: GE_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: GE_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: LT_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: LT_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: LT_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: LT_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: LE_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: LE_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: LE_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: LE_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: IFTRUE_R
    args:
      - BC_R
  - name: IFTRUE_C
    args:
      - BC_C
  - name: IFFALSE_R
    args:
      - BC_R
  - name: IFFALSE_C
    args:
      - BC_C
  - name: ADD_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: ADD_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: ADD_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: ADD_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: SUB_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: SUB_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: SUB_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: SUB_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: MUL_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: MUL_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: MUL_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: MUL_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: DIV_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: DIV_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: DIV_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: DIV_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: MOD_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: MOD_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: MOD_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: MOD_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: EXP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: EXP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: EXP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: EXP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BAND_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BAND_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BAND_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BAND_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BOR_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BOR_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BOR_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BOR_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BXOR_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BXOR_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BXOR_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BXOR_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BASL_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BASL_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BASL_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BASL_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BLSR_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BLSR_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BLSR_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BLSR_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: BASR_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: BASR_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: BASR_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: BASR_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: INSTOF_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: INSTOF_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: INSTOF_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: INSTOF_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: IN_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: IN_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: IN_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: IN_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: GETPROP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: GETPROP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: GETPROP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: GETPROP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: PUTPROP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: PUTPROP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: PUTPROP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: PUTPROP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: DELPROP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: DELPROP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: DELPROP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: DELPROP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: PREINCR
    args:
      - A_R
      - BC_R
  - name: PREDECR
    args:
      - A_R
      - BC_R
  - name: POSTINCR
    args:
      - A_R
      - BC_R
  - name: POSTDECR
    args:
      - A_R
      - BC_R
  - name: PREINCV
    args:
      - A_R
      - BC_C
  - name: PREDECV
    args:
      - A_R
      - BC_C
  - name: POSTINCV
    args:
      - A_R
      - BC_C
  - name: POSTDECV
    args:
      - A_R
      - BC_C
  - name: PREINCP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: PREINCP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: PREINCP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: PREINCP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: PREDECP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: PREDECP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: PREDECP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: PREDECP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: POSTINCP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: POSTINCP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: POSTINCP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: POSTINCP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: POSTDECP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: POSTDECP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: POSTDECP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: POSTDECP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: DECLVAR_RR
    args:
      - A_H
      - B_R
      - C_R
    flags:
      - mask: 0x100
        name: writable
      - mask: 0x200
        name: enumerable
      - mask: 0x400
        name: configurable
      - mask: 0x800
        name: accessor
      - mask: 0x1000
        name: func_decl
  - name: DECLVAR_CR
    args:
      - A_H
      - B_C
      - C_R
    flags:
      - mask: 0x100
        name: writable
      - mask: 0x200
        name: enumerable
      - mask: 0x400
        name: configurable
      - mask: 0x800
        name: accessor
      - mask: 0x1000
        name: func_decl
  - name: DECLVAR_RC
    args:
      - A_H
      - B_R
      - C_C
    flags:
      - mask: 0x100
        name: writable
      - mask: 0x200
        name: enumerable
      - mask: 0x400
        name: configurable
      - mask: 0x800
        name: accessor
      - mask: 0x1000
        name: func_decl
  - name: DECLVAR_CC
    args:
      - A_H
      - B_C
      - C_C
    flags:
      - mask: 0x100
        name: writable
      - mask: 0x200
        name: enumerable
      - mask: 0x400
        name: configurable
      - mask: 0x800
        name: accessor
      - mask: 0x1000
        name: func_decl
  - name: REGEXP_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: REGEXP_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: REGEXP_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: REGEXP_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: CLOSURE
    args:
      - A_R
      - BC_I
  - name: TYPEOF
    args:
      - A_R
      - BC_R
  - name: TYPEOFID
    args:
      - A_R
      - BC_C
  - name: PUTVAR
    args:
      - A_R
      - BC_C
  - name: DELVAR
    args:
      - A_R
      - BC_C
  - name: RETREG
    args:
      - BC_R
  - name: RETUNDEF
  - name: RETCONST
    args:
      - BC_C
  - name: RETCONSTN
    args:
      - BC_C
  - name: LABEL
    args:
      - BC_I
  - name: ENDLABEL
    args:
      - BC_I
  - name: BREAK
    args:
      - BC_I
  - name: CONTINUE
    args:
      - BC_I
  - name: TRYCATCH
    args:
      - A_H
      # base register for two consecutive regs (base_reg + 0, base_reg + 1) used for two things:
      # - input: either 'with' target register or catch varname constant (base_reg + 0), depending on flags
      # - output: when caught, catch value (base_reg + 0) and type (base_reg + 1)
      - BC_R
    flags:
      - mask: 0x100
        name: have_catch
      - mask: 0x200
        name: have_finally
      - mask: 0x400
        name: catch_binding
      - mask: 0x800
        name: with_binding
  - name: ENDTRY
  - name: ENDCATCH
  - name: ENDFIN
    args:
      - ABC_R
  - name: THROW
    args:
      - BC_R
  - name: INVLHS
  - name: CSREG
    args:
      - A_R
      - BC_R
  - name: CSVAR_RR
    args:
      - A_R
      - B_R
  - name: CSVAR_CR
    args:
      - A_R
      - B_C
  - name: CSVAR_RC
    args:
      - A_R
      - B_R
  - name: CSVAR_CC
    args:
      - A_R
      - B_C
  - name: CALL0
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL1
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL2
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL3
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL4
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL5
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL6
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL7
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL8
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL9
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL10
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL11
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL12
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL13
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL14
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: CALL15
    args:
      - A_I
      - BC_R
    flags:
      - mask: 0x01
        name: tailcall
      - mask: 0x02
        name: construct
      - mask: 0x04
        name: called_as_eval
      - mask: 0x08
        name: indirect
  - name: NEWOBJ
    args:
      - A_I  # property count init size
      - BC_R
  - name: NEWARR
    args:
      - A_I  # array item count init size
      - BC_R
  - name: MPUTOBJ
    args:
      - A_R
      - B_R
      - C_I
  - name: MPUTOBJI
    args:
      - A_R
      - B_RI
      - C_I
  - name: INITSET
    args:
      - A_R
      - BC_R
  - name: INITGET
    args:
      - A_R
      - BC_R
  - name: MPUTARR
    args:
      - A_R
      - B_R
      - C_I
  - name: MPUTARRI
    args:
      - A_R
      - B_RI
      - C_I
  - name: SETALEN
    args:
      - B_R
      - C_R
  - name: INITENUM
    args:
      - B_R
      - C_R
  - name: NEXTENUM
    args:
      - B_R
      - C_R
  - name: NEWTARGET
    args:
      - BC_R
  - name: DEBUGGER
  - name: NOP
    args:
      - ABC_I
  - name: INVALID
    args:
      - ABC_I
  - name: UNUSED207
  - name: GETPROPC_RR
    args:
      - A_R
      - B_R
      - C_R
  - name: GETPROPC_CR
    args:
      - A_R
      - B_C
      - C_R
  - name: GETPROPC_RC
    args:
      - A_R
      - B_R
      - C_C
  - name: GETPROPC_CC
    args:
      - A_R
      - B_C
      - C_C
  - name: UNUSED212
  - name: UNUSED213
  - name: UNUSED214
  - name: UNUSED215
  - name: UNUSED216
  - name: UNUSED217
  - name: UNUSED218
  - name: UNUSED219
  - name: UNUSED220
  - name: UNUSED221
  - name: UNUSED222
  - name: UNUSED223
  - name: UNUSED224
  - name: UNUSED225
  - name: UNUSED226
  - name: UNUSED227
  - name: UNUSED228
  - name: UNUSED229
  - name: UNUSED230
  - name: UNUSED231
  - name: UNUSED232
  - name: UNUSED233
  - name: UNUSED234
  - name: UNUSED235
  - name: UNUSED236
  - name: UNUSED237
  - name: UNUSED238
  - name: UNUSED239
  - name: UNUSED240
  - name: UNUSED241
  - name: UNUSED242
  - name: UNUSED243
  - name: UNUSED244
  - name: UNUSED245
  - name: UNUSED246
  - name: UNUSED247
  - name: UNUSED248
  - name: UNUSED249
  - name: UNUSED250
  - name: UNUSED251
  - name: UNUSED252
  - name: UNUSED253
  - name: UNUSED254
  - name: UNUSED255
