don't ever use memory that has been freed (that was done by LU).

generic fixes for WIN32 libraries


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1172 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-11-04 18:22:36 +00:00
parent 20dcf89f9a
commit 6853d8eecd
15 changed files with 99 additions and 49 deletions

View File

@ -10,8 +10,11 @@
* * * *
* File: absmi.c * * File: absmi.c *
* comments: Portable abstract machine interpreter * * comments: Portable abstract machine interpreter *
* Last rev: $Date: 2004-10-26 20:15:36 $,$Author: vsc $ * * Last rev: $Date: 2004-11-04 18:22:28 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.150 2004/10/26 20:15:36 vsc
* More bug fixes for overflow handling
*
* Revision 1.149 2004/10/14 22:14:52 vsc * Revision 1.149 2004/10/14 22:14:52 vsc
* don't use a cached version of ARG1 in choice-points * don't use a cached version of ARG1 in choice-points
* *
@ -1344,7 +1347,7 @@ Yap_absmi(int inp)
} }
UNLOCK(lcl->ClLock); UNLOCK(lcl->ClLock);
} }
Yap_ErLogUpdIndex(cl); PREG = Yap_ErLogUpdIndex(cl, PREG);
} else { } else {
UNLOCK(cl->ClLock); UNLOCK(cl->ClLock);
} }
@ -1364,7 +1367,7 @@ Yap_absmi(int inp)
TRAIL_CLREF(lcl); TRAIL_CLREF(lcl);
} }
} }
Yap_ErLogUpdIndex(cl); PREG = Yap_ErLogUpdIndex(cl, PREG);
} }
} }
#endif #endif
@ -1875,7 +1878,7 @@ Yap_absmi(int inp)
/* at this point, /* at this point,
we are the only ones accessing the clause, we are the only ones accessing the clause,
hence we don't need to have a lock it */ hence we don't need to have a lock it */
Yap_ErLogUpdIndex(cl); Yap_ErLogUpdIndex(cl, NULL);
setregs(); setregs();
} }
} else { } else {
@ -1925,7 +1928,7 @@ Yap_absmi(int inp)
saveregs(); saveregs();
if (flags & LogUpdMask) { if (flags & LogUpdMask) {
if (flags & IndexMask) { if (flags & IndexMask) {
Yap_ErLogUpdIndex(ClauseFlagsToLogUpdIndex(pt1)); Yap_ErLogUpdIndex(ClauseFlagsToLogUpdIndex(pt1), NULL);
} else { } else {
Yap_ErLogUpdCl(ClauseFlagsToLogUpdClause(pt1)); Yap_ErLogUpdCl(ClauseFlagsToLogUpdClause(pt1));
} }
@ -2014,7 +2017,7 @@ Yap_absmi(int inp)
we are the only ones accessing the clause, we are the only ones accessing the clause,
hence we don't need to have a lock it */ hence we don't need to have a lock it */
saveregs(); saveregs();
Yap_ErLogUpdIndex(cl); Yap_ErLogUpdIndex(cl, NULL);
setregs(); setregs();
} }
} else { } else {

View File

@ -12,7 +12,7 @@
* Last rev: * * Last rev: *
* mods: * * mods: *
* comments: allocating space * * comments: allocating space *
* version:$Id: alloc.c,v 1.63 2004-10-28 20:12:20 vsc Exp $ * * version:$Id: alloc.c,v 1.64 2004-11-04 18:22:30 vsc Exp $ *
*************************************************************************/ *************************************************************************/
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "%W% %G%"; static char SccsId[] = "%W% %G%";
@ -57,14 +57,14 @@ static char SccsId[] = "%W% %G%";
/************************************************************************/ /************************************************************************/
/* Yap workspace management */ /* Yap workspace management */
#if USE_SYSTEM_MALLOC||USE_DL_MALLOC
#if USE_DL_MALLOC #if USE_DL_MALLOC
#define malloc Yap_dlmalloc #define malloc Yap_dlmalloc
#define free Yap_dlfree #define free Yap_dlfree
#define realloc Yap_dlrealloc #define realloc Yap_dlrealloc
#endif #endif
#if USE_SYSTEM_MALLOC||USE_DL_MALLOC
char * char *
Yap_AllocCodeSpace(unsigned int size) Yap_AllocCodeSpace(unsigned int size)
{ {

View File

@ -11,8 +11,11 @@
* File: cdmgr.c * * File: cdmgr.c *
* comments: Code manager * * comments: Code manager *
* * * *
* Last rev: $Date: 2004-10-31 02:18:03 $,$Author: vsc $ * * Last rev: $Date: 2004-11-04 18:22:31 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.140 2004/10/31 02:18:03 vsc
* fix bug in handling Yap heap overflow while adding new clause.
*
* Revision 1.139 2004/10/28 20:12:21 vsc * Revision 1.139 2004/10/28 20:12:21 vsc
* Use Doug Lea's malloc as an alternative to YAP's standard malloc * Use Doug Lea's malloc as an alternative to YAP's standard malloc
* don't use TR directly in scanner/parser, this avoids trouble with ^C while * don't use TR directly in scanner/parser, this avoids trouble with ^C while
@ -938,10 +941,34 @@ Yap_kill_iblock(ClauseUnion *blk, ClauseUnion *parent_blk, PredEntry *ap)
This predicate is supposed to be called with a This predicate is supposed to be called with a
lock on the current predicate lock on the current predicate
*/ */
void yamop *
Yap_ErLogUpdIndex(LogUpdIndex *clau) Yap_ErLogUpdIndex(LogUpdIndex *clau, yamop *ipc)
{ {
LogUpdIndex *c = clau; LogUpdIndex *c = clau;
yamop *codep;
if (ipc) {
op_numbers op = Yap_op_from_opcode(ipc->opc);
codep = TrustLUCode;
if (op == _trust) {
codep->opc = ipc->opc;
codep->u.ld.s = ipc->u.ld.s;
codep->u.ld.p = ipc->u.ld.p;
codep->u.ld.d = ipc->u.ld.d;
#ifdef YAPOR
codep->u.ld.or_arg = ipc->u.ld.or_arg;
#endif /* YAPOR */
#ifdef TABLING
codep->u.ld.te = ipc->u.ld.te;
#endif /* TABLING */
} else {
Yap_Error(SYSTEM_ERROR,TermNil,"Expected To Find trust, found %d", op);
codep = ipc;
}
} else {
codep = NULL;
}
if (clau->ClFlags & ErasedMask) { if (clau->ClFlags & ErasedMask) {
if (!c->ClRefCount) { if (!c->ClRefCount) {
if (c->ClFlags & SwitchRootMask) { if (c->ClFlags & SwitchRootMask) {
@ -953,7 +980,7 @@ Yap_ErLogUpdIndex(LogUpdIndex *clau)
} }
} }
/* otherwise, nothing I can do, I have been erased already */ /* otherwise, nothing I can do, I have been erased already */
return; return codep;
} }
if (c->ClFlags & SwitchRootMask) { if (c->ClFlags & SwitchRootMask) {
kill_first_log_iblock(clau, NULL, c->u.pred); kill_first_log_iblock(clau, NULL, c->u.pred);
@ -974,6 +1001,7 @@ Yap_ErLogUpdIndex(LogUpdIndex *clau)
UNLOCK(clau->u.ParentIndex->ClLock); UNLOCK(clau->u.ParentIndex->ClLock);
#endif #endif
} }
return codep;
} }
/* Routine used when wanting to remove the indexation */ /* Routine used when wanting to remove the indexation */

View File

@ -6,6 +6,8 @@
#include "alloc.h" #include "alloc.h"
#include "dlmalloc.h" #include "dlmalloc.h"
#if USE_DL_MALLOC
/* /*
This is a version (aka dlmalloc) of malloc/free/realloc written by This is a version (aka dlmalloc) of malloc/free/realloc written by
Doug Lea and released to the public domain. Use, modify, and Doug Lea and released to the public domain. Use, modify, and
@ -777,7 +779,7 @@ static Void_t** iALLOc();
in malloc. In which case, please report it!) in malloc. In which case, please report it!)
*/ */
#if ! DEBUG #if ! DEBUG_DLMALLOC
#define check_chunk(P) #define check_chunk(P)
#define check_free_chunk(P) #define check_free_chunk(P)
@ -2487,7 +2489,7 @@ Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size;
assert(nclears >= 3); assert(nclears >= 3);
if (nclears > 9) if (nclears > 9)
bzero(d, clearsize); memset(d, 0, clearsize);
else { else {
*(d+0) = 0; *(d+0) = 0;
@ -2633,7 +2635,7 @@ static Void_t** iALLOc(n_elements, sizes, opts, chunks) size_t n_elements; size_
remainder_size = chunksize(p); remainder_size = chunksize(p);
if (opts & 0x2) { /* optionally clear the elements */ if (opts & 0x2) { /* optionally clear the elements */
bzero(mem, remainder_size - SIZE_SZ - array_size); memset(mem, 0, remainder_size - SIZE_SZ - array_size);
} }
/* If not provided, allocate the pointer array as final part of chunk */ /* If not provided, allocate the pointer array as final part of chunk */
@ -2662,7 +2664,7 @@ static Void_t** iALLOc(n_elements, sizes, opts, chunks) size_t n_elements; size_
} }
} }
#if DEBUG #if DEBUG_DLMALLOC
if (marray != chunks) { if (marray != chunks) {
/* final element must have exactly exhausted chunk */ /* final element must have exactly exhausted chunk */
if (element_size != 0) if (element_size != 0)
@ -3170,7 +3172,9 @@ Yap_initdlmalloc(void)
{ {
HeapTop = (ADDR)ALIGN_SIZE(HeapTop,16); HeapTop = (ADDR)ALIGN_SIZE(HeapTop,16);
Yap_av = (struct malloc_state *)HeapTop; Yap_av = (struct malloc_state *)HeapTop;
bzero((void *)Yap_av, sizeof(struct malloc_state)); memset((void *)Yap_av, 0, sizeof(struct malloc_state));
HeapTop += sizeof(struct malloc_state); HeapTop += sizeof(struct malloc_state);
HeapMax = HeapUsed = HeapTop-Yap_HeapBase; HeapMax = HeapUsed = HeapTop-Yap_HeapBase;
} }
#endif /* USE_DL_MALLOC */

View File

@ -357,23 +357,19 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
exit(1); exit(1);
} }
/* must do this here */ /* must do this here */
if (type == FATAL_ERROR if (type == FATAL_ERROR || Yap_HeapBase == NULL) {
#if !USE_SYSTEM_MALLOC if (format != NULL) {
|| Yap_HeapBase == NULL
#endif
) {
va_start (ap, format); va_start (ap, format);
/* now build the error string */ /* now build the error string */
if (format != NULL) {
#if HAVE_VSNPRINTF #if HAVE_VSNPRINTF
(void) vsnprintf(tmpbuf, YAP_BUF_SIZE, format, ap); (void) vsnprintf(tmpbuf, YAP_BUF_SIZE, format, ap);
#else #else
(void) vsprintf(tmpbuf, format, ap); (void) vsprintf(tmpbuf, format, ap);
#endif #endif
va_end (ap);
} else { } else {
tmpbuf[0] = '\0'; tmpbuf[0] = '\0';
} }
va_end (ap);
fprintf(stderr,"%% Fatal YAP Error: %s exiting....\n",tmpbuf); fprintf(stderr,"%% Fatal YAP Error: %s exiting....\n",tmpbuf);
error_exit_yap (1); error_exit_yap (1);
} }

