diff --git a/C/alloc.c b/C/alloc.c old mode 100644 new mode 100755 index a50c2d798..8e46a4a12 --- a/C/alloc.c +++ b/C/alloc.c @@ -804,7 +804,7 @@ Yap_AllocCodeSpace(unsigned long int size) #if defined(_WIN32) || defined(__CYGWIN__) -#undef DEBUG_WIN32_ALLOC +#undef DEBUG_WIN32_ALLOC #include "windows.h" @@ -821,7 +821,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) Yap_PrologMode = ExtendStackMode; #if DEBUG_WIN32_ALLOC - fprintf(stderr,"trying: %p--%x %d\n",b, s, fixed_allocation); + fprintf(stderr,"trying: %p (" Int_FORMAT "K) %d\n",b, s/1024, fixed_allocation); #endif if (fixed_allocation) { b = VirtualAlloc(b, s, MEM_RESERVE, PAGE_NOACCESS); @@ -840,7 +840,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msg, 256, NULL); - fprintf(stderr,"NOT OK1: %p--%p %s\n",b, brk, msg); + fprintf(stderr,"NOT OK1: %p %p %s\n", brk, b, msg); } #endif return FALSE; diff --git a/C/arith1.c b/C/arith1.c old mode 100644 new mode 100755 index 076aa95d2..2a3d413b9 --- a/C/arith1.c +++ b/C/arith1.c @@ -150,7 +150,7 @@ msb(Int inp) /* calculate the most significant bit for an integer */ } while (off) { - Int limit = 1L << (off); + Int limit = ((CELL)1) << (off); if (inp >= limit) { out += off; inp >>= off; @@ -179,7 +179,7 @@ lsb(Int inp) /* calculate the least significant bit for an integer */ if (!(inp & 0xffL)) {inp >>= 8; out += 8;} if (!(inp & 0xfL)) {inp >>= 4; out += 4;} if (!(inp & 0x3L)) {inp >>= 2; out += 2;} - if (!(inp & 0x1L)) out++; + if (!(inp & ((CELL)0x1))) out++; return out; } @@ -188,7 +188,7 @@ static Int popcount(Int inp) /* calculate the least significant bit for an integer */ { /* the obvious solution: do it by using binary search */ - Int c = 0, j = 0, m = 1L; + Int c = 0, j = 0, m = ((CELL)1); if (inp < 0) { return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp), diff --git a/C/arith2.c b/C/arith2.c old mode 100644 new mode 100755 index c3bb0f80c..a5fad8ecb --- a/C/arith2.c +++ b/C/arith2.c @@ -542,12 +542,12 @@ ipow(Int x, Int p) { Int r; - if (p == 0) return 1L; + if (p == 0) return ((CELL)1); if (x == 0 && p > 0) return 0L; if(p < 0) - return (-p % 2) ? x : 1L; + return (-p % 2) ? x : ((CELL)1); - r = 1L; + r = ((CELL)1); for(;;) { if(p & 1) { if (mul_overflow((r*x), r, x)) { diff --git a/C/compiler.c b/C/compiler.c index 9c396afeb..fb8d68116 100755 --- a/C/compiler.c +++ b/C/compiler.c @@ -565,7 +565,7 @@ compile_sf_term(Term t, int argno, int level) Yap_Error_Term = TermNil; Yap_ErrorMessage = "illegal argument of soft functor"; save_machine_regs(); - longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } else c_var(t, -argno, arity, level, cglobs); @@ -592,7 +592,7 @@ c_args(Term app, unsigned int level, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "exceed maximum arity of compiled goal"; save_machine_regs(); - longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } if (Arity > cglobs->max_args) cglobs->max_args = Arity; @@ -2247,14 +2247,10 @@ static CELL * init_bvarray(int nperm, compiler_struct *cglobs) { CELL *vinfo = NULL; - unsigned int i; - CELL *vptr; - - vptr = vinfo = (CELL *)Yap_AllocCMem(sizeof(CELL)*(1+nperm/(8*sizeof(CELL))), &cglobs->cint); - for (i = 0; i <= nperm/(8*sizeof(CELL)); i++) { - *vptr++ = (CELL)(0L); - } - return(vinfo); + size_t sz = sizeof(CELL)*(1+nperm/(8*sizeof(CELL))); + vinfo = (CELL *)Yap_AllocCMem(sz, &cglobs->cint); + memset((void *)vinfo, 0, sz); + return vinfo; } static void @@ -2273,15 +2269,16 @@ clear_bvarray(int var, CELL *bvarray var -= max; } /* now put a 0 on it, from now on the variable is initialised */ - nbit = (1L << var); + nbit = ((CELL)1 << var); #ifdef DEBUG if (*bvarray & nbit) { /* someone had already marked this variable: complain */ Yap_Error_TYPE = INTERNAL_COMPILER_ERROR; Yap_Error_Term = TermNil; Yap_ErrorMessage = "compiler internal error: variable initialised twice"; + fprintf(stderr," vsc: compiling7\n"); save_machine_regs(); - longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } cglobs->pbvars++; #endif @@ -2322,7 +2319,7 @@ push_bvmap(int label, PInstr *pcpc, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "Too many embedded disjunctions"; save_machine_regs(); - longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } /* the label instruction */ bvstack[bvindex].lab = label; @@ -2345,7 +2342,7 @@ reset_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "No embedding in disjunctions"; save_machine_regs(); - longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } env_size = (bvstack[bvindex-1].pc)->rnd1; size = env_size/(8*sizeof(CELL)); diff --git a/C/dbase.c b/C/dbase.c old mode 100644 new mode 100755 index fa88b7fc7..9463dcbc3 --- a/C/dbase.c +++ b/C/dbase.c @@ -304,14 +304,14 @@ static void create_hash_table(DBProp p, Int hint) { if (hint < p->NOfEntries) hint = p->NOfEntries; while (off) { - Int limit = 1L << (off); + Int limit = ((CELL)1) << (off); if (inp >= limit) { out += off; inp >>= off; } off >>= 1; } - if ((size = 1L << out) < hint) + if ((size = ((CELL)1) << out) < hint) hint <<= 1; /* clean up the table */ pt = tbl = (hash_db_entry *)AllocDBSpace(hint*sizeof(hash_db_entry)); diff --git a/C/heapgc.c b/C/heapgc.c index e27476bfd..74f4374e5 100755 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1507,7 +1507,7 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap) pvbmap += tsize/(sizeof(CELL)*8); bmap = *pvbmap; } else { - bmap = -1L; + bmap = ((CELL)-1); } bmap = (Int)(((CELL)bmap) << currv); } @@ -1518,7 +1518,7 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap) pvbmap--; bmap = *pvbmap; } else { - bmap = -1L; + bmap = ((CELL)-1); } currv = 0; } @@ -2734,7 +2734,7 @@ sweep_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap) pvbmap += tsize/(sizeof(CELL)*8); bmap = *pvbmap; } else { - bmap = -1L; + bmap = ((CELL)-1); } bmap = (Int)(((CELL)bmap) << currv); } @@ -2745,7 +2745,7 @@ sweep_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap) pvbmap--; bmap = *pvbmap; } else { - bmap = -1L; + bmap = ((CELL)-1); } currv = 0; } diff --git a/C/stdpreds.c b/C/stdpreds.c index 26c16cfbf..e30f7d745 100755 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -3980,7 +3980,7 @@ p_in_range2(void) { static Int p_max_tagged_integer(void) { - return Yap_unify(ARG1, MkIntTerm(MAX_ABS_INT-1L)); + return Yap_unify(ARG1, MkIntTerm(MAX_ABS_INT-((CELL)1))); } static Int diff --git a/H/compile.h b/H/compile.h old mode 100644 new mode 100755