move to Yap-4.5.7

Fix clause size


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1236 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-01-28 23:14:41 +00:00
parent be638d705c
commit 2ce853ec5f
15 changed files with 101 additions and 72 deletions

View File

@ -11,8 +11,12 @@
* File: amasm.c *
* comments: abstract machine assembler *
* *
* Last rev: $Date: 2004-12-28 22:20:35 $ *
* Last rev: $Date: 2005-01-28 23:14:34 $ *
* $Log: not supported by cvs2svn $
* Revision 1.70 2004/12/28 22:20:35 vsc
* some extra bug fixes for trail overflows: some cannot be recovered that easily,
* some can.
*
* Revision 1.69 2004/12/20 21:44:56 vsc
* more fixes to CLPBN
* fix some Yap overflows.
@ -3040,6 +3044,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
return NULL;
}
cl = (LogUpdClause *)((CODEADDR)x-(UInt)size);
cl->ClSize += sizeof(DBTerm) + sizeof(CELL)*x->NOfCells;
cl->ClSource = x;
cip->code_addr = (yamop *)cl;
} else if (mode == ASSEMBLING_CLAUSE &&
@ -3055,6 +3060,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
cip->code_addr = (yamop *)cl;
code_p = do_pass(1, &entry_code, mode, &clause_has_blobs, cip, size);
/* make sure we copy after second pass */
cl->ClSize += sizeof(DBTerm) + sizeof(CELL)*x->NOfCells;
cl->usc.ClSource = x;
ProfEnd=code_p;
return entry_code;

View File

@ -11,8 +11,11 @@
* File: cdmgr.c *
* comments: Code manager *
* *
* Last rev: $Date: 2005-01-05 05:35:01 $,$Author: vsc $ *
* Last rev: $Date: 2005-01-28 23:14:34 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.149 2005/01/05 05:35:01 vsc
* get rid of debugging stub.
*
* Revision 1.148 2005/01/04 02:50:21 vsc
* - allow MegaClauses with blobs
* - change Diffs to be thread specific
@ -2057,10 +2060,10 @@ p_compile_dynamic(void)
yamop *code_adr;
int old_optimize;
if (IsVarTerm(t1) || !IsIntTerm(t1))
return (FALSE);
if (IsVarTerm(t1) || !IsAtomTerm(t1))
return FALSE;
if (IsVarTerm(mod) || !IsAtomTerm(mod))
return (FALSE);
return FALSE;
old_optimize = optimizer_on;
optimizer_on = FALSE;
YAPEnterCriticalSection();
@ -2069,17 +2072,14 @@ p_compile_dynamic(void)
t = Deref(ARG1); /* just in case there was an heap overflow */
if (!Yap_ErrorMessage) {
optimizer_on = old_optimize;
addclause(t, code_adr, (int) (IntOfTerm(t1) & 3), mod, &ARG5);
addclause(t, code_adr, RepAtom(AtomOfTerm(t1))->StrOfAE[0] == 'f', mod, &ARG5);
}
if (Yap_ErrorMessage) {
if (!Yap_Error_Term)
Yap_Error_Term = TermNil;
if (IntOfTerm(t1) & 4) {
Yap_Error(Yap_Error_TYPE, Yap_Error_Term, "line %d, %s", Yap_FirstLineInParse(), Yap_ErrorMessage);
} else {
Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage);
}
Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage);
YAPLeaveCriticalSection();
return FALSE;
}
@ -4052,18 +4052,32 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
}
} else {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gc(4, YENV, P)) {
ARG5 = th;
ARG6 = tb;
ARG7 = tr;
if (!Yap_gc(7, YENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FALSE;
}
th = ARG5;
tb = ARG6;
tr = ARG7;
}
} else {
if (!Yap_gc(5, ENV, CP)) {
Yap_Error_TYPE = YAP_NO_ERROR;
ARG6 = th;
ARG7 = tb;
ARG8 = tr;
if (!Yap_gc(8, ENV, CP)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FALSE;
}
th = ARG6;
tb = ARG7;
tr = ARG8;
}
}
rtn = Yap_MkStaticRefTerm(cl);
return(Yap_unify(th, ArgOfTerm(1,t)) &&
Yap_unify(tb, ArgOfTerm(2,t)) &&
Yap_unify(tr, rtn));

View File

