use stdbool
This commit is contained in:
parent
9b5c4ea710
commit
3c0a65218b
46
C/absmi.c
46
C/absmi.c
@ -607,7 +607,7 @@ check_alarm_fail_int(int CONT USES_REGS)
|
||||
}
|
||||
#endif
|
||||
if (Yap_get_signal( YAP_FAIL_SIGNAL )) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (!Yap_has_a_signal()) {
|
||||
/* no need to look into GC */
|
||||
@ -639,7 +639,7 @@ code_overflow( CELL *yenv USES_REGS )
|
||||
CELL cut_b = LCL0-(CELL *)(yenv[E_CB]);
|
||||
|
||||
/* do a garbage collection first to check if we can recover memory */
|
||||
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
|
||||
if (!Yap_locked_growheap(false, 0, NULL)) {
|
||||
Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
|
||||
return 0;
|
||||
}
|
||||
@ -726,7 +726,7 @@ interrupt_handler( PredEntry *pe USES_REGS )
|
||||
#endif /* LOW_LEVEL_TRACE */
|
||||
/* for profiler */
|
||||
CACHE_A1();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// interrupt handling code that sets up the case when we do not have
|
||||
@ -813,14 +813,14 @@ safe_interrupt_handler( PredEntry *pe USES_REGS )
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||
if (pe->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
return FALSE;
|
||||
return false;
|
||||
else DEPTH = RESET_DEPTH();
|
||||
}
|
||||
} else if (pe->ModuleOfPred) {
|
||||
DEPTH -= MkIntConstant(2);
|
||||
}
|
||||
#endif /* DEPTH_LIMIT */
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -888,7 +888,7 @@ interrupt_handler_either( Term t_cut, PredEntry *pe USES_REGS )
|
||||
// #define DEBUG_INTERRUPTS 1
|
||||
|
||||
#ifdef DEBUG_INTERRUPTS
|
||||
static int trace_interrupts = TRUE;
|
||||
static int trace_interrupts = true;
|
||||
#endif
|
||||
|
||||
static int
|
||||
@ -898,16 +898,16 @@ interrupt_fail( USES_REGS1 )
|
||||
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
||||
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
||||
#endif
|
||||
check_alarm_fail_int( FALSE PASS_REGS );
|
||||
check_alarm_fail_int( false PASS_REGS );
|
||||
/* don't do debugging and stack expansion here: space will
|
||||
be recovered. automatically by fail, so
|
||||
better wait.
|
||||
*/
|
||||
if (Yap_has_signal( YAP_CREEP_SIGNAL ) ) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (Yap_has_signal( YAP_CDOVF_SIGNAL ) ) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
/* make sure we have the correct environment for continuation */
|
||||
ENV = B->cp_env;
|
||||
@ -924,7 +924,7 @@ interrupt_execute( USES_REGS1 )
|
||||
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
||||
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
||||
#endif
|
||||
if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) {
|
||||
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
||||
return v;
|
||||
}
|
||||
PP = P->y_u.pp.p0;
|
||||
@ -950,7 +950,7 @@ interrupt_call( USES_REGS1 )
|
||||
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
||||
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
||||
#endif
|
||||
if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) {
|
||||
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
||||
return v;
|
||||
}
|
||||
PP = P->y_u.Osbpp.p0;
|
||||
@ -1010,7 +1010,7 @@ interrupt_deallocate( USES_REGS1 )
|
||||
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
||||
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
||||
#endif
|
||||
if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) {
|
||||
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
||||
return v;
|
||||
}
|
||||
/*
|
||||
@ -1459,7 +1459,7 @@ Yap_absmi(int inp)
|
||||
SET_ASP(YREG, E_CB*sizeof(CELL));
|
||||
cut_b = LCL0-(CELL *)(ASP[E_CB]);
|
||||
saveregs();
|
||||
if(!Yap_growtrail (0, FALSE)) {
|
||||
if(!Yap_growtrail (0, false)) {
|
||||
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
|
||||
setregs();
|
||||
FAIL();
|
||||
@ -1509,7 +1509,7 @@ Yap_absmi(int inp)
|
||||
Op(try_me, Otapl);
|
||||
/* check if enough space between trail and codespace */
|
||||
check_trail(TR);
|
||||
/* I use YREG =to go through the choicepoint. Usually YREG =is in a
|
||||
/* I use YREG to go through the choicepoint. Usually YREG is in a
|
||||
* register, but sometimes (X86) not. In this case, have a
|
||||
* new register to point at YREG =*/
|
||||
CACHE_Y(YREG);
|
||||
@ -1604,7 +1604,7 @@ Yap_absmi(int inp)
|
||||
Op(try_exo, lp);
|
||||
/* check if enough space between trail and codespace */
|
||||
check_trail(TR);
|
||||
/* I use YREG =to go through the choicepoint. Usually YREG =is in a
|
||||
/* I use YREG to go through the choicepoint. Usually YREG is in a
|
||||
* register, but sometimes (X86) not. In this case, have a
|
||||
* new register to point at YREG =*/
|
||||
CACHE_Y(YREG);
|
||||
@ -2886,13 +2886,13 @@ Yap_absmi(int inp)
|
||||
SP = SP0;
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
if (Yap_do_low_level_trace) {
|
||||
int go_on = TRUE;
|
||||
int go_on = true;
|
||||
yamop *ipc = PREG;
|
||||
|
||||
while (go_on) {
|
||||
op_numbers opnum = Yap_op_from_opcode(ipc->opc);
|
||||
|
||||
go_on = FALSE;
|
||||
go_on = false;
|
||||
switch (opnum) {
|
||||
#ifdef TABLING
|
||||
case _table_load_answer:
|
||||
@ -2958,11 +2958,11 @@ Yap_absmi(int inp)
|
||||
case _retry3:
|
||||
case _retry4:
|
||||
ipc = NEXTOP(ipc,l);
|
||||
go_on = TRUE;
|
||||
go_on = true;
|
||||
break;
|
||||
case _jump:
|
||||
ipc = ipc->y_u.l.l;
|
||||
go_on = TRUE;
|
||||
go_on = true;
|
||||
break;
|
||||
case _retry_c:
|
||||
case _retry_userc:
|
||||
@ -2971,7 +2971,7 @@ Yap_absmi(int inp)
|
||||
case _retry_profiled:
|
||||
case _count_retry:
|
||||
ipc = NEXTOP(ipc,p);
|
||||
go_on = TRUE;
|
||||
go_on = true;
|
||||
break;
|
||||
case _retry_me:
|
||||
case _trust_me:
|
||||
@ -11785,7 +11785,7 @@ Yap_absmi(int inp)
|
||||
|
||||
Op(p_equal, e);
|
||||
save_hb();
|
||||
if (Yap_IUnify(ARG1, ARG2) == FALSE) {
|
||||
if (Yap_IUnify(ARG1, ARG2) == false) {
|
||||
FAIL();
|
||||
}
|
||||
PREG = NEXTOP(PREG, e);
|
||||
@ -11941,7 +11941,7 @@ Yap_absmi(int inp)
|
||||
BEGD(d2);
|
||||
always_save_pc();
|
||||
d2 = iequ_complex(RepPair(d0)-1, RepPair(d0)+1,RepPair(d1)-1);
|
||||
if (d2 == FALSE) {
|
||||
if (d2 == false) {
|
||||
PREG = PREG->y_u.l.l;
|
||||
GONext();
|
||||
}
|
||||
@ -12030,7 +12030,7 @@ Yap_absmi(int inp)
|
||||
always_save_pc();
|
||||
BEGD(d2);
|
||||
d2 = iequ_complex(RepAppl(d0), RepAppl(d0)+ArityOfFunctor(f0), RepAppl(d1));
|
||||
if (d2 == FALSE) {
|
||||
if (d2 == false) {
|
||||
PREG = PREG->y_u.l.l;
|
||||
GONext();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ LookupAtom(const char *atom)
|
||||
HashChain[hash].Entry = na;
|
||||
INIT_RWLOCK(ae->ARWLock);
|
||||
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
||||
CACHE_REGS
|
||||
|
||||
if (NOfAtoms > 2*AtomHashTableSize) {
|
||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||
}
|
||||
@ -271,7 +271,7 @@ LookupWideAtom(const wchar_t *atom)
|
||||
WideHashChain[hash].Entry = na;
|
||||
INIT_RWLOCK(ae->ARWLock);
|
||||
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
|
||||
CACHE_REGS
|
||||
|
||||
if (NOfWideAtoms > 2*WideAtomHashTableSize) {
|
||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||
}
|
||||
|
16
C/alloc.c
16
C/alloc.c
@ -450,10 +450,10 @@ Yap_ExtendWorkSpace(Int s)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UInt
|
||||
Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
size_t
|
||||
Yap_ExtendWorkSpaceThroughHole(size_t s)
|
||||
{
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1600,8 +1600,8 @@ Yap_ExtendWorkSpace(Int s)
|
||||
#endif
|
||||
}
|
||||
|
||||
UInt
|
||||
Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
size_t
|
||||
Yap_ExtendWorkSpaceThroughHole(size_t s)
|
||||
{
|
||||
#if USE_SYSTEM_MMAP || defined(_WIN32) || defined(__CYGWIN__)
|
||||
MALLOC_T WorkSpaceTop0 = WorkSpaceTop;
|
||||
@ -1618,7 +1618,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
/* 487 happens when you step over someone else's memory */
|
||||
if (GetLastError() != 487) {
|
||||
WorkSpaceTop = WorkSpaceTop0;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#elif SIZEOF_INT_P==8
|
||||
@ -1636,7 +1636,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
/* 487 happens when you step over someone else's memory */
|
||||
if (GetLastError() != 487) {
|
||||
WorkSpaceTop = WorkSpaceTop0;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1644,7 +1644,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
}
|
||||
WorkSpaceTop = WorkSpaceTop0;
|
||||
#endif
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -852,10 +852,10 @@ p_show_sequences(void)
|
||||
void
|
||||
Yap_InitAnalystPreds(void)
|
||||
{
|
||||
Yap_InitCPred("wam_profile_reset_op_counters", 0, p_reset_op_counters, SafePredFlag |SyncPredFlag);
|
||||
Yap_InitCPred("wam_profile_show_op_counters", 1, p_show_op_counters, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("wam_profile_show_ops_by_group", 1, p_show_ops_by_group, SafePredFlag |SyncPredFlag);
|
||||
Yap_InitCPred("wam_profile_show_sequences", 1, p_show_sequences, SafePredFlag |SyncPredFlag);
|
||||
Yap_InitCPred("wam_profiler_reset_op_counters", 0, p_reset_op_counters, SafePredFlag |SyncPredFlag);
|
||||
Yap_InitCPred("wam_profiler_show_op_counters", 1, p_show_op_counters, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("wam_profiler_show_ops_by_group", 1, p_show_ops_by_group, SafePredFlag |SyncPredFlag);
|
||||
Yap_InitCPred("wam_profiler_show_sequences", 1, p_show_sequences, SafePredFlag |SyncPredFlag);
|
||||
}
|
||||
|
||||
#endif /* ANALYST */
|
||||
|
@ -1270,7 +1270,7 @@ typedef Int (*CPredicate9)(Int,Int,Int,Int,Int,Int,Int,Int,Int);
|
||||
typedef Int (*CPredicate10)(Int,Int,Int,Int,Int,Int,Int,Int,Int,Int);
|
||||
typedef Int (*CPredicateV)(Int,Int,struct foreign_context *);
|
||||
|
||||
static
|
||||
static Int
|
||||
execute_cargs(PredEntry *pe, CPredicate exec_code USES_REGS)
|
||||
{
|
||||
switch (pe->ArityOfPE) {
|
||||
@ -3900,7 +3900,6 @@ YAP_SlotsToArgs(int n, yhandle_t slot)
|
||||
X_API void
|
||||
YAP_signal(int sig)
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_signal(sig);
|
||||
}
|
||||
|
||||
|
17
C/globals.c
17
C/globals.c
@ -47,7 +47,9 @@ static char SccsId[] = "%W% %G%";
|
||||
#define HEAP_ARENA 2
|
||||
#define HEAP_START 3
|
||||
|
||||
#define MIN_ARENA_SIZE 1048
|
||||
#define MIN_ARENA_SIZE (1048L)
|
||||
|
||||
|
||||
#define MAX_ARENA_SIZE (2048*16)
|
||||
|
||||
#define Global_MkIntegerTerm(I) MkIntegerTerm(I)
|
||||
@ -170,7 +172,7 @@ adjust_cps(UInt size USES_REGS)
|
||||
|
||||
|
||||
static int
|
||||
GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
|
||||
GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, UInt arity USES_REGS)
|
||||
{
|
||||
LOCAL_ArenaOverflows++;
|
||||
if (size == 0) {
|
||||
@ -396,8 +398,8 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
||||
#endif
|
||||
break;
|
||||
case (CELL)FunctorString:
|
||||
if (ASP - HR > MIN_ARENA_SIZE+3+ap2[1]) {
|
||||
goto overflow;
|
||||
if (ASP - HR < MIN_ARENA_SIZE+3+ap2[1]) {
|
||||
goto overflow;
|
||||
}
|
||||
*ptf++ = AbsAppl(HR);
|
||||
memcpy(HR, ap2, sizeof(CELL)*(3+ap2[1]));
|
||||
@ -584,9 +586,9 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
||||
}
|
||||
|
||||
static Term
|
||||
CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Term *newarena, UInt min_grow USES_REGS)
|
||||
CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars, UInt arity, Term *newarena, size_t min_grow USES_REGS)
|
||||
{
|
||||
UInt old_size = ArenaSz(arena);
|
||||
size_t old_size = ArenaSz(arena);
|
||||
CELL *oldH = HR;
|
||||
CELL *oldHB = HB;
|
||||
CELL *oldASP = ASP;
|
||||
@ -689,7 +691,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
||||
#endif
|
||||
break;
|
||||
case (CELL)FunctorString:
|
||||
if (HR > ASP - MIN_ARENA_SIZE+3+ap[1]) {
|
||||
if (HR > ASP - (MIN_ARENA_SIZE+3+ap[1])) {
|
||||
res = -1;
|
||||
goto error_handler;
|
||||
}
|
||||
@ -756,6 +758,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
||||
newarena = (CELL *)XREGS[arity+3];
|
||||
arena = Deref(XREGS[arity+2]);
|
||||
t = XREGS[arity+1];
|
||||
Yap_DebugPlWrite(t);
|
||||
old_size = ArenaSz(arena);
|
||||
goto restart;
|
||||
}
|
||||
|
81
C/grow.c
81
C/grow.c
@ -54,16 +54,16 @@ static Int p_inform_stack_overflows( USES_REGS1 );
|
||||
static int growstack(size_t CACHE_TYPE);
|
||||
static void MoveGlobal( CACHE_TYPE1 );
|
||||
static void MoveLocalAndTrail( CACHE_TYPE1 );
|
||||
static void SetHeapRegs(int CACHE_TYPE);
|
||||
static void AdjustTrail(int, int CACHE_TYPE);
|
||||
static void AdjustLocal(int CACHE_TYPE);
|
||||
static void AdjustGlobal(long, int CACHE_TYPE);
|
||||
static void SetHeapRegs(bool CACHE_TYPE);
|
||||
static void AdjustTrail(bool, bool CACHE_TYPE);
|
||||
static void AdjustLocal(bool CACHE_TYPE);
|
||||
static void AdjustGlobal(Int, bool CACHE_TYPE);
|
||||
static void AdjustGrowStack( CACHE_TYPE1 );
|
||||
static int static_growheap(long,int,struct intermediates *,tr_fr_ptr *, TokEntry **, VarEntry ** CACHE_TYPE);
|
||||
static int static_growheap(size_t,bool,struct intermediates *,tr_fr_ptr *, TokEntry **, VarEntry ** CACHE_TYPE);
|
||||
static void cpcellsd(CELL *, CELL *, CELL);
|
||||
static CELL AdjustAppl(CELL CACHE_TYPE);
|
||||
static CELL AdjustPair(CELL CACHE_TYPE);
|
||||
static void AdjustStacksAndTrail(long, int CACHE_TYPE);
|
||||
static void AdjustStacksAndTrail(Int, bool CACHE_TYPE);
|
||||
static void AdjustRegs(int CACHE_TYPE);
|
||||
static Term AdjustGlobTerm(Term CACHE_TYPE);
|
||||
|
||||
@ -89,7 +89,7 @@ cpcellsd(register CELL *Dest, register CELL *Org, CELL NOf)
|
||||
|
||||
|
||||
static void
|
||||
SetHeapRegs(int copying_threads USES_REGS)
|
||||
SetHeapRegs(bool copying_threads USES_REGS)
|
||||
{
|
||||
#ifdef undf7
|
||||
Sfprintf(GLOBAL_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, LOCAL_GlobalBase, H, LCL0, ASP);
|
||||
@ -377,7 +377,7 @@ AdjustPair(register CELL t0 USES_REGS)
|
||||
}
|
||||
|
||||
static void
|
||||
AdjustTrail(int adjusting_heap, int thread_copying USES_REGS)
|
||||
AdjustTrail(bool adjusting_heap, bool thread_copying USES_REGS)
|
||||
{
|
||||
volatile tr_fr_ptr ptt, tr_base = (tr_fr_ptr)LOCAL_TrailBase;
|
||||
|
||||
@ -435,7 +435,7 @@ AdjustTrail(int adjusting_heap, int thread_copying USES_REGS)
|
||||
}
|
||||
|
||||
static void
|
||||
AdjustLocal(int thread_copying USES_REGS)
|
||||
AdjustLocal(bool thread_copying USES_REGS)
|
||||
{
|
||||
register CELL reg, *pt, *pt_bot;
|
||||
|
||||
@ -490,10 +490,10 @@ AdjustGlobTerm(Term reg USES_REGS)
|
||||
return AtomTermAdjust(reg);
|
||||
}
|
||||
|
||||
static volatile CELL *cpt=NULL;
|
||||
static volatile CELL *cpt=NULL, *ocpt = NULL;
|
||||
|
||||
static void
|
||||
AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
AdjustGlobal(Int sz, bool thread_copying USES_REGS)
|
||||
{
|
||||
CELL *pt, *pt_max;
|
||||
ArrayEntry *al = LOCAL_DynamicArrays;
|
||||
@ -541,10 +541,12 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
}
|
||||
#endif
|
||||
pt = H0;
|
||||
ocpt = NULL;
|
||||
while (pt < pt_max) {
|
||||
CELL reg;
|
||||
|
||||
cpt = pt;
|
||||
if (cpt > ocpt)
|
||||
ocpt = cpt;
|
||||
reg = *pt;
|
||||
if (IsVarTerm(reg)) {
|
||||
if (IsOldGlobal(reg))
|
||||
@ -571,6 +573,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
Int sz = 2+
|
||||
(sizeof(MP_INT)+
|
||||
(((MP_INT *)(pt+2))->_mp_alloc*sizeof(mp_limb_t)))/CellSize;
|
||||
//printf("sz *%ld* at @%ld@\n", sz, pt-H0);
|
||||
Opaque_CallOnGCMark f;
|
||||
Opaque_CallOnGCRelocate f2;
|
||||
Term t = AbsAppl(pt);
|
||||
@ -602,8 +605,10 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
}
|
||||
if ( (f2 = Yap_blob_gc_relocate_handler(t)) < 0 ) {
|
||||
int out = (f2)(Yap_BlobTag(t), Yap_BlobInfo(t), ar, n);
|
||||
if (out < 0)
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"bad restore of slot internal variables");
|
||||
if (out < 0) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"bad restore of slot internal variables");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
pt += sz;
|
||||
@ -630,6 +635,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
*pt = AtomTermAdjust(reg);
|
||||
pt++;
|
||||
}
|
||||
printf("exit with cpt=%p, (%p-%p) %ld\n", cpt, HR, H0, cpt-H0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -638,9 +644,9 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
* (just once) the trail cells pointing both to the global and to the local
|
||||
*/
|
||||
static void
|
||||
AdjustStacksAndTrail(long sz, int copying_threads USES_REGS)
|
||||
AdjustStacksAndTrail(Int sz, bool copying_threads USES_REGS)
|
||||
{
|
||||
AdjustTrail(TRUE, copying_threads PASS_REGS);
|
||||
AdjustTrail(true, copying_threads PASS_REGS);
|
||||
AdjustLocal(copying_threads PASS_REGS);
|
||||
AdjustGlobal(sz, copying_threads PASS_REGS);
|
||||
}
|
||||
@ -782,11 +788,12 @@ Yap_AdjustRegs(int n)
|
||||
|
||||
/* Used by do_goal() when we're short of heap space */
|
||||
static int
|
||||
static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
static_growheap(size_t esize, bool fix_code, struct intermediates *cip, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
{
|
||||
Int size = esize;
|
||||
UInt start_growth_time, growth_time;
|
||||
int gc_verbose;
|
||||
UInt minimal_request = 0L;
|
||||
size_t minimal_request = 0L;
|
||||
|
||||
/* adjust to a multiple of 256) */
|
||||
if (size < YAP_ALLOC_SIZE)
|
||||
@ -863,17 +870,17 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
|
||||
/* Used when we're short of heap, usually because of an overflow in
|
||||
the attributed stack, but also because we allocated a zone */
|
||||
static int
|
||||
static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
{
|
||||
UInt start_growth_time, growth_time;
|
||||
int gc_verbose;
|
||||
char *omax = (char *)H0;
|
||||
ADDR old_GlobalBase = LOCAL_GlobalBase;
|
||||
UInt minimal_request = 0L;
|
||||
long size = request;
|
||||
Int size = request;
|
||||
char vb_msg1 = '\0', *vb_msg2;
|
||||
int do_grow = TRUE;
|
||||
int insert_in_delays = FALSE;
|
||||
bool do_grow = true;
|
||||
bool insert_in_delays = false;
|
||||
/*
|
||||
request is the amount of memory we requested, in bytes;
|
||||
base_move is the shift in global stacks we had to do
|
||||
@ -1413,11 +1420,11 @@ growatomtable( USES_REGS1 )
|
||||
|
||||
|
||||
int
|
||||
Yap_locked_growheap(int fix_code, size_t in_size, void *cip)
|
||||
Yap_locked_growheap(bool fix_code, size_t in_size, void *cip)
|
||||
{
|
||||
CACHE_REGS
|
||||
int res;
|
||||
int blob_overflow = (NOfBlobs > NOfBlobsMax);
|
||||
bool blob_overflow = (NOfBlobs > NOfBlobsMax);
|
||||
|
||||
#ifdef THREADS
|
||||
LOCK(GLOBAL_ThreadHandlesLock);
|
||||
@ -1472,9 +1479,8 @@ Yap_locked_growheap(int fix_code, size_t in_size, void *cip)
|
||||
}
|
||||
|
||||
int
|
||||
Yap_growheap(int fix_code, size_t in_size, void *cip)
|
||||
Yap_growheap(bool fix_code, size_t in_size, void *cip)
|
||||
{
|
||||
CACHE_REGS
|
||||
int rc;
|
||||
rc = Yap_locked_growheap(fix_code, in_size, cip);
|
||||
return rc;
|
||||
@ -1519,14 +1525,13 @@ Yap_locked_growglobal(CELL **ptr)
|
||||
int
|
||||
Yap_growglobal(CELL **ptr)
|
||||
{
|
||||
CACHE_REGS
|
||||
int rc;
|
||||
int rc;
|
||||
rc = Yap_locked_growglobal(ptr);
|
||||
return rc;
|
||||
}
|
||||
|
||||
UInt
|
||||
Yap_InsertInGlobal(CELL *where, UInt howmuch)
|
||||
Yap_InsertInGlobal(CELL *where, size_t howmuch)
|
||||
{
|
||||
CACHE_REGS
|
||||
if ((howmuch = static_growglobal(howmuch, NULL, where PASS_REGS)) == 0)
|
||||
@ -1563,10 +1568,11 @@ Yap_growstack(size_t size)
|
||||
}
|
||||
|
||||
static int
|
||||
execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
execute_growstack(size_t esize0, bool from_trail, bool in_parser, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
{
|
||||
UInt minimal_request = 0L;
|
||||
long size = size0;
|
||||
Int size0 = esize0;
|
||||
Int size = size0;
|
||||
ADDR old_LOCAL_GlobalBase = LOCAL_GlobalBase;
|
||||
|
||||
if (!GLOBAL_AllowGlobalExpansion) {
|
||||
@ -1709,7 +1715,7 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
||||
CACHE_REGS
|
||||
UInt size;
|
||||
UInt start_growth_time, growth_time;
|
||||
int gc_verbose;
|
||||
bool gc_verbose;
|
||||
|
||||
LOCAL_PrologMode |= GrowStackMode;
|
||||
/* adjust to a multiple of 256) */
|
||||
@ -1743,11 +1749,12 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
static int do_growtrail(size_t esize, bool contiguous_only, bool in_parser, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS)
|
||||
{
|
||||
UInt start_growth_time = Yap_cputime(), growth_time;
|
||||
int gc_verbose = Yap_is_gc_verbose();
|
||||
long size0 = size;
|
||||
Int size0 = esize;
|
||||
Int size = esize;
|
||||
|
||||
#if USE_SYSTEM_MALLOC
|
||||
if (contiguous_only)
|
||||
@ -1820,7 +1827,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
||||
|
||||
/* Used by do_goal() when we're short of stack space */
|
||||
int
|
||||
Yap_growtrail(long size, int contiguous_only)
|
||||
Yap_growtrail(size_t size, bool contiguous_only)
|
||||
{
|
||||
int rc;
|
||||
CACHE_REGS
|
||||
@ -1830,7 +1837,7 @@ Yap_growtrail(long size, int contiguous_only)
|
||||
|
||||
/* Used by do_goal() when we're short of stack space */
|
||||
int
|
||||
Yap_locked_growtrail(long size, int contiguous_only)
|
||||
Yap_locked_growtrail(size_t size, bool contiguous_only)
|
||||
{
|
||||
CACHE_REGS
|
||||
return do_growtrail(size, contiguous_only, FALSE, NULL, NULL, NULL PASS_REGS);
|
||||
@ -1926,7 +1933,7 @@ p_inform_heap_overflows( USES_REGS1 )
|
||||
|
||||
#if defined(YAPOR_THREADS)
|
||||
void
|
||||
Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
||||
Yap_CopyThreadStacks(int worker_q, int worker_p, bool incremental)
|
||||
{
|
||||
CACHE_REGS
|
||||
Int size;
|
||||
|
@ -4263,7 +4263,6 @@ LeaveGCMode( USES_REGS1 )
|
||||
int
|
||||
Yap_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
{
|
||||
CACHE_REGS
|
||||
int rc;
|
||||
rc = Yap_locked_gc(predarity, current_env, nextop);
|
||||
return rc;
|
||||
|
6
C/save.c
6
C/save.c
@ -1299,7 +1299,7 @@ static void
|
||||
RestoreHashPreds( USES_REGS1 )
|
||||
{
|
||||
UInt size = PredHashTableSize;
|
||||
int malloced = FALSE;
|
||||
bool malloced = FALSE;
|
||||
PredEntry **np;
|
||||
UInt i;
|
||||
PredEntry **oldp = PredHash;
|
||||
@ -1620,7 +1620,7 @@ static int
|
||||
check_opcodes(OPCODE old_ops[])
|
||||
{
|
||||
#if USE_THREADED_CODE
|
||||
int have_shifted = FALSE;
|
||||
bool have_shifted = FALSE;
|
||||
op_numbers op = _Ystop;
|
||||
for (op = _Ystop; op < _std_top; op++) {
|
||||
if (Yap_opcode(op) != old_ops[op]) {
|
||||
@ -1639,7 +1639,7 @@ check_opcodes(OPCODE old_ops[])
|
||||
static void
|
||||
RestoreHeap(OPCODE old_ops[] USES_REGS)
|
||||
{
|
||||
int heap_moved = (LOCAL_OldHeapBase != Yap_HeapBase ||
|
||||
bool heap_moved = (LOCAL_OldHeapBase != Yap_HeapBase ||
|
||||
LOCAL_XDiff), opcodes_moved;
|
||||
Term mod = CurrentModule;
|
||||
|
||||
|
116
configure
vendored
116
configure
vendored
@ -7892,6 +7892,99 @@ fi
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
|
||||
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
|
||||
if ${ac_cv_header_stdbool_h+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifndef bool
|
||||
"error: bool is not defined"
|
||||
#endif
|
||||
#ifndef false
|
||||
"error: false is not defined"
|
||||
#endif
|
||||
#if false
|
||||
"error: false is not 0"
|
||||
#endif
|
||||
#ifndef true
|
||||
"error: true is not defined"
|
||||
#endif
|
||||
#if true != 1
|
||||
"error: true is not 1"
|
||||
#endif
|
||||
#ifndef __bool_true_false_are_defined
|
||||
"error: __bool_true_false_are_defined is not defined"
|
||||
#endif
|
||||
|
||||
struct s { _Bool s: 1; _Bool t; } s;
|
||||
|
||||
char a[true == 1 ? 1 : -1];
|
||||
char b[false == 0 ? 1 : -1];
|
||||
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
||||
char d[(bool) 0.5 == true ? 1 : -1];
|
||||
/* See body of main program for 'e'. */
|
||||
char f[(_Bool) 0.0 == false ? 1 : -1];
|
||||
char g[true];
|
||||
char h[sizeof (_Bool)];
|
||||
char i[sizeof s.t];
|
||||
enum { j = false, k = true, l = false * true, m = true * 256 };
|
||||
/* The following fails for
|
||||
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
|
||||
_Bool n[m];
|
||||
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
||||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
||||
/* Catch a bug in an HP-UX C compiler. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
*/
|
||||
_Bool q = true;
|
||||
_Bool *pq = &q;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
bool e = &s;
|
||||
*pq |= q;
|
||||
*pq |= ! q;
|
||||
/* Refer to every declared value, to avoid compiler optimizations. */
|
||||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
||||
+ !m + !n + !o + !p + !q + !pq);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_header_stdbool_h=yes
|
||||
else
|
||||
ac_cv_header_stdbool_h=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
|
||||
$as_echo "$ac_cv_header_stdbool_h" >&6; }
|
||||
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
|
||||
if test "x$ac_cv_type__Bool" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BOOL 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
|
||||
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
|
||||
$as_echo_n "checking for ANSI C header files... " >&6; }
|
||||
if ${ac_cv_header_stdc+:} false; then :
|
||||
@ -8123,7 +8216,20 @@ fi
|
||||
|
||||
done
|
||||
|
||||
for ac_header in siginfo.h signal.h stdarg.h stdint.h string.h stropts.h
|
||||
for ac_header in siginfo.h signal.h stdarg.h stdbool.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
for ac_header in stdint.h string.h stropts.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
@ -13636,7 +13742,7 @@ else
|
||||
JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* #line 13639 "configure" */
|
||||
/* #line 13745 "configure" */
|
||||
public class Test {
|
||||
}
|
||||
EOF
|
||||
@ -13812,7 +13918,7 @@ EOF
|
||||
if uudecode$EXEEXT Test.uue; then
|
||||
ac_cv_prog_uudecode_base64=yes
|
||||
else
|
||||
echo "configure: 13815: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||
echo "configure: 13921: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||
echo "configure: failed file was:" >&5
|
||||
cat Test.uue >&5
|
||||
ac_cv_prog_uudecode_base64=no
|
||||
@ -13943,7 +14049,7 @@ else
|
||||
JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* #line 13946 "configure" */
|
||||
/* #line 14052 "configure" */
|
||||
public class Test {
|
||||
}
|
||||
EOF
|
||||
@ -13978,7 +14084,7 @@ JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
TEST=Test
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* [#]line 13981 "configure" */
|
||||
/* [#]line 14087 "configure" */
|
||||
public class Test {
|
||||
public static void main (String args[]) {
|
||||
System.exit (0);
|
||||
|
@ -1241,6 +1241,8 @@ AC_SUBST(INSTALL_ENV)
|
||||
AC_SUBST(PRE_INSTALL_ENV)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDBOOL
|
||||
dnl check stdlib, stdarg, string, float
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(arpa/inet.h alloca.h crtdbg.h crypt.h)
|
||||
@ -1249,7 +1251,8 @@ AC_CHECK_HEADERS(errno.h execinfo.h fcntl.h fenv.h)
|
||||
AC_CHECK_HEADERS(float.h fpu_control.h ieeefp.h inttypes.h io.h limits.h)
|
||||
AC_CHECK_HEADERS(malloc.h math.h memory.h)
|
||||
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/tcp.h pwd.h regex.h shlobj.h)
|
||||
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h stdint.h string.h stropts.h)
|
||||
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h stdbool.h)
|
||||
AC_CHECK_HEADERS(stdint.h string.h stropts.h)
|
||||
AC_CHECK_HEADERS(sys/conf.h sys/dir.h sys/file.h)
|
||||
AC_CHECK_HEADERS(sys/mman.h sys/ndir.h sys/param.h)
|
||||
AC_CHECK_HEADERS(sys/resource.h sys/select.h)
|
||||
|
Reference in New Issue
Block a user