Merge branch 'master' of gitosis@yap.dcc.fc.up.pt:yap-6

This commit is contained in:
Vítor Manuel de Morais Santos Costa 2009-11-18 13:13:51 +00:00
commit 71de4ed52a
18 changed files with 11355 additions and 2287 deletions

View File

@ -4856,9 +4856,9 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
Terms[2] = tr;
cl = (StaticClause *)Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredStaticClause->CodeOfPred,Otapl), cp_ptr);
UNLOCK(pe->PELock);
th = Terms[0];
tb = Terms[1];
tr = Terms[2];
th = Deref(Terms[0]);
tb = Deref(Terms[1]);
tr = Deref(Terms[2]);
/* don't do this!! I might have stored a choice-point and changed ASP
Yap_RecoverSlots(3);
*/

View File

@ -696,8 +696,8 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
continue;
}
case (CELL)FunctorLongInt:
*StoPoint++ = AbsAppl(CodeMax);
CheckDBOverflow(3);
*StoPoint++ = AbsAppl(CodeMax);
CodeMax = copy_long_int(CodeMax, ap2);
++pt0;
continue;

View File

@ -1631,7 +1631,8 @@ JumpToEnv(Term t) {
to the emulator */
P = (yamop *)FAILCODE;
/* try to recover space */
H = B->cp_h;
/* can only do that when we recover space */
/* H = B->cp_h; */
t = clean_trail(t, dbt, B->cp_a1);
B->cp_a3 = t;
if (first_func != NULL) {

View File

@ -732,9 +732,6 @@ search_pc_pred(yamop *pc_ptr,clauseentry *beg, clauseentry *end) {
}
}
extern void Yap_InitAbsmi(void);
extern int Yap_rational_tree_loop(CELL *pt0, CELL *pt0_end, CELL **to_visit0, CELL **to_visit_max);
static Int profend(void);
static int

View File

@ -2160,6 +2160,8 @@ check_bom(int sno, StreamDesc *st)
int ch;
ch = st->stream_getc(sno);
if (ch == EOFCHAR)
return TRUE;
switch(ch) {
case 0xFE:
{

View File

@ -53,8 +53,6 @@ rtree_loop:
to_visit -= 3;
if (to_visit < to_visit_max) {
to_visit = Yap_shift_visit(to_visit, &to_visit_max);
}
to_visit[0] = pt0;
to_visit[1] = pt0_end;

View File

@ -2542,6 +2542,7 @@ p_variant(void) /* variant terms t1 and t2 */
return FALSE;
}
static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
CELL *pt1)
{
@ -2601,6 +2602,8 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
Bind_Global(pt0, new);
if (d0 != d1) { /* avoid loops */
Bind_Global(VarOfTerm(new), d1);
if (Yap_rational_tree_loop(VarOfTerm(new)-1,VarOfTerm(new),(CELL **)AuxSp,(CELL **)AuxBase))
goto fail;
}
} else {
if (d0 == d1) continue;
@ -2759,7 +2762,9 @@ p_subsumes(void) /* subsumes terms t1 and t2 */
return (TRUE);
if (IsVarTerm(t1)) {
Bind(VarOfTerm(t1), t2);
return(TRUE);
if (Yap_rational_tree_loop(VarOfTerm(t1)-1,VarOfTerm(t1),(CELL **)AuxSp,(CELL **)AuxBase))
return FALSE;
return TRUE;
} else if (IsVarTerm(t2))
return(FALSE);
if (IsAtomOrIntTerm(t1)) {

View File

@ -346,6 +346,7 @@ void STD_PROTO(Yap_InitLowLevelTrace,(void));
void STD_PROTO(Yap_udi_init,(void));
/* unify.c */
int STD_PROTO(Yap_rational_tree_loop, (CELL *, CELL *, CELL **, CELL **));
void STD_PROTO(Yap_InitAbsmi,(void));
void STD_PROTO(Yap_InitUnify,(void));
void STD_PROTO(Yap_TrimTrail,(void));

13530
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@ dnl store the environment's compilation flags
mycflags="$CFLAGS"
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_SUBST(GCC)
AC_SUBST(C_INTERF_FLAGS)
@ -379,9 +380,11 @@ then
if test "$debugyap" = "yes"
then
CFLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes"
CXXFLAGS="-O -g -Wall"
C_INTERF_FLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes"
else
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes"
CXXFLAGS="-O3 -fomit-frame-pointer -Wall"
case "`$CC --version < /dev/null`" in
*3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;;
esac
@ -390,11 +393,13 @@ then
case "$target_cpu" in
i*86*)
CFLAGS="-DBP_FREE $CFLAGS"
CXXFLAGS="-DBP_FREE $CXXFLAGS"
;;
sparc*)
case "$target_os" in
*solaris[2-9]*) dnl
CFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFLAGS"
CXXFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFPPLAGS"
;;
esac
;;
@ -407,18 +412,23 @@ then
case "$target_cpu" in
athlon)
CFLAGS="-march=athlon $CFLAGS"
CXXFLAGS="-march=athlon $CXXFLAGS"
;;
i686*)
CFLAGS="-march=i686 $CFLAGS"
CXXFLAGS="-march=i686 $CXXFLAGS"
;;
i586*)
CFLAGS="-march=i586 $CFLAGS"
CXXFLAGS="-march=i586 $CXXFLAGS"
;;
i486*)
CFLAGS="-march=i486 $CFLAGS"
CXXFLAGS="-march=i486 $CXXFLAGS"
;;
i386*)
CFLAGS="-march=i386 $CFLAGS"
CXXFLAGS="-march=i386 $CXXFLAGS"
;;
esac
fi
@ -441,6 +451,7 @@ else
elif test "$CC" = "cl"
then
CFLAGS="/nologo"
CXXFLAGS="-/nologo"
CPP="/nologo /E"
fi
;;
@ -450,8 +461,10 @@ else
if test "$debugyap" = "yes"
then
CFLAGS="-Ae -g -O"
CXXFLAGS="-Ae -g -O"
else
CFLAGS="-Ae +O3 +Onolimit"
CXXFLAGS="-Ae +O3 +Onolimit"
fi
fi
dnl LDFLAGS="+e UserCPredicate $LDFLAGS"
@ -754,6 +767,7 @@ dnl defaults
INSTALL_DLLS="#"
EXTRA_OBJS=""
SHLIB_LD="#"
SHLIB_LOWER_LD="#"
SHLIB_SWI_LD="#"
DO_SECOND_LD="#"
M4="m4"
@ -775,6 +789,7 @@ case "$target_os" in
then
SHLIB_SUFFIX=".so"
SHLIB_LD="$CC -shared -export-dynamic"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="$CC -shared -export-dynamic"
DO_SECOND_LD=""
LIBS="$LIBS -ldl"
@ -833,6 +848,7 @@ case "$target_os" in
#this tells ld to export all non-static symbols,
#otherwise no external predicates.
SHLIB_LD="$CC -shared -export-dynamic"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="$CC -shared -export-dynamic"
DO_SECOND_LD=""
SHLIB_SUFFIX=".sl"
@ -881,6 +897,7 @@ dnl Linux has both elf and a.out, in this case we found elf
SHLIB_SUFFIX=".so"
DO_SECOND_LD=""
SHLIB_LD="ld -n32 -shared -rdata_shared"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="ld -n32 -shared -rdata_shared"
INSTALL_DLLS=""
;;
@ -903,6 +920,7 @@ dnl Linux has both elf and a.out, in this case we found elf
# SHLIB_LD="$CC -bundle -bundle_loader \$(abs_top_builddir)/yap -L\$(abs_top_builddir) -lYap -undefined dynamic_lookup -Wl,-x -dead-strip -dead_strip_dylibs"
# LDFLAGS="-Wl,-x -dead_strip -dead_strip_dylibs $LDFLAGS"
SHLIB_LD="$CC -bundle -flat_namespace -undefined suppress"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="$CC -bundle -flat_namespace -undefined suppress"
INSTALL_DLLS=""
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall -Wstrict-aliasing=2"
@ -920,6 +938,7 @@ dnl Linux has both elf and a.out, in this case we found elf
LDFLAGS="-Wl,--export-dynamic $LDFLAGS"
SHLIB_CFLAGS="-fPIC"
SHLIB_LD="ld -Bshareable -x"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="ld -Bshareable -x"
DO_SECOND_LD=""
SHLIB_SUFFIX=".so"
@ -931,6 +950,7 @@ dnl Linux has both elf and a.out, in this case we found elf
LDFLAGS="-dynamic $LDFLAGS"
SHLIB_CFLAGS="-fPIC"
SHLIB_LD="$CC -shared"
SHLIB_LOWER_LD="$SHLIB_LD"
SHLIB_SWI_LD="$CC -shared"
DO_SECOND_LD=""
SHLIB_SUFFIX=".so"
@ -942,6 +962,7 @@ dnl Linux has both elf and a.out, in this case we found elf
YAPLIB="libWYap.a"
SHLIB_CFLAGS=""
SHLIB_LD="\$(CC) -shared -Wl,--export-all-symbols ../../yap.dll"
SHLIB_LOWER_LD="\$(CC) -shared -Wl,--export-all-symbols ../../../yap.dll"
SHLIB_SWI_LD="\$(CC) -shared -Wl,--export-all-symbols ../../yap.dll ../../packages/PLStream/plstream.dll"
SHLIB_SUFFIX=".dll"
C_PARSER_FLAGS="$C_INTERF_FLAGS"
@ -1251,6 +1272,7 @@ AC_SUBST(INSTALL_DLLS)
dnl if we need to merge several .o files into a single dll.
AC_SUBST(MERGE_DLL_OBJS)
dnl C-flags used to compile a file that will be loaded dynamically
AC_SUBST(CXXFLAGS)
AC_SUBST(SHLIB_CFLAGS)
dnl suffix for loadable binary (.so,.dll,.o)
AC_SUBST(SHLIB_SUFFIX)
@ -1260,6 +1282,7 @@ AC_SUBST(EXEC_SUFFIX)
dnl how to call the loader
AC_SUBST(DO_SECOND_LD)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LOWER_LD)
AC_SUBST(SHLIB_SWI_LD)
AC_SUBST(DYNLIB_LD)
dnl objects in YAP library

