diff options
Diffstat (limited to 'src/interp.c')
-rw-r--r-- | src/interp.c | 416 |
1 files changed, 208 insertions, 208 deletions
diff --git a/src/interp.c b/src/interp.c index aa40c53..b858f26 100644 --- a/src/interp.c +++ b/src/interp.c @@ -7,214 +7,214 @@ * be returned. Included from src/interp.c */ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg params[paramc], bool run, void ***labels_wb) { - static void *labels[OPCODE_COUNT] = { - [MOVI] = &&MOVI, - [MOVI_F] = &&MOVI_F, - [MOVI_D] = &&MOVI_D, - [MOVR] = &&MOVR, - [MOVR_F] = &&MOVR_F, - [MOVR_D] = &&MOVR_D, - - [EXTR8] = &&EXTR8, - [EXTR16] = &&EXTR16, - [EXTR32] = &&EXTR32, - [EXTRU8] = &&EXTRU8, - [EXTRU16] = &&EXTRU16, - [EXTRU32] = &&EXTRU32, - [EXTRF] = &&EXTRF, - [EXTRD] = &&EXTRD, - - [ADDR] = &&ADDR, - [ADDR_F] = &&ADDR_F, - [ADDR_D] = &&ADDR_D, - [ADDI] = &&ADDI, - - [ABSR_F] = &&ABSR_F, - [ABSR_D] = &&ABSR_D, - - [SUBR] = &&SUBR, - [SUBR_F] = &&SUBR_F, - [SUBR_D] = &&SUBR_D, - [SUBI] = &&SUBI, - - [MULR] = &&MULR, - [MULR_F] = &&MULR_F, - [MULR_D] = &&MULR_D, - - [DIVR] = &&DIVR, - [DIVR_U] = &&DIVR_U, - [DIVR_F] = &&DIVR_F, - [DIVR_D] = &&DIVR_D, - - [REMR] = &&REMR, - [REMR_U] = &&REMR_U, - - [LSHI] = &&LSHI, - [LSHR] = &&LSHR, - [RSHI] = &&RSHI, - [RSHR] = &&RSHR, - [RSHI_U] = &&RSHI_U, - [RSHR_U] = &&RSHR_U, - - [ANDR] = &&ANDR, - [ANDI] = &&ANDI, - - [ORR] = &&ORR, - [ORI] = &&ORI, - - [XORR] = &&XORR, - [XORI] = &&XORI, - - [COMR] = &&COMR, - [NEGR] = &&NEGR, - [NEGR_F] = &&NEGR_F, - [NEGR_D] = &&NEGR_D, - - [EQR] = &&EQR, - [EQR_F] = &&EQR_F, - [EQR_D] = &&EQR_D, - - [NER] = &&NER, - [NER_F] = &&NER_F, - [NER_D] = &&NER_D, - - [GTR] = &>R, - [GTR_U] = &>R_U, - [GTR_F] = &>R_F, - [GTR_D] = &>R_D, - - [GER] = &&GER, - [GER_U] = &&GER_U, - [GER_F] = &&GER_F, - [GER_D] = &&GER_D, - - [STI8] = &&STI8, - [STI16] = &&STI16, - [STI32] = &&STI32, - [STI64] = &&STI64, - [STIF] = &&STIF, - [STID] = &&STID, - - [STXI8] = &&STXI8, - [STXI16] = &&STXI16, - [STXI32] = &&STXI32, - [STXI64] = &&STXI64, - [STXIF] = &&STXIF, - [STXID] = &&STXID, - - [STXR8] = &&STXR8, - [STXR16] = &&STXR16, - [STXR32] = &&STXR32, - [STXR64] = &&STXR64, - [STXRF] = &&STXRF, - [STXRD] = &&STXRD, - - [LDI8] = &&LDI8, - [LDI16] = &&LDI16, - [LDI32] = &&LDI32, - [LDI64] = &&LDI64, - [LDIU8] = &&LDIU8, - [LDIU16] = &&LDIU16, - [LDIU32] = &&LDIU32, - [LDIU64] = &&LDIU64, - [LDIF] = &&LDIF, - [LDID] = &&LDID, - - [LDXI8] = &&LDXI8, - [LDXI16] = &&LDXI16, - [LDXI32] = &&LDXI32, - [LDXI64] = &&LDXI64, - [LDXIU8] = &&LDXIU8, - [LDXIU16] = &&LDXIU16, - [LDXIU32] = &&LDXIU32, - [LDXIU64] = &&LDXIU64, - [LDXIF] = &&LDXIF, - [LDXID] = &&LDXID, - - [LDXR8] = &&LDXR8, - [LDXR16] = &&LDXR16, - [LDXR32] = &&LDXR32, - [LDXR64] = &&LDXR64, - [LDXRU8] = &&LDXRU8, - [LDXRU16] = &&LDXRU16, - [LDXRU32] = &&LDXRU32, - [LDXRU64] = &&LDXRU64, - [LDXRF] = &&LDXRF, - [LDXRD] = &&LDXRD, - - [TRUNCR_D_32] = &&TRUNCR_D_32, - [TRUNCR_D_64] = &&TRUNCR_D_64, - [TRUNCR_F_32] = &&TRUNCR_F_32, - [TRUNCR_F_64] = &&TRUNCR_F_64, - - [BNER] = &&BNER, - [BNEI] = &&BNEI, - [BNER_F] = &&BNER_F, - [BNER_D] = &&BNER_D, - - [BEQR] = &&BEQR, - [BEQI] = &&BEQI, - [BEQR_F] = &&BEQR_F, - [BEQR_D] = &&BEQR_D, - - [BGER] = &&BGER, - [BGER_U] = &&BGER_U, - [BGEI] = &&BGEI, - [BGEI_U] = &&BGEI_U, - [BGER_F] = &&BGER_F, - [BGER_D] = &&BGER_D, - - [BLEI] = &&BLEI, - [BLEI_U] = &&BLEI_U, - - [BGTR] = &&BGTR, - [BGTR_U] = &&BGTR_U, - [BGTI] = &&BGTI, - [BGTI_U] = &&BGTI_U, - [BGTR_F] = &&BGTR_F, - [BGTR_D] = &&BGTR_D, - - [BLTI] = &&BLTI, - [BLTI_U] = &&BLTI_U, - - [JMP] = &&JMP, - [JMPR] = &&JMPR, - - [BMCI] = &&BMCI, - [BMCR] = &&BMCR, - [BMSI] = &&BMSI, - [BMSR] = &&BMSR, - - [RETR] = &&RETR, - [RETI] = &&RETI, - [RETR_F] = &&RETR_F, - [RETI_F] = &&RETI_F, - [RETR_D] = &&RETR_D, - [RETI_D] = &&RETI_D, - - [RETVAL] = &&RETVAL, - [RETVAL_F] = &&RETVAL_F, - [RETVAL_D] = &&RETVAL_D, - - [ARG] = &&ARG, - [ARG_I] = &&ARG_I, - [ARG_F] = &&ARG_F, - [ARG_FI] = &&ARG_FI, - - [PARAM] = &&PARAM, - [PARAM_F] = &&PARAM_F, - - [CALLI_I] = &&CALLI_I, - [CALLI_L] = &&CALLI_L, - [CALLI_F] = &&CALLI_F, - [CALLI_D] = &&CALLI_D, - [ESCAPEI_I] = &&ESCAPEI_I, - [ESCAPEI_F] = &&ESCAPEI_F, - [ESCAPEI_L] = &&ESCAPEI_L, - [ESCAPEI_D] = &&ESCAPEI_D, - - [START] = &&START, - [END] = &&END, + static void *labels[EJIT_OPCODE_COUNT] = { + [EJIT_OP_MOVI] = &&MOVI, + [EJIT_OP_MOVI_F] = &&MOVI_F, + [EJIT_OP_MOVI_D] = &&MOVI_D, + [EJIT_OP_MOVR] = &&MOVR, + [EJIT_OP_MOVR_F] = &&MOVR_F, + [EJIT_OP_MOVR_D] = &&MOVR_D, + + [EJIT_OP_EXTR8] = &&EXTR8, + [EJIT_OP_EXTR16] = &&EXTR16, + [EJIT_OP_EXTR32] = &&EXTR32, + [EJIT_OP_EXTRU8] = &&EXTRU8, + [EJIT_OP_EXTRU16] = &&EXTRU16, + [EJIT_OP_EXTRU32] = &&EXTRU32, + [EJIT_OP_EXTRF] = &&EXTRF, + [EJIT_OP_EXTRD] = &&EXTRD, + + [EJIT_OP_ADDR] = &&ADDR, + [EJIT_OP_ADDR_F] = &&ADDR_F, + [EJIT_OP_ADDR_D] = &&ADDR_D, + [EJIT_OP_ADDI] = &&ADDI, + + [EJIT_OP_ABSR_F] = &&ABSR_F, + [EJIT_OP_ABSR_D] = &&ABSR_D, + + [EJIT_OP_SUBR] = &&SUBR, + [EJIT_OP_SUBR_F] = &&SUBR_F, + [EJIT_OP_SUBR_D] = &&SUBR_D, + [EJIT_OP_SUBI] = &&SUBI, + + [EJIT_OP_MULR] = &&MULR, + [EJIT_OP_MULR_F] = &&MULR_F, + [EJIT_OP_MULR_D] = &&MULR_D, + + [EJIT_OP_DIVR] = &&DIVR, + [EJIT_OP_DIVR_U] = &&DIVR_U, + [EJIT_OP_DIVR_F] = &&DIVR_F, + [EJIT_OP_DIVR_D] = &&DIVR_D, + + [EJIT_OP_REMR] = &&REMR, + [EJIT_OP_REMR_U] = &&REMR_U, + + [EJIT_OP_LSHI] = &&LSHI, + [EJIT_OP_LSHR] = &&LSHR, + [EJIT_OP_RSHI] = &&RSHI, + [EJIT_OP_RSHR] = &&RSHR, + [EJIT_OP_RSHI_U] = &&RSHI_U, + [EJIT_OP_RSHR_U] = &&RSHR_U, + + [EJIT_OP_ANDR] = &&ANDR, + [EJIT_OP_ANDI] = &&ANDI, + + [EJIT_OP_ORR] = &&ORR, + [EJIT_OP_ORI] = &&ORI, + + [EJIT_OP_XORR] = &&XORR, + [EJIT_OP_XORI] = &&XORI, + + [EJIT_OP_COMR] = &&COMR, + [EJIT_OP_NEGR] = &&NEGR, + [EJIT_OP_NEGR_F] = &&NEGR_F, + [EJIT_OP_NEGR_D] = &&NEGR_D, + + [EJIT_OP_EQR] = &&EQR, + [EJIT_OP_EQR_F] = &&EQR_F, + [EJIT_OP_EQR_D] = &&EQR_D, + + [EJIT_OP_NER] = &&NER, + [EJIT_OP_NER_F] = &&NER_F, + [EJIT_OP_NER_D] = &&NER_D, + + [EJIT_OP_GTR] = &>R, + [EJIT_OP_GTR_U] = &>R_U, + [EJIT_OP_GTR_F] = &>R_F, + [EJIT_OP_GTR_D] = &>R_D, + + [EJIT_OP_GER] = &&GER, + [EJIT_OP_GER_U] = &&GER_U, + [EJIT_OP_GER_F] = &&GER_F, + [EJIT_OP_GER_D] = &&GER_D, + + [EJIT_OP_STI8] = &&STI8, + [EJIT_OP_STI16] = &&STI16, + [EJIT_OP_STI32] = &&STI32, + [EJIT_OP_STI64] = &&STI64, + [EJIT_OP_STIF] = &&STIF, + [EJIT_OP_STID] = &&STID, + + [EJIT_OP_STXI8] = &&STXI8, + [EJIT_OP_STXI16] = &&STXI16, + [EJIT_OP_STXI32] = &&STXI32, + [EJIT_OP_STXI64] = &&STXI64, + [EJIT_OP_STXIF] = &&STXIF, + [EJIT_OP_STXID] = &&STXID, + + [EJIT_OP_STXR8] = &&STXR8, + [EJIT_OP_STXR16] = &&STXR16, + [EJIT_OP_STXR32] = &&STXR32, + [EJIT_OP_STXR64] = &&STXR64, + [EJIT_OP_STXRF] = &&STXRF, + [EJIT_OP_STXRD] = &&STXRD, + + [EJIT_OP_LDI8] = &&LDI8, + [EJIT_OP_LDI16] = &&LDI16, + [EJIT_OP_LDI32] = &&LDI32, + [EJIT_OP_LDI64] = &&LDI64, + [EJIT_OP_LDIU8] = &&LDIU8, + [EJIT_OP_LDIU16] = &&LDIU16, + [EJIT_OP_LDIU32] = &&LDIU32, + [EJIT_OP_LDIU64] = &&LDIU64, + [EJIT_OP_LDIF] = &&LDIF, + [EJIT_OP_LDID] = &&LDID, + + [EJIT_OP_LDXI8] = &&LDXI8, + [EJIT_OP_LDXI16] = &&LDXI16, + [EJIT_OP_LDXI32] = &&LDXI32, + [EJIT_OP_LDXI64] = &&LDXI64, + [EJIT_OP_LDXIU8] = &&LDXIU8, + [EJIT_OP_LDXIU16] = &&LDXIU16, + [EJIT_OP_LDXIU32] = &&LDXIU32, + [EJIT_OP_LDXIU64] = &&LDXIU64, + [EJIT_OP_LDXIF] = &&LDXIF, + [EJIT_OP_LDXID] = &&LDXID, + + [EJIT_OP_LDXR8] = &&LDXR8, + [EJIT_OP_LDXR16] = &&LDXR16, + [EJIT_OP_LDXR32] = &&LDXR32, + [EJIT_OP_LDXR64] = &&LDXR64, + [EJIT_OP_LDXRU8] = &&LDXRU8, + [EJIT_OP_LDXRU16] = &&LDXRU16, + [EJIT_OP_LDXRU32] = &&LDXRU32, + [EJIT_OP_LDXRU64] = &&LDXRU64, + [EJIT_OP_LDXRF] = &&LDXRF, + [EJIT_OP_LDXRD] = &&LDXRD, + + [EJIT_OP_TRUNCR_D_32] = &&TRUNCR_D_32, + [EJIT_OP_TRUNCR_D_64] = &&TRUNCR_D_64, + [EJIT_OP_TRUNCR_F_32] = &&TRUNCR_F_32, + [EJIT_OP_TRUNCR_F_64] = &&TRUNCR_F_64, + + [EJIT_OP_BNER] = &&BNER, + [EJIT_OP_BNEI] = &&BNEI, + [EJIT_OP_BNER_F] = &&BNER_F, + [EJIT_OP_BNER_D] = &&BNER_D, + + [EJIT_OP_BEQR] = &&BEQR, + [EJIT_OP_BEQI] = &&BEQI, + [EJIT_OP_BEQR_F] = &&BEQR_F, + [EJIT_OP_BEQR_D] = &&BEQR_D, + + [EJIT_OP_BGER] = &&BGER, + [EJIT_OP_BGER_U] = &&BGER_U, + [EJIT_OP_BGEI] = &&BGEI, + [EJIT_OP_BGEI_U] = &&BGEI_U, + [EJIT_OP_BGER_F] = &&BGER_F, + [EJIT_OP_BGER_D] = &&BGER_D, + + [EJIT_OP_BLEI] = &&BLEI, + [EJIT_OP_BLEI_U] = &&BLEI_U, + + [EJIT_OP_BGTR] = &&BGTR, + [EJIT_OP_BGTR_U] = &&BGTR_U, + [EJIT_OP_BGTI] = &&BGTI, + [EJIT_OP_BGTI_U] = &&BGTI_U, + [EJIT_OP_BGTR_F] = &&BGTR_F, + [EJIT_OP_BGTR_D] = &&BGTR_D, + + [EJIT_OP_BLTI] = &&BLTI, + [EJIT_OP_BLTI_U] = &&BLTI_U, + + [EJIT_OP_JMP] = &&JMP, + [EJIT_OP_JMPR] = &&JMPR, + + [EJIT_OP_BMCI] = &&BMCI, + [EJIT_OP_BMCR] = &&BMCR, + [EJIT_OP_BMSI] = &&BMSI, + [EJIT_OP_BMSR] = &&BMSR, + + [EJIT_OP_RETR] = &&RETR, + [EJIT_OP_RETI] = &&RETI, + [EJIT_OP_RETR_F] = &&RETR_F, + [EJIT_OP_RETI_F] = &&RETI_F, + [EJIT_OP_RETR_D] = &&RETR_D, + [EJIT_OP_RETI_D] = &&RETI_D, + + [EJIT_OP_RETVAL] = &&RETVAL, + [EJIT_OP_RETVAL_F] = &&RETVAL_F, + [EJIT_OP_RETVAL_D] = &&RETVAL_D, + + [EJIT_OP_ARG] = &&ARG, + [EJIT_OP_ARG_I] = &&ARG_I, + [EJIT_OP_ARG_F] = &&ARG_F, + [EJIT_OP_ARG_FI] = &&ARG_FI, + + [EJIT_OP_PARAM] = &&PARAM, + [EJIT_OP_PARAM_F] = &&PARAM_F, + + [EJIT_OP_CALLI_I] = &&CALLI_I, + [EJIT_OP_CALLI_L] = &&CALLI_L, + [EJIT_OP_CALLI_F] = &&CALLI_F, + [EJIT_OP_CALLI_D] = &&CALLI_D, + [EJIT_OP_ESCAPEI_I] = &&ESCAPEI_I, + [EJIT_OP_ESCAPEI_F] = &&ESCAPEI_F, + [EJIT_OP_ESCAPEI_L] = &&ESCAPEI_L, + [EJIT_OP_ESCAPEI_D] = &&ESCAPEI_D, + + [EJIT_OP_START] = &&START, + [EJIT_OP_END] = &&END, }; if (!run) { |