more bigint and dbterm fixes.
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
OPCODE(get_struct ,xfa),
|
||||
OPCODE(get_float ,xd),
|
||||
OPCODE(get_longint ,xi),
|
||||
OPCODE(get_bigint ,xB),
|
||||
OPCODE(get_bigint ,xN),
|
||||
OPCODE(get_dbterm ,xD),
|
||||
OPCODE(glist_valx ,xx),
|
||||
OPCODE(glist_valy ,yx),
|
||||
@@ -125,8 +125,8 @@
|
||||
OPCODE(unify_longint_write ,oi),
|
||||
OPCODE(unify_l_longint ,oi),
|
||||
OPCODE(unify_l_longint_write ,oi),
|
||||
OPCODE(unify_bigint ,oB),
|
||||
OPCODE(unify_l_bigint ,oB),
|
||||
OPCODE(unify_bigint ,oN),
|
||||
OPCODE(unify_l_bigint ,oN),
|
||||
OPCODE(unify_dbterm ,oD),
|
||||
OPCODE(unify_l_dbterm ,oD),
|
||||
OPCODE(unify_list ,o),
|
||||
@@ -145,6 +145,8 @@
|
||||
OPCODE(put_y_vals ,yyxx),
|
||||
OPCODE(put_unsafe ,yx),
|
||||
OPCODE(put_atom ,xc),
|
||||
OPCODE(put_dbterm ,xD),
|
||||
OPCODE(put_bigint ,xN),
|
||||
OPCODE(put_float ,xd),
|
||||
OPCODE(put_longint ,xi),
|
||||
OPCODE(put_list ,x),
|
||||
@@ -158,6 +160,8 @@
|
||||
OPCODE(write_y_val ,y),
|
||||
OPCODE(write_y_loc ,y),
|
||||
OPCODE(write_atom ,c),
|
||||
OPCODE(write_bigint ,N),
|
||||
OPCODE(write_dbterm ,D),
|
||||
OPCODE(write_float ,d),
|
||||
OPCODE(write_longint ,i),
|
||||
OPCODE(write_n_atoms ,sc),
|
||||
|
14
H/amidefs.h
14
H/amidefs.h
@@ -241,7 +241,6 @@ typedef enum {
|
||||
The meaning and type of the symbols in a abstract machine instruction is:
|
||||
|
||||
b: arity (Int)
|
||||
B: bigint, Blob (Term)
|
||||
b: bitmap (CELL *)
|
||||
c: constant, is a Term
|
||||
d: double (functor + unaligned double)
|
||||
@@ -253,6 +252,7 @@ typedef enum {
|
||||
L: logic upd clause, logic_upd_clause *
|
||||
m: module, Term
|
||||
n: number, Integer
|
||||
N: bigint, Blob (Term)
|
||||
o: opcode, OPCODE
|
||||
O: OR-parallel information, used by YAPOR, unsigned int
|
||||
p: predicate, struct pred_entry *
|
||||
@@ -277,6 +277,14 @@ typedef struct yami {
|
||||
Term c;
|
||||
CELL next;
|
||||
} c;
|
||||
struct {
|
||||
Term D;
|
||||
CELL next;
|
||||
} D;
|
||||
struct {
|
||||
Term b;
|
||||
CELL next;
|
||||
} N;
|
||||
struct {
|
||||
Term c1;
|
||||
Term c2;
|
||||
@@ -501,7 +509,7 @@ typedef struct yami {
|
||||
OPCODE opcw;
|
||||
Term b;
|
||||
CELL next;
|
||||
} oB;
|
||||
} oN;
|
||||
struct {
|
||||
OPCODE opcw;
|
||||
CELL d[1+SIZEOF_DOUBLE/SIZEOF_INT_P];
|
||||
@@ -720,7 +728,7 @@ typedef struct yami {
|
||||
wamreg x;
|
||||
Term b;
|
||||
CELL next;
|
||||
} xB;
|
||||
} xN;
|
||||
struct {
|
||||
wamreg x;
|
||||
CELL d[1+SIZEOF_DOUBLE/SIZEOF_INT_P];
|
||||
|
@@ -6,9 +6,15 @@
|
||||
while (TRUE) {
|
||||
op_numbers op = Yap_op_from_opcode(cl->opc);
|
||||
switch (op) {
|
||||
case _write_dbterm:
|
||||
cl = NEXTOP(cl,D);
|
||||
break;
|
||||
case _alloc_for_logical_pred:
|
||||
cl = NEXTOP(cl,L);
|
||||
break;
|
||||
case _write_bigint:
|
||||
cl = NEXTOP(cl,N);
|
||||
break;
|
||||
case _ensure_space:
|
||||
cl = NEXTOP(cl,Osbpi);
|
||||
break;
|
||||
@@ -316,18 +322,18 @@
|
||||
case _unify_void_write:
|
||||
cl = NEXTOP(cl,o);
|
||||
break;
|
||||
case _unify_bigint:
|
||||
cl = NEXTOP(cl,oB);
|
||||
break;
|
||||
case _unify_l_bigint:
|
||||
cl = NEXTOP(cl,oB);
|
||||
break;
|
||||
case _unify_dbterm:
|
||||
cl = NEXTOP(cl,oD);
|
||||
break;
|
||||
case _unify_l_dbterm:
|
||||
cl = NEXTOP(cl,oD);
|
||||
break;
|
||||
case _unify_bigint:
|
||||
cl = NEXTOP(cl,oN);
|
||||
break;
|
||||
case _unify_l_bigint:
|
||||
cl = NEXTOP(cl,oN);
|
||||
break;
|
||||
case _unify_atom:
|
||||
cl = NEXTOP(cl,oc);
|
||||
break;
|
||||
@@ -656,12 +662,26 @@
|
||||
}
|
||||
cl = NEXTOP(cl,x);
|
||||
break;
|
||||
case _get_bigint:
|
||||
if (is_regcopy(myregs, nofregs, cl->u.xB.x)) {
|
||||
clause->Tag = cl->u.xB.b;
|
||||
case _put_dbterm:
|
||||
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xD.x))) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xB);
|
||||
cl = NEXTOP(cl,xD);
|
||||
break;
|
||||
case _get_bigint:
|
||||
if (is_regcopy(myregs, nofregs, cl->u.xN.x)) {
|
||||
clause->Tag = cl->u.xN.b;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xN);
|
||||
break;
|
||||
case _put_bigint:
|
||||
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xN.x))) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xN);
|
||||
break;
|
||||
case _get_atom:
|
||||
if (is_regcopy(myregs, nofregs, cl->u.xc.x)) {
|
||||
|
@@ -291,18 +291,18 @@
|
||||
case _unify_void_write:
|
||||
cl = NEXTOP(cl,o);
|
||||
break;
|
||||
case _unify_bigint:
|
||||
cl = NEXTOP(cl,oB);
|
||||
break;
|
||||
case _unify_l_bigint:
|
||||
cl = NEXTOP(cl,oB);
|
||||
break;
|
||||
case _unify_dbterm:
|
||||
cl = NEXTOP(cl,oD);
|
||||
break;
|
||||
case _unify_l_dbterm:
|
||||
cl = NEXTOP(cl,oD);
|
||||
break;
|
||||
case _unify_bigint:
|
||||
cl = NEXTOP(cl,oN);
|
||||
break;
|
||||
case _unify_l_bigint:
|
||||
cl = NEXTOP(cl,oN);
|
||||
break;
|
||||
case _unify_atom:
|
||||
cl = NEXTOP(cl,oc);
|
||||
break;
|
||||
@@ -553,12 +553,26 @@
|
||||
}
|
||||
cl = NEXTOP(cl,x);
|
||||
break;
|
||||
case _get_bigint:
|
||||
if (iarg == cl->u.xB.x) {
|
||||
clause->Tag = cl->u.xB.b;
|
||||
case _put_dbterm:
|
||||
if (iarg == cl->u.xD.x) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xB);
|
||||
cl = NEXTOP(cl,xD);
|
||||
break;
|
||||
case _get_bigint:
|
||||
if (iarg == cl->u.xN.x) {
|
||||
clause->Tag = cl->u.xN.b;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xN);
|
||||
break;
|
||||
case _put_bigint:
|
||||
if (iarg == cl->u.xN.x) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xN);
|
||||
break;
|
||||
case _get_atom:
|
||||
if (iarg == cl->u.xc.x) {
|
||||
|
38
H/rclause.h
38
H/rclause.h
@@ -16,6 +16,11 @@ restore_opcodes(yamop *pc, yamop *max)
|
||||
fprintf(stderr, "%s ", Yap_op_names[op]);
|
||||
#endif
|
||||
switch (op) {
|
||||
/* instructions type D */
|
||||
case _write_dbterm:
|
||||
pc->u.D.D = DBGroundTermAdjust(pc->u.D.D);
|
||||
pc = NEXTOP(pc,D);
|
||||
break;
|
||||
/* instructions type Ills */
|
||||
case _enter_lu_pred:
|
||||
pc->u.Ills.I = PtoLUIndexAdjust(pc->u.Ills.I);
|
||||
@@ -30,6 +35,11 @@ restore_opcodes(yamop *pc, yamop *max)
|
||||
pc->u.L.ClBase = PtoLUClauseAdjust(pc->u.L.ClBase);
|
||||
pc = NEXTOP(pc,L);
|
||||
break;
|
||||
/* instructions type N */
|
||||
case _write_bigint:
|
||||
pc->u.N.b = BlobTermInCodeAdjust(pc->u.N.b);
|
||||
pc = NEXTOP(pc,N);
|
||||
break;
|
||||
/* instructions type Osblp */
|
||||
case _either:
|
||||
case _or_else:
|
||||
@@ -294,13 +304,6 @@ restore_opcodes(yamop *pc, yamop *max)
|
||||
pc->u.o.opcw = OpcodeAdjust(pc->u.o.opcw);
|
||||
pc = NEXTOP(pc,o);
|
||||
break;
|
||||
/* instructions type oB */
|
||||
case _unify_bigint:
|
||||
case _unify_l_bigint:
|
||||
pc->u.oB.opcw = OpcodeAdjust(pc->u.oB.opcw);
|
||||
pc->u.oB.b = BlobTermInCodeAdjust(pc->u.oB.b);
|
||||
pc = NEXTOP(pc,oB);
|
||||
break;
|
||||
/* instructions type oD */
|
||||
case _unify_dbterm:
|
||||
case _unify_l_dbterm:
|
||||
@@ -308,6 +311,13 @@ restore_opcodes(yamop *pc, yamop *max)
|
||||
pc->u.oD.D = DBGroundTermAdjust(pc->u.oD.D);
|
||||
pc = NEXTOP(pc,oD);
|
||||
break;
|
||||
/* instructions type oN */
|
||||
case _unify_bigint:
|
||||
case _unify_l_bigint:
|
||||
pc->u.oN.opcw = OpcodeAdjust(pc->u.oN.opcw);
|
||||
pc->u.oN.b = BlobTermInCodeAdjust(pc->u.oN.b);
|
||||
pc = NEXTOP(pc,oN);
|
||||
break;
|
||||
/* instructions type oc */
|
||||
case _unify_atom:
|
||||
case _unify_atom_write:
|
||||
@@ -535,18 +545,20 @@ restore_opcodes(yamop *pc, yamop *max)
|
||||
pc->u.x.x = XAdjust(pc->u.x.x);
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xB */
|
||||
case _get_bigint:
|
||||
pc->u.xB.x = XAdjust(pc->u.xB.x);
|
||||
pc->u.xB.b = BlobTermInCodeAdjust(pc->u.xB.b);
|
||||
pc = NEXTOP(pc,xB);
|
||||
break;
|
||||
/* instructions type xD */
|
||||
case _get_dbterm:
|
||||
case _put_dbterm:
|
||||
pc->u.xD.x = XAdjust(pc->u.xD.x);
|
||||
pc->u.xD.D = DBGroundTermAdjust(pc->u.xD.D);
|
||||
pc = NEXTOP(pc,xD);
|
||||
break;
|
||||
/* instructions type xN */
|
||||
case _get_bigint:
|
||||
case _put_bigint:
|
||||
pc->u.xN.x = XAdjust(pc->u.xN.x);
|
||||
pc->u.xN.b = BlobTermInCodeAdjust(pc->u.xN.b);
|
||||
pc = NEXTOP(pc,xN);
|
||||
break;
|
||||
/* instructions type xc */
|
||||
case _get_atom:
|
||||
case _put_atom:
|
||||
|
@@ -250,10 +250,11 @@ ConstantTermAdjust (Term t)
|
||||
static Term
|
||||
DBGroundTermAdjust (Term t)
|
||||
{
|
||||
/* The term itself is restored by dbtermlist */
|
||||
if (IsPairTerm(t)) {
|
||||
return AdjustDBTerm(t, PtoHeapCellAdjust(RepPair(t)));
|
||||
return AbsPair(PtoHeapCellAdjust(RepPair(t)));
|
||||
} else {
|
||||
return AdjustDBTerm(t, PtoHeapCellAdjust(RepAppl(t)));
|
||||
return AbsAppl(PtoHeapCellAdjust(RepAppl(t)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,12 +9,20 @@
|
||||
op = Yap_op_from_opcode(pc->opc);
|
||||
/* C-code, maybe indexing */
|
||||
switch (op) {
|
||||
/* instructions type D */
|
||||
case _write_dbterm:
|
||||
pc = NEXTOP(pc,D);
|
||||
break;
|
||||
/* instructions type Ills */
|
||||
case _enter_lu_pred:
|
||||
return walk_got_lu_block(pc->u.Ills.I, startp, endp);
|
||||
/* instructions type L */
|
||||
case _alloc_for_logical_pred:
|
||||
return walk_got_lu_clause(pc->u.L.ClBase, startp, endp);
|
||||
/* instructions type N */
|
||||
case _write_bigint:
|
||||
pc = NEXTOP(pc,N);
|
||||
break;
|
||||
/* instructions type Osblp */
|
||||
case _either:
|
||||
case _or_else:
|
||||
@@ -225,16 +233,16 @@
|
||||
case _unify_void_write:
|
||||
pc = NEXTOP(pc,o);
|
||||
break;
|
||||
/* instructions type oB */
|
||||
case _unify_bigint:
|
||||
case _unify_l_bigint:
|
||||
pc = NEXTOP(pc,oB);
|
||||
break;
|
||||
/* instructions type oD */
|
||||
case _unify_dbterm:
|
||||
case _unify_l_dbterm:
|
||||
pc = NEXTOP(pc,oD);
|
||||
break;
|
||||
/* instructions type oN */
|
||||
case _unify_bigint:
|
||||
case _unify_l_bigint:
|
||||
pc = NEXTOP(pc,oN);
|
||||
break;
|
||||
/* instructions type oc */
|
||||
case _unify_atom:
|
||||
case _unify_atom_write:
|
||||
@@ -406,14 +414,16 @@
|
||||
case _write_x_var:
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xB */
|
||||
case _get_bigint:
|
||||
pc = NEXTOP(pc,xB);
|
||||
break;
|
||||
/* instructions type xD */
|
||||
case _get_dbterm:
|
||||
case _put_dbterm:
|
||||
pc = NEXTOP(pc,xD);
|
||||
break;
|
||||
/* instructions type xN */
|
||||
case _get_bigint:
|
||||
case _put_bigint:
|
||||
pc = NEXTOP(pc,xN);
|
||||
break;
|
||||
/* instructions type xc */
|
||||
case _get_atom:
|
||||
case _put_atom:
|
||||
|
Reference in New Issue
Block a user