diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2019-03-07 17:28:52 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2019-03-07 17:28:52 +0200 |
commit | d0259b21becfa366bde486f90112b83d3ba6ec09 (patch) | |
tree | 8f99b1d0b01e07a5a6d7f4baea6c2ccfe1b07cfa /src/bin | |
parent | 50e58bdd111ae4603c30314a656f57efa9d7f16c (diff) |
tmpir-wip
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/fspec-dump.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/bin/fspec-dump.c b/src/bin/fspec-dump.c index e7993e6..5732018 100644 --- a/src/bin/fspec-dump.c +++ b/src/bin/fspec-dump.c @@ -164,11 +164,9 @@ enum fspec_instruction { INS_PUSH, INS_PUSHR, INS_POP, - INS_INCR, INS_OP, INS_QUEUE, INS_IO, - INS_EXEC, INS_CALL, INS_JMP, INS_JMPIF, @@ -415,10 +413,6 @@ fspec_execute(struct fspec_ctx *ctx, const uint8_t *ir, const uint64_t irlen, co fprintf(stderr, "POP R: %lu\n", insv); stack_pop(&ctx->S, &ctx->R.value[insv]); break; - case INS_INCR: - fprintf(stderr, "INCR R: %lu\n", insv); - register_set_num(&ctx->R.value[insv], &ctx->mem, register_get_num(&ctx->R.value[insv], &ctx->mem) + 1); - break; case INS_OP: fprintf(stderr, "OP op: %lu\n", insv); do_op(ctx, insv); @@ -428,6 +422,7 @@ fspec_execute(struct fspec_ctx *ctx, const uint8_t *ir, const uint64_t irlen, co break; case INS_IO: { const uint64_t R = stack_pop_num(&ctx->S, &ctx->mem); + assert(R > 0 && R < ARRAY_SIZE(ctx->R.value)); fprintf(stderr, "IO: sz: %lu, R: %lu\n", insv, R); ctx->R.value[R].off = ctx->mem.ptr; const uint64_t szb = DIV_ROUND_UP(insv, CHAR_BIT), bpe = (szb * CHAR_BIT) / insv; @@ -442,21 +437,6 @@ fspec_execute(struct fspec_ctx *ctx, const uint8_t *ir, const uint64_t irlen, co return true; } break; - case INS_EXEC: { - fprintf(stderr, "EXEC R: %lu\n", insv); - const struct fspec_register old_r1 = ctx->R.value[1]; - stack_pop(&ctx->S, &ctx->R.value[1]); - uint64_t nmemb = 1; - do { - nmemb *= (ctx->S.numv ? stack_pop_num(&ctx->S, &ctx->mem) : 1); - fprintf(stderr, "off: %lu len: %lu nmemb: %lu\n", ctx->R.value[insv].off, ctx->R.value[insv].len, nmemb); - for (uint64_t i = 0; i < nmemb; ++i) - if (fspec_execute(ctx, ctx->mem.data + ctx->R.value[insv].off, ctx->R.value[insv].len, ind + INDSTP)) - return true; - } while (ctx->S.numv); - ctx->R.value[1] = old_r1; - } - break; case INS_CALL: { fprintf(stderr, "CALL R: %lu\n", insv); ctx->S.numv = 0; |