amd64 fixes

library fixes


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1247 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-02-21 16:50:21 +00:00
parent f40265838d
commit 0139bfc33a
11 changed files with 55 additions and 33 deletions

View File

@ -1661,7 +1661,7 @@ msb(Int inp) /* calculate the most significant bit for an integer */
} }
while (off) { while (off) {
int limit = 1 << (off); Int limit = 1L << (off);
if (inp >= limit) { if (inp >= limit) {
out += off; out += off;
inp >>= off; inp >>= off;

View File

@ -11,8 +11,12 @@
* File: compiler.c * * File: compiler.c *
* comments: Clause compiler * * comments: Clause compiler *
* * * *
* Last rev: $Date: 2005-01-28 23:14:35 $,$Author: vsc $ * * Last rev: $Date: 2005-02-21 16:49:39 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.61 2005/01/28 23:14:35 vsc
* move to Yap-4.5.7
* Fix clause size
*
* Revision 1.60 2005/01/14 20:55:16 vsc * Revision 1.60 2005/01/14 20:55:16 vsc
* improve register liveness calculations. * improve register liveness calculations.
* *
@ -1943,13 +1947,13 @@ clear_bvarray(int var, CELL *bvarray
var -= max; var -= max;
} }
/* now put a 0 on it, from now on the variable is initialised */ /* now put a 0 on it, from now on the variable is initialised */
nbit = (1 << var); nbit = (1L << var);
#ifdef DEBUG #ifdef DEBUG
if (*bvarray & nbit) { if (*bvarray & nbit) {
/* someone had already marked this variable: complain */ /* someone had already marked this variable: complain */
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = SYSTEM_ERROR;
Yap_Error_Term = TermNil; Yap_Error_Term = TermNil;
Yap_ErrorMessage = "repeated bit for variable"; Yap_ErrorMessage = "compiler internal error: variable initialised twice";
save_machine_regs(); save_machine_regs();
longjmp(cglobs->cint.CompilerBotch, 2); longjmp(cglobs->cint.CompilerBotch, 2);
} }
@ -2007,6 +2011,9 @@ reset_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs)
{ {
int size, size1, env_size, i; int size, size1, env_size, i;
CELL *source; CELL *source;
if (bvarray == NULL)
if (bvindex == 0) { if (bvindex == 0) {
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = SYSTEM_ERROR;
Yap_Error_Term = TermNil; Yap_Error_Term = TermNil;

View File

@ -313,14 +313,14 @@ static void create_hash_table(DBProp p, Int hint) {
if (hint < p->NOfEntries) if (hint < p->NOfEntries)
hint = p->NOfEntries; hint = p->NOfEntries;
while (off) { while (off) {
int limit = 1 << (off); Int limit = 1L << (off);
if (inp >= limit) { if (inp >= limit) {
out += off; out += off;
inp >>= off; inp >>= off;
} }
off >>= 1; off >>= 1;
} }
if ((size = 1 << out) < hint) if ((size = 1L << out) < hint)
hint <<= 1; hint <<= 1;
/* clean up the table */ /* clean up the table */
pt = tbl = (hash_db_entry *)AllocDBSpace(hint*sizeof(hash_db_entry)); pt = tbl = (hash_db_entry *)AllocDBSpace(hint*sizeof(hash_db_entry));

View File

@ -273,16 +273,16 @@ dump_stack(void)
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, Yap_GlobalBase); fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, Yap_GlobalBase);
} else { } else {
#if !USE_SYSTEM_MALLOC #if !USE_SYSTEM_MALLOC
fprintf (stderr,"%dKB of Code Space (%p--%p)\n",((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop); fprintf (stderr,"%ldKB of Code Space (%p--%p)\n",(long int)((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop);
#if USE_DL_MALLOC #if USE_DL_MALLOC
if (Yap_hole_start) { if (Yap_hole_start) {
fprintf (stderr," Last hole: %p--%p\n", Yap_hole_start, Yap_hole_end); fprintf (stderr," Last hole: %p--%p\n", Yap_hole_start, Yap_hole_end);
} }
#endif #endif
#endif #endif
fprintf (stderr,"%dKB of Global Stack (%p--%p)\n",(sizeof(CELL)*(H-H0))/1024,H0,H); fprintf (stderr,"%ldKB of Global Stack (%p--%p)\n",(long int)(sizeof(CELL)*(H-H0))/1024,H0,H);
fprintf (stderr,"%dKB of Local Stack (%p--%p)\n",(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0); fprintf (stderr,"%ldKB of Local Stack (%p--%p)\n",(long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
fprintf (stderr,"%dKB of Trail (%p--%p)\n",((ADDR)TR-Yap_TrailBase)/1024,Yap_TrailBase,TR); fprintf (stderr,"%ldKB of Trail (%p--%p)\n",(long int)((ADDR)TR-Yap_TrailBase)/1024,Yap_TrailBase,TR);
fprintf (stderr,"Performed %d garbage collections\n", GcCalls); fprintf (stderr,"Performed %d garbage collections\n", GcCalls);
#if LOW_LEVEL_TRACER #if LOW_LEVEL_TRACER
{ {

View File

@ -11,8 +11,12 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2005-01-28 23:14:36 $,$Author: vsc $ * * Last rev: $Date: 2005-02-21 16:50:00 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.114 2005/01/28 23:14:36 vsc
* move to Yap-4.5.7
* Fix clause size
*
* Revision 1.113 2005/01/15 05:21:36 vsc * Revision 1.113 2005/01/15 05:21:36 vsc
* fix bug in clause emulator * fix bug in clause emulator
* *
@ -3485,6 +3489,9 @@ do_pair(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int first
while (IsPairTerm(max->Tag) && max != grp->LastClause) { while (IsPairTerm(max->Tag) && max != grp->LastClause) {
max++; max++;
} }
if (!IsPairTerm(max->Tag)) {
max--;
}
if (min > grp->LastClause) { if (min > grp->LastClause) {
/* no clauses, just skip */ /* no clauses, just skip */
return nxtlbl; return nxtlbl;
@ -3840,7 +3847,7 @@ copy_clauses(ClauseDef *max0, ClauseDef *min0, CELL *top, struct intermediates *
static UInt static UInt
do_compound_index(ClauseDef *min0, ClauseDef* max0, Term* sreg, struct intermediates *cint, UInt i, UInt arity, UInt argno, UInt fail_l, int first, int last_arg, int clleft, CELL *top, int done_work) do_compound_index(ClauseDef *min0, ClauseDef* max0, Term* sreg, struct intermediates *cint, UInt i, UInt arity, UInt argno, UInt fail_l, int first, int last_arg, int clleft, CELL *top, int done_work)
{ {
int ret_lab = 0, *newlabp; UInt ret_lab = 0, *newlabp;
CELL *top0 = top; CELL *top0 = top;
ClauseDef *min, *max; ClauseDef *min, *max;
PredEntry *ap = cint->CurrentPred; PredEntry *ap = cint->CurrentPred;

View File

@ -11,8 +11,12 @@
* File: stdpreds.c * * File: stdpreds.c *
* comments: General-purpose C implemented system predicates * * comments: General-purpose C implemented system predicates *
* * * *
* Last rev: $Date: 2005-02-08 04:05:35 $,$Author: vsc $ * * Last rev: $Date: 2005-02-21 16:50:04 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.81 2005/02/08 04:05:35 vsc
* fix mess with add clause
* improves on sigsegv handling
*
* Revision 1.80 2005/01/05 05:32:37 vsc * Revision 1.80 2005/01/05 05:32:37 vsc
* Ricardo's latest version of profiler. * Ricardo's latest version of profiler.
* *
@ -231,7 +235,7 @@ static Int order=0;
Int temp; Int temp;
order++; order++;
if (index_code) temp=-order; else temp=order; if (index_code) temp=-order; else temp=order;
fprintf(FPreds,"+%p %p %p %d",code_start,code_end, pe, temp); fprintf(FPreds,"+%p %p %p %ld",code_start,code_end, pe, (long int)temp);
#if MORE_INFO_FILE #if MORE_INFO_FILE
if (pe->FunctorOfPred->KindOfPE==47872) { if (pe->FunctorOfPred->KindOfPE==47872) {
if (pe->ArityOfPE) { if (pe->ArityOfPE) {
@ -334,7 +338,7 @@ showprofres(UInt type) {
ProfPreds=0; ProfPreds=0;
pr=(clauseentry *) TR; pr=(clauseentry *) TR;
while (fscanf(FPreds,"+%p %p %p %d",&(pr->beg),&(pr->end),&(pr->pp),&(pr->ts)) > 0){ while (fscanf(FPreds,"+%p %p %p %ld",&(pr->beg),&(pr->end),&(pr->pp),&(pr->ts)) > 0){
int c; int c;
pr->pcs = 0L; pr->pcs = 0L;
pr++; pr++;
@ -447,7 +451,7 @@ showprofres(UInt type) {
printf(" %s",RepAtom(AtomOfTerm(myp->ModuleOfPred))->StrOfAE); printf(" %s",RepAtom(AtomOfTerm(myp->ModuleOfPred))->StrOfAE);
printf(":%s",RepAtom(NameOfFunctor(myp->FunctorOfPred))->StrOfAE); printf(":%s",RepAtom(NameOfFunctor(myp->FunctorOfPred))->StrOfAE);
if (myp->ArityOfPE) printf("/%d",myp->ArityOfPE); if (myp->ArityOfPE) printf("/%d",myp->ArityOfPE);
printf(" -> %u (%3.1f%c)\n",calls,(float) calls*100/ProfCalls,'%'); printf(" -> %lu (%3.1f%c)\n",(unsigned long int)calls,(float) calls*100/ProfCalls,'%');
} }
while (t<pr && t->pp == myp) t++; while (t<pr && t->pp == myp) t++;
} }
@ -472,19 +476,19 @@ showprofres(UInt type) {
printf(" %s",RepAtom(AtomOfTerm(t->pp->ModuleOfPred))->StrOfAE); printf(" %s",RepAtom(AtomOfTerm(t->pp->ModuleOfPred))->StrOfAE);
printf(":%s",RepAtom(NameOfFunctor(t->pp->FunctorOfPred))->StrOfAE); printf(":%s",RepAtom(NameOfFunctor(t->pp->FunctorOfPred))->StrOfAE);
if (t->pp->ArityOfPE) printf("/%d",t->pp->ArityOfPE); if (t->pp->ArityOfPE) printf("/%d",t->pp->ArityOfPE);
printf(" -> %u (%3.1f%c)\n",calls,(float) calls*100/ProfCalls,'%'); printf(" -> %lu (%3.1f%c)\n",(unsigned long int)calls,(float) calls*100/ProfCalls,'%');
} }
t++; t++;
} }
} }
count=ProfCalls-(count+InGrowHeap+InGrowStack+InGC+InError+InUnify+InCCall); // Falta +InCCall count=ProfCalls-(count+InGrowHeap+InGrowStack+InGC+InError+InUnify+InCCall); // Falta +InCCall
if (InGrowHeap>0) printf("%p sys: GrowHeap -> %u (%3.1f%c)\n",(void *) GrowHeapMode,InGrowHeap,(float) InGrowHeap*100/ProfCalls,'%'); if (InGrowHeap>0) printf("%p sys: GrowHeap -> %lu (%3.1f%c)\n",(void *) GrowHeapMode,(unsigned long int)InGrowHeap,(float) InGrowHeap*100/ProfCalls,'%');
if (InGrowStack>0) printf("%p sys: GrowStack -> %u (%3.1f%c)\n",(void *) GrowStackMode,InGrowStack,(float) InGrowStack*100/ProfCalls,'%'); if (InGrowStack>0) printf("%p sys: GrowStack -> %lu (%3.1f%c)\n",(void *) GrowStackMode,(unsigned long int)InGrowStack,(float) InGrowStack*100/ProfCalls,'%');
if (InGC>0) printf("%p sys: GC -> %u (%3.1f%c)\n",(void *) GCMode,InGC,(float) InGC*100/ProfCalls,'%'); if (InGC>0) printf("%p sys: GC -> %lu (%3.1f%c)\n",(void *) GCMode,(unsigned long int)InGC,(float) InGC*100/ProfCalls,'%');
if (InError>0) printf("%p sys: ErrorHandling -> %u (%3.1f%c)\n",(void *) ErrorHandlingMode,InError,(float) InError*100/ProfCalls,'%'); if (InError>0) printf("%p sys: ErrorHandling -> %lu (%3.1f%c)\n",(void *) ErrorHandlingMode,(unsigned long int)InError,(float) InError*100/ProfCalls,'%');
if (InUnify>0) printf("%p sys: Unify -> %u (%3.1f%c)\n",(void *) UnifyMode,InUnify,(float) InUnify*100/ProfCalls,'%'); if (InUnify>0) printf("%p sys: Unify -> %lu (%3.1f%c)\n",(void *) UnifyMode,(unsigned long int)InUnify,(float) InUnify*100/ProfCalls,'%');
if (InCCall>0) printf("%p sys: C Code -> %u (%3.1f%c)\n",(void *) CCallMode,InCCall,(float) InCCall*100/ProfCalls,'%'); if (InCCall>0) printf("%p sys: C Code -> %lu (%3.1f%c)\n",(void *) CCallMode,(unsigned long int)InCCall,(float) InCCall*100/ProfCalls,'%');
if (count>0) printf("Unknown:Unknown -> %u (%3.1f%c)\n",count,(float) count*100/ProfCalls,'%'); if (count>0) printf("Unknown:Unknown -> %lu (%3.1f%c)\n",(unsigned long int)count,(float) count*100/ProfCalls,'%');
printf("Total of Calls=%u \n",ProfCalls); printf("Total of Calls=%u \n",ProfCalls);
return TRUE; return TRUE;

View File

@ -120,11 +120,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* extern int gc_calls; */ /* extern int gc_calls; */
vsc_count++; vsc_count++;
/* if (vsc_count < 16458458000LL) if (vsc_count < 3590LL)
return; return;
if (vsc_count == 16458458322LL)
jmp_deb(1);
*/
#ifdef COMMENTED #ifdef COMMENTED
// if (vsc_count == 218280) // if (vsc_count == 218280)
// vsc_xstop = 1; // vsc_xstop = 1;

View File

@ -1587,7 +1587,7 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
loop: loop:
while (pt0 < pt0_end) { while (pt0 < pt0_end) {
register CELL d0, d1; register CELL d0, d1;
int our_write_mode = write_mode; Int our_write_mode = write_mode;
++ pt0; ++ pt0;
++ pt1; ++ pt1;

View File

@ -176,7 +176,7 @@ ord_intersection(>, Head1, Tail1, _, Tail2, Intersection) :-
% is true when Intersection is the ordered representation of Set1 % is true when Intersection is the ordered representation of Set1
% and Set2, provided that Set1 and Set2 are ordered sets. % and Set2, provided that Set1 and Set2 are ordered sets.
ord_intersection(L, [], [], L) :- !. ord_intersection(L, [], [], []) :- !.
ord_intersection([], L, [], L) :- !. ord_intersection([], L, [], L) :- !.
ord_intersection([Head1|Tail1], [Head2|Tail2], Intersection, Difference) :- ord_intersection([Head1|Tail1], [Head2|Tail2], Intersection, Difference) :-
compare(Order, Head1, Head2), compare(Order, Head1, Head2),

View File

@ -11,7 +11,7 @@
* Last rev: December 90 * * Last rev: December 90 *
* mods: * * mods: *
* comments: Original Tag Scheme for machines with 32 bits adresses * * comments: Original Tag Scheme for machines with 32 bits adresses *
* version: $Id: Tags_64bits.h.m4,v 1.3 2003-06-06 13:16:40 vsc Exp $ * * version: $Id: Tags_64bits.h.m4,v 1.4 2005-02-21 16:50:18 vsc Exp $ *
*************************************************************************/ *************************************************************************/
#define TAG_64BITS 1 #define TAG_64BITS 1
@ -33,7 +33,7 @@ property list
*/ */
#define SHIFT_HIGH_TAG 61 #define SHIFT_HIGH_TAG 63
#define MKTAG(HI,LO) ((((UInt) (HI))<<SHIFT_HIGH_TAG)|(LO)) #define MKTAG(HI,LO) ((((UInt) (HI))<<SHIFT_HIGH_TAG)|(LO))

View File

@ -11,8 +11,12 @@
* File: errors.yap * * File: errors.yap *
* comments: error messages for YAP * * comments: error messages for YAP *
* * * *
* Last rev: $Date: 2005-01-28 23:14:41 $,$Author: vsc $ * * Last rev: $Date: 2005-02-21 16:50:21 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.60 2005/01/28 23:14:41 vsc
* move to Yap-4.5.7
* Fix clause size
*
* Revision 1.59 2005/01/13 05:47:27 vsc * Revision 1.59 2005/01/13 05:47:27 vsc
* lgamma broke arithmetic optimisation * lgamma broke arithmetic optimisation
* integer_y has type y * integer_y has type y
@ -483,6 +487,9 @@ print_message(Level, Mss) :-
'$output_error_message'(existence_error(mutex,F), W) :- '$output_error_message'(existence_error(mutex,F), W) :-
format(user_error,'% EXISTENCE ERROR- ~w could not open mutex ~w~n', format(user_error,'% EXISTENCE ERROR- ~w could not open mutex ~w~n',
[W,F]). [W,F]).
'$output_error_message'(existence_error(library,F), W) :-
format(user_error,'% EXISTENCE ERROR- ~w could not open library ~w~n',
[W,F]).
'$output_error_message'(existence_error(queue,F), W) :- '$output_error_message'(existence_error(queue,F), W) :-
format(user_error,'% EXISTENCE ERROR- ~w could not open message queue ~w~n', format(user_error,'% EXISTENCE ERROR- ~w could not open message queue ~w~n',
[W,F]). [W,F]).