more bigint and dbterm fixes.
This commit is contained in:
74
C/absmi.c
74
C/absmi.c
@@ -4261,17 +4261,17 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(get_bigint, xB);
|
||||
Op(get_bigint, xN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xB.x);
|
||||
d0 = XREG(PREG->u.xN.x);
|
||||
deref_head(d0, gbigint_unk);
|
||||
|
||||
gbigint_nonvar:
|
||||
if (!IsApplTerm(d0))
|
||||
FAIL();
|
||||
/* we have met a preexisting bigint */
|
||||
START_PREFETCH(xB);
|
||||
START_PREFETCH(xN);
|
||||
BEGP(pt0);
|
||||
pt0 = RepAppl(d0);
|
||||
/* check functor */
|
||||
@@ -4279,9 +4279,9 @@ Yap_absmi(int inp)
|
||||
{
|
||||
FAIL();
|
||||
}
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.xB.b))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.xN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, xB);
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
ENDP(pt0);
|
||||
/* enter read mode */
|
||||
GONext();
|
||||
@@ -4291,10 +4291,10 @@ Yap_absmi(int inp)
|
||||
deref_body(d0, pt0, gbigint_unk, gbigint_nonvar);
|
||||
/* Enter Write mode */
|
||||
/* set d1 to be the new structure we are going to create */
|
||||
START_PREFETCH(xB);
|
||||
START_PREFETCH(xN);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.xB.b;
|
||||
PREG = NEXTOP(PREG, xB);
|
||||
d1 = PREG->u.xN.b;
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
BIND(pt0, d1, bind_gbigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -6347,7 +6347,7 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(unify_bigint, oB);
|
||||
Op(unify_bigint, oN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
BEGP(pt0);
|
||||
@@ -6368,16 +6368,16 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
ENDD(d1);
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oB.b))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, oB);
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
ENDP(pt0);
|
||||
GONext();
|
||||
|
||||
derefa_body(d0, pt0, ubigint_unk, ubigint_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oB.b;
|
||||
PREG = NEXTOP(PREG, oB);
|
||||
d1 = PREG->u.oN.b;
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
BIND_GLOBAL(pt0, d1, bind_ubigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -6393,7 +6393,7 @@ Yap_absmi(int inp)
|
||||
#endif
|
||||
ENDOp();
|
||||
|
||||
Op(unify_l_bigint, oB);
|
||||
Op(unify_l_bigint, oN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
CACHE_S();
|
||||
@@ -6413,16 +6413,16 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
ENDD(d0);
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oB.b))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, oB);
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
ENDP(pt0);
|
||||
GONext();
|
||||
|
||||
derefa_body(d0, S_SREG, ulbigint_unk, ulbigint_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oB.b;
|
||||
PREG = NEXTOP(PREG, oB);
|
||||
d1 = PREG->u.oN.b;
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
BIND_GLOBAL(S_SREG, d1, bind_ulbigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(S_SREG, d1);
|
||||
@@ -6907,8 +6907,26 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_dbterm, xD);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.xD.D;
|
||||
XREG(PREG->u.xD.x) = d0;
|
||||
PREG = NEXTOP(PREG, xD);
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_float, xd);
|
||||
Op(put_bigint, xN);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.xN.b;
|
||||
XREG(PREG->u.xN.x) = d0;
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_float, xd);
|
||||
BEGD(d0);
|
||||
d0 = AbsAppl(PREG->u.xd.d);
|
||||
XREG(PREG->u.xd.x) = d0;
|
||||
@@ -7101,6 +7119,24 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_bigint, N);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.N.b;
|
||||
*SREG++ = d0;
|
||||
ENDD(d0);
|
||||
PREG = NEXTOP(PREG, N);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_dbterm, D);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.D.D;
|
||||
*SREG++ = d0;
|
||||
ENDD(d0);
|
||||
PREG = NEXTOP(PREG, D);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_float, d);
|
||||
BEGD(d0);
|
||||
d0 = AbsAppl(PREG->u.d.d);
|
||||
|
14
C/agc.c
14
C/agc.c
@@ -114,20 +114,6 @@ AtomAdjust(Atom a)
|
||||
|
||||
static Term AdjustDBTerm(Term, Term *);
|
||||
|
||||
static Term
|
||||
CodeComposedTermAdjust(Term t)
|
||||
{
|
||||
Term *base;
|
||||
|
||||
if (IsApplTerm(t)) {
|
||||
base = RepAppl(t);
|
||||
} else {
|
||||
base = RepPair(t);
|
||||
}
|
||||
return AdjustDBTerm(t, base);
|
||||
}
|
||||
|
||||
|
||||
#define IsOldCode(P) FALSE
|
||||
#define IsOldCodeCellPtr(P) FALSE
|
||||
#define IsOldDelay(P) FALSE
|
||||
|
42
C/amasm.c
42
C/amasm.c
@@ -1083,15 +1083,15 @@ a_uc(CELL rnd1, op_numbers opcode, op_numbers opcode_w, yamop *code_p, int pass_
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_blob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
a_wblob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.c.c =
|
||||
code_p->u.N.b =
|
||||
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(c);
|
||||
GONEXT(N);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1117,11 +1117,11 @@ a_wdbt(CELL rnd1, op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.c.c = rnd1;
|
||||
code_p->u.D.D = rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(c);
|
||||
GONEXT(D);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1130,13 +1130,13 @@ a_ublob(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blobs
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.oc.opcw = emit_op(opcode_w);
|
||||
code_p->u.oc.c =
|
||||
code_p->u.oN.opcw = emit_op(opcode_w);
|
||||
code_p->u.oN.b =
|
||||
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
|
||||
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(oc);
|
||||
GONEXT(oN);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1145,12 +1145,12 @@ a_udbt(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_dbterm
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.oc.opcw = emit_op(opcode_w);
|
||||
code_p->u.oc.c = cip->cpc->rnd1;
|
||||
code_p->u.oD.opcw = emit_op(opcode_w);
|
||||
code_p->u.oD.D = cip->cpc->rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(oc);
|
||||
GONEXT(oD);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1372,11 +1372,11 @@ a_rb(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, stru
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xc.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
code_p->u.xN.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xN.b = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(xc);
|
||||
GONEXT(xN);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1385,12 +1385,12 @@ a_dbt(op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int pass_no, st
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xc.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xc.c = cip->cpc->rnd1;
|
||||
code_p->u.xD.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xD.D = cip->cpc->rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(xc);
|
||||
GONEXT(xD);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -3248,10 +3248,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
code_p = a_ri(_put_longint, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case put_bigint_op:
|
||||
code_p = a_rb(_put_atom, clause_has_blobsp, code_p, pass_no, cip);
|
||||
code_p = a_rb(_put_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_dbterm_op:
|
||||
code_p = a_dbt(_put_atom, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
code_p = a_dbt(_put_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_list_op:
|
||||
code_p = a_glist(&do_not_optimise_uatom, code_p, pass_no, cip);
|
||||
@@ -3344,10 +3344,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
code_p = a_wi(_write_longint, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case write_bigint_op:
|
||||
code_p = a_blob(cip->cpc->rnd1, _write_atom, clause_has_blobsp, code_p, pass_no, cip);
|
||||
code_p = a_wblob(cip->cpc->rnd1, _write_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case write_dbterm_op:
|
||||
code_p = a_wdbt(cip->cpc->rnd1, _write_atom, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
code_p = a_wdbt(cip->cpc->rnd1, _write_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_list_op:
|
||||
code_p = a_ue(_unify_list, _unify_list_write, code_p, pass_no);
|
||||
|
Reference in New Issue
Block a user