Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3
This commit is contained in:
commit
30cc02e4ee
104
C/absmi.c
104
C/absmi.c
@ -9376,7 +9376,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_plus(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_plus(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9421,7 +9421,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_plus(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_plus(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9462,7 +9462,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_plus(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_plus(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9510,7 +9510,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_plus(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_plus(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9554,7 +9554,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_minus(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_minus(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9599,7 +9599,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_minus(MkIntegerTerm(d1),Yap_Eval(d0));
|
||||
d0 = p_minus(MkIntegerTerm(d1),Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9640,7 +9640,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_minus(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_minus(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9688,7 +9688,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_minus(MkIntegerTerm(d1), Yap_Eval(d0));
|
||||
d0 = p_minus(MkIntegerTerm(d1), Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9728,11 +9728,11 @@ Yap_absmi(int inp)
|
||||
times_vv_nvar_nvar:
|
||||
/* d0 and d1 are where I want them */
|
||||
if (IsIntTerm(d0) && IsIntTerm(d1)) {
|
||||
d0 = times_int(IntOfTerm(d0), IntOfTerm(d1));
|
||||
d0 = times_int(IntOfTerm(d0), IntOfTerm(d1) PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_times(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_times(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9773,11 +9773,11 @@ Yap_absmi(int inp)
|
||||
{
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = times_int(IntOfTerm(d0), d1);
|
||||
d0 = times_int(IntOfTerm(d0), d1 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_times(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_times(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9814,11 +9814,11 @@ Yap_absmi(int inp)
|
||||
times_y_vv_nvar_nvar:
|
||||
/* d0 and d1 are where I want them */
|
||||
if (IsIntTerm(d0) && IsIntTerm(d1)) {
|
||||
d0 = times_int(IntOfTerm(d0), IntOfTerm(d1));
|
||||
d0 = times_int(IntOfTerm(d0), IntOfTerm(d1) PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_times(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_times(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9862,11 +9862,11 @@ Yap_absmi(int inp)
|
||||
{
|
||||
Int d1 = PREG->u.yxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = times_int(IntOfTerm(d0), d1);
|
||||
d0 = times_int(IntOfTerm(d0), d1 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_times(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_times(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9917,7 +9917,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_div(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -9962,7 +9962,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(Yap_Eval(d0),MkIntegerTerm(d1));
|
||||
d0 = p_div(Yap_Eval(d0),MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10006,7 +10006,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(MkIntegerTerm(d1),Yap_Eval(d0));
|
||||
d0 = p_div(MkIntegerTerm(d1),Yap_Eval(d0) PASS_REGS);
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
@ -10053,7 +10053,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_div(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10101,7 +10101,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(Yap_Eval(d0),MkIntegerTerm(d1));
|
||||
d0 = p_div(Yap_Eval(d0),MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10148,7 +10148,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_div(MkIntegerTerm(d1), Yap_Eval(d0));
|
||||
d0 = p_div(MkIntegerTerm(d1), Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10193,7 +10193,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_and(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_and(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10238,7 +10238,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_and(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_and(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10279,7 +10279,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_and(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_and(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10327,7 +10327,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_and(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_and(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10372,7 +10372,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_or(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_or(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10417,7 +10417,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_or(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_or(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
|
||||
@ -10457,7 +10457,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_or(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_or(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10505,7 +10505,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_or(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_or(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10549,11 +10549,11 @@ Yap_absmi(int inp)
|
||||
if (i2 < 0)
|
||||
d0 = MkIntegerTerm(SLR(IntOfTerm(d0), -i2));
|
||||
else
|
||||
d0 = do_sll(IntOfTerm(d0),i2);
|
||||
d0 = do_sll(IntOfTerm(d0),i2 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_sll(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
if (d0 == 0L) {
|
||||
@ -10594,11 +10594,11 @@ Yap_absmi(int inp)
|
||||
{
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = do_sll(IntOfTerm(d0), (Int)d1);
|
||||
d0 = do_sll(IntOfTerm(d0), (Int)d1 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_sll(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
@ -10635,11 +10635,11 @@ Yap_absmi(int inp)
|
||||
if (i2 < 0)
|
||||
d0 = MkIntegerTerm(SLR(d1, -i2));
|
||||
else
|
||||
d0 = do_sll(d1,i2);
|
||||
d0 = do_sll(d1,i2 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(MkIntegerTerm(d1), Yap_Eval(d0));
|
||||
d0 = p_sll(MkIntegerTerm(d1), Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
@ -10680,11 +10680,11 @@ Yap_absmi(int inp)
|
||||
if (i2 < 0)
|
||||
d0 = MkIntegerTerm(SLR(IntOfTerm(d0), -i2));
|
||||
else
|
||||
d0 = do_sll(IntOfTerm(d0),i2);
|
||||
d0 = do_sll(IntOfTerm(d0),i2 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_sll(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
if (d0 == 0L) {
|
||||
@ -10728,11 +10728,11 @@ Yap_absmi(int inp)
|
||||
{
|
||||
Int d1 = PREG->u.yxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = do_sll(IntOfTerm(d0), Yap_Eval(d1));
|
||||
d0 = do_sll(IntOfTerm(d0), Yap_Eval(d1) PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_sll(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
@ -10773,11 +10773,11 @@ Yap_absmi(int inp)
|
||||
if (i2 < 0)
|
||||
d0 = MkIntegerTerm(SLR(d1, -i2));
|
||||
else
|
||||
d0 = do_sll(d1,i2);
|
||||
d0 = do_sll(d1,i2 PASS_REGS);
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_sll(MkIntegerTerm(d1), Yap_Eval(0));
|
||||
d0 = p_sll(MkIntegerTerm(d1), Yap_Eval(0) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
@ -10819,13 +10819,13 @@ Yap_absmi(int inp)
|
||||
if (IsIntTerm(d0) && IsIntTerm(d1)) {
|
||||
Int i2 = IntOfTerm(d1);
|
||||
if (i2 < 0)
|
||||
d0 = do_sll(IntOfTerm(d0), -i2);
|
||||
d0 = do_sll(IntOfTerm(d0), -i2 PASS_REGS);
|
||||
else
|
||||
d0 = MkIntTerm(SLR(IntOfTerm(d0), i2));
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_slr(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
if (d0 == 0L) {
|
||||
@ -10870,7 +10870,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_slr(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -10905,13 +10905,13 @@ Yap_absmi(int inp)
|
||||
if (IsIntTerm(d0)) {
|
||||
Int i2 = IntOfTerm(d0);
|
||||
if (i2 < 0)
|
||||
d0 = do_sll(d1, -i2);
|
||||
d0 = do_sll(d1, -i2 PASS_REGS);
|
||||
else
|
||||
d0 = MkIntegerTerm(SLR(d1, i2));
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(MkIntegerTerm(d1), Yap_Eval(d0));
|
||||
d0 = p_slr(MkIntegerTerm(d1), Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
@ -10950,13 +10950,13 @@ Yap_absmi(int inp)
|
||||
if (IsIntTerm(d0) && IsIntTerm(d1)) {
|
||||
Int i2 = IntOfTerm(d1);
|
||||
if (i2 < 0)
|
||||
d0 = do_sll(IntOfTerm(d0), -i2);
|
||||
d0 = do_sll(IntOfTerm(d0), -i2 PASS_REGS);
|
||||
else
|
||||
d0 = MkIntTerm(SLR(IntOfTerm(d0), i2));
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(Yap_Eval(d0), Yap_Eval(d1));
|
||||
d0 = p_slr(Yap_Eval(d0), Yap_Eval(d1) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
BEGP(pt0);
|
||||
@ -11004,7 +11004,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(Yap_Eval(d0), MkIntegerTerm(d1));
|
||||
d0 = p_slr(Yap_Eval(d0), MkIntegerTerm(d1) PASS_REGS);
|
||||
setregs();
|
||||
if (d0 == 0L) {
|
||||
saveregs();
|
||||
@ -11041,13 +11041,13 @@ Yap_absmi(int inp)
|
||||
if (IsIntTerm(d0)) {
|
||||
Int i2 = IntOfTerm(d0);
|
||||
if (i2 < 0)
|
||||
d0 = do_sll(d1, -i2);
|
||||
d0 = do_sll(d1, -i2 PASS_REGS);
|
||||
else
|
||||
d0 = MkIntegerTerm(SLR(d1, i2));
|
||||
}
|
||||
else {
|
||||
saveregs();
|
||||
d0 = p_slr(MkIntegerTerm(d1), Yap_Eval(d0));
|
||||
d0 = p_slr(MkIntegerTerm(d1), Yap_Eval(d0) PASS_REGS);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
|
@ -852,7 +852,6 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
||||
p->FunctorOfPred = fe;
|
||||
WRITE_UNLOCK(fe->FRWLock);
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC);
|
||||
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
||||
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_FUNC);
|
||||
@ -966,7 +965,6 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
||||
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM);
|
||||
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
||||
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_ATOM);
|
||||
@ -1057,8 +1055,10 @@ Yap_GetValue(Atom a)
|
||||
if (IsApplTerm(out)) {
|
||||
Functor f = FunctorOfTerm(out);
|
||||
if (f == FunctorDouble) {
|
||||
CACHE_REGS
|
||||
out = MkFloatTerm(FloatOfTerm(out));
|
||||
} else if (f == FunctorLongInt) {
|
||||
CACHE_REGS
|
||||
out = MkLongIntTerm(LongIntOfTerm(out));
|
||||
}
|
||||
#ifdef USE_GMP
|
||||
|
@ -2056,10 +2056,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
save_machine_regs();
|
||||
siglongjmp(cip->CompilerBotch,2);
|
||||
}
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX);
|
||||
}
|
||||
Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX);
|
||||
Yap_LUIndexSpace_CP += size;
|
||||
#ifdef DEBUG
|
||||
Yap_NewCps++;
|
||||
|
25
C/arith1.c
25
C/arith1.c
@ -29,7 +29,7 @@ static char SccsId[] = "%W% %G%";
|
||||
#include "eval.h"
|
||||
|
||||
static Term
|
||||
float_to_int(Float v)
|
||||
float_to_int(Float v USES_REGS)
|
||||
{
|
||||
#if USE_GMP
|
||||
Int i = (Int)v;
|
||||
@ -44,7 +44,7 @@ float_to_int(Float v)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define RBIG_FL(v) return(float_to_int(v))
|
||||
#define RBIG_FL(v) return(float_to_int(v PASS_REGS))
|
||||
|
||||
typedef struct init_un_eval {
|
||||
char *OpName;
|
||||
@ -118,7 +118,7 @@ double my_rint(double x)
|
||||
#endif
|
||||
|
||||
static Int
|
||||
msb(Int inp) /* calculate the most significant bit for an integer */
|
||||
msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */
|
||||
{
|
||||
/* the obvious solution: do it by using binary search */
|
||||
Int out = 0;
|
||||
@ -141,7 +141,7 @@ msb(Int inp) /* calculate the most significant bit for an integer */
|
||||
}
|
||||
|
||||
static Int
|
||||
lsb(Int inp) /* calculate the least significant bit for an integer */
|
||||
lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
||||
{
|
||||
/* the obvious solution: do it by using binary search */
|
||||
Int out = 0;
|
||||
@ -165,7 +165,7 @@ lsb(Int inp) /* calculate the least significant bit for an integer */
|
||||
}
|
||||
|
||||
static Int
|
||||
popcount(Int inp) /* calculate the least significant bit for an integer */
|
||||
popcount(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
||||
{
|
||||
/* the obvious solution: do it by using binary search */
|
||||
Int c = 0, j = 0, m = ((CELL)1);
|
||||
@ -185,7 +185,7 @@ popcount(Int inp) /* calculate the least significant bit for an integer */
|
||||
}
|
||||
|
||||
static Term
|
||||
eval1(Int fi, Term t) {
|
||||
eval1(Int fi, Term t USES_REGS) {
|
||||
arith1_op f = fi;
|
||||
switch (f) {
|
||||
case op_uplus:
|
||||
@ -586,7 +586,7 @@ eval1(Int fi, Term t) {
|
||||
case op_msb:
|
||||
switch (ETypeOfTerm(t)) {
|
||||
case long_int_e:
|
||||
RINT(msb(IntegerOfTerm(t)));
|
||||
RINT(msb(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "msb(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
@ -599,7 +599,7 @@ eval1(Int fi, Term t) {
|
||||
case op_lsb:
|
||||
switch (ETypeOfTerm(t)) {
|
||||
case long_int_e:
|
||||
RINT(lsb(IntegerOfTerm(t)));
|
||||
RINT(lsb(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "lsb(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
@ -612,7 +612,7 @@ eval1(Int fi, Term t) {
|
||||
case op_popcount:
|
||||
switch (ETypeOfTerm(t)) {
|
||||
case long_int_e:
|
||||
RINT(popcount(IntegerOfTerm(t)));
|
||||
RINT(popcount(IntegerOfTerm(t) PASS_REGS));
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "popcount(%f)", FloatOfTerm(t));
|
||||
case big_int_e:
|
||||
@ -699,7 +699,8 @@ eval1(Int fi, Term t) {
|
||||
|
||||
Term Yap_eval_unary(Int f, Term t)
|
||||
{
|
||||
return eval1(f,t);
|
||||
CACHE_REGS
|
||||
return eval1(f,t PASS_REGS);
|
||||
}
|
||||
|
||||
static InitUnEntry InitUnTab[] = {
|
||||
@ -758,7 +759,7 @@ p_unary_is( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
if (IsIntTerm(t)) {
|
||||
Term tout = Yap_FoundArithError(eval1(IntegerOfTerm(t), top), Deref(ARG3));
|
||||
Term tout = Yap_FoundArithError(eval1(IntegerOfTerm(t), top PASS_REGS), Deref(ARG3));
|
||||
if (!tout)
|
||||
return FALSE;
|
||||
return Yap_unify_constant(ARG1,tout);
|
||||
@ -781,7 +782,7 @@ p_unary_is( USES_REGS1 )
|
||||
P = FAILCODE;
|
||||
return(FALSE);
|
||||
}
|
||||
if (!(out=Yap_FoundArithError(eval1(p->FOfEE, top),Deref(ARG3))))
|
||||
if (!(out=Yap_FoundArithError(eval1(p->FOfEE, top PASS_REGS),Deref(ARG3))))
|
||||
return FALSE;
|
||||
return Yap_unify_constant(ARG1,out);
|
||||
}
|
||||
|
71
C/arith2.c
71
C/arith2.c
@ -37,7 +37,7 @@ typedef struct init_un_eval {
|
||||
|
||||
|
||||
static Term
|
||||
p_mod(Term t1, Term t2) {
|
||||
p_mod(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case (CELL)long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -97,7 +97,7 @@ p_mod(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_div2(Term t1, Term t2) {
|
||||
p_div2(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case (CELL)long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -163,7 +163,7 @@ p_div2(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_rem(Term t1, Term t2) {
|
||||
p_rem(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case (CELL)long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -215,7 +215,7 @@ p_rem(Term t1, Term t2) {
|
||||
|
||||
|
||||
static Term
|
||||
p_rdiv(Term t1, Term t2) {
|
||||
p_rdiv(Term t1, Term t2 USES_REGS) {
|
||||
#ifdef USE_GMP
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case (CELL)double_e:
|
||||
@ -266,7 +266,7 @@ p_rdiv(Term t1, Term t2) {
|
||||
Floating point division: /
|
||||
*/
|
||||
static Term
|
||||
p_fdiv(Term t1, Term t2)
|
||||
p_fdiv(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -338,7 +338,7 @@ p_fdiv(Term t1, Term t2)
|
||||
xor #
|
||||
*/
|
||||
static Term
|
||||
p_xor(Term t1, Term t2)
|
||||
p_xor(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -382,7 +382,7 @@ p_xor(Term t1, Term t2)
|
||||
atan2: arc tangent x/y
|
||||
*/
|
||||
static Term
|
||||
p_atan2(Term t1, Term t2)
|
||||
p_atan2(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -461,7 +461,7 @@ p_atan2(Term t1, Term t2)
|
||||
power: x^y
|
||||
*/
|
||||
static Term
|
||||
p_power(Term t1, Term t2)
|
||||
p_power(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -577,7 +577,7 @@ ipow(Int x, Int p)
|
||||
power: x^y
|
||||
*/
|
||||
static Term
|
||||
p_exp(Term t1, Term t2)
|
||||
p_exp(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -669,7 +669,7 @@ p_exp(Term t1, Term t2)
|
||||
}
|
||||
|
||||
static Int
|
||||
gcd(Int m11,Int m21)
|
||||
gcd(Int m11,Int m21 USES_REGS)
|
||||
{
|
||||
/* Blankinship algorithm, provided by Miguel Filgueiras */
|
||||
Int m12=1, m22=0, k;
|
||||
@ -719,7 +719,7 @@ Int gcdmult(Int m11,Int m21,Int *pm11) /* *pm11 gets multiplier of m11 */
|
||||
module gcd
|
||||
*/
|
||||
static Term
|
||||
p_gcd(Term t1, Term t2)
|
||||
p_gcd(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
@ -731,7 +731,7 @@ p_gcd(Term t1, Term t2)
|
||||
i1 = (i1 >= 0 ? i1 : -i1);
|
||||
i2 = (i2 >= 0 ? i2 : -i2);
|
||||
|
||||
RINT(gcd(i1,i2));
|
||||
RINT(gcd(i1,i2 PASS_REGS));
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "gcd/2");
|
||||
@ -957,56 +957,57 @@ p_max(Term t1, Term t2)
|
||||
}
|
||||
|
||||
static Term
|
||||
eval2(Int fi, Term t1, Term t2) {
|
||||
eval2(Int fi, Term t1, Term t2 USES_REGS) {
|
||||
arith2_op f = fi;
|
||||
switch (f) {
|
||||
case op_plus:
|
||||
return p_plus(t1, t2);
|
||||
return p_plus(t1, t2 PASS_REGS);
|
||||
case op_minus:
|
||||
return p_minus(t1, t2);
|
||||
return p_minus(t1, t2 PASS_REGS);
|
||||
case op_times:
|
||||
return p_times(t1, t2);
|
||||
return p_times(t1, t2 PASS_REGS);
|
||||
case op_div:
|
||||
return p_div(t1, t2);
|
||||
return p_div(t1, t2 PASS_REGS);
|
||||
case op_idiv:
|
||||
return p_div2(t1, t2);
|
||||
return p_div2(t1, t2 PASS_REGS);
|
||||
case op_and:
|
||||
return p_and(t1, t2);
|
||||
return p_and(t1, t2 PASS_REGS);
|
||||
case op_or:
|
||||
return p_or(t1, t2);
|
||||
return p_or(t1, t2 PASS_REGS);
|
||||
case op_sll:
|
||||
return p_sll(t1, t2);
|
||||
return p_sll(t1, t2 PASS_REGS);
|
||||
case op_slr:
|
||||
return p_slr(t1, t2);
|
||||
return p_slr(t1, t2 PASS_REGS);
|
||||
case op_mod:
|
||||
return p_mod(t1, t2);
|
||||
return p_mod(t1, t2 PASS_REGS);
|
||||
case op_rem:
|
||||
return p_rem(t1, t2);
|
||||
return p_rem(t1, t2 PASS_REGS);
|
||||
case op_fdiv:
|
||||
return p_fdiv(t1, t2);
|
||||
return p_fdiv(t1, t2 PASS_REGS);
|
||||
case op_xor:
|
||||
return p_xor(t1, t2);
|
||||
return p_xor(t1, t2 PASS_REGS);
|
||||
case op_atan2:
|
||||
return p_atan2(t1, t2);
|
||||
return p_atan2(t1, t2 PASS_REGS);
|
||||
case op_power:
|
||||
return p_exp(t1, t2);
|
||||
return p_exp(t1, t2 PASS_REGS);
|
||||
case op_power2:
|
||||
return p_power(t1, t2);
|
||||
return p_power(t1, t2 PASS_REGS);
|
||||
case op_gcd:
|
||||
return p_gcd(t1, t2);
|
||||
return p_gcd(t1, t2 PASS_REGS);
|
||||
case op_min:
|
||||
return p_min(t1, t2);
|
||||
case op_max:
|
||||
return p_max(t1, t2);
|
||||
case op_rdiv:
|
||||
return p_rdiv(t1, t2);
|
||||
return p_rdiv(t1, t2 PASS_REGS);
|
||||
}
|
||||
RERROR();
|
||||
}
|
||||
|
||||
Term Yap_eval_binary(Int f, Term t1, Term t2)
|
||||
{
|
||||
return eval2(f,t1,t2);
|
||||
CACHE_REGS
|
||||
return eval2(f,t1,t2 PASS_REGS);
|
||||
}
|
||||
|
||||
static InitBinEntry InitBinTab[] = {
|
||||
@ -1058,7 +1059,7 @@ p_binary_is( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
if (IsIntTerm(t)) {
|
||||
Term tout = Yap_FoundArithError(eval2(IntOfTerm(t), t1, t2), 0L);
|
||||
Term tout = Yap_FoundArithError(eval2(IntOfTerm(t), t1, t2 PASS_REGS), 0L);
|
||||
if (!tout)
|
||||
return FALSE;
|
||||
return Yap_unify_constant(ARG1,tout);
|
||||
@ -1081,7 +1082,7 @@ p_binary_is( USES_REGS1 )
|
||||
P = FAILCODE;
|
||||
return(FALSE);
|
||||
}
|
||||
if (!(out=Yap_FoundArithError(eval2(p->FOfEE, t1, t2), 0L)))
|
||||
if (!(out=Yap_FoundArithError(eval2(p->FOfEE, t1, t2 PASS_REGS), 0L)))
|
||||
return FALSE;
|
||||
return Yap_unify_constant(ARG1,out);
|
||||
}
|
||||
@ -1105,7 +1106,7 @@ do_arith23(arith2_op op USES_REGS)
|
||||
t2 = Yap_Eval(Deref(ARG2));
|
||||
if (t2 == 0L)
|
||||
return FALSE;
|
||||
if (!(out=Yap_FoundArithError(eval2(op, t1, t2), 0L)))
|
||||
if (!(out=Yap_FoundArithError(eval2(op, t1, t2 PASS_REGS), 0L)))
|
||||
return FALSE;
|
||||
return Yap_unify_constant(ARG3,out);
|
||||
}
|
||||
|
34
C/bignum.c
34
C/bignum.c
@ -320,6 +320,7 @@ Yap_MkULLIntTerm(YAP_ULONG_LONG n)
|
||||
/* try to scan it as a bignum */
|
||||
mpz_init_set_str (new, tmp, 10);
|
||||
if (mpz_fits_slong_p(new)) {
|
||||
CACHE_REGS
|
||||
return MkIntegerTerm(mpz_get_si(new));
|
||||
}
|
||||
t = Yap_MkBigIntTerm(new);
|
||||
@ -346,6 +347,38 @@ p_is_bignum( USES_REGS1 )
|
||||
#endif
|
||||
}
|
||||
|
||||
static Int
|
||||
p_nb_set_bit( USES_REGS1 )
|
||||
{
|
||||
#ifdef USE_GMP
|
||||
Term t = Deref(ARG1);
|
||||
Term ti = Deref(ARG2);
|
||||
Int i;
|
||||
|
||||
if (!(
|
||||
IsNonVarTerm(t) &&
|
||||
IsApplTerm(t) &&
|
||||
FunctorOfTerm(t) == FunctorBigInt &&
|
||||
RepAppl(t)[1] == BIG_INT
|
||||
))
|
||||
return FALSE;
|
||||
if (!IsIntegerTerm(ti)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsIntegerTerm(ti)) {
|
||||
return FALSE;
|
||||
}
|
||||
i = IntegerOfTerm(ti);
|
||||
if (i < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
Yap_gmp_set_bit(i, t);
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static Int
|
||||
p_has_bignums( USES_REGS1 )
|
||||
{
|
||||
@ -560,4 +593,5 @@ Yap_InitBigNums(void)
|
||||
Yap_InitCPred("$bignum", 1, p_is_bignum, SafePredFlag);
|
||||
Yap_InitCPred("rational", 3, p_rational, 0);
|
||||
Yap_InitCPred("rational", 1, p_is_rational, SafePredFlag);
|
||||
Yap_InitCPred("nb_set_bit", 2, p_nb_set_bit, SafePredFlag);
|
||||
}
|
||||
|
@ -738,6 +738,7 @@ YAP_IsCompoundTerm(Term t)
|
||||
X_API Term
|
||||
YAP_MkIntTerm(Int n)
|
||||
{
|
||||
CACHE_REGS
|
||||
Term I;
|
||||
BACKUP_H();
|
||||
|
||||
@ -854,6 +855,7 @@ YAP_BlobOfTerm(Term t)
|
||||
X_API Term
|
||||
YAP_MkFloatTerm(double n)
|
||||
{
|
||||
CACHE_REGS
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
|
||||
@ -3734,6 +3736,7 @@ YAP_CloseList(Term t0, Term tail)
|
||||
X_API int
|
||||
YAP_IsAttVar(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
t = Deref(t);
|
||||
if (!IsVarTerm(t))
|
||||
return FALSE;
|
||||
@ -3743,6 +3746,7 @@ YAP_IsAttVar(Term t)
|
||||
X_API Term
|
||||
YAP_AttsOfVar(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
attvar_record *attv;
|
||||
|
||||
t = Deref(t);
|
||||
@ -4023,6 +4027,7 @@ YAP_TagOfTerm(Term t)
|
||||
if (IsVarTerm(t)) {
|
||||
CELL *pt = VarOfTerm(t);
|
||||
if (IsUnboundVar(pt)) {
|
||||
CACHE_REGS
|
||||
if (IsAttVar(pt))
|
||||
return YAP_TAG_ATT;
|
||||
return YAP_TAG_UNBOUND;
|
||||
|
@ -4910,6 +4910,7 @@ replace_integer(Term orig, UInt new)
|
||||
return MkIntTerm(new);
|
||||
/* should create an old integer */
|
||||
if (!IsApplTerm(orig)) {
|
||||
CACHE_REGS
|
||||
Yap_Error(SYSTEM_ERROR,orig,"%uld-->%uld where it should increase",(unsigned long int)IntegerOfTerm(orig),(unsigned long int)new);
|
||||
return MkIntegerTerm(new);
|
||||
}
|
||||
|
@ -471,6 +471,7 @@ ShowOp (char *f, struct PSEUDO *cpc)
|
||||
case 'b':
|
||||
/* write a variable bitmap for a call */
|
||||
{
|
||||
CACHE_REGS
|
||||
int max = arg/(8*sizeof(CELL)), i;
|
||||
CELL *ptr = cptr;
|
||||
for (i = 0; i <= max; i++) {
|
||||
@ -490,7 +491,10 @@ ShowOp (char *f, struct PSEUDO *cpc)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
Yap_DebugPlWrite (MkIntegerTerm (arg));
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_DebugPlWrite (MkIntegerTerm (arg));
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
Yap_DebugPlWrite (MkIntTerm (cpc->rnd3));
|
||||
|
@ -2381,6 +2381,7 @@ GetDBLUKey(PredEntry *ap)
|
||||
{
|
||||
PELOCK(63,ap);
|
||||
if (ap->PredFlags & NumberDBPredFlag) {
|
||||
CACHE_REGS
|
||||
Int id = ap->src.IndxId;
|
||||
UNLOCK(ap->PELock);
|
||||
return MkIntegerTerm(id);
|
||||
@ -2430,6 +2431,7 @@ UnifyDBKey(DBRef DBSP, PropFlags flags, Term t)
|
||||
static int
|
||||
UnifyDBNumber(DBRef DBSP, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
DBProp p = DBSP->Parent;
|
||||
DBRef ref;
|
||||
Int i = 1;
|
||||
|
@ -2121,6 +2121,7 @@ p_nb_beam_close( USES_REGS1 )
|
||||
static void
|
||||
PushBeam(CELL *pt, CELL *npt, UInt hsize, Term key, Term to)
|
||||
{
|
||||
CACHE_REGS
|
||||
UInt off = hsize, off2 = hsize;
|
||||
Term toff, toff2;
|
||||
|
||||
@ -2166,6 +2167,7 @@ PushBeam(CELL *pt, CELL *npt, UInt hsize, Term key, Term to)
|
||||
static void
|
||||
DelBeamMax(CELL *pt, CELL *pt2, UInt sz)
|
||||
{
|
||||
CACHE_REGS
|
||||
UInt off = IntegerOfTerm(pt2[1]);
|
||||
UInt indx = 0;
|
||||
Term tk, ti, tv;
|
||||
@ -2240,6 +2242,7 @@ DelBeamMax(CELL *pt, CELL *pt2, UInt sz)
|
||||
static Term
|
||||
DelBeamMin(CELL *pt, CELL *pt2, UInt sz)
|
||||
{
|
||||
CACHE_REGS
|
||||
UInt off2 = IntegerOfTerm(pt[1]);
|
||||
Term ov = pt2[3*off2+2]; /* return value */
|
||||
UInt indx = 0;
|
||||
|
@ -132,6 +132,14 @@ Yap_gmp_add_int_big(Int i, Term t)
|
||||
}
|
||||
}
|
||||
|
||||
/* add i + b using temporary bigint new */
|
||||
void
|
||||
Yap_gmp_set_bit(Int i, Term t)
|
||||
{
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
mpz_setbit(b, i);
|
||||
}
|
||||
|
||||
/* sub i - b using temporary bigint new */
|
||||
Term
|
||||
Yap_gmp_sub_int_big(Int i, Term t)
|
||||
@ -384,6 +392,7 @@ Yap_gmp_sll_big_int(Term t, Int i)
|
||||
} else {
|
||||
mpz_init(&new);
|
||||
if (i == Int_MIN) {
|
||||
CACHE_REGS
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, MkIntegerTerm(i), "<</2");
|
||||
}
|
||||
mpz_fdiv_q_2exp(&new, b, -i);
|
||||
@ -706,6 +715,7 @@ Yap_gmp_mod_big_int(Term t, Int i2)
|
||||
Term
|
||||
Yap_gmp_mod_int_big(Int i1, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
@ -782,6 +792,7 @@ Yap_gmp_rem_big_int(Term t, Int i2)
|
||||
Term
|
||||
Yap_gmp_rem_int_big(Int i1, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
@ -815,6 +826,7 @@ Yap_gmp_gcd_big_big(Term t1, Term t2)
|
||||
Term
|
||||
Yap_gmp_gcd_int_big(Int i, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] != BIG_INT) {
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t, "mod/2");
|
||||
@ -855,6 +867,7 @@ Yap_gmp_to_float(Term t)
|
||||
Term
|
||||
Yap_gmp_add_float_big(Float d, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -868,6 +881,7 @@ Yap_gmp_add_float_big(Float d, Term t)
|
||||
Term
|
||||
Yap_gmp_sub_float_big(Float d, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -881,6 +895,7 @@ Yap_gmp_sub_float_big(Float d, Term t)
|
||||
Term
|
||||
Yap_gmp_sub_big_float(Term t, Float d)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -894,6 +909,7 @@ Yap_gmp_sub_big_float(Term t, Float d)
|
||||
Term
|
||||
Yap_gmp_mul_float_big(Float d, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -907,6 +923,7 @@ Yap_gmp_mul_float_big(Float d, Term t)
|
||||
Term
|
||||
Yap_gmp_fdiv_float_big(Float d, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -920,6 +937,7 @@ Yap_gmp_fdiv_float_big(Float d, Term t)
|
||||
Term
|
||||
Yap_gmp_fdiv_big_float(Term t, Float d)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *b = Yap_BigIntOfTerm(t);
|
||||
@ -943,6 +961,7 @@ Yap_gmp_exp_int_int(Int i1, Int i2)
|
||||
Term
|
||||
Yap_gmp_exp_big_int(Term t, Int i)
|
||||
{
|
||||
CACHE_REGS
|
||||
MP_INT new;
|
||||
|
||||
CELL *pt = RepAppl(t);
|
||||
@ -969,6 +988,7 @@ Yap_gmp_exp_big_int(Term t, Int i)
|
||||
Term
|
||||
Yap_gmp_exp_int_big(Int i, Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t, "^/2");
|
||||
@ -982,6 +1002,7 @@ Yap_gmp_exp_int_big(Int i, Term t)
|
||||
Term
|
||||
Yap_gmp_exp_big_big(Term t1, Term t2)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt1 = RepAppl(t1);
|
||||
CELL *pt2 = RepAppl(t2);
|
||||
Float dbl1, dbl2;
|
||||
@ -1116,6 +1137,7 @@ Yap_gmq_rdiv_big_big(Term t1, Term t2)
|
||||
Term
|
||||
Yap_gmp_fdiv_int_big(Int i1, Term t2)
|
||||
{
|
||||
CACHE_REGS
|
||||
MP_RAT new;
|
||||
MP_RAT *b1, *b2;
|
||||
MP_RAT bb1, bb2;
|
||||
@ -1142,6 +1164,7 @@ Yap_gmp_fdiv_int_big(Int i1, Term t2)
|
||||
Term
|
||||
Yap_gmp_fdiv_big_int(Term t2, Int i1)
|
||||
{
|
||||
CACHE_REGS
|
||||
MP_RAT new;
|
||||
MP_RAT *b1, *b2;
|
||||
MP_RAT bb1, bb2;
|
||||
@ -1168,6 +1191,7 @@ Yap_gmp_fdiv_big_int(Term t2, Int i1)
|
||||
Term
|
||||
Yap_gmp_fdiv_big_big(Term t1, Term t2)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt1 = RepAppl(t1);
|
||||
CELL *pt2 = RepAppl(t2);
|
||||
MP_RAT new;
|
||||
@ -1602,6 +1626,7 @@ Yap_gmp_float_integer_part(Term t)
|
||||
Term
|
||||
Yap_gmp_sign(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
return MkIntegerTerm(mpz_sgn(Yap_BigIntOfTerm(t)));
|
||||
@ -1613,6 +1638,7 @@ Yap_gmp_sign(Term t)
|
||||
Term
|
||||
Yap_gmp_lsb(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
@ -1629,6 +1655,7 @@ Yap_gmp_lsb(Term t)
|
||||
Term
|
||||
Yap_gmp_msb(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
@ -1645,6 +1672,7 @@ Yap_gmp_msb(Term t)
|
||||
Term
|
||||
Yap_gmp_popcount(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt = RepAppl(t);
|
||||
if (pt[1] == BIG_INT) {
|
||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||
|
@ -1923,10 +1923,7 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi
|
||||
} else {
|
||||
Yap_IndexSpace_EXT += sz;
|
||||
}
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_inform_profiler_of_clause(ncode, (CODEADDR)ncode+sz, ap, GPROF_NEW_EXPAND_BLOCK);
|
||||
}
|
||||
Yap_inform_profiler_of_clause(ncode, (CODEADDR)ncode+sz, ap, GPROF_NEW_EXPAND_BLOCK);
|
||||
/* create an expand_block */
|
||||
ncode->opc = Yap_opcode(_expand_clauses);
|
||||
ncode->u.sssllp.p = ap;
|
||||
|
8
C/save.c
8
C/save.c
@ -261,7 +261,7 @@ open_file(char *my_file, int flag)
|
||||
#endif /* O_BINARY */
|
||||
#endif /* M_WILLIAMS */
|
||||
{
|
||||
splfild = 0; /* We do not have an open file */
|
||||
splfild = -1; /* We do not have an open file */
|
||||
return -1;
|
||||
}
|
||||
#ifdef undf0
|
||||
@ -1466,7 +1466,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
} else {
|
||||
strncat(LOCAL_FileNameBuf, inpf, YAP_FILENAME_MAX-1);
|
||||
}
|
||||
if (inpf != NULL && (splfild = open_file(inpf, O_RDONLY)) > 0) {
|
||||
if (inpf != NULL && !((splfild = open_file(inpf, O_RDONLY)) < 0)) {
|
||||
if ((mode = try_open(inpf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
|
||||
return mode;
|
||||
}
|
||||
@ -1499,7 +1499,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
#endif
|
||||
if (YAP_LIBDIR != NULL) {
|
||||
cat_file_name(LOCAL_FileNameBuf, YAP_LIBDIR, inpf, YAP_FILENAME_MAX);
|
||||
if ((splfild = open_file(LOCAL_FileNameBuf, O_RDONLY)) > 0) {
|
||||
if (!((splfild = open_file(LOCAL_FileNameBuf, O_RDONLY)) < 0)) {
|
||||
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
|
||||
return mode;
|
||||
}
|
||||
@ -1508,7 +1508,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
}
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
if ((inpf = Yap_RegistryGetString("startup"))) {
|
||||
if ((splfild = open_file(inpf, O_RDONLY)) > 0) {
|
||||
if (!((splfild = open_file(inpf, O_RDONLY)) < 0)) {
|
||||
if ((mode = try_open(inpf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
|
||||
return mode;
|
||||
}
|
||||
|
@ -230,6 +230,7 @@ extern double atof(const char *);
|
||||
static Term
|
||||
float_send(char *s, int sign)
|
||||
{
|
||||
CACHE_REGS
|
||||
Float f = (Float)atof(s);
|
||||
#if HAVE_FINITE
|
||||
if (yap_flags[LANGUAGE_MODE_FLAG] == 1) { /* iso */
|
||||
@ -512,6 +513,7 @@ num_send_error_message(char s[])
|
||||
static Term
|
||||
get_num(int *chp, int *chbuffp, IOSTREAM *inp_stream, char *s, UInt max_size, int sign)
|
||||
{
|
||||
CACHE_REGS
|
||||
char *sp = s;
|
||||
int ch = *chp;
|
||||
Int val = 0L, base = ch - '0';
|
||||
|
@ -74,9 +74,6 @@ p_creep( USES_REGS1 )
|
||||
static Int
|
||||
p_stop_creeping( USES_REGS1 )
|
||||
{
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
|
16
C/stdpreds.c
16
C/stdpreds.c
@ -292,7 +292,7 @@ STD_PROTO(static Int p_values, ( USES_REGS1 ));
|
||||
STD_PROTO(static CODEADDR *FindAtom, (CODEADDR, int *));
|
||||
#endif /* undefined */
|
||||
STD_PROTO(static Int p_opdec, ( USES_REGS1 ));
|
||||
STD_PROTO(static Term get_num, (char *));
|
||||
STD_PROTO(static Term get_num, (char * USES_REGS));
|
||||
STD_PROTO(static Int p_name, ( USES_REGS1 ));
|
||||
STD_PROTO(static Int p_atom_chars, ( USES_REGS1 ));
|
||||
STD_PROTO(static Int p_atom_codes, ( USES_REGS1 ));
|
||||
@ -537,7 +537,7 @@ strtod(s, pe)
|
||||
#endif
|
||||
|
||||
static Term
|
||||
get_num(char *t)
|
||||
get_num(char *t USES_REGS)
|
||||
{
|
||||
Term out;
|
||||
IOSTREAM *smem = Sopenmem(&t, NULL, "r");
|
||||
@ -832,7 +832,7 @@ p_name( USES_REGS1 )
|
||||
return(FALSE);
|
||||
}
|
||||
if (IsAtomTerm(t) && AtomOfTerm(t) == AtomNil) {
|
||||
if ((NewT = get_num(String)) == TermNil) {
|
||||
if ((NewT = get_num(String PASS_REGS)) == TermNil) {
|
||||
Atom at;
|
||||
while ((at = Yap_LookupAtom(String)) == NIL) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
@ -1375,7 +1375,7 @@ p_atom_concat( USES_REGS1 )
|
||||
if (wide_mode) {
|
||||
wchar_t *cptr = (wchar_t *)(((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE), *cpt0;
|
||||
wchar_t *top = (wchar_t *)AuxSp;
|
||||
unsigned char *atom_str;
|
||||
unsigned char *atom_str = NULL;
|
||||
Atom ahead;
|
||||
UInt sz;
|
||||
|
||||
@ -2227,7 +2227,7 @@ p_number_chars( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
*s++ = '\0';
|
||||
if ((NewT = get_num(String)) == TermNil) {
|
||||
if ((NewT = get_num(String PASS_REGS)) == TermNil) {
|
||||
Yap_Error(SYNTAX_ERROR, gen_syntax_error(Yap_LookupAtom(String), "number_chars"), "while scanning %s", String);
|
||||
return (FALSE);
|
||||
}
|
||||
@ -2294,7 +2294,7 @@ p_number_atom( USES_REGS1 )
|
||||
return(FALSE);
|
||||
}
|
||||
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||
if ((NewT = get_num(s)) == TermNil) {
|
||||
if ((NewT = get_num(s PASS_REGS)) == TermNil) {
|
||||
Yap_Error(SYNTAX_ERROR, gen_syntax_error(Yap_LookupAtom(String), "number_atom"), "while scanning %s", s);
|
||||
return (FALSE);
|
||||
}
|
||||
@ -2387,7 +2387,7 @@ p_number_codes( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
*s++ = '\0';
|
||||
if ((NewT = get_num(String)) == TermNil) {
|
||||
if ((NewT = get_num(String PASS_REGS)) == TermNil) {
|
||||
Yap_Error(SYNTAX_ERROR, gen_syntax_error(Yap_LookupAtom(String), "number_codes"), "while scanning %s", String);
|
||||
return (FALSE);
|
||||
}
|
||||
@ -2452,7 +2452,7 @@ p_atom_number( USES_REGS1 )
|
||||
return FALSE;
|
||||
}
|
||||
s = RepAtom(at)->StrOfAE; /* alloc temp space on Trail */
|
||||
if ((NewT = get_num(s)) == TermNil) {
|
||||
if ((NewT = get_num(s PASS_REGS)) == TermNil) {
|
||||
Yap_Error(SYNTAX_ERROR, gen_syntax_error(at, "atom_number"), "while scanning %s", s);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -4921,7 +4921,7 @@ numbervar_singleton(USES_REGS1)
|
||||
}
|
||||
|
||||
static void
|
||||
renumbervar(Term t, Int id)
|
||||
renumbervar(Term t, Int id USES_REGS)
|
||||
{
|
||||
Term *ts = RepAppl(t);
|
||||
ts[1] = MkIntegerTerm(id);
|
||||
@ -4975,7 +4975,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
|
||||
continue;
|
||||
}
|
||||
if (singles && ap2 >= InitialH && ap2 < H) {
|
||||
renumbervar(d0, numbv++);
|
||||
renumbervar(d0, numbv++ PASS_REGS);
|
||||
continue;
|
||||
}
|
||||
/* store the terms to visit */
|
||||
|
34
H/TermExt.h
34
H/TermExt.h
@ -60,13 +60,14 @@ blob_type;
|
||||
|
||||
#include "inline-only.h"
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsAttVar (CELL *pt);
|
||||
#define IsAttVar(pt) __IsAttVar((pt) PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN int __IsAttVar (CELL *pt USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsAttVar (CELL *pt)
|
||||
__IsAttVar (CELL *pt USES_REGS)
|
||||
{
|
||||
#ifdef YAP_H
|
||||
CACHE_REGS
|
||||
return (pt)[-1] == (CELL)attvar_e
|
||||
&& pt < H;
|
||||
#else
|
||||
@ -182,13 +183,13 @@ INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
||||
|
||||
#if SIZEOF_DOUBLE == SIZEOF_LONG_INT
|
||||
|
||||
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term MkFloatTerm (Float);
|
||||
INLINE_ONLY inline EXTERN Term __MkFloatTerm (Float USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
MkFloatTerm (Float dbl)
|
||||
__MkFloatTerm (Float dbl USES_REGS)
|
||||
{
|
||||
CACHE_REGS
|
||||
return (Term) ((H[0] = (CELL) FunctorDouble, *(Float *) (H + 1) =
|
||||
dbl, H[2] = EndSpecials, H +=
|
||||
3, AbsAppl (H - 3)));
|
||||
@ -303,12 +304,13 @@ IsFloatTerm (Term t)
|
||||
|
||||
/* extern Functor FunctorLongInt; */
|
||||
|
||||
INLINE_ONLY inline EXTERN Term MkLongIntTerm (Int);
|
||||
#define MkLongIntTerm(i) __MkLongIntTerm((i) PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term __MkLongIntTerm (Int USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
MkLongIntTerm (Int i)
|
||||
__MkLongIntTerm (Int i USES_REGS)
|
||||
{
|
||||
CACHE_REGS
|
||||
H[0] = (CELL) FunctorLongInt;
|
||||
H[1] = (CELL) (i);
|
||||
H[2] = EndSpecials;
|
||||
@ -546,11 +548,12 @@ IsAttachFunc (Functor f)
|
||||
|
||||
|
||||
|
||||
#define IsAttachedTerm(t) __IsAttachedTerm(t PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachedTerm (Term);
|
||||
INLINE_ONLY inline EXTERN Int __IsAttachedTerm (Term USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
IsAttachedTerm (Term t)
|
||||
__IsAttachedTerm (Term t USES_REGS)
|
||||
{
|
||||
return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t))));
|
||||
}
|
||||
@ -563,17 +566,16 @@ GlobalIsAttachedTerm (Term t)
|
||||
return (Int) ((IsVarTerm (t) && GlobalIsAttVar(VarOfTerm(t))));
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN Int SafeIsAttachedTerm (Term);
|
||||
#define SafeIsAttachedTerm(t) __SafeIsAttachedTerm((t) PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm (Term USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
SafeIsAttachedTerm (Term t)
|
||||
__SafeIsAttachedTerm (Term t USES_REGS)
|
||||
{
|
||||
return (Int) (IsVarTerm (t) && IsAttVar(VarOfTerm(t)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN exts ExtFromCell (CELL *);
|
||||
|
||||
INLINE_ONLY inline EXTERN exts
|
||||
|
@ -364,10 +364,13 @@ MkPairTerm__ (Term head, Term tail USES_REGS)
|
||||
#define IsAccessFunc(func) ((func) == FunctorAccess)
|
||||
|
||||
#ifdef YAP_H
|
||||
INLINE_ONLY inline EXTERN Term MkIntegerTerm (Int);
|
||||
|
||||
#define MkIntegerTerm(i) __MkIntegerTerm(i PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term __MkIntegerTerm (Int USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
MkIntegerTerm (Int n)
|
||||
__MkIntegerTerm (Int n USES_REGS)
|
||||
{
|
||||
return (Term) (IntInBnd (n) ? MkIntTerm (n) : MkLongIntTerm (n));
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ void STD_PROTO(Yap_InitSavePreds,(void));
|
||||
/* signals.c */
|
||||
void STD_PROTO(Yap_signal,(yap_signals));
|
||||
void STD_PROTO(Yap_undo_signal,(yap_signals));
|
||||
void STD_PROTO(Yap_InitSignalPreds,(void));
|
||||
void STD_PROTO(Yap_InitSignalCPreds,(void));
|
||||
|
||||
/* sort.c */
|
||||
void STD_PROTO(Yap_InitSortPreds,(void));
|
||||
|
34
H/arith2.h
34
H/arith2.h
@ -26,7 +26,7 @@ add_overflow(Int x, Int i, Int j)
|
||||
}
|
||||
|
||||
inline static Term
|
||||
add_int(Int i, Int j)
|
||||
add_int(Int i, Int j USES_REGS)
|
||||
{
|
||||
Int x = i+j;
|
||||
#if USE_GMP
|
||||
@ -51,7 +51,7 @@ sub_overflow(Int x, Int i, Int j)
|
||||
}
|
||||
|
||||
inline static Term
|
||||
sub_int(Int i, Int j)
|
||||
sub_int(Int i, Int j USES_REGS)
|
||||
{
|
||||
Int x = i-j;
|
||||
#if USE_GMP
|
||||
@ -105,7 +105,7 @@ mul_overflow(Int z, Int i1, Int i2)
|
||||
#endif
|
||||
|
||||
inline static Term
|
||||
times_int(Int i1, Int i2) {
|
||||
times_int(Int i1, Int i2 USES_REGS) {
|
||||
#ifdef USE_GMP
|
||||
Int z;
|
||||
DO_MULTI();
|
||||
@ -151,7 +151,7 @@ clrsb(Int i)
|
||||
#endif
|
||||
|
||||
inline static Term
|
||||
do_sll(Int i, Int j) /* j > 0 */
|
||||
do_sll(Int i, Int j USES_REGS) /* j > 0 */
|
||||
{
|
||||
#ifdef USE_GMP
|
||||
if (
|
||||
@ -174,13 +174,13 @@ do_sll(Int i, Int j) /* j > 0 */
|
||||
|
||||
|
||||
static inline Term
|
||||
p_plus(Term t1, Term t2) {
|
||||
p_plus(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
/* two integers */
|
||||
return add_int(IntegerOfTerm(t1),IntegerOfTerm(t2));
|
||||
return add_int(IntegerOfTerm(t1),IntegerOfTerm(t2) PASS_REGS);
|
||||
case double_e:
|
||||
{
|
||||
/* integer, double */
|
||||
@ -230,13 +230,13 @@ p_plus(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_minus(Term t1, Term t2) {
|
||||
p_minus(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
/* two integers */
|
||||
return sub_int(IntegerOfTerm(t1), IntegerOfTerm(t2));
|
||||
return sub_int(IntegerOfTerm(t1), IntegerOfTerm(t2) PASS_REGS);
|
||||
case double_e:
|
||||
{
|
||||
/* integer, double */
|
||||
@ -290,13 +290,13 @@ p_minus(Term t1, Term t2) {
|
||||
|
||||
|
||||
static Term
|
||||
p_times(Term t1, Term t2) {
|
||||
p_times(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
case long_int_e:
|
||||
/* two integers */
|
||||
return(times_int(IntegerOfTerm(t1),IntegerOfTerm(t2)));
|
||||
return(times_int(IntegerOfTerm(t1),IntegerOfTerm(t2) PASS_REGS));
|
||||
case double_e:
|
||||
{
|
||||
/* integer, double */
|
||||
@ -348,7 +348,7 @@ p_times(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_div(Term t1, Term t2) {
|
||||
p_div(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -405,7 +405,7 @@ p_div(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_and(Term t1, Term t2) {
|
||||
p_and(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -446,7 +446,7 @@ p_and(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_or(Term t1, Term t2) {
|
||||
p_or(Term t1, Term t2 USES_REGS) {
|
||||
switch(ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -487,7 +487,7 @@ p_or(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_sll(Term t1, Term t2) {
|
||||
p_sll(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -501,7 +501,7 @@ p_sll(Term t1, Term t2) {
|
||||
}
|
||||
RINT(SLR(IntegerOfTerm(t1), -i2));
|
||||
}
|
||||
return do_sll(IntegerOfTerm(t1),i2);
|
||||
return do_sll(IntegerOfTerm(t1),i2 PASS_REGS);
|
||||
}
|
||||
case double_e:
|
||||
return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<</2");
|
||||
@ -535,7 +535,7 @@ p_sll(Term t1, Term t2) {
|
||||
}
|
||||
|
||||
static Term
|
||||
p_slr(Term t1, Term t2) {
|
||||
p_slr(Term t1, Term t2 USES_REGS) {
|
||||
switch (ETypeOfTerm(t1)) {
|
||||
case long_int_e:
|
||||
switch (ETypeOfTerm(t2)) {
|
||||
@ -547,7 +547,7 @@ p_slr(Term t1, Term t2) {
|
||||
if (i2 == Int_MIN) {
|
||||
return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2");
|
||||
}
|
||||
return do_sll(IntegerOfTerm(t1), -i2);
|
||||
return do_sll(IntegerOfTerm(t1), -i2 PASS_REGS);
|
||||
}
|
||||
RINT(SLR(IntegerOfTerm(t1), i2));
|
||||
}
|
||||
|
@ -341,8 +341,10 @@ same_lu_block(yamop **paddr, yamop *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define Yap_MkStaticRefTerm(cp) __Yap_MkStaticRefTerm((cp) PASS_REGS)
|
||||
|
||||
static inline Term
|
||||
Yap_MkStaticRefTerm(StaticClause *cp)
|
||||
__Yap_MkStaticRefTerm(StaticClause *cp USES_REGS)
|
||||
{
|
||||
Term t[1];
|
||||
t[0] = MkIntegerTerm((Int)cp);
|
||||
@ -355,8 +357,10 @@ Yap_ClauseFromTerm(Term t)
|
||||
return (StaticClause *)IntegerOfTerm(ArgOfTerm(1,t));
|
||||
}
|
||||
|
||||
#define Yap_MkMegaRefTerm(ap, ipc) __Yap_MkMegaRefTerm((ap), (ipc) PASS_REGS)
|
||||
|
||||
static inline Term
|
||||
Yap_MkMegaRefTerm(PredEntry *ap,yamop *ipc)
|
||||
__Yap_MkMegaRefTerm(PredEntry *ap,yamop *ipc USES_REGS)
|
||||
{
|
||||
Term t[2];
|
||||
t[0] = MkIntegerTerm((Int)ap);
|
||||
|
8
H/eval.h
8
H/eval.h
@ -314,12 +314,16 @@ size_t STD_PROTO(Yap_gmp_to_size,(Term, int));
|
||||
|
||||
int STD_PROTO(Yap_term_to_existing_big,(Term, MP_INT *));
|
||||
int STD_PROTO(Yap_term_to_existing_rat,(Term, MP_RAT *));
|
||||
|
||||
void Yap_gmp_set_bit(Int i, Term t);
|
||||
#endif
|
||||
|
||||
INLINE_ONLY inline EXTERN Term Yap_Mk64IntegerTerm(YAP_LONG_LONG);
|
||||
#define Yap_Mk64IntegerTerm(i) __Yap_Mk64IntegerTerm((i) PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term __Yap_Mk64IntegerTerm(YAP_LONG_LONG USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
Yap_Mk64IntegerTerm(YAP_LONG_LONG i)
|
||||
__Yap_Mk64IntegerTerm(YAP_LONG_LONG i USES_REGS)
|
||||
{
|
||||
if (i <= Int_MAX && i >= Int_MIN) {
|
||||
return MkIntegerTerm((Int)i);
|
||||
|
@ -10,6 +10,7 @@ INIT_SEQ_STRING(size_t n)
|
||||
|
||||
static inline Word
|
||||
EXTEND_SEQ_CODES(Word ptr, int c) {
|
||||
CACHE_REGS
|
||||
ptr[0] = MkIntegerTerm(c);
|
||||
ptr[1] = AbsPair(ptr+2);
|
||||
|
||||
|
@ -13,7 +13,7 @@ static void readswap8(double *buf);
|
||||
static byte get_hostbyteorder(void);
|
||||
static byte get_inbyteorder(void);
|
||||
static uint32 get_wkbType(void);
|
||||
static Term get_point(char *functor);
|
||||
static Term get_point(char *functor USES_REGS);
|
||||
static Term get_linestring(char *functor);
|
||||
static Term get_polygon(char *functor);
|
||||
static Term get_geometry(uint32 type);
|
||||
@ -150,7 +150,7 @@ static void readswap8(double *buf) {
|
||||
cursor += 8;
|
||||
}
|
||||
|
||||
static Term get_point(char *func){
|
||||
static Term get_point(char *func USES_REGS){
|
||||
Term args[2];
|
||||
Functor functor;
|
||||
double d;
|
||||
@ -188,7 +188,7 @@ static Term get_linestring(char *func){
|
||||
c_list = (Term *) calloc(sizeof(Term),n);
|
||||
|
||||
for ( i = 0; i < n; i++) {
|
||||
c_list[i] = get_point(NULL);
|
||||
c_list[i] = get_point(NULL PASS_REGS);
|
||||
}
|
||||
|
||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||
@ -241,15 +241,14 @@ static Term get_geometry(uint32 type){
|
||||
|
||||
switch(type) {
|
||||
case WKBPOINT:
|
||||
return get_point("point");
|
||||
return get_point("point" PASS_REGS);
|
||||
case WKBLINESTRING:
|
||||
return get_linestring("linestring");
|
||||
case WKBPOLYGON:
|
||||
return get_polygon("polygon");
|
||||
case WKBMULTIPOINT:
|
||||
{
|
||||
byte b;
|
||||
uint32 n, u;
|
||||
uint32 n;
|
||||
int i;
|
||||
Functor functor;
|
||||
Term *c_list;
|
||||
@ -264,10 +263,10 @@ static Term get_geometry(uint32 type){
|
||||
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
/* read (and ignore) the byteorder and type */
|
||||
b = get_inbyteorder();
|
||||
u = get_wkbType();
|
||||
get_inbyteorder();
|
||||
get_wkbType();
|
||||
|
||||
c_list[i] = get_point(NULL);
|
||||
c_list[i] = get_point(NULL PASS_REGS);
|
||||
}
|
||||
|
||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||
@ -282,8 +281,7 @@ static Term get_geometry(uint32 type){
|
||||
}
|
||||
case WKBMULTILINESTRING:
|
||||
{
|
||||
byte b;
|
||||
uint32 n, u;
|
||||
uint32 n;
|
||||
int i;
|
||||
Functor functor;
|
||||
Term *c_list;
|
||||
@ -298,8 +296,8 @@ static Term get_geometry(uint32 type){
|
||||
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
/* read (and ignore) the byteorder and type */
|
||||
b = get_inbyteorder();
|
||||
u = get_wkbType();
|
||||
get_inbyteorder();
|
||||
get_wkbType();
|
||||
|
||||
c_list[i] = get_linestring(NULL);
|
||||
}
|
||||
@ -316,8 +314,7 @@ static Term get_geometry(uint32 type){
|
||||
}
|
||||
case WKBMULTIPOLYGON:
|
||||
{
|
||||
byte b;
|
||||
uint32 n, u;
|
||||
uint32 n;
|
||||
int i;
|
||||
Functor functor;
|
||||
Term *c_list;
|
||||
@ -332,8 +329,8 @@ static Term get_geometry(uint32 type){
|
||||
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
/* read (and ignore) the byteorder and type */
|
||||
b = get_inbyteorder();
|
||||
u = get_wkbType();
|
||||
get_inbyteorder();
|
||||
get_wkbType();
|
||||
|
||||
c_list[i] = get_polygon(NULL);
|
||||
}
|
||||
@ -350,7 +347,6 @@ static Term get_geometry(uint32 type){
|
||||
}
|
||||
case WKBGEOMETRYCOLLECTION:
|
||||
{
|
||||
byte b;
|
||||
uint32 n;
|
||||
int i;
|
||||
Functor functor;
|
||||
@ -365,7 +361,7 @@ static Term get_geometry(uint32 type){
|
||||
|
||||
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
b = get_inbyteorder();
|
||||
get_inbyteorder();
|
||||
c_list[i] = get_geometry(get_wkbType());
|
||||
}
|
||||
|
||||
|
@ -22,39 +22,39 @@
|
||||
#include "opt.mavar.h"
|
||||
|
||||
#ifdef THREADS
|
||||
static inline void **get_insert_thread_bucket(void **, lockvar *);
|
||||
static inline void **get_thread_bucket(void **);
|
||||
static inline void **__get_insert_thread_bucket(void **, lockvar * USES_REGS);
|
||||
static inline void **__get_thread_bucket(void ** USES_REGS);
|
||||
static inline void abolish_thread_buckets(void **);
|
||||
#endif /* THREADS */
|
||||
static inline sg_node_ptr get_insert_subgoal_trie(tab_ent_ptr USES_REGS);
|
||||
static inline sg_node_ptr get_subgoal_trie(tab_ent_ptr);
|
||||
static inline sg_node_ptr __get_subgoal_trie(tab_ent_ptr USES_REGS);
|
||||
static inline sg_node_ptr get_subgoal_trie_for_abolish(tab_ent_ptr USES_REGS);
|
||||
static inline sg_fr_ptr *get_insert_subgoal_frame_addr(sg_node_ptr USES_REGS);
|
||||
static inline sg_fr_ptr get_subgoal_frame(sg_node_ptr);
|
||||
static inline sg_fr_ptr get_subgoal_frame_for_abolish(sg_node_ptr USES_REGS);
|
||||
#ifdef THREADS_FULL_SHARING
|
||||
static inline void SgFr_batched_cached_answers_check_insert(sg_fr_ptr, ans_node_ptr);
|
||||
static inline void __SgFr_batched_cached_answers_check_insert(sg_fr_ptr, ans_node_ptr USES_REGS);
|
||||
static inline int SgFr_batched_cached_answers_check_remove(sg_fr_ptr, ans_node_ptr);
|
||||
#endif /* THREADS_FULL_SHARING */
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
static inline void add_to_tdv(int, int);
|
||||
static inline void check_for_deadlock(sg_fr_ptr);
|
||||
static inline sg_fr_ptr deadlock_detection(sg_fr_ptr);
|
||||
static inline void __add_to_tdv(int, int USES_REGS);
|
||||
static inline void __check_for_deadlock(sg_fr_ptr USES_REGS);
|
||||
static inline sg_fr_ptr __deadlock_detection(sg_fr_ptr USES_REGS);
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
static inline Int freeze_current_cp(void);
|
||||
static inline void wake_frozen_cp(Int);
|
||||
static inline void abolish_frozen_cps_until(Int);
|
||||
static inline void abolish_frozen_cps_all(void);
|
||||
static inline void adjust_freeze_registers(void);
|
||||
static inline void mark_as_completed(sg_fr_ptr);
|
||||
static inline void unbind_variables(tr_fr_ptr, tr_fr_ptr);
|
||||
static inline void rebind_variables(tr_fr_ptr, tr_fr_ptr);
|
||||
static inline void restore_bindings(tr_fr_ptr, tr_fr_ptr);
|
||||
static inline CELL *expand_auxiliary_stack(CELL *);
|
||||
static inline void abolish_incomplete_subgoals(choiceptr);
|
||||
static inline Int __freeze_current_cp( USES_REGS1 );
|
||||
static inline void __wake_frozen_cp(Int USES_REGS);
|
||||
static inline void __abolish_frozen_cps_until(Int USES_REGS);
|
||||
static inline void __abolish_frozen_cps_all( USES_REGS1 );
|
||||
static inline void __adjust_freeze_registers( USES_REGS1 );
|
||||
static inline void __mark_as_completed(sg_fr_ptr USES_REGS);
|
||||
static inline void __unbind_variables(tr_fr_ptr, tr_fr_ptr USES_REGS);
|
||||
static inline void __rebind_variables(tr_fr_ptr, tr_fr_ptr USES_REGS);
|
||||
static inline void __restore_bindings(tr_fr_ptr, tr_fr_ptr USES_REGS);
|
||||
static inline CELL *__expand_auxiliary_stack(CELL * USES_REGS);
|
||||
static inline void __abolish_incomplete_subgoals(choiceptr USES_REGS);
|
||||
#ifdef YAPOR
|
||||
static inline void pruning_over_tabling_data_structures(void);
|
||||
static inline void collect_suspension_frames(or_fr_ptr);
|
||||
static inline void __collect_suspension_frames(or_fr_ptr USES_REGS);
|
||||
#ifdef TIMESTAMP_CHECK
|
||||
static inline susp_fr_ptr suspension_frame_to_resume(or_fr_ptr, long);
|
||||
#else
|
||||
@ -658,8 +658,9 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
||||
******************************/
|
||||
|
||||
#ifdef THREADS
|
||||
static inline void **get_insert_thread_bucket(void **buckets, lockvar *buckets_lock) {
|
||||
CACHE_REGS
|
||||
#define get_insert_thread_bucket(b, bl) __get_insert_thread_bucket((b), (bl) PASS_REGS)
|
||||
|
||||
static inline void **__get_insert_thread_bucket(void **buckets, lockvar *buckets_lock USES_REGS) {
|
||||
|
||||
/* direct bucket */
|
||||
if (worker_id < THREADS_DIRECT_BUCKETS)
|
||||
@ -678,9 +679,9 @@ static inline void **get_insert_thread_bucket(void **buckets, lockvar *buckets_l
|
||||
return *buckets + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS;
|
||||
}
|
||||
|
||||
#define get_thread_bucket(b) __get_thread_bucket((b) PASS_REGS)
|
||||
|
||||
static inline void **get_thread_bucket(void **buckets) {
|
||||
CACHE_REGS
|
||||
static inline void **__get_thread_bucket(void **buckets USES_REGS) {
|
||||
|
||||
/* direct bucket */
|
||||
if (worker_id < THREADS_DIRECT_BUCKETS)
|
||||
@ -729,8 +730,9 @@ static inline sg_node_ptr get_insert_subgoal_trie(tab_ent_ptr tab_ent USES_REGS)
|
||||
#endif /* THREADS_NO_SHARING */
|
||||
}
|
||||
|
||||
#define get_subgoal_trie(te) __get_subgoal_trie((te) PASS_REGS)
|
||||
|
||||
static inline sg_node_ptr get_subgoal_trie(tab_ent_ptr tab_ent) {
|
||||
static inline sg_node_ptr __get_subgoal_trie(tab_ent_ptr tab_ent USES_REGS) {
|
||||
#ifdef THREADS_NO_SHARING
|
||||
sg_node_ptr *sg_node_addr = (sg_node_ptr *) get_thread_bucket((void **) &TabEnt_subgoal_trie(tab_ent));
|
||||
return *sg_node_addr;
|
||||
@ -825,8 +827,8 @@ static inline sg_fr_ptr get_subgoal_frame_for_abolish(sg_node_ptr sg_node USES_R
|
||||
|
||||
|
||||
#ifdef THREADS_FULL_SHARING
|
||||
static inline void SgFr_batched_cached_answers_check_insert(sg_fr_ptr sg_fr, ans_node_ptr ans_node) {
|
||||
CACHE_REGS
|
||||
#define SgFr_batched_cached_answers_check_insert(s, a) __SgFr_batched_cached_answers_check_insert((s), (a) PASS_REGS)
|
||||
static inline void SgFr_batched_cached_answers_check_insert(sg_fr_ptr sg_fr, ans_node_ptr ans_node USES_REGS) {
|
||||
|
||||
if (SgFr_batched_last_answer(sg_fr) == NULL)
|
||||
SgFr_batched_last_answer(sg_fr) = SgFr_first_answer(sg_fr);
|
||||
@ -854,8 +856,9 @@ static inline void SgFr_batched_cached_answers_check_insert(sg_fr_ptr sg_fr, ans
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int SgFr_batched_cached_answers_check_remove(sg_fr_ptr sg_fr, ans_node_ptr ans_node) {
|
||||
CACHE_REGS
|
||||
#define SgFr_batched_cached_answers_check_remove(s, a) __SgFr_batched_cached_answers_check_remove((s), (a) PASS_REGS)
|
||||
|
||||
static inline int __SgFr_batched_cached_answers_check_remove(sg_fr_ptr sg_fr, ans_node_ptr ans_node USES_REgS) {
|
||||
struct answer_ref_node *local_uncons_ans;
|
||||
|
||||
local_uncons_ans = SgFr_batched_cached_answers(sg_fr) ;
|
||||
@ -884,10 +887,10 @@ static inline int SgFr_batched_cached_answers_check_remove(sg_fr_ptr sg_fr, ans_
|
||||
|
||||
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
static inline void add_to_tdv(int wid, int wid_dep) {
|
||||
#ifdef OUTPUT_THREADS_TABLING
|
||||
CACHE_REGS
|
||||
#endif /* OUTPUT_THREADS_TABLING */
|
||||
|
||||
#define add_to_tdv(w, wd) __add_to_tdv((w), (wd) PASS_REGS)
|
||||
|
||||
static inline void __add_to_tdv(int wid, int wid_dep USES_REGS) {
|
||||
// thread wid next of thread wid_dep
|
||||
/* check before insert */
|
||||
int c_wid = ThDepFr_next(GLOBAL_th_dep_fr(wid));
|
||||
@ -927,9 +930,9 @@ static inline void add_to_tdv(int wid, int wid_dep) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define check_for_deadlock(s) __check_for_deadlock((s) PASS_REGS)
|
||||
|
||||
static inline void check_for_deadlock(sg_fr_ptr sg_fr) {
|
||||
CACHE_REGS
|
||||
static inline void __check_for_deadlock(sg_fr_ptr sg_fr USES_REGS) {
|
||||
sg_fr_ptr local_sg_fr = deadlock_detection(sg_fr);
|
||||
|
||||
if (local_sg_fr){
|
||||
@ -942,9 +945,9 @@ static inline void check_for_deadlock(sg_fr_ptr sg_fr) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define deadlock_detection(s) __deadlock_detection((s) PASS_REGS)
|
||||
|
||||
static inline sg_fr_ptr deadlock_detection(sg_fr_ptr sg_fr) {
|
||||
CACHE_REGS
|
||||
static inline sg_fr_ptr __deadlock_detection(sg_fr_ptr sg_fr USES_REGS) {
|
||||
sg_fr_ptr remote_sg_fr = REMOTE_top_sg_fr(SgFr_gen_worker(sg_fr));
|
||||
|
||||
while( SgFr_sg_ent(remote_sg_fr) != SgFr_sg_ent(sg_fr)){
|
||||
@ -977,9 +980,9 @@ static inline sg_fr_ptr deadlock_detection(sg_fr_ptr sg_fr) {
|
||||
}
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
|
||||
#define freeze_current_cp() __freeze_current_cp( PASS_REGS1 )
|
||||
|
||||
static inline Int freeze_current_cp(void) {
|
||||
CACHE_REGS
|
||||
static inline Int __freeze_current_cp(USES_REGS1) {
|
||||
choiceptr freeze_cp = B;
|
||||
|
||||
B_FZ = freeze_cp;
|
||||
@ -991,8 +994,11 @@ static inline Int freeze_current_cp(void) {
|
||||
}
|
||||
|
||||
|
||||
static inline void wake_frozen_cp(Int frozen_offset) {
|
||||
CACHE_REGS
|
||||
#define wake_frozen_cp(f) __wake_frozen_cp((f) PASS_REGS)
|
||||
|
||||
#define restore_bindings(u, r) __restore_bindings((u), (r) PASS_REGS)
|
||||
|
||||
static inline void __wake_frozen_cp(Int frozen_offset USES_REGS) {
|
||||
choiceptr frozen_cp = (choiceptr)(LOCAL_LocalBase - frozen_offset);
|
||||
|
||||
restore_bindings(TR, frozen_cp->cp_tr);
|
||||
@ -1003,8 +1009,9 @@ static inline void wake_frozen_cp(Int frozen_offset) {
|
||||
}
|
||||
|
||||
|
||||
static inline void abolish_frozen_cps_until(Int frozen_offset) {
|
||||
CACHE_REGS
|
||||
#define abolish_frozen_cps_until(f) __abolish_frozen_cps_until((f) PASS_REGS )
|
||||
|
||||
static inline void __abolish_frozen_cps_until(Int frozen_offset USES_REGS) {
|
||||
choiceptr frozen_cp = (choiceptr)(LOCAL_LocalBase - frozen_offset);
|
||||
|
||||
B_FZ = frozen_cp;
|
||||
@ -1013,28 +1020,28 @@ static inline void abolish_frozen_cps_until(Int frozen_offset) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define abolish_frozen_cps_all() __abolish_frozen_cps_all( PASS_REGS1 )
|
||||
|
||||
static inline void abolish_frozen_cps_all(void) {
|
||||
CACHE_REGS
|
||||
static inline void __abolish_frozen_cps_all( USES_REGS1 ) {
|
||||
B_FZ = (choiceptr) LOCAL_LocalBase;
|
||||
H_FZ = (CELL *) LOCAL_GlobalBase;
|
||||
TR_FZ = (tr_fr_ptr) LOCAL_TrailBase;
|
||||
return;
|
||||
}
|
||||
|
||||
#define adjust_freeze_registers() __adjust_freeze_registers( PASS_REGS1 )
|
||||
|
||||
static inline void adjust_freeze_registers(void) {
|
||||
CACHE_REGS
|
||||
static inline void __adjust_freeze_registers( USES_REGS1 ) {
|
||||
B_FZ = DepFr_cons_cp(LOCAL_top_dep_fr);
|
||||
H_FZ = B_FZ->cp_h;
|
||||
TR_FZ = B_FZ->cp_tr;
|
||||
return;
|
||||
}
|
||||
|
||||
#define mark_as_completed(sg) __mark_as_completed((sg) PASS_REGS )
|
||||
|
||||
static inline void mark_as_completed(sg_fr_ptr sg_fr) {
|
||||
static inline void __mark_as_completed(sg_fr_ptr sg_fr USES_REGS) {
|
||||
#if defined(MODE_DIRECTED_TABLING) && !defined(THREADS_FULL_SHARING) && !defined(THREADS_CONSUMER_SHARING)
|
||||
CACHE_REGS
|
||||
#endif /* MODE_DIRECTED_TABLING && !THREADS_FULL_SHARING && !THREADS_CONSUMER_SHARING */
|
||||
|
||||
LOCK_SG_FR(sg_fr);
|
||||
@ -1079,9 +1086,9 @@ static inline void mark_as_completed(sg_fr_ptr sg_fr) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define unbind_variables(u, e) __unbind_variables((u), (e) PASS_REGS)
|
||||
|
||||
static inline void unbind_variables(tr_fr_ptr unbind_tr, tr_fr_ptr end_tr) {
|
||||
CACHE_REGS
|
||||
static inline void __unbind_variables(tr_fr_ptr unbind_tr, tr_fr_ptr end_tr USES_REGS) {
|
||||
TABLING_ERROR_CHECKING(unbind_variables, unbind_tr < end_tr);
|
||||
/* unbind loop */
|
||||
while (unbind_tr != end_tr) {
|
||||
@ -1111,8 +1118,9 @@ static inline void unbind_variables(tr_fr_ptr unbind_tr, tr_fr_ptr end_tr) {
|
||||
}
|
||||
|
||||
|
||||
static inline void rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr) {
|
||||
CACHE_REGS
|
||||
#define rebind_variables(u, e) __rebind_variables(u, e PASS_REGS)
|
||||
|
||||
static inline void __rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr USES_REGS) {
|
||||
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr < end_tr);
|
||||
/* rebind loop */
|
||||
Yap_NEW_MAHASH((ma_h_inner_struct *)H PASS_REGS);
|
||||
@ -1144,9 +1152,7 @@ static inline void rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
|
||||
CACHE_REGS
|
||||
static inline void __restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr USES_REGS) {
|
||||
CELL ref;
|
||||
tr_fr_ptr end_tr;
|
||||
|
||||
@ -1218,9 +1224,9 @@ static inline void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define expand_auxiliary_stack(s) __expand_auxiliary_stack((s) PASS_REGS)
|
||||
|
||||
static inline CELL *expand_auxiliary_stack(CELL *stack) {
|
||||
CACHE_REGS
|
||||
static inline CELL *__expand_auxiliary_stack(CELL *stack USES_REGS) {
|
||||
void *old_top = LOCAL_TrailTop;
|
||||
INFORMATION_MESSAGE("Expanding trail in 64 Kbytes");
|
||||
if (! Yap_growtrail(K64, TRUE)) { /* TRUE means 'contiguous_only' */
|
||||
@ -1234,9 +1240,10 @@ static inline CELL *expand_auxiliary_stack(CELL *stack) {
|
||||
}
|
||||
}
|
||||
|
||||
#define abolish_incomplete_subgoals(p) __abolish_incomplete_subgoals((p) PASS_REGS)
|
||||
|
||||
static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
||||
CACHE_REGS
|
||||
|
||||
static inline void __abolish_incomplete_subgoals(choiceptr prune_cp USES_REGS) {
|
||||
|
||||
#ifdef YAPOR
|
||||
if (EQUAL_OR_YOUNGER_CP(GetOrFr_node(LOCAL_top_susp_or_fr), prune_cp))
|
||||
@ -1389,8 +1396,9 @@ static inline void pruning_over_tabling_data_structures(void) {
|
||||
}
|
||||
|
||||
|
||||
static inline void collect_suspension_frames(or_fr_ptr or_fr) {
|
||||
CACHE_REGS
|
||||
#define collect_suspension_frames(o) __collect_suspension_frames((o) PASS_REGS)
|
||||
|
||||
static inline void __collect_suspension_frames(or_fr_ptr or_fr USES_REGS) {
|
||||
int depth;
|
||||
or_fr_ptr *susp_ptr;
|
||||
|
||||
|
10
configure
vendored
10
configure
vendored
@ -1539,7 +1539,7 @@ Optional Packages:
|
||||
--with-java=JAVA_HOME use Java instalation in JAVA_HOME
|
||||
--with-readline=DIR use GNU Readline Library in DIR
|
||||
--with-matlab=DIR use MATLAB package in DIR
|
||||
--with-mpi=DIR use MPI library in DIR
|
||||
--with-mpi=DIR use LAM/MPI library in DIR
|
||||
--with-mpe=DIR use MPE library in DIR
|
||||
--with-lam=DIR use LAM MPI library in DIR
|
||||
--with-heap-space=space default heap size in Kbytes
|
||||
@ -4860,16 +4860,16 @@ fi
|
||||
# Check whether --with-mpi was given.
|
||||
if test "${with_mpi+set}" = set; then :
|
||||
withval=$with_mpi; if test "$withval" = yes; then
|
||||
yap_cv_mpi=yes
|
||||
yap_cv_lam=yes
|
||||
elif test "$withval" = no; then
|
||||
yap_cv_mpi=no
|
||||
yap_cv_lam=no
|
||||
else
|
||||
yap_cv_mpi=$with_mpi
|
||||
yap_cv_lam=$with_mpi
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
|
||||
fi
|
||||
else
|
||||
yap_cv_mpi=no
|
||||
yap_cv_lam=no
|
||||
fi
|
||||
|
||||
|
||||
|
10
configure.in
10
configure.in
@ -360,18 +360,18 @@ AC_ARG_WITH(matlab,
|
||||
[yap_cv_matlab=no])
|
||||
|
||||
AC_ARG_WITH(mpi,
|
||||
[ --with-mpi[=DIR] use MPI library in DIR],
|
||||
[ --with-mpi[=DIR] use LAM/MPI library in DIR],
|
||||
if test "$withval" = yes; then
|
||||
dnl handle UBUNTU systems
|
||||
yap_cv_mpi=yes
|
||||
yap_cv_lam=yes
|
||||
elif test "$withval" = no; then
|
||||
yap_cv_mpi=no
|
||||
yap_cv_lam=no
|
||||
else
|
||||
yap_cv_mpi=$with_mpi
|
||||
yap_cv_lam=$with_mpi
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
|
||||
fi,
|
||||
[yap_cv_mpi=no])
|
||||
[yap_cv_lam=no])
|
||||
|
||||
|
||||
AC_ARG_WITH(mpe,
|
||||
|
@ -32,23 +32,23 @@ static char *rcsid = "$Header: /Users/vitor/Yap/yap-cvsbackup/library/mpi/mpi.c,
|
||||
|
||||
void STD_PROTO(YAP_Write, (Term, void (*)(int), int));
|
||||
|
||||
STATIC_PROTO (Int p_mpi_open, (void));
|
||||
STATIC_PROTO (Int p_mpi_close, (void));
|
||||
STATIC_PROTO (Int p_mpi_send, (void));
|
||||
STATIC_PROTO (Int p_mpi_receive, (void));
|
||||
STATIC_PROTO (Int p_mpi_bcast3, (void));
|
||||
STATIC_PROTO (Int p_mpi_bcast2, (void));
|
||||
STATIC_PROTO (Int p_mpi_barrier, (void));
|
||||
STATIC_PROTO (Int p_mpi_open, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_close, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_send, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_receive, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_bcast3, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_bcast2, ( USES_REGS1 ));
|
||||
STATIC_PROTO (Int p_mpi_barrier, ( USES_REGS1 ));
|
||||
|
||||
|
||||
/*
|
||||
* Auxiliary Data
|
||||
*/
|
||||
|
||||
static Int rank, numprocs, namelen;
|
||||
static int rank, numprocs, namelen;
|
||||
static char processor_name[MPI_MAX_PROCESSOR_NAME];
|
||||
|
||||
static Int mpi_argc;
|
||||
static int mpi_argc;
|
||||
static char **mpi_argv;
|
||||
|
||||
/* this should eventually be moved to config.h */
|
||||
@ -111,7 +111,7 @@ mpi_putc(Int ch)
|
||||
|
||||
|
||||
static Int
|
||||
p_mpi_open(void) /* mpi_open(?rank, ?num_procs, ?proc_name) */
|
||||
p_mpi_open( USES_REGS1 ) /* mpi_open(?rank, ?num_procs, ?proc_name) */
|
||||
{
|
||||
Term t_rank = Deref(ARG1), t_numprocs = Deref(ARG2), t_procname = Deref(ARG3);
|
||||
Int retv;
|
||||
@ -156,7 +156,7 @@ Yap exit(FAILURE), whereas in Yap/LAM mpi_open/3 simply fails.
|
||||
|
||||
|
||||
static Int /* mpi_close */
|
||||
p_mpi_close()
|
||||
p_mpi_close( USES_REGS1 )
|
||||
{
|
||||
MPI_Finalize();
|
||||
return TRUE;
|
||||
@ -164,7 +164,7 @@ p_mpi_close()
|
||||
|
||||
|
||||
static Int
|
||||
p_mpi_send() /* mpi_send(+data, +destination, +tag) */
|
||||
p_mpi_send( USES_REGS1 ) /* mpi_send(+data, +destination, +tag) */
|
||||
{
|
||||
Term t_data = Deref(ARG1), t_dest = Deref(ARG2), t_tag = Deref(ARG3);
|
||||
int tag, dest, retv;
|
||||
@ -216,7 +216,7 @@ p_mpi_send() /* mpi_send(+data, +destination, +tag) */
|
||||
|
||||
|
||||
static Int
|
||||
p_mpi_receive() /* mpi_receive(-data, ?orig, ?tag) */
|
||||
p_mpi_receive( USES_REGS1 ) /* mpi_receive(-data, ?orig, ?tag) */
|
||||
{
|
||||
Term t, t_data = Deref(ARG1), t_orig = Deref(ARG2), t_tag = Deref(ARG3);
|
||||
int tag, orig, retv;
|
||||
@ -305,7 +305,7 @@ p_mpi_receive() /* mpi_receive(-data, ?orig, ?tag) */
|
||||
|
||||
|
||||
static Int
|
||||
p_mpi_bcast3() /* mpi_bcast( ?data, +root, +max_size ) */
|
||||
p_mpi_bcast3( USES_REGS1 ) /* mpi_bcast( ?data, +root, +max_size ) */
|
||||
{
|
||||
Term t_data = Deref(ARG1), t_root = Deref(ARG2), t_max_size = Deref(ARG3);
|
||||
int root, retv, max_size;
|
||||
@ -386,7 +386,7 @@ p_mpi_bcast3() /* mpi_bcast( ?data, +root, +max_size ) */
|
||||
*/
|
||||
|
||||
static Int
|
||||
p_mpi_bcast2() /* mpi_bcast( ?data, +root ) */
|
||||
p_mpi_bcast2( USES_REGS1 ) /* mpi_bcast( ?data, +root ) */
|
||||
{
|
||||
Term t_data = Deref(ARG1), t_root = Deref(ARG2);
|
||||
int root, retv;
|
||||
@ -460,7 +460,7 @@ p_mpi_bcast2() /* mpi_bcast( ?data, +root ) */
|
||||
|
||||
|
||||
static Int
|
||||
p_mpi_barrier() /* mpi_barrier/0 */
|
||||
p_mpi_barrier( USES_REGS1 ) /* mpi_barrier/0 */
|
||||
{
|
||||
int retv;
|
||||
|
||||
|
@ -34,7 +34,7 @@ double floatval(TERM);
|
||||
#ifdef __YAP_PROLOG__
|
||||
static inline
|
||||
#endif
|
||||
TERM encodefloat1(double);
|
||||
TERM encodefloat1(double USES_REGS);
|
||||
|
||||
/* loader.c */
|
||||
SYM_REC_PTR insert(const char *, int, int);
|
||||
@ -272,7 +272,7 @@ TERM bpx_build_float(double x)
|
||||
{
|
||||
CACHE_REGS
|
||||
REQUIRE_HEAP(4);
|
||||
return encodefloat1(x);
|
||||
return encodefloat1(x PASS_REGS);
|
||||
}
|
||||
|
||||
TERM bpx_build_atom(const char *name)
|
||||
|
@ -128,7 +128,7 @@ double floatval(TERM t)
|
||||
}
|
||||
|
||||
static inline
|
||||
TERM encodefloat1(double f)
|
||||
TERM encodefloat1(double f USES_REGS)
|
||||
{
|
||||
return MkFloatTerm((Float)f);
|
||||
}
|
||||
|
Reference in New Issue
Block a user