This commit is contained in:
Vitor Santos Costa 2019-01-22 01:47:07 +00:00
parent 86decdddde
commit 17a75d79ff
7 changed files with 408 additions and 433 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ static char SccsId[] = "%W% %G%";
#include "YapHeap.h" #include "YapHeap.h"
#include "Yatom.h" #include "Yatom.h"
static Int currgent_module(USES_REGS1); static Int current_module(USES_REGS1);
static Int current_module1(USES_REGS1); static Int current_module1(USES_REGS1);
static ModEntry *LookupModule(Term a); static ModEntry *LookupModule(Term a);
static ModEntry *LookupSystemModule(Term a); static ModEntry *LookupSystemModule(Term a);

View File

@ -52,6 +52,7 @@ typedef struct non_single_struct_t {
}\ }\
LIST0;\ LIST0;\
ptd0 = RepPair(d0);\ ptd0 = RepPair(d0);\
if (*ptd0 == TermFreeTerm) continue;\
to_visit->pt0 = pt0;\ to_visit->pt0 = pt0;\
to_visit->pt0_end = pt0_end;\ to_visit->pt0_end = pt0_end;\
to_visit->ptd0 = ptd0;\ to_visit->ptd0 = ptd0;\
@ -59,7 +60,7 @@ typedef struct non_single_struct_t {
to_visit ++;\ to_visit ++;\
d0 = ptd0[0];\ d0 = ptd0[0];\
pt0 = ptd0;\ pt0 = ptd0;\
*ptd0 = TermNil;\ *ptd0 = TermFreeTerm;\
pt0_end = pt0 + 1;\ pt0_end = pt0 + 1;\
goto list_loop;\ goto list_loop;\
} else if (IsApplTerm(d0)) {\ } else if (IsApplTerm(d0)) {\
@ -2269,9 +2270,8 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*to_visit = Malloc(1024*sizeof( struct non_single_struct_t)), *to_visit = Malloc(1024*sizeof( struct non_single_struct_t)),
*to_visit0 = to_visit, *to_visit0 = to_visit,
*to_visit_max = to_visit+1024; *to_visit_max = to_visit+1024;
Term o = TermNil;
CELL *InitialH = HR; CELL *InitialH = HR;
*HR++ = MkAtomTerm(AtomDollar);
to_visit0 = to_visit; to_visit0 = to_visit;
restart: restart:
while (pt0 < pt0_end) { while (pt0 < pt0_end) {
@ -2284,7 +2284,7 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
deref_head(d0, vars_within_term_unk); deref_head(d0, vars_within_term_unk);
vars_within_term_nvar: vars_within_term_nvar:
{ {
WALK_COMPLEX_TERM() WALK_COMPLEX_TERM();
continue; continue;
} }
@ -2293,10 +2293,13 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*ptd0 = TermNil; *ptd0 = TermNil;
/* leave an empty slot to fill in later */ /* leave an empty slot to fill in later */
if (HR+1024 > ASP) { if (HR+1024 > ASP) {
o = TermNil;
goto global_overflow; goto global_overflow;
} }
HR[0] = (CELL)ptd0; HR[0] = (CELL)ptd0;
HR ++; HR[1] = o;
o = AbsPair(HR);
HR += 2;
/* next make sure noone will see this as a variable again */ /* next make sure noone will see this as a variable again */
if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) { if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) {
/* Trail overflow */ /* Trail overflow */
@ -2318,13 +2321,8 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
} }
clean_tr(TR0 PASS_REGS); clean_tr(TR0 PASS_REGS);
pop_text_stack(lvl); pop_text_stack(lvl);
if (HR > InitialH+1) { return o;
InitialH[0] = (CELL)Yap_MkFunctor(AtomDollar, (HR-InitialH)-1);
return AbsAppl(InitialH);
} else {
return MkAtomTerm(AtomDollar);
}
def_trail_overflow(); def_trail_overflow();

View File

@ -62,7 +62,7 @@
[ [
class_drop/2 class_drop/2
]). ]).

do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :- do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :-
numbers_only(Y), numbers_only(Y),
verify_nonzero(No,Y), verify_nonzero(No,Y),
@ -76,7 +76,7 @@ numbers_only(Y) :-
; throw(type_error(_X = Y,2,'a rational number',Y)) ; throw(type_error(_X = Y,2,'a rational number',Y))
), ),
!. !.
ø
% verify_nonzero(Nonzero,Y) % verify_nonzero(Nonzero,Y)
% %
% if Nonzero = nonzero, then verify that Y is not zero % if Nonzero = nonzero, then verify that Y is not zero

View File

@ -43,6 +43,10 @@
project_nonlin/3, project_nonlin/3,
collect_nonlin/3 collect_nonlin/3
]). ]).
:- use_module(library(maplist),
[
maplist/2
]).
% l2conj(List,Conj) % l2conj(List,Conj)
% %

View File

@ -47,6 +47,10 @@
dump_nonzero/3, dump_nonzero/3,
clp_type/2 clp_type/2
]). ]).
:- use_module(library(maplist),
[
maplist/2
]).
clp_type(Var,Type) :- clp_type(Var,Type) :-

View File

@ -63,6 +63,10 @@
[ [
class_drop/2 class_drop/2
]). ]).
:- use_module(library(maplist),
[
maplist/2
]).
do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :- do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :-
numbers_only(Y), numbers_only(Y),