diff --git a/C/absmi.c b/C/absmi.c index 764ff672d..7c07cabe9 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -1807,7 +1807,7 @@ absmi(int inp) /* find something to fool S */ if (CFREG == Unsigned(LCL0) && ReadTimedVar(WokenGoals) != TermNil) { SREG = (CELL *)RepPredProp(GetPredPropByFunc(MkFunctor(AtomRestoreRegs,2),0)); - XREGS[0] = XREG(PREG->u.y.y); + XREGS[0] = Y[PREG->u.y.y]; PREG = NEXTOP(PREG,y); goto creep_either; } diff --git a/C/attvar.c b/C/attvar.c index 790df693d..4ed4a71bb 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -158,26 +158,7 @@ AttVarToTerm(CELL *orig) static int TermToAttVar(Term attvar, Term to) { - int i = 0; - int open = FALSE; - - while (IsPairTerm(attvar)) { - Term t = HeadOfTerm(attvar); - if (!IsVarTerm(t)) { - if (open) { - attvar_record *attv = (attvar_record *)VarOfTerm(Deref(to)); - if (!PutAtt(attv, i, t)) - return(FALSE); - } else { - if (!BuildNewAttVar(to, i, t)) - return(FALSE); - open = TRUE; - } - } - i++; - attvar = TailOfTerm(attvar); - } - return(TRUE); + return(BuildNewAttVar(to, -1, attvar)); } static void @@ -369,11 +350,13 @@ BuildNewAttVar(Term t, Int i, Term tatt) attvar_record *attv = (attvar_record *)ReadTimedVar(DelayedVars); if (H0 - (CELL *)attv < 1024+(2*NUM_OF_ATTS)) { - ARG1 = t; - ARG2 = tatt; + H[0] = t; + H[1] = tatt; + H += 2; growglobal(); - t = ARG1; - tatt = ARG2; + H -= 2; + t = H[0]; + tatt = H[1]; } time = InitVarTime(); RESET_VARIABLE(&(attv->Value)); @@ -386,7 +369,22 @@ BuildNewAttVar(Term t, Int i, Term tatt) attv->NS = UpdateTimedVar(AttsMutableList, (CELL)&(attv->Done)); Bind((CELL *)t,(CELL)attv); UpdateTimedVar(DelayedVars,(CELL)(attv->Atts+2*j)); - return(PutAtt(attv, i, tatt)); + /* if i < 0 then we have the list of arguments */ + if (i < 0) { + Int j = 0; + while (IsPairTerm(tatt)) { + Term t = HeadOfTerm(tatt); + /* I need to do this because BuildNewAttVar may shift the stacks */ + if (!IsVarTerm(t)) { + attv->Atts[2*j+1] = t; + } + j++; + tatt = TailOfTerm(tatt); + } + return(TRUE); + } else { + return(PutAtt(attv, i, tatt)); + } } static Int diff --git a/C/exec.c b/C/exec.c index e7cc80487..6af66eded 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1224,7 +1224,7 @@ p_restore_regs2(void) if (pt0 > B) { /* Wow, we're gonna cut!!! */ #ifdef YAPOR - CUT_prune_to((choiceptr) d0); + CUT_prune_to(pt0); #else B = pt0; #endif /* YAPOR */ diff --git a/C/tracer.c b/C/tracer.c index ac3c09afb..1b899a345 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -113,9 +113,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) vsc_count++; /* if (vsc_count < 84600) return; */ - /* if (vsc_count == 6469) { - printf("Here I go\n"); - } + /* + if (vsc_count == 4376) { + printf("Here I go\n"); + } */ /* if (vsc_count > 500000) exit(0); */ /* if (gc_calls < 1) return;*/