@ -1 +1 @@
Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e
Subproject commit e071f01c1d9015e6d3fabc73092a6e902541485a

@ -1 +1 @@
Subproject commit a2d2f03107eecd45462cd61a678035132cf06326
Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa

View File

@ -18,7 +18,8 @@ LIBDIR=$(EROOTDIR)/lib/Yap
#
#
CC=@CC@
CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../../.. -I$(srcdir)/../../../include
CXX=@CXX@
CXXFLAGS= @CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../../.. -I$(srcdir)/../../../include
#
#
# You shouldn't need to change what follows.
@ -61,10 +62,10 @@ all: $(SOBJS)
# default rule
%.o : $(srcdir)/%.C
$(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $< -o $@
$(CXX) -c $(CXXFLAGS) $(SHLIB_CFLAGS) $< -o $@
@DO_SECOND_LD@pl-minisat@SHLIB_SUFFIX@: $(OBJS)
@DO_SECOND_LD@ @SHLIB_LD@ -o pl-minisat@SHLIB_SUFFIX@ $(OBJS)
@DO_SECOND_LD@ @SHLIB_LOWER_LD@ -o pl-minisat@SHLIB_SUFFIX@ $(OBJS)
install: all
$(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(LIBDIR)
@ -75,9 +76,9 @@ clean:
depend: $(HEADERS) $(C_SOURCES)
-@if test "$(GCC)" = yes; then\
$(CC) -MM -MG $(CFLAGS) -I$(srcdir) -I$(srcdir)/../../include -I$(srcdir)/../../H $(C_SOURCES) >> Makefile;\
$(CC) -MM -MG $(CFLAGS) -I$(srcdir) -I$(srcdir)/../../../include -I$(srcdir)/../../../H $(C_SOURCES) >> Makefile;\
else\
makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../H -I$(srcdir)/../../include -- $(C_SOURCES) |\
makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../../H -I$(srcdir)/../../../include -- $(C_SOURCES) |\
sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
fi

View File

@ -163,6 +163,7 @@ true :- true.
'$run_atom_goal'(GA),
set_value('$live','$false').
'$enter_top_level' :-
'$disable_docreep',
prompt(_,' ?- '),
prompt(' | '),
'$run_toplevel_hooks',

View File

@ -384,11 +384,18 @@ debugging :-
fail.
% if we are in
'$loop_spy2'(GoalNumber, G, Module, CalledFromDebugger, CP) :-
'$loop_spy2'(GoalNumber, G0, Module, CalledFromDebugger, CP) :-
/* the following choice point is where the predicate is called */
b_getval('$spy_glist',[info(_,_,_,Retry,Det)|_]), /* get goal list */
(
/* call port */
(
'$is_metapredicate'(G0, Module)
->
'$meta_expansion'(G0,Module,Module,Module,G,[])
;
G = G0
),
b_getval('$spy_glist',[info(_,_,_,Retry,Det)|_]), /* get goal list */
(
/* call port */
'$enter_goal'(GoalNumber, G, Module),
'$spycall'(G, Module, CalledFromDebugger, Retry),
'$disable_docreep',
@ -501,7 +508,7 @@ debugging :-
CP is '$last_choice_pt',
'$static_clause'(G,M,_,R),
% I may backtrack to here from far away
'$disable_docreep',
'$disable_docreep',
(
'$continue_debugging'(no, '$execute_clause'(G, M, R, CP))
;
@ -549,12 +556,14 @@ debugging :-
% ( SL = L -> SLL = '>' ; SLL = ' '),
SLL = ' ',
( Module\=prolog,
Module\=user ->
format(user_error,'~a~a~a (~d) ~q: ~a:',[Det,CSPY,SLL,L,P0,Module])
Module\=user
->
GW = Module:G
;
format(user_error,'~a~a~a (~d) ~q:',[Det,CSPY,SLL,L,P0])
GW = G
),
'$debugger_write'(user_error,G).
format(user_error,'~a~a~a (~d) ~q:',[Det,CSPY,SLL,L,P0]),
'$debugger_write'(user_error,GW).
'$unleashed'(call) :- get_value('$leash',L), L /\ 2'1000 =:= 0. %'
'$unleashed'(exit) :- get_value('$leash',L), L /\ 2'0100 =:= 0. %'

View File

@ -94,7 +94,7 @@ module(N) :-
Arity2 is Arity+2,
'$process_exports'(Exports,Mod,ExportedPreds).
'$process_exports'([op(Prio,Assoc,Name)|Exports],Mod,ExportedPreds) :- !,
op(Prio,Assoc,Name),
op(Prio,Assoc,prolog:Name),
'$process_exports'(Exports,Mod,ExportedPreds).
'$process_exports'([Trash|_],Mod,_) :-
'$do_error'(type_error(predicate_indicator,Trash),module(Mod,[Trash])).

View File

@ -95,6 +95,10 @@ op(P,T,V) :-
'$op2'(P, T, A),
'$opl'(P, T, As).
'$op2'(P,T,A) :-
atom(A),
prolog_load_context(module, Mod), Mod \= user, !,
'$opdec'(P,T,A,Mod).
'$op2'(P,T,A) :-
atom(A), !,
'$opdec'(P,T,A,prolog).

View File

@ -132,13 +132,13 @@ open(F,T,S,Opts) :-
'$process_open_opts'(L,N0,N, Aliases, Encoding, BOM, DefaultExpand).
'$value_open_opt'(text,_,1,X) :- X is 128-2. % default
'$value_open_opt'(binary,_,2, X) :- X is 128-1.
'$value_open_opt'(true,_,4, X) :- X is 128-8.
'$value_open_opt'(false,_,8, X) :- X is 128-4.
'$value_open_opt'(error,_,16, X) :- X is 128-32-64.
'$value_open_opt'(eof_code,_,32, X) :- X is 128-16-64.
'$value_open_opt'(reset,64, X) :- X is 128-32-16.
'$value_open_opt'(text,_,1,X) :- X is 0xffff-2. % default
'$value_open_opt'(binary,_,2, X) :- X is 0xffff-1.
'$value_open_opt'(true,_,4, X) :- X is 0xffff-8.
'$value_open_opt'(false,_,8, X) :- X is 0xffff-4.
'$value_open_opt'(error,_,16, X) :- X is 0xffff-0x0060.
'$value_open_opt'(eof_code,_,32, X) :- X is 0xffff-0x0050.
'$value_open_opt'(reset, _, 64, X) :- X is 0xffff-0x0030.
%128 -> use bom
%256 -> do not use bom
%512 -> do prolog on unrepresentable char