View File

@ -35,9 +35,11 @@ static char SccsId[] = "%W% %G%";
/* in a single gc */ /* in a single gc */
static unsigned long int total_marked; /* number of heap objects marked */ static unsigned long int total_marked; /* number of heap objects marked */
#if DEBUG
#ifdef COROUTINING #ifdef COROUTINING
static unsigned long int total_smarked; static unsigned long int total_smarked;
#endif #endif
#endif
STATIC_PROTO(Int p_inform_gc, (void)); STATIC_PROTO(Int p_inform_gc, (void));
STATIC_PROTO(Int p_gc, (void)); STATIC_PROTO(Int p_gc, (void));
@ -458,7 +460,7 @@ pop_registers(Int num_regs, yamop *nextop)
} }
} }
#ifdef DEBUG #if DEBUG && COUNT_CELLS_MARKED
static int static int
count_cells_marked(void) count_cells_marked(void)
{ {
@ -2200,7 +2202,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
if (erase) { if (erase) {
/* at this point, /* at this point,
no one is accessing the clause */ no one is accessing the clause */
Yap_ErLogUpdIndex(indx); Yap_ErLogUpdIndex(indx, NULL);
} }
} else { } else {
LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt0); LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt0);
@ -3421,7 +3423,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
} }
if (!bp) if (!bp)
return 0; return 0;
bzero((void *)bp, alloc_sz); memset((void *)bp, 0, alloc_sz);
} }
#endif /* GC_NO_TAGS */ #endif /* GC_NO_TAGS */
#ifdef HYBRID_SCHEME #ifdef HYBRID_SCHEME
@ -3429,7 +3431,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
#endif #endif
/* get the number of active registers */ /* get the number of active registers */
YAPEnterCriticalSection(); YAPEnterCriticalSection();
Yap_old_TR = old_TR = TR; Yap_old_TR = (struct trail_frame *)(old_TR = TR);
push_registers(predarity, nextop); push_registers(predarity, nextop);
marking_phase(old_TR, current_env, nextop, max); marking_phase(old_TR, current_env, nextop, max);
m_time = Yap_cputime(); m_time = Yap_cputime();