@ -11,8 +11,11 @@
* File: compiler.c *
* comments: Clause compiler *
* *
* Last rev: $Date: 2005-01-14 20:55:16 $,$Author: vsc $ *
* Last rev: $Date: 2005-01-28 23:14:35 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.60 2005/01/14 20:55:16 vsc
* improve register liveness calculations.
*
* Revision 1.59 2005/01/04 02:50:21 vsc
* - allow MegaClauses with blobs
* - change Diffs to be thread specific
@ -84,6 +87,7 @@ typedef struct compiler_struct_struct {
PInstr *BodyStart;
Ventry *vtable;
CExpEntry *common_exps;
int is_a_fact;
int n_common_exps;
int goalno;
int onlast;
@ -2388,35 +2392,37 @@ c_layout(compiler_struct *cglobs)
rn_to_kill[0] = rn_to_kill[1] = 0;
cglobs->cint.cpc = cglobs->BodyStart;
while (v != NIL) {
if (v->FlagsOfVE & BranchVar) {
v->AgeOfVE = v->FirstOfVE + 1; /* force permanent */
++(v->RCountOfVE);
Yap_emit(put_var_op, (CELL) v, Zero, &cglobs->cint);
v->FlagsOfVE &= ~GlobalVal;
v->FirstOpForV = cglobs->cint.cpc;
if (!cglobs->is_a_fact) {
while (v != NIL) {
if (v->FlagsOfVE & BranchVar) {
v->AgeOfVE = v->FirstOfVE + 1; /* force permanent */
++(v->RCountOfVE);
Yap_emit(put_var_op, (CELL) v, Zero, &cglobs->cint);
v->FlagsOfVE &= ~GlobalVal;
v->FirstOpForV = cglobs->cint.cpc;
}
v = v->NextOfVE;
}
v = v->NextOfVE;
}
cglobs->cint.cpc->nextInst = savepc;
cglobs->cint.cpc->nextInst = savepc;
nperm = 0;
AssignPerm(cglobs->cint.CodeStart, cglobs);
/* vsc: need to do it from the beginning to find which perm vars are active */
/* CheckUnsafe(cglobs->BodyStart, cglobs); */
nperm = 0;
AssignPerm(cglobs->cint.CodeStart, cglobs);
/* vsc: need to do it from the beginning to find which perm vars are active */
/* CheckUnsafe(cglobs->BodyStart, cglobs); */
#ifdef DEBUG
cglobs->pbvars = 0;
cglobs->pbvars = 0;
#endif
CheckUnsafe(cglobs->cint.CodeStart, cglobs);
CheckUnsafe(cglobs->cint.CodeStart, cglobs);
#ifdef DEBUG
if (cglobs->pbvars != nperm) {
Yap_Error_TYPE = SYSTEM_ERROR;
Yap_Error_Term = TermNil;
Yap_ErrorMessage = "wrong number of variables found in bitmap";
save_machine_regs();
longjmp(cglobs->cint.CompilerBotch, 2);
}
if (cglobs->pbvars != nperm) {
Yap_Error_TYPE = SYSTEM_ERROR;
Yap_Error_Term = TermNil;
Yap_ErrorMessage = "wrong number of variables found in bitmap";
save_machine_regs();
longjmp(cglobs->cint.CompilerBotch, 2);
}
#endif
}
cglobs->MaxCTemps = cglobs->nvars + cglobs->max_args - cglobs->tmpreg + cglobs->n_common_exps + 2;
if (cglobs->MaxCTemps >= MaxTemps)
cglobs->MaxCTemps = MaxTemps;
@ -2883,6 +2889,7 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src)
cglobs.common_exps = NULL;
cglobs.n_common_exps = 0;
cglobs.labelno = 0L;
cglobs.is_a_fact = FALSE;
if (IsVarTerm(my_clause)) {
Yap_Error_TYPE = INSTANTIATION_ERROR;
Yap_Error_Term = my_clause;
@ -2926,10 +2933,10 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src)
}
READ_UNLOCK(cglobs.cint.CurrentPred->PRWLock);
}
cglobs.is_a_fact = (body == MkAtomTerm(AtomTrue));
/* phase 1 : produce skeleton code and variable information */
c_head(head, &cglobs);
if (body == MkAtomTerm(AtomTrue) &&
!cglobs.vtable) {
if (cglobs.is_a_fact && !cglobs.vtable) {
Yap_emit(procceed_op, Zero, Zero, &cglobs.cint);
/* ground term, do not need much more work */
if (cglobs.cint.BlobsStart != NULL) {

View File

@ -11,8 +11,11 @@
* File: index.c *
* comments: Indexing a Prolog predicate *
* *
* Last rev: $Date: 2005-01-15 05:21:36 $,$Author: vsc $ *
* Last rev: $Date: 2005-01-28 23:14:36 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.113 2005/01/15 05:21:36 vsc
* fix bug in clause emulator
*
* Revision 1.112 2004/12/28 22:20:35 vsc
* some extra bug fixes for trail overflows: some cannot be recovered that easily,
* some can.
@ -6234,7 +6237,7 @@ static_clause(yamop *ipc, PredEntry *ap)
UInt fls = c->ClFlags & ~HasBlobsMask;
if (fls == StaticMask) {
if ((char *)c->usc.ClSource < (char *)c+c->ClSize &&
valid_instructions(ipc, c->ClCode));
valid_instructions(ipc, c->ClCode))
return c;
} else if (fls == (StaticMask|FactMask)) {
if (c->usc.ClPred == ap &&

View File

@ -110,9 +110,6 @@ jmp_buf Yap_CompilerBotch;
/************ variables concerned with Error Handling *************/
sigjmp_buf Yap_RestartEnv; /* used to restart after an abort execution */
/******** whether Yap is responsible for signal handling******************/
int Yap_PrologShouldHandleInterrupts;
/********* IO support *****/
/********* parsing ********************************************/
@ -128,6 +125,9 @@ char Yap_FileNameBuf[YAP_FILENAME_MAX],
#endif /* THREADS */
/******** whether Yap is responsible for signal handling******************/
int Yap_PrologShouldHandleInterrupts;
/********* readline support *****/
#if HAVE_LIBREADLINE
@ -499,7 +499,7 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
}
} else {
cl->ClFlags = 0;
cl->ClSize = sz-sizeof(StaticClause);
cl->ClSize = sz;
cl->usc.ClPred = pe;
p_code = cl->ClCode;
}
@ -557,7 +557,7 @@ Yap_InitCmpPred(char *Name, unsigned long int Arity, CmpPredicate cmp_code, int
return;
}
} else {
cl->ClSize = sz-sizeof(StaticClause);
cl->ClSize = sz;
cl->usc.ClPred = pe;
cl->ClFlags = 0;
p_code = cl->ClCode;

View File

@ -1059,9 +1059,9 @@ void clean_tokens(TokEntry *tk)
void
Yap_clean_tokenizer(TokEntry *tokstart, VarEntry *vartable, VarEntry *anonvartable)
{
scanner_extra_alloc *ptr = ScannerExtraBlocks;
struct scanner_extra_alloc *ptr = ScannerExtraBlocks;
while (ptr) {
scanner_extra_alloc *next = ptr->next;
struct scanner_extra_alloc *next = ptr->next;
free(ptr);
ptr = next;
}

View File

@ -10,7 +10,7 @@
* File: Heap.h *
* mods: *
* comments: Heap Init Structure *
* version: $Id: Heap.h,v 1.77 2005-01-04 02:50:21 vsc Exp $ *
* version: $Id: Heap.h,v 1.78 2005-01-28 23:14:38 vsc Exp $ *
*************************************************************************/
/* information that can be stored in Code Space */
@ -710,7 +710,7 @@ struct various_codes *Yap_heap_regs;
#define XDiff rinfo[worker_id].x_diff
#define DelayDiff rinfo[worker_id].delay_diff
#define ScannerStack Yap_heap_regs->wl[worker_id].scanner_stack
#define ScannerExtraAlloc Yap_heap_regs->wl[worker_id].scanner_extra_alloc
#define ScannerExtraBlocks Yap_heap_regs->wl[worker_id].scanner_extra_blocks
#define SignalLock Yap_heap_regs->wl[worker_id].signal_lock
#define WPP Yap_heap_regs->wl[worker_id].wpp
#define UncaughtThrow Yap_heap_regs->wl[worker_id].uncaught_throw

View File

@ -314,4 +314,3 @@ void STD_PROTO(Yap_bug_location,(yamop *));

View File

@ -90,7 +90,7 @@ TEXI2PDF=texi2pdf
#4.1VPATH=@srcdir@:@srcdir@/OPTYap
CWD=$(PWD)
#
VERSION=Yap-4.5.6
VERSION=Yap-4.5.7
#
TAG_HEADERS= Tags_32bits.h Tags_32Ops.h Tags_32LowTag.h\

View File

@ -8,7 +8,7 @@
@c @setchapternewpage odd
@c %**end of header
@set VERSION 4.5.6
@set VERSION 4.5.7
@set EDITION 4.2.4
@set UPDATED December 2004

View File

@ -10,7 +10,7 @@
* File: Yap.h.m4 *
* mods: *
* comments: main header file for YAP *
* version: $Id: Yap.h.m4,v 1.76 2005-01-04 02:50:23 vsc Exp $ *
* version: $Id: Yap.h.m4,v 1.77 2005-01-28 23:14:40 vsc Exp $ *
*************************************************************************/
#include "config.h"
@ -94,7 +94,7 @@
#undef USE_THREADED_CODE
#endif
#define inline __inline
#define YAP_VERSION "Yap-4.5.3"
#define YAP_VERSION "Yap-4.5.7"
#define BIN_DIR "c:\\Program Files\\Yap\\bin"
#define LIB_DIR "c:\\Program Files\\Yap\\lib\\Yap"
#define SHARE_DIR "c:\\Program Files\\Yap\\share\\Yap"

View File

@ -3,7 +3,7 @@
Name: Yap
Summary: Prolog Compiler
Version: 4.5.6
Version: 4.5.7
Packager: Vitor Santos Costa <vitor@cos.ufrj.br>
Release: 1
Source: http://www.ncc.up.pt/~vsc/Yap/%{name}-%{version}.tar.gz

View File

@ -11,8 +11,14 @@
* File: errors.yap *
* comments: error messages for YAP *
* *
* Last rev: $Date: 2005-01-13 05:47:27 $,$Author: vsc $ *
* Last rev: $Date: 2005-01-28 23:14:41 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.59 2005/01/13 05:47:27 vsc
* lgamma broke arithmetic optimisation
* integer_y has type y
* pass original source to checker (and maybe even use option in parser)
* use warning mechanism for checker messages.
*
* Revision 1.58 2004/11/19 21:32:53 vsc
* change abort so that it won't be caught by handlers.
*
@ -191,7 +197,7 @@ print_message(Level, Mss) :-
'$write_svs'(SVs),
format(user_error, ' in ~q at line ~d, clause ~d.',[P,LN,CLN]).
'$do_print_message'(trace_help) :- !,
yap_flag(user_error,' Please enter a valid debugger command (h for help).', []).
format(user_error,' Please enter a valid debugger command (h for help).', []).
'$do_print_message'(version(Version)) :- !,
format(user_error,'YAP version ~a', [Version]).
'$do_print_message'(yes) :- !,

View File

@ -58,8 +58,7 @@ assert(C) :-
'$assert_fact'(H,Mod,Where,R) :-
'$is_log_updatable'(H, Mod), !,
(Where = first -> Pos = 2 ; Pos = 0),
'$compile_dynamic'(H, Pos, H, Mod, R).
'$compile_dynamic'(H, Where, H, Mod, R).
'$assert_fact'(H,Mod,Where,R) :-
( '$is_dynamic'(H, Mod) ->
'$assertat_d'(Where, H, true, H, Mod, R)
@ -84,8 +83,7 @@ assert(C) :-
'$assert_clause3'(C0,C,Mod,Where,R,P) :-
'$check_head_and_body'(C,H,B,P),
( '$is_log_updatable'(H, Mod) ->
(Where = first -> Pos = 2 ; Pos = 0),
'$compile_dynamic'((H :- B), Pos, C0, Mod, R)
'$compile_dynamic'((H :- B), Where, C0, Mod, R)
;
'$is_dynamic'(H, Mod) ->
'$assertat_d'(Where, H, B, C0, Mod, R)
@ -122,8 +120,7 @@ assert(C) :-
'$assert_dynamic2'(C0,C,Mod,Where,R,P) :-
'$check_head_and_body'(C,H,B,P),
( '$is_log_updatable'(H, Mod) ->
(Where = first -> Pos = 2 ; Pos = 0),
'$compile_dynamic'(C, Pos, C0, Mod, R)
'$compile_dynamic'(C, Where, C0, Mod, R)
;
'$is_dynamic'(H, Mod) ->
'$assertat_d'(Where,H,B,C0,Mod,R)
@ -181,7 +178,7 @@ assertz_static(C) :-
'$assertat_d'(first,Head,Body,C0,Mod,R) :- !,
'$compile_dynamic'((Head:-Body), 2, C0, Mod, CR),
'$compile_dynamic'((Head:-Body), first, C0, Mod, CR),
( get_value('$abol',true)
->
'$flags'(Head,Mod,Fl,Fl),
@ -200,7 +197,7 @@ assertz_static(C) :-
true
).
'$assertat_d'(last,Head,Body,C0,Mod,R) :-
'$compile_dynamic'((Head:-Body), 0, C0, Mod, CR),
'$compile_dynamic'((Head:-Body), last, C0, Mod, CR),
( get_value('$abol',true)
->
'$flags'(Head,Mod,Fl,Fl),

View File

@ -477,18 +477,15 @@ garbage_collect_atoms :-
'$good_character_code'(X) :- integer(X), X > -2, X < 256.
atom_concat(X,Y,At) :-
atom(At), !,
var(X), var(Y), !,
atom_length(At,Len),
'$atom_contact_split'(At,0,Len,X,Y).
/* Let atom_chars do our error handling */
atom_concat(X,Y,At) :-
atom_codes(X,S1),
atom_codes(Y,S2),
'$append'(S1,S2,S),
atom_codes(At,S).
atom_concat([X,Y],At).
atomic_concat(X,Y,At) :-
atom(At), !,
var(X), var(Y), !,
atom_length(At,Len),
'$atom_contact_split'(At,0,Len,X,Y).
/* Let atom_chars do our error handling */