• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/include/ucode/internal/vm.h

  1 /*
  2  * Copyright (C) 2020-2021 Jo-Philipp Wich <jo@mein.io>
  3  *
  4  * Permission to use, copy, modify, and/or distribute this software for any
  5  * purpose with or without fee is hereby granted, provided that the above
  6  * copyright notice and this permission notice appear in all copies.
  7  *
  8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 15  */
 16 
 17 /* Internal VM instruction set. */
 18 
 19 #ifndef UCODE_INTERNAL_VM_H
 20 #define UCODE_INTERNAL_VM_H
 21 
 22 #include "ucode/vm.h"
 23 
 24 #define __insns \
 25 __insn(NOOP) \
 26 __insn(LOAD) \
 27 __insn(LOAD8) \
 28 __insn(LOAD16) \
 29 __insn(LOAD32) \
 30 __insn(LTHIS) \
 31 __insn(LREXP) \
 32 __insn(LNULL) \
 33 __insn(LTRUE) \
 34 __insn(LFALSE) \
 35 __insn(LLOC) \
 36 __insn(LUPV) \
 37 __insn(LVAR) \
 38 __insn(LVAL) \
 39 __insn(PVAL) \
 40 __insn(CLFN) \
 41 __insn(ARFN) \
 42 __insn(SLOC) \
 43 __insn(SUPV) \
 44 __insn(SVAR) \
 45 __insn(SVAL) \
 46 __insn(ULOC) \
 47 __insn(UUPV) \
 48 __insn(UVAR) \
 49 __insn(UVAL) \
 50 __insn(NARR) \
 51 __insn(PARR) \
 52 __insn(MARR) \
 53 __insn(NOBJ) \
 54 __insn(SOBJ) \
 55 __insn(MOBJ) \
 56 __insn(BOR) \
 57 __insn(BXOR) \
 58 __insn(BAND) \
 59 __insn(EQS) \
 60 __insn(NES) \
 61 __insn(EQ) \
 62 __insn(NE) \
 63 __insn(LT) \
 64 __insn(LE) \
 65 __insn(GT) \
 66 __insn(GE) \
 67 __insn(IN) \
 68 __insn(LSHIFT) \
 69 __insn(RSHIFT) \
 70 __insn(ADD) \
 71 __insn(SUB) \
 72 __insn(MUL) \
 73 __insn(DIV) \
 74 __insn(MOD) \
 75 __insn(EXP) \
 76 __insn(NOT) \
 77 __insn(COMPL) \
 78 __insn(PLUS) \
 79 __insn(MINUS) \
 80 __insn(JMP) \
 81 __insn(JMPZ) \
 82 __insn(JMPNT) \
 83 __insn(COPY) \
 84 __insn(POP) \
 85 __insn(CUPV) \
 86 __insn(RETURN) \
 87 __insn(CALL) \
 88 __insn(PRINT) \
 89 __insn(NEXTK) \
 90 __insn(NEXTKV) \
 91 __insn(DELETE) \
 92 __insn(IMPORT) \
 93 __insn(EXPORT) \
 94 __insn(DYNLOAD)
 95 
 96 
 97 #undef __insn
 98 #define __insn(_name) I_##_name,
 99 
100 typedef enum {
101         __insns
102         __I_MAX
103 } uc_vm_insn_t;
104 
105 extern uint32_t insns[__I_MAX];
106 
107 extern const int8_t uc_vm_insn_format[__I_MAX];
108 
109 int8_t uc_vm_insn_to_argtype(uc_vm_insn_t insn);
110 
111 static inline bool
112 uc_vm_is_strict(uc_vm_t *vm)
113 {
114         return (vm->callframes.count && uc_vector_last(&vm->callframes)->strict);
115 }
116 
117 #endif /* UCODE_INTERNAL_VM_H */
118 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt