aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ejit/ejit.h8
-rw-r--r--src/compile/compile.c6
-rw-r--r--src/ejit.c4
-rw-r--r--src/interp.c4
4 files changed, 11 insertions, 11 deletions
diff --git a/include/ejit/ejit.h b/include/ejit/ejit.h
index 56582be..512cbb8 100644
--- a/include/ejit/ejit.h
+++ b/include/ejit/ejit.h
@@ -160,10 +160,10 @@ void ejit_destroy_func(struct ejit_func *s);
#define EJIT_GPR(x) ((struct ejit_gpr){.r = (x)})
#define EJIT_FPR(x) ((struct ejit_fpr){.f = (x)})
-#define EJIT_OPERAND_GPR(x, type) (struct ejit_operand { .kind = EJIT_OPERAND_GPR, .r = (long)(x), .type = (type)})
-#define EJIT_OPERAND_FPR(x, type) (struct ejit_operand { .kind = EJIT_OPERAND_FPR, .r = (long)(x)})
-#define EJIT_OPERAND_IMM(x, type) (struct ejit_operand { .kind = EJIT_OPERAND_IMM, .r = (long)(x)})
-#define EJIT_OPERAND_FLT(x, type) (struct ejit_operand { .kind = EJIT_OPERAND_FLT, .r = (double)(x)})
+#define EJIT_OPERAND_GPR(x, t) ((struct ejit_operand){ .kind = EJIT_OPERAND_GPR, .r = (long)(x), .type = (t)})
+#define EJIT_OPERAND_FPR(x, t) ((struct ejit_operand){ .kind = EJIT_OPERAND_FPR, .r = (long)(x) .type =(t)})
+#define EJIT_OPERAND_IMM(x, t) ((struct ejit_operand){ .kind = EJIT_OPERAND_IMM, .r = (long)(x), .type = (t)})
+#define EJIT_OPERAND_FLT(x, t) ((struct ejit_operand){ .kind = EJIT_OPERAND_FLT, .r = (double)(x), .type = (t)})
typedef long (*ejit_escape_t)(size_t argc, const struct ejit_arg args[argc]);
typedef double (*ejit_escape_f_t)(size_t argc, const struct ejit_arg args[argc]);
diff --git a/src/compile/compile.c b/src/compile/compile.c
index e651199..807ecc4 100644
--- a/src/compile/compile.c
+++ b/src/compile/compile.c
@@ -98,10 +98,10 @@ static void compile_addr(struct ejit_func *f, jit_state_t *j, struct ejit_insn i
static void compile_bltr(struct ejit_func *f, jit_state_t *j, struct ejit_insn i, struct vec *relocs)
{
- jit_gpr_t c0 = getloc(f, j, i.r0, 0);
- jit_gpr_t c1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t c0 = getloc(f, j, i.r1, 0);
+ jit_gpr_t c1 = getloc(f, j, i.r2, 1);
jit_reloc_t r = jit_bltr(j, c0, c1);
- struct reloc_helper h = {.r = r, .to = i.o};
+ struct reloc_helper h = {.r = r, .to = i.r0};
vect_append(struct reloc_helper, *relocs, &h);
}
diff --git a/src/ejit.c b/src/ejit.c
index 69ade9a..9393dc0 100644
--- a/src/ejit.c
+++ b/src/ejit.c
@@ -93,7 +93,7 @@ void ejit_patch(struct ejit_func *f, struct ejit_reloc r, struct ejit_label l)
{
struct ejit_insn i = vect_at(struct ejit_insn, f->insns, r.insn);
/** @todo some assert that checks the opcode? */
- i.o = l.addr;
+ i.r0 = l.addr;
vect_at(struct ejit_insn, f->insns, r.insn) = i;
}
@@ -190,7 +190,7 @@ void ejit_movi(struct ejit_func *s, struct ejit_gpr r0, long o)
struct ejit_reloc ejit_bltr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1)
{
size_t addr = vec_len(&s->insns);
- emit_insn_i(s, BLTR, r0.r, r1.r, 0);
+ emit_insn_r(s, BLTR, 0, r0.r, r1.r);
return (struct ejit_reloc){.insn = addr};
}
diff --git a/src/interp.c b/src/interp.c
index bbf461b..158606b 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -93,8 +93,8 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, struct ejit_arg a
DISPATCH();
DO(bltr);
- if (gpr[i.r0] < gpr[i.r1])
- JUMP(i.o);
+ if (gpr[i.r1] < gpr[i.r2])
+ JUMP(i.r0);
DISPATCH();