From 0b420f5493a19991ecdb5d1a1c4b2f70298b109c Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 12 May 2005 03:36:33 +0000 Subject: [PATCH] debugger was making predicates meta instead of testing fix handling of dbrefs in facts and in subarguments. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1287 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/cdmgr.c | 9 +++++++-- C/compiler.c | 22 ++++++++++++++++------ LGPL/JPL/jpl.yap | 4 ++-- LGPL/JPL/src/jpl.c | 4 +++- docs/yap.tex | 2 +- pl/debug.yap | 2 +- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index c55317e05..189c32331 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,13 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2005-04-20 04:02:15 $,$Author: vsc $ * +* Last rev: $Date: 2005-05-12 03:36:32 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.156 2005/04/20 04:02:15 vsc +* fix a few variable warnings +* fix erase clause to pass a pointer to clause, not code +* get rid of Yap4.4 code in Yap_EraseStaticClause +* * Revision 1.155 2005/04/10 04:01:10 vsc * bug fixes, I hope! * @@ -3808,7 +3813,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya WPP = NULL; #endif if (cl->ClFlags & FactMask) { - if (!Yap_unify(tb, MkAtomTerm(AtomTrue)) || + if (!Yap_unify_constant(tb, MkAtomTerm(AtomTrue)) || !Yap_unify(tr, rtn)) return FALSE; if (pe->ArityOfPE) { diff --git a/C/compiler.c b/C/compiler.c index 2e2780779..9ebec9a0e 100644 --- a/C/compiler.c +++ b/C/compiler.c @@ -11,8 +11,11 @@ * File: compiler.c * * comments: Clause compiler * * * -* Last rev: $Date: 2005-04-10 04:01:10 $,$Author: vsc $ * +* Last rev: $Date: 2005-05-12 03:36:32 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.65 2005/04/10 04:01:10 vsc +* bug fixes, I hope! +* * Revision 1.64 2005/03/13 06:26:10 vsc * fix excessive pruning in meta-calls * fix Term->int breakage in compiler @@ -104,6 +107,7 @@ typedef struct compiler_struct_struct { Ventry *vtable; CExpEntry *common_exps; int is_a_fact; + int hasdbrefs; int n_common_exps; int goalno; int onlast; @@ -599,15 +603,14 @@ c_arg(Int argno, Term t, unsigned int arity, unsigned int level, compiler_struct } /* That's it folks! */ return; - } + } if (level == 0) Yap_emit((cglobs->onhead ? get_num_op : put_num_op), (CELL) t, argno, &cglobs->cint); else Yap_emit((cglobs->onhead ? (argno == (Int)arity ? unify_last_num_op : unify_num_op) : write_num_op), (CELL) t, Zero, &cglobs->cint); - } - else if (IsPairTerm(t)) { + } else if (IsPairTerm(t)) { if (optimizer_on && (!cglobs->onhead || argno != 1 || level > 1) && level < 6) { t = optimize_ce(t, arity, level, cglobs); if (IsVarTerm(t)) { @@ -640,7 +643,13 @@ c_arg(Int argno, Term t, unsigned int arity, unsigned int level, compiler_struct FAIL("can not compile data base reference",TYPE_ERROR_CALLABLE,t); } else { READ_UNLOCK(cglobs->cint.CurrentPred->PRWLock); - Yap_emit((cglobs->onhead ? get_atom_op : put_atom_op), (CELL) t, argno, &cglobs->cint); + cglobs->hasdbrefs = TRUE; + if (level == 0) + Yap_emit((cglobs->onhead ? get_atom_op : put_atom_op), (CELL) t, argno, &cglobs->cint); + else + Yap_emit((cglobs->onhead ? (argno == (Int)arity ? unify_last_atom_op + : unify_atom_op) : + write_atom_op), (CELL) t, Zero, &cglobs->cint); } } else { @@ -2898,6 +2907,7 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src) cglobs.n_common_exps = 0; cglobs.labelno = 0L; cglobs.is_a_fact = FALSE; + cglobs.hasdbrefs = FALSE; if (IsVarTerm(my_clause)) { Yap_Error_TYPE = INSTANTIATION_ERROR; Yap_Error_Term = my_clause; @@ -3006,7 +3016,7 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src) Yap_ShowCode(&cglobs.cint); #endif /* phase 3: assemble code */ - acode = Yap_assemble(ASSEMBLING_CLAUSE, src, cglobs.cint.CurrentPred, body == MkAtomTerm(AtomTrue), &cglobs.cint); + acode = Yap_assemble(ASSEMBLING_CLAUSE, src, cglobs.cint.CurrentPred, (cglobs.is_a_fact && !cglobs.hasdbrefs), &cglobs.cint); /* check first if there was space for us */ diff --git a/LGPL/JPL/jpl.yap b/LGPL/JPL/jpl.yap index e16d1d7d6..a7735b802 100644 --- a/LGPL/JPL/jpl.yap +++ b/LGPL/JPL/jpl.yap @@ -1,4 +1,4 @@ -/* $Id: jpl.yap,v 1.3 2005-03-15 18:29:24 vsc Exp $ +/* $Id: jpl.yap,v 1.4 2005-05-12 03:36:33 vsc Exp $ Part of JPL -- SWI-Prolog/Java interface @@ -4249,7 +4249,7 @@ setup_jvm :- setup_jvm :- add_jpl_to_classpath, add_java_to_ldpath, - libjpl(JPL), +% libjpl(_JPL), % catch(load_foreign_library(JPL), E, report_java_setup_problem(E)), assert(jvm_ready). diff --git a/LGPL/JPL/src/jpl.c b/LGPL/JPL/src/jpl.c index c510cd3f8..4c818cd38 100644 --- a/LGPL/JPL/src/jpl.c +++ b/LGPL/JPL/src/jpl.c @@ -1,4 +1,4 @@ -/* $Id: jpl.c,v 1.6 2005-04-15 20:27:57 vsc Exp $ +/* $Id: jpl.c,v 1.7 2005-05-12 03:36:33 vsc Exp $ Part of JPL -- SWI-Prolog/Java interface @@ -1465,6 +1465,7 @@ jni_check_exception(void) } else { + // (*env)->ExceptionDescribe(env); // send message (*env)->ExceptionClear(env); // clear "exception-pending" state so we can do JNI calls if ( (c=(*env)->GetObjectClass(env,ej)) != NULL ) { // we've got its class @@ -1907,6 +1908,7 @@ jni_create_jvm_c( // opt[optn].optionString = "abort"; // I don't understand this yet... // opt[optn++].extraInfo = jvm_abort; // opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls + opt[optn++].optionString = "-Xmx1024m"; // give java enough space // opt[optn++].optionString = "-Xnoclassgc"; // so method/field IDs remain valid (?) // opt[optn].optionString = "vfprintf"; // opt[optn++].extraInfo = fprintf; // no O/P, then SEGV diff --git a/docs/yap.tex b/docs/yap.tex index 49489c92e..64219266d 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -5600,7 +5600,7 @@ once_with_alarm(Time,Goal,DoOnAlarm) :- execute_once_with_alarm(Time, Goal) :- alarm(Time, alarm, _), - ( call(Goal) -> alarm(0, alarm, _) ; alarm(0, alarm, _)). + ( call(Goal) -> alarm(0, alarm, _) ; alarm(0, alarm, _), fail). @end example The procedure has three arguments: the @var{Time} before the alarm is diff --git a/pl/debug.yap b/pl/debug.yap index 29786c502..345a74cca 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -404,7 +404,7 @@ debugging :- % '$spycall'(G, M, _) :- ( '$access_yap_flags'(10,0); - '$system_predicate'(G,M), \+ '$meta_predicate'(G,M) + '$system_predicate'(G,M), \+ '$is_metapredicate'(G,M) ), !, '$execute_nonstop'(G, M). '$spycall'(G, M, InControl) :-