Merge branch 'master' of dmineserv2:Yap/yap-6.2
This commit is contained in:
commit
03ed764580
@ -792,7 +792,6 @@ Yap_absmi(int inp)
|
|||||||
noheapleft:
|
noheapleft:
|
||||||
{
|
{
|
||||||
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
|
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
|
||||||
|
|
||||||
#ifdef SHADOW_S
|
#ifdef SHADOW_S
|
||||||
S = SREG;
|
S = SREG;
|
||||||
#endif
|
#endif
|
||||||
@ -2535,6 +2534,7 @@ Yap_absmi(int inp)
|
|||||||
PP = PREG->u.pp.p0;
|
PP = PREG->u.pp.p0;
|
||||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||||
ASP = YREG+E_CB;
|
ASP = YREG+E_CB;
|
||||||
|
SREG = YENV;
|
||||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||||
goto noheapleft;
|
goto noheapleft;
|
||||||
@ -2690,6 +2690,7 @@ Yap_absmi(int inp)
|
|||||||
SREG = (CELL *) PREG->u.Osbpp.p;
|
SREG = (CELL *) PREG->u.Osbpp.p;
|
||||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||||
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
|
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
|
||||||
|
SREG = YENV;
|
||||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||||
goto noheapleft;
|
goto noheapleft;
|
||||||
@ -2926,6 +2927,7 @@ Yap_absmi(int inp)
|
|||||||
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
|
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
|
||||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||||
|
SREG = YENV;
|
||||||
goto noheapleft;
|
goto noheapleft;
|
||||||
}
|
}
|
||||||
if (ActiveSignals) {
|
if (ActiveSignals) {
|
||||||
@ -3049,6 +3051,7 @@ Yap_absmi(int inp)
|
|||||||
ASP = YREG+E_CB;
|
ASP = YREG+E_CB;
|
||||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||||
|
SREG = YENV;
|
||||||
goto noheapleft;
|
goto noheapleft;
|
||||||
}
|
}
|
||||||
if (ActiveSignals)
|
if (ActiveSignals)
|
||||||
@ -14558,6 +14561,7 @@ Yap_absmi(int inp)
|
|||||||
if (ActiveSignals) {
|
if (ActiveSignals) {
|
||||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||||
UNLOCK(SignalLock);
|
UNLOCK(SignalLock);
|
||||||
|
SREG = YENV;
|
||||||
goto noheapleft;
|
goto noheapleft;
|
||||||
}
|
}
|
||||||
UNLOCK(SignalLock);
|
UNLOCK(SignalLock);
|
||||||
|
22
C/alloc.c
22
C/alloc.c
@ -1596,14 +1596,28 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
#elif SIZEOF_INT_P==8
|
||||||
WorkSpaceTop = WorkSpaceTop0;
|
{
|
||||||
#endif
|
int n = 1024*1024;
|
||||||
if (ExtendWorkSpace(s, 0)) {
|
while (n) {
|
||||||
|
/* progress 1 MB */
|
||||||
|
WorkSpaceTop += 512*1024;
|
||||||
|
if (ExtendWorkSpace(s, MAP_FIXED)) {
|
||||||
Yap_add_memory_hole((ADDR)WorkSpaceTop0, (ADDR)WorkSpaceTop-s);
|
Yap_add_memory_hole((ADDR)WorkSpaceTop0, (ADDR)WorkSpaceTop-s);
|
||||||
Yap_ErrorMessage = NULL;
|
Yap_ErrorMessage = NULL;
|
||||||
return WorkSpaceTop-WorkSpaceTop0;
|
return WorkSpaceTop-WorkSpaceTop0;
|
||||||
}
|
}
|
||||||
|
#if defined(_WIN32)
|
||||||
|
/* 487 happens when you step over someone else's memory */
|
||||||
|
if (GetLastError() != 487) {
|
||||||
|
WorkSpaceTop = WorkSpaceTop0;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
WorkSpaceTop = WorkSpaceTop0;
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
15
C/index.c
15
C/index.c
@ -2430,18 +2430,15 @@ count_consts(GroupDef *grp)
|
|||||||
static UInt
|
static UInt
|
||||||
count_blobs(GroupDef *grp)
|
count_blobs(GroupDef *grp)
|
||||||
{
|
{
|
||||||
Term current = MkAtomTerm(AtomFoundVar);
|
UInt i = 1;
|
||||||
UInt i = 0;
|
ClauseDef *cl = grp->FirstClause+1;
|
||||||
ClauseDef *cl = grp->FirstClause;
|
Term current = grp->FirstClause->Tag;
|
||||||
|
|
||||||
while (TRUE) {
|
while (cl <= grp->LastClause) {
|
||||||
if (current != cl->Tag) {
|
if (current != cl->Tag) {
|
||||||
i++;
|
i++;
|
||||||
current = cl->Tag;
|
current = cl->Tag;
|
||||||
}
|
}
|
||||||
if (cl == grp->LastClause) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
cl++;
|
cl++;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
@ -3224,7 +3221,7 @@ do_dbref_index(ClauseDef *min, ClauseDef* max, Term t, struct intermediates *cin
|
|||||||
Yap_emit(label_op, labl, Zero, cint);
|
Yap_emit(label_op, labl, Zero, cint);
|
||||||
Yap_emit(index_dbref_op, Zero, Zero, cint);
|
Yap_emit(index_dbref_op, Zero, Zero, cint);
|
||||||
sort_group(group,(CELL *)(group+1),cint);
|
sort_group(group,(CELL *)(group+1),cint);
|
||||||
do_blobs(group, t, cint, argno, first, fail_l, clleft, (CELL *)group+1);
|
do_blobs(group, t, cint, argno, first, fail_l, clleft, (CELL *)(group+1));
|
||||||
return labl;
|
return labl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3261,7 +3258,7 @@ do_blob_index(ClauseDef *min, ClauseDef* max, Term t, struct intermediates *cint
|
|||||||
else
|
else
|
||||||
Yap_emit(index_long_op, Zero, Zero, cint);
|
Yap_emit(index_long_op, Zero, Zero, cint);
|
||||||
sort_group(group,(CELL *)(group+1),cint);
|
sort_group(group,(CELL *)(group+1),cint);
|
||||||
do_blobs(group, t, cint, argno, first, fail_l, clleft, (CELL *)group+1);
|
do_blobs(group, t, cint, argno, first, fail_l, clleft, (CELL *)(group+1));
|
||||||
return labl;
|
return labl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -717,6 +717,9 @@ Yap_scan_num(int (*Nxtch) (int))
|
|||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
ch = Nxtch(-1);
|
ch = Nxtch(-1);
|
||||||
|
while (chtype(ch) == BS) {
|
||||||
|
ch = Nxtch(-1);
|
||||||
|
}
|
||||||
if (ch == '-') {
|
if (ch == '-') {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
ch = Nxtch(-1);
|
ch = Nxtch(-1);
|
||||||
|
@ -49,13 +49,6 @@ format_to_chars(Form, Args, OUT, L0) :-
|
|||||||
write_to_chars(Term, OUT) :-
|
write_to_chars(Term, OUT) :-
|
||||||
write_to_chars(Term, [], OUT).
|
write_to_chars(Term, [], OUT).
|
||||||
|
|
||||||
write_to_chars(Term, L0, OUT) :-
|
|
||||||
open_mem_write_stream(Stream),
|
|
||||||
write(Stream, Term),
|
|
||||||
peek_mem_write_stream(Stream, L0, O),
|
|
||||||
close(Stream),
|
|
||||||
O = OUT.
|
|
||||||
|
|
||||||
atom_to_chars(Atom, OUT) :-
|
atom_to_chars(Atom, OUT) :-
|
||||||
atom_to_chars(Atom, [], OUT).
|
atom_to_chars(Atom, [], OUT).
|
||||||
|
|
||||||
@ -88,12 +81,6 @@ number_to_chars(Number, L0, OUT) :-
|
|||||||
number_to_chars(Number, L0, OUT) :-
|
number_to_chars(Number, L0, OUT) :-
|
||||||
throw(error(type_error(number,Number),number_to_chars(Number, L0, OUT))).
|
throw(error(type_error(number,Number),number_to_chars(Number, L0, OUT))).
|
||||||
|
|
||||||
read_from_chars(Chars, Term) :-
|
|
||||||
open_mem_read_stream(Chars, Stream),
|
|
||||||
read(Stream, T),
|
|
||||||
close(Stream),
|
|
||||||
T = Term.
|
|
||||||
|
|
||||||
open_chars_stream(Chars, Stream) :-
|
open_chars_stream(Chars, Stream) :-
|
||||||
open_mem_read_stream(Chars, Stream).
|
open_mem_read_stream(Chars, Stream).
|
||||||
|
|
||||||
|
@ -1924,15 +1924,16 @@ typedef struct {
|
|||||||
X_API int PL_unify_term(term_t l,...)
|
X_API int PL_unify_term(term_t l,...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int type;
|
int type, res;
|
||||||
int nels = 1;
|
int nels = 1;
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
Term a[1], *pt;
|
Term a[1], *pt;
|
||||||
stack_el stack[MAX_DEPTH];
|
stack_el stack[MAX_DEPTH];
|
||||||
|
|
||||||
|
BACKUP_MACHINE_REGS();
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!Yap_gc(0, ENV, CP)) {
|
if (!Yap_gc(0, ENV, CP)) {
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2137,7 +2138,9 @@ X_API int PL_unify_term(term_t l,...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return YAP_Unify(Yap_GetFromSlot(l),a[0]);
|
res = Yap_unify(Yap_GetFromSlot(l),a[0]);
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end PL_unify_* functions =============================*/
|
/* end PL_unify_* functions =============================*/
|
||||||
|
17
pl/utils.yap
17
pl/utils.yap
@ -684,6 +684,23 @@ term_to_atom(Term,Atom) :-
|
|||||||
charsio:write_to_chars(Term,S),
|
charsio:write_to_chars(Term,S),
|
||||||
atom_codes(Atom,S).
|
atom_codes(Atom,S).
|
||||||
|
|
||||||
|
%
|
||||||
|
% hack this here.
|
||||||
|
%
|
||||||
|
charsio:write_to_chars(Term, L0, OUT) :-
|
||||||
|
charsio:open_mem_write_stream(Stream),
|
||||||
|
prolog:write(Stream, Term),
|
||||||
|
charsio:peek_mem_write_stream(Stream, L0, O),
|
||||||
|
prolog:close(Stream),
|
||||||
|
O = OUT.
|
||||||
|
|
||||||
|
charsio:read_from_chars(Chars, Term) :-
|
||||||
|
charsio:open_mem_read_stream(Chars, Stream),
|
||||||
|
prolog:read(Stream, T),
|
||||||
|
prolog:close(Stream),
|
||||||
|
T = Term.
|
||||||
|
|
||||||
|
|
||||||
simple(V) :- var(V), !.
|
simple(V) :- var(V), !.
|
||||||
simple(A) :- atom(A), !.
|
simple(A) :- atom(A), !.
|
||||||
simple(N) :- number(N).
|
simple(N) :- number(N).
|
||||||
|
Reference in New Issue
Block a user