L constants are evil in 64 bits
This commit is contained in:
parent
c52dda489b
commit
be2a3a635e
4
C/absmi.c
Normal file → Executable file
4
C/absmi.c
Normal file → Executable file
@ -835,7 +835,7 @@ Yap_absmi(int inp)
|
||||
cut_b = LCL0-(CELL *)(ASP[E_CB]);
|
||||
saveregs();
|
||||
if(!Yap_growtrail (0, FALSE)) {
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L);
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
|
||||
setregs();
|
||||
FAIL();
|
||||
}
|
||||
@ -14277,7 +14277,7 @@ Yap_absmi(int inp)
|
||||
#endif
|
||||
saveregs_and_ycache();
|
||||
if(!Yap_growtrail (0, FALSE)) {
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L);
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
|
||||
setregs_and_ycache();
|
||||
FAIL();
|
||||
}
|
||||
|
2
C/amasm.c
Normal file → Executable file
2
C/amasm.c
Normal file → Executable file
@ -3769,7 +3769,7 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep)
|
||||
case OUT_OF_TRAIL_ERROR:
|
||||
/* don't just return NULL */
|
||||
ARG1 = *tp;
|
||||
if (!Yap_growtrail(64 * 1024L, FALSE)) {
|
||||
if (!Yap_growtrail(K64, FALSE)) {
|
||||
return NULL;
|
||||
}
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
|
4
C/computils.c
Normal file → Executable file
4
C/computils.c
Normal file → Executable file
@ -97,9 +97,9 @@ static char *
|
||||
AllocCMem (UInt size, struct intermediates *cip)
|
||||
{
|
||||
#if SIZEOF_INT_P==8
|
||||
size = (size + 7) & 0xfffffffffffffff8L;
|
||||
size = (size + 7) & ((UInt)-8);
|
||||
#else
|
||||
size = (size + 3) & 0xfffffffcL;
|
||||
size = (size + 3) & ((UInt)0xfffffffc);
|
||||
#endif
|
||||
#if USE_SYSTEM_MALLOC
|
||||
if (!cip->blks || cip->blk_cur+size > cip->blk_top) {
|
||||
|
@ -249,10 +249,10 @@ STATIC_PROTO(DBProp find_int_key, (Int));
|
||||
static UInt new_trail_size(void)
|
||||
{
|
||||
UInt sz = (Yap_TrailTop-(ADDR)TR)/2;
|
||||
if (sz < 64 * 1024L)
|
||||
return 64 * 1024L;
|
||||
if (sz > 1024*1024L)
|
||||
return 1024*1024L;
|
||||
if (sz < K64)
|
||||
return K64;
|
||||
if (sz > M1)
|
||||
return M1;
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
2
C/gprof.c
Normal file → Executable file
2
C/gprof.c
Normal file → Executable file
@ -756,7 +756,7 @@ showprofres(UInt type) {
|
||||
pr->pcs = 0L;
|
||||
pr++;
|
||||
if (pr > (clauseentry *)Yap_TrailTop - 1024) {
|
||||
Yap_growtrail(64 * 1024L, FALSE);
|
||||
Yap_growtrail(K64, FALSE);
|
||||
}
|
||||
ProfPreds++;
|
||||
|
||||
|
14
C/grow.c
Normal file → Executable file
14
C/grow.c
Normal file → Executable file
@ -1236,7 +1236,7 @@ fix_tabling_info(void)
|
||||
static int
|
||||
do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
||||
{
|
||||
unsigned long size = sizeof(CELL) * 16 * 1024L;
|
||||
unsigned long size = sizeof(CELL) * K16;
|
||||
int shift_factor = (heap_overflows > 8 ? 8 : heap_overflows);
|
||||
unsigned long sz = size << shift_factor;
|
||||
|
||||
@ -1252,7 +1252,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
||||
size = YAP_ALLOC_SIZE;
|
||||
sz = AdjustPageSize(SizeOfOverflow);
|
||||
}
|
||||
while(sz >= sizeof(CELL) * 16 * 1024L && !static_growheap(sz, fix_code, cip, old_trp, tksp, vep)) {
|
||||
while(sz >= sizeof(CELL) * K16 && !static_growheap(sz, fix_code, cip, old_trp, tksp, vep)) {
|
||||
size = size/2;
|
||||
sz = size << shift_factor;
|
||||
if (sz < in_size) {
|
||||
@ -1277,7 +1277,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
||||
#ifdef TABLING
|
||||
fix_tabling_info();
|
||||
#endif /* TABLING */
|
||||
if (sz >= sizeof(CELL) * 16 * 1024L) {
|
||||
if (sz >= sizeof(CELL) * K16) {
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
@ -1427,7 +1427,7 @@ Yap_growheap_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
||||
int
|
||||
Yap_growglobal(CELL **ptr)
|
||||
{
|
||||
unsigned long sz = sizeof(CELL) * 16 * 1024L;
|
||||
unsigned long sz = sizeof(CELL) * K16;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (NOfThreads != 1) {
|
||||
@ -1662,8 +1662,8 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
||||
size *= 2;
|
||||
if (size < YAP_ALLOC_SIZE)
|
||||
size = YAP_ALLOC_SIZE;
|
||||
if (size > 2048*1024)
|
||||
size = 2048*1024;
|
||||
if (size > M2)
|
||||
size = M2;
|
||||
if (size < size0)
|
||||
size=size0;
|
||||
/* adjust to a multiple of 256) */
|
||||
@ -1824,7 +1824,7 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
||||
Int p_size = FOREIGN_ThreadHandle(worker_p).ssize+FOREIGN_ThreadHandle(worker_p).tsize;
|
||||
Int q_size = FOREIGN_ThreadHandle(worker_q).ssize+FOREIGN_ThreadHandle(worker_q).tsize;
|
||||
if (p_size != q_size) {
|
||||
if (!(FOREIGN_ThreadHandle(worker_q).stack_address = realloc(FOREIGN_ThreadHandle(worker_q).stack_address,p_size*1024))) {
|
||||
if (!(FOREIGN_ThreadHandle(worker_q).stack_address = realloc(FOREIGN_ThreadHandle(worker_q).stack_address,p_size*K1))) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -4025,7 +4025,7 @@ static Int
|
||||
}
|
||||
if (Yap_Error_TYPE == OUT_OF_TRAIL_ERROR) {
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!Yap_growtrail (sizeof(CELL) * 16 * 1024L, FALSE)) {
|
||||
if (!Yap_growtrail (sizeof(CELL) * K16, FALSE)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (Yap_Error_TYPE == OUT_OF_AUXSPACE_ERROR) {
|
||||
|
2
C/scanner.c
Normal file → Executable file
2
C/scanner.c
Normal file → Executable file
@ -163,7 +163,7 @@ AllocScannerMemory(unsigned int size)
|
||||
ScannerExtraBlocks = ptr;
|
||||
return (char *)(ptr+1);
|
||||
} else if (Yap_TrailTop <= AuxSpScan+size) {
|
||||
UInt alloc_size = sizeof(CELL) * 16 * 1024L;
|
||||
UInt alloc_size = sizeof(CELL) * K16;
|
||||
|
||||
if (size > alloc_size)
|
||||
alloc_size = size;
|
||||
|
12
C/sysbits.c
12
C/sysbits.c
@ -1059,8 +1059,8 @@ HandleSIGSEGV(int sig, siginfo_t *sip, ucontext_t *uap)
|
||||
sip->si_code != SI_NOINFO &&
|
||||
sip->si_code == SEGV_MAPERR &&
|
||||
(void *)(sip->si_addr) > (void *)(Yap_HeapBase) &&
|
||||
(void *)(sip->si_addr) < (void *)(Yap_TrailTop+64 * 1024L)) {
|
||||
Yap_growtrail(64 * 1024L, TRUE);
|
||||
(void *)(sip->si_addr) < (void *)(Yap_TrailTop+K64)) {
|
||||
Yap_growtrail(K64, TRUE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@ -1204,7 +1204,7 @@ SearchForTrailFault(siginfo_t *siginfo)
|
||||
if ((ptr > (void *)Yap_TrailTop-1024 &&
|
||||
TR < (tr_fr_ptr) Yap_TrailTop+(64*1024))) {
|
||||
if (!Yap_growtrail(64*1024, TRUE)) {
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", 64*1024L);
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
||||
}
|
||||
/* just in case, make sure the OS keeps the signal handler. */
|
||||
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
||||
@ -1334,13 +1334,13 @@ SearchForTrailFault(void)
|
||||
#if OS_HANDLES_TR_OVERFLOW && !USE_SYSTEM_MALLOC
|
||||
if ((TR > (tr_fr_ptr)Yap_TrailTop-1024 &&
|
||||
TR < (tr_fr_ptr)Yap_TrailTop+(64*1024))|| Yap_DBTrailOverflow()) {
|
||||
long trsize = 64*2014L;
|
||||
long trsize = K64;
|
||||
|
||||
while ((CELL)TR > (CELL)Yap_TrailTop+trsize) {
|
||||
trsize += 64*2014L;
|
||||
trsize += K64;
|
||||
}
|
||||
if (!Yap_growtrail(trsize, TRUE)) {
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", 64*1024L);
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
||||
}
|
||||
/* just in case, make sure the OS keeps the signal handler. */
|
||||
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
||||
|
6
H/Yap.h
Normal file → Executable file
6
H/Yap.h
Normal file → Executable file
@ -303,6 +303,12 @@ extern char Yap_Option[20];
|
||||
#define ALIGN_LONGS 1
|
||||
#endif
|
||||
|
||||
#define K1 ((CELL)1024)
|
||||
#define K16 ((CELL)(1024*64))
|
||||
#define K64 ((CELL)(1024*64))
|
||||
#define M1 ((CELL)(1024*1024))
|
||||
#define M2 ((CELL)(2048*1024))
|
||||
|
||||
/* basic data types */
|
||||
|
||||
typedef UInt CELL;
|
||||
|
4
H/Yatom.h
Normal file → Executable file
4
H/Yatom.h
Normal file → Executable file
@ -1394,8 +1394,8 @@ typedef enum
|
||||
|
||||
#include "YapHeap.h"
|
||||
|
||||
#define PredHashInitialSize 1039L
|
||||
#define PredHashIncrement 7919L
|
||||
#define PredHashInitialSize ((UInt)1039)
|
||||
#define PredHashIncrement ((UInt)7919)
|
||||
|
||||
EXTERN inline UInt STD_PROTO(PRED_HASH, (FunctorEntry *, Term, UInt));
|
||||
|
||||
|
4
H/alloc.h
Normal file → Executable file
4
H/alloc.h
Normal file → Executable file
@ -137,6 +137,6 @@ MALLOC_T calloc(size_t,size_t);
|
||||
|
||||
void Yap_add_memory_hole(ADDR, ADDR);
|
||||
|
||||
#define SCRATCH_START_SIZE (64*1024L)
|
||||
#define SCRATCH_INC_SIZE (64*1024L)
|
||||
#define SCRATCH_START_SIZE K64
|
||||
#define SCRATCH_INC_SIZE K64
|
||||
|
||||
|
2
H/heapgc.h
Normal file → Executable file
2
H/heapgc.h
Normal file → Executable file
@ -20,7 +20,7 @@
|
||||
/* macros used by garbage collection */
|
||||
|
||||
#if TAG_64BITS
|
||||
#define MaskAdr (~0x7L)
|
||||
#define MaskAdr (~((CELL)0x7))
|
||||
#endif
|
||||
|
||||
/* return pointer from object pointed to by ptr (remove tag & mark) */
|
||||
|
2
OPTYap/tab.macros.h
Normal file → Executable file
2
OPTYap/tab.macros.h
Normal file → Executable file
@ -605,7 +605,7 @@ static inline void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
|
||||
static inline CELL *expand_auxiliary_stack(CELL *stack) {
|
||||
void *old_top = Yap_TrailTop;
|
||||
INFORMATION_MESSAGE("Expanding trail in 64 Kbytes");
|
||||
if (! Yap_growtrail(64 * 1024L, TRUE)) { /* TRUE means 'contiguous_only' */
|
||||
if (! Yap_growtrail(K64, TRUE)) { /* TRUE means 'contiguous_only' */
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
|
||||
return NULL;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user