View File

@ -11,8 +11,11 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2004-10-27 15:56:33 $,$Author: vsc $ * * Last rev: $Date: 2004-11-04 18:22:32 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.104 2004/10/27 15:56:33 vsc
* bug fixes on memory overflows and on clauses :- fail being ignored by clause.
*
* Revision 1.103 2004/10/22 16:53:19 vsc * Revision 1.103 2004/10/22 16:53:19 vsc
* bug fixes * bug fixes
* *
@ -7574,6 +7577,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
{ {
LogUpdIndex *cl = (LogUpdIndex *)ipc->u.l.l; LogUpdIndex *cl = (LogUpdIndex *)ipc->u.l.l;
/* check if we are the ones using this code */ /* check if we are the ones using this code */
ipc = NEXTOP(ipc,l);
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
LOCK(cl->ClLock); LOCK(cl->ClLock);
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
@ -7585,7 +7589,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
/* I am the last one using this clause, hence I don't need a lock /* I am the last one using this clause, hence I don't need a lock
to dispose of it to dispose of it
*/ */
Yap_ErLogUpdIndex(cl); ipc = Yap_ErLogUpdIndex(cl, ipc);
} else { } else {
UNLOCK(cl->ClLock); UNLOCK(cl->ClLock);
} }
@ -7597,7 +7601,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
TR = --(B->cp_tr); TR = --(B->cp_tr);
/* next, recover space for the indexing code if it was erased */ /* next, recover space for the indexing code if it was erased */
if (cl->ClFlags & ErasedMask) { if (cl->ClFlags & ErasedMask) {
yamop *next = NEXTOP(ipc,l)->u.ld.d; yamop *next = ipc->u.ld.d;
if (next != FAILCODE) { if (next != FAILCODE) {
LogUpdClause *lcl = ClauseCodeToLogUpdClause(next); LogUpdClause *lcl = ClauseCodeToLogUpdClause(next);
/* make sure we don't erase the clause we are jumping too */ /* make sure we don't erase the clause we are jumping too */
@ -7606,12 +7610,11 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
TRAIL_CLREF(lcl); TRAIL_CLREF(lcl);
} }
} }
Yap_ErLogUpdIndex(cl); ipc = Yap_ErLogUpdIndex(cl, ipc);
} }
} }
#endif #endif
} }
ipc = NEXTOP(ipc,l);
break; break;
case _stale_lu_index: case _stale_lu_index:
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)

