From f877e787854ebe462bf6c5f13dc7a1317a84dbef Mon Sep 17 00:00:00 2001 From: Costa Vitor Date: Wed, 19 Aug 2009 21:53:49 -0500 Subject: [PATCH] make YAP compile with --enable-or-parallelism --- C/cdmgr.c | 2 +- C/clause_list.c | 4 ++++ C/index.c | 25 +++++++++++++------------ H/walkclause.h | 2 +- OPTYap/opt.preds.c | 2 +- misc/buildops | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index 42b095e66..69405c5ea 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -2238,7 +2238,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref) } UNLOCK(p->PELock); if (pflags & LogUpdatePredFlag) { - LogUpdClause *cl = (DBRef)ClauseCodeToLogUpdClause(cp); + LogUpdClause *cl = (LogUpdClause *)ClauseCodeToLogUpdClause(cp); tf = MkDBRefTerm((DBRef)cl); #if defined(YAPOR) || defined(THREADS) TRAIL_CLREF(cl); /* So that fail will erase it */ diff --git a/C/clause_list.c b/C/clause_list.c index aeb940f4b..c656bb333 100644 --- a/C/clause_list.c +++ b/C/clause_list.c @@ -1,5 +1,9 @@ #include "Yap.h" #include "clause.h" +#include "tracer.h" +#ifdef YAPOR +#include "or.macros.h" +#endif /* YAPOR */ #include "clause_list.h" /* need to fix overflow handling */ diff --git a/C/index.c b/C/index.c index 96bcae3cf..ff8221847 100644 --- a/C/index.c +++ b/C/index.c @@ -995,16 +995,12 @@ has_cut(yamop *pc) break; case _execute: case _dexecute: - case _p_execute_cpred: + case _execute_cpred: pc = NEXTOP(pc,pp); break; case _native_me: pc = NEXTOP(pc,aFlp); break; - case _dexecute: - case _p_execute_cpred: - pc = NEXTOP(pc,pp); - break; /* instructions type l */ case _enter_profiling: case _count_call: @@ -1056,8 +1052,6 @@ has_cut(yamop *pc) case _p_equal: case _p_functor: case _p_execute_tail: - case _enter_a_profiling: - case _count_a_call: case _index_dbref: case _index_blob: case _index_long: @@ -1171,12 +1165,14 @@ has_cut(yamop *pc) break; /* instructions type sbpp */ case _p_execute: + pc = NEXTOP(pc,Osbmp); + break; case _p_execute2: case _fcall: case _call: case _call_cpred: case _call_usercpred: - pc = NEXTOP(pc,sbpp); + pc = NEXTOP(pc,Osbpp); break; /* instructions type sblp */ #ifdef YAPOR @@ -1184,7 +1180,7 @@ has_cut(yamop *pc) #endif /* YAPOR */ case _either: case _or_else: - pc = NEXTOP(pc,sblp); + pc = NEXTOP(pc,Osblp); break; /* instructions type xx */ case _get_x_var: @@ -1387,7 +1383,7 @@ has_cut(yamop *pc) /* instructions type f */ case _write_struct: case _write_l_struc: - pc = NEXTOP(pc,f); + pc = NEXTOP(pc,fa); break; /* instructions type slp */ case _call_c_wfail: @@ -1396,7 +1392,7 @@ has_cut(yamop *pc) /* instructions type lds */ case _try_c: case _try_userc: - pc = NEXTOP(pc,lds); + pc = NEXTOP(pc,OtapFs); break; /* instructions type OtaLl,OtILl */ case _try_logical: @@ -1412,7 +1408,7 @@ has_cut(yamop *pc) break; case _retry_c: case _retry_userc: - pc = NEXTOP(pc,lds); + pc = NEXTOP(pc,OtapFs); break; /* instructions type llll */ case _switch_on_type: @@ -1492,6 +1488,11 @@ has_cut(yamop *pc) pc = NEXTOP(pc,yxx); break; /* instructions type yyx */ + case _get_yy_var: + case _put_y_vals: + pc = NEXTOP(pc,yyxx); + break; + /* instructions type yyx */ case _p_func2f_yy: pc = NEXTOP(pc,yyx); break; diff --git a/H/walkclause.h b/H/walkclause.h index 5a0698e16..34ac60cfd 100644 --- a/H/walkclause.h +++ b/H/walkclause.h @@ -673,7 +673,7 @@ /* this instruction is hardwired */ case _or_last: #ifdef YAPOR - pp = pc->u.Osblp.p; + pp = pc->u.Osblp.p0; if (pp->PredFlags & MegaClausePredFlag) return found_mega_clause(pp, startp, endp); clause_code = TRUE; diff --git a/OPTYap/opt.preds.c b/OPTYap/opt.preds.c index 2bac304f0..67c48f35e 100644 --- a/OPTYap/opt.preds.c +++ b/OPTYap/opt.preds.c @@ -368,7 +368,7 @@ Int p_parallel_new_answer(void) { length_answer = 0; ALLOC_QG_ANSWER_FRAME(actual_answer); - Yap_plwrite(ARG1, parallel_new_answer_putchar, 4); + Yap_plwrite(ARG1, parallel_new_answer_putchar, 4, 1200); AnsFr_answer(actual_answer)[length_answer] = 0; AnsFr_next(actual_answer) = NULL; leftmost_or_fr = CUT_leftmost_or_frame(); diff --git a/misc/buildops b/misc/buildops index f2ef4069f..0543739a0 100644 --- a/misc/buildops +++ b/misc/buildops @@ -674,7 +674,7 @@ footer_walk_clause(W) :- format(W,' /* this instruction is hardwired */~n',[]), dump_ops(W,["or_last"]), format(W,'#ifdef YAPOR~n',[]), - add_pp(W,"Osblp","p"), + add_pp(W,"Osblp","p0"), format(W,'#else~n',[]), add_pp(W,"p","p"), format(W,'#endif~n',[]),