mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-13 13:12:51 -06:00
using instruction RET was wrong; now use EVAL
This commit is contained in:
@@ -118,9 +118,8 @@ typedef enum {
|
||||
PGF_INSTR_SET_PAD = 8,
|
||||
PGF_INSTR_PUSH = 9,
|
||||
PGF_INSTR_EVAL = 10,
|
||||
PGF_INSTR_RET = 13,
|
||||
PGF_INSTR_DROP = 15,
|
||||
PGF_INSTR_FAIL = 16
|
||||
PGF_INSTR_DROP = 13,
|
||||
PGF_INSTR_FAIL = 14
|
||||
} PgfInstruction;
|
||||
|
||||
struct PgfPGF {
|
||||
|
||||
@@ -1085,35 +1085,6 @@ pgf_jit_function(PgfReader* rdr, PgfAbstr* abstr,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PGF_INSTR_RET: {
|
||||
size_t h = pgf_read_int(rdr);
|
||||
|
||||
if (h > 0)
|
||||
jit_addi_p(JIT_VHEAP, JIT_VHEAP, h*sizeof(PgfClosure*));
|
||||
|
||||
size_t a, b;
|
||||
if (mod == 1) {
|
||||
a = pgf_read_int(rdr);
|
||||
b = pgf_read_int(rdr);
|
||||
#ifdef PGF_JIT_DEBUG
|
||||
gu_printf(out, err, "RET hp(%d) tail(%d,%d)\n", h, a, b);
|
||||
#endif
|
||||
} else {
|
||||
a = 0;
|
||||
b = pgf_read_int(rdr);
|
||||
#ifdef PGF_JIT_DEBUG
|
||||
gu_printf(out, err, "RET hp(%d) update(%d)\n", h, b);
|
||||
#endif
|
||||
jit_movi_p(JIT_R0, abstr->eval_gates->evaluate_indirection);
|
||||
jit_str_p(JIT_VCLOS, JIT_R0);
|
||||
jit_stxi_p(offsetof(PgfIndirection,val), JIT_VCLOS, JIT_VHEAP);
|
||||
}
|
||||
|
||||
if (b-(a+1) > 0)
|
||||
jit_addi_p(JIT_SP, JIT_SP, (b-(a+1))*sizeof(PgfClosure*));
|
||||
jit_bare_ret(a*sizeof(PgfClosure*));
|
||||
break;
|
||||
}
|
||||
case PGF_INSTR_DROP: {
|
||||
size_t n = pgf_read_int(rdr);
|
||||
size_t target = pgf_read_int(rdr);
|
||||
|
||||
@@ -168,10 +168,8 @@ instance Binary Instr where
|
||||
put (EVAL (ARG_VAR n) (UpdateCall b c)) = putWord8 49 >> put n >> put (b,c)
|
||||
put (EVAL (FREE_VAR n) (UpdateCall b c)) = putWord8 50 >> put n >> put (b,c)
|
||||
put (EVAL (GLOBAL id) (UpdateCall b c)) = putWord8 51 >> put id >> put (b,c)
|
||||
put (RET h (TailCall a b c)) = putWord8 53 >> put h >> put a >> put b
|
||||
put (RET h (UpdateCall b c)) = putWord8 54 >> put h >> put b
|
||||
put (DROP n l ) = putWord8 60 >> put (n,l)
|
||||
put (FAIL ) = putWord8 64
|
||||
put (DROP n l ) = putWord8 52 >> put (n,l)
|
||||
put (FAIL ) = putWord8 56
|
||||
|
||||
instance Binary Type where
|
||||
put (DTyp hypos cat exps) = put (hypos,cat,exps)
|
||||
|
||||
@@ -26,7 +26,6 @@ data Instr
|
||||
| SET_PAD
|
||||
| PUSH IVal
|
||||
| EVAL IVal TailInfo
|
||||
| RET {-# UNPACK #-} !Int TailInfo
|
||||
| DROP {-# UNPACK #-} !Int {-# UNPACK #-} !CodeLabel
|
||||
| FAIL
|
||||
|
||||
@@ -60,8 +59,6 @@ ppInstr (SET v) = text "SET " <+> ppIVal v
|
||||
ppInstr (SET_PAD ) = text "SET_PAD"
|
||||
ppInstr (PUSH v) = text "PUSH " <+> ppIVal v
|
||||
ppInstr (EVAL v ti) = text "EVAL " <+> ppIVal v <+> ppTailInfo ti
|
||||
ppInstr (RET h (TailCall a b c)) = text "RET " <+> ppIVal (HEAP h) <+> text "tail" <> parens (int a <> comma <> int b)
|
||||
ppInstr (RET h (UpdateCall b c)) = text "RET " <+> ppIVal (HEAP h) <+> text "update" <> parens (int b)
|
||||
ppInstr (DROP n l ) = text "DROP " <+> int n <+> ppLabel l
|
||||
ppInstr (FAIL ) = text "FAIL"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user