View File

@ -2997,8 +2997,9 @@ do_read(int inp_stream)
if (Yap_ErrorMessage || (t = Yap_Parse()) == 0) { if (Yap_ErrorMessage || (t = Yap_Parse()) == 0) {
if (Yap_ErrorMessage && (strcmp(Yap_ErrorMessage,"Stack Overflow") == 0)) { if (Yap_ErrorMessage && (strcmp(Yap_ErrorMessage,"Stack Overflow") == 0)) {
/* ignore term we just built */ /* ignore term we just built */
H = old_H;
tr_fr_ptr old_TR = TR; tr_fr_ptr old_TR = TR;
H = old_H;
TR = (tr_fr_ptr)ScannerStack; TR = (tr_fr_ptr)ScannerStack;
if (Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable)) { if (Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable)) {
ScannerStack = (char *)TR; ScannerStack = (char *)TR;
@ -3758,7 +3759,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
int (* f_putc)(int, int); int (* f_putc)(int, int);
int has_tabs; int has_tabs;
jmp_buf format_botch; jmp_buf format_botch;
volatile void *old_handler = NULL; volatile void *old_handler;
volatile int old_pos; volatile int old_pos;
if (Stream[sno].status & InMemory_Stream_f) { if (Stream[sno].status & InMemory_Stream_f) {
@ -3778,6 +3779,8 @@ format(volatile Term otail, volatile Term oargs, int sno)
Stream[sno].u.mem_string.pos = old_pos; Stream[sno].u.mem_string.pos = old_pos;
H -= 2; H -= 2;
} }
} else {
old_handler = NULL;
} }
args = oargs; args = oargs;
tail = otail; tail = otail;

View File

@ -1388,7 +1388,7 @@ UnmarkTrEntries(void)
} else { } else {
if (flags & LogUpdMask) { if (flags & LogUpdMask) {
if (flags & IndexMask) { if (flags & IndexMask) {
Yap_ErLogUpdIndex(ClauseFlagsToLogUpdIndex(ent)); Yap_ErLogUpdIndex(ClauseFlagsToLogUpdIndex(ent), NULL);
} else { } else {
Yap_ErLogUpdCl(ClauseFlagsToLogUpdClause(ent)); Yap_ErLogUpdCl(ClauseFlagsToLogUpdClause(ent));
} }

View File

@ -10,7 +10,7 @@
* File: Heap.h * * File: Heap.h *
* mods: * * mods: *
* comments: Heap Init Structure * * comments: Heap Init Structure *
* version: $Id: Heap.h,v 1.70 2004-10-28 20:12:22 vsc Exp $ * * version: $Id: Heap.h,v 1.71 2004-11-04 18:22:34 vsc Exp $ *
*************************************************************************/ *************************************************************************/
/* information that can be stored in Code Space */ /* information that can be stored in Code Space */
@ -66,6 +66,7 @@ typedef struct worker_local_struct {
Int tot_gc_recovered; /* number of heap objects in all garbage collections */ Int tot_gc_recovered; /* number of heap objects in all garbage collections */
jmp_buf gc_restore; /* where to jump if garbage collection crashes */ jmp_buf gc_restore; /* where to jump if garbage collection crashes */
struct trail_frame *old_TR; struct trail_frame *old_TR;
yamop trust_lu_code[3];
} worker_local; } worker_local;
#ifdef THREADS #ifdef THREADS
@ -683,6 +684,7 @@ struct various_codes *heap_regs;
#define TotGcRecovered heap_regs->wl[worker_id].tot_gc_recovered #define TotGcRecovered heap_regs->wl[worker_id].tot_gc_recovered
#define Yap_gc_restore heap_regs->wl[worker_id].gc_restore #define Yap_gc_restore heap_regs->wl[worker_id].gc_restore
#define Yap_old_TR heap_regs->wl[worker_id].old_TR #define Yap_old_TR heap_regs->wl[worker_id].old_TR
#define TrustLUCode heap_regs->wl[worker_id].trust_lu_code
#else #else
#define ActiveSignals heap_regs->wl.active_signals #define ActiveSignals heap_regs->wl.active_signals
#define DelayedTrace heap_regs->wl.delayed_trace #define DelayedTrace heap_regs->wl.delayed_trace
@ -700,6 +702,7 @@ struct various_codes *heap_regs;
#define TotGcRecovered heap_regs->wl.tot_gc_recovered #define TotGcRecovered heap_regs->wl.tot_gc_recovered
#define Yap_gc_restore heap_regs->wl.gc_restore #define Yap_gc_restore heap_regs->wl.gc_restore
#define Yap_old_TR heap_regs->wl.old_TR #define Yap_old_TR heap_regs->wl.old_TR
#define TrustLUCode heap_regs->wl.trust_lu_code
#endif #endif
#define profiling heap_regs->compiler_profiling #define profiling heap_regs->compiler_profiling
#define call_counting heap_regs->compiler_call_counting #define call_counting heap_regs->compiler_call_counting
@ -760,8 +763,6 @@ struct various_codes *heap_regs;
#define ReadlinePos heap_regs->readline_pos #define ReadlinePos heap_regs->readline_pos
#endif #endif
#define USE_DL_MALLOC 1
ADDR STD_PROTO(Yap_ExpandPreAllocCodeSpace, (UInt)); ADDR STD_PROTO(Yap_ExpandPreAllocCodeSpace, (UInt));
#define Yap_ReleasePreAllocCodeSpace(x) #define Yap_ReleasePreAllocCodeSpace(x)
#if USE_SYSTEM_MALLOC||USE_DL_MALLOC #if USE_SYSTEM_MALLOC||USE_DL_MALLOC

View File

@ -195,7 +195,7 @@ ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *));
/* dbase.c */ /* dbase.c */
void STD_PROTO(Yap_ErCl,(DynamicClause *)); void STD_PROTO(Yap_ErCl,(DynamicClause *));
void STD_PROTO(Yap_ErLogUpdCl,(LogUpdClause *)); void STD_PROTO(Yap_ErLogUpdCl,(LogUpdClause *));
void STD_PROTO(Yap_ErLogUpdIndex,(LogUpdIndex *)); yamop *STD_PROTO(Yap_ErLogUpdIndex,(LogUpdIndex *, yamop *));
Int STD_PROTO(Yap_Recordz,(Atom, Term)); Int STD_PROTO(Yap_Recordz,(Atom, Term));
/* exec.c */ /* exec.c */

View File

@ -1,3 +1,6 @@
#if USE_DL_MALLOC
/* YAP only stuff */ /* YAP only stuff */
void STD_PROTO(Yap_initdlmalloc,(void)); void STD_PROTO(Yap_initdlmalloc,(void));
@ -1167,3 +1170,4 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
#endif /* USE_DL_MALLOC */

View File

@ -176,7 +176,9 @@ static void PROTO(freeset,(struct parse *p, cset *cs));
static int PROTO(freezeset,(struct parse *p, cset *cs)); static int PROTO(freezeset,(struct parse *p, cset *cs));
static int PROTO(firstch,(struct parse *p, cset *cs)); static int PROTO(firstch,(struct parse *p, cset *cs));
static int PROTO(nch,(struct parse *p, cset *cs)); static int PROTO(nch,(struct parse *p, cset *cs));
#if 0
static void PROTO(mcadd,(struct parse *p, cset *cs, char *cp)); static void PROTO(mcadd,(struct parse *p, cset *cs, char *cp));
#endif
#if used #if used
static void PROTO(mcsub,(cset *cs, char *cp)); static void PROTO(mcsub,(cset *cs, char *cp));
static int PROTO(mcin,(cset *cs, char *cp)); static int PROTO(mcin,(cset *cs, char *cp));
@ -361,8 +363,8 @@ register struct parse *p;
int stop; /* character this ERE should end at */ int stop; /* character this ERE should end at */
{ {
register char c; register char c;
register sopno prevback; register sopno prevback = 0;
register sopno prevfwd; register sopno prevfwd = 0;
register sopno conc; register sopno conc;
register int first = 1; /* is this the first alternative? */ register int first = 1; /* is this the first alternative? */
@ -933,7 +935,7 @@ register cset *cs;
break; break;
case CBLANK: case CBLANK:
for (c = CHAR_MIN; c <= CHAR_MAX; c++) for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (isblank((uch)c)) if (((uch)c) == ' ' || ((uch)c) == '\t')
CHadd(cs, c); CHadd(cs, c);
break; break;
case CCNTRL: case CCNTRL:
@ -1386,6 +1388,7 @@ register cset *cs;
return(n); return(n);
} }
#if 0
/* /*
- mcadd - add a collating element to a cset - mcadd - add a collating element to a cset
== static void mcadd(register struct parse *p, register cset *cs, \ == static void mcadd(register struct parse *p, register cset *cs, \
@ -1412,6 +1415,7 @@ register char *cp;
(void) strcpy(cs->multis + oldend - 1, cp); (void) strcpy(cs->multis + oldend - 1, cp);
cs->multis[cs->smultis - 1] = '\0'; cs->multis[cs->smultis - 1] = '\0';
} }
#endif
#if used #if used
/* /*
@ -1741,8 +1745,8 @@ struct parse *p;
register struct re_guts *g; register struct re_guts *g;
{ {
register sop *scan; register sop *scan;
sop *start; sop *start = NULL;
register sop *newstart; register sop *newstart = NULL;
register sopno newlen; register sopno newlen;
register sop s; register sop s;
register char *cp; register char *cp;

View File

@ -69,7 +69,9 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
#include "utils.h" #include "utils.h"
#include "regex2.h" #include "regex2.h"
#if used
static int nope = 0; /* for use in asserts; shuts lint up */ static int nope = 0; /* for use in asserts; shuts lint up */
#endif
/* macros for manipulating states, small version */ /* macros for manipulating states, small version */
#define states long #define states long

View File

@ -239,7 +239,7 @@ prolog_load_context(term_position, Position) :-
recorded('$module','$module'(F1,_,P),_), recorded('$module','$module'(F1,_,P),_),
recorded('$loaded','$loaded'(F1,_,Age),R), recorded('$loaded','$loaded'(F1,_,Age),R),
'$same_file'(F1,F), !, '$same_file'(F1,F), !,
'$loaded_file_age'(F, R). '$loaded_file_age'(F, R, Age).
'$loaded_file'(F,M,F1) :- '$loaded_file'(F,M,F1) :-
recorded('$loaded','$loaded'(F1,M,Age),R), recorded('$loaded','$loaded'(F1,M,Age),R),
'$same_file'(F1,F), !, '$same_file'(F1,F), !,