moved several global variables to misc/GLOBALS
This commit is contained in:
		
							
								
								
									
										22
									
								
								C/absmi.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								C/absmi.c
									
									
									
									
									
								
							| @@ -784,8 +784,8 @@ Yap_absmi(int inp) | |||||||
|   op_switch: |   op_switch: | ||||||
|  |  | ||||||
| #ifdef ANALYST | #ifdef ANALYST | ||||||
|     Yap_opcount[opcode]++; |     GLOBAL_opcount[opcode]++; | ||||||
|     Yap_2opcount[old_op][opcode]++; |     GLOBAL_2opcount[old_op][opcode]++; | ||||||
| #ifdef DEBUG_XX | #ifdef DEBUG_XX | ||||||
|     ops_done++; |     ops_done++; | ||||||
|     /*    if (B->cp_b > 0x103fff90) |     /*    if (B->cp_b > 0x103fff90) | ||||||
| @@ -3037,12 +3037,12 @@ Yap_absmi(int inp) | |||||||
| 	/* I need this for Windows and other systems where SIGINT | 	/* I need this for Windows and other systems where SIGINT | ||||||
| 	   is not proceesed by same thread as absmi */ | 	   is not proceesed by same thread as absmi */ | ||||||
|       LOCK(LOCAL_SignalLock); |       LOCK(LOCAL_SignalLock); | ||||||
|       if (Yap_PrologMode & (AbortMode|InterruptMode)) { |       if (LOCAL_PrologMode & (AbortMode|InterruptMode)) { | ||||||
| 	CreepFlag = CalculateStackGap(); | 	CreepFlag = CalculateStackGap(); | ||||||
| 	UNLOCK(LOCAL_SignalLock); | 	UNLOCK(LOCAL_SignalLock); | ||||||
| 	/* same instruction */ | 	/* same instruction */ | ||||||
| 	if (Yap_PrologMode & InterruptMode) { | 	if (LOCAL_PrologMode & InterruptMode) { | ||||||
| 	  Yap_PrologMode &= ~InterruptMode; | 	  LOCAL_PrologMode &= ~InterruptMode; | ||||||
| 	  SET_ASP(YREG, E_CB*sizeof(CELL)); | 	  SET_ASP(YREG, E_CB*sizeof(CELL)); | ||||||
| 	  saveregs(); | 	  saveregs(); | ||||||
| 	  Yap_ProcessSIGINT(); | 	  Yap_ProcessSIGINT(); | ||||||
| @@ -7102,7 +7102,7 @@ Yap_absmi(int inp) | |||||||
| 	yamop *savedP; | 	yamop *savedP; | ||||||
|  |  | ||||||
| 	Yap_StartSlots( PASS_REGS1 ); | 	Yap_StartSlots( PASS_REGS1 ); | ||||||
| 	Yap_PrologMode = UserCCallMode; | 	LOCAL_PrologMode = UserCCallMode; | ||||||
| 	{ | 	{ | ||||||
| 	  PredEntry *p = PREG->u.Osbpp.p; | 	  PredEntry *p = PREG->u.Osbpp.p; | ||||||
|  |  | ||||||
| @@ -7115,7 +7115,7 @@ Yap_absmi(int inp) | |||||||
| 	} | 	} | ||||||
| 	Yap_CloseSlots( PASS_REGS1 ); | 	Yap_CloseSlots( PASS_REGS1 ); | ||||||
| 	setregs(); | 	setregs(); | ||||||
| 	Yap_PrologMode = UserMode; | 	LOCAL_PrologMode = UserMode; | ||||||
| 	restore_machine_regs(); | 	restore_machine_regs(); | ||||||
| 	PREG = savedP; | 	PREG = savedP; | ||||||
|       } |       } | ||||||
| @@ -7283,7 +7283,7 @@ Yap_absmi(int inp) | |||||||
| #endif | #endif | ||||||
|       SET_BB(B_YREG); |       SET_BB(B_YREG); | ||||||
|       ENDCACHE_Y(); |       ENDCACHE_Y(); | ||||||
|       Yap_PrologMode = UserCCallMode; |       LOCAL_PrologMode = UserCCallMode; | ||||||
|       ASP = YREG; |       ASP = YREG; | ||||||
|       /* for slots to work */ |       /* for slots to work */ | ||||||
|       Yap_StartSlots( PASS_REGS1 ); |       Yap_StartSlots( PASS_REGS1 ); | ||||||
| @@ -7293,7 +7293,7 @@ Yap_absmi(int inp) | |||||||
|       EX = 0L; |       EX = 0L; | ||||||
|       restore_machine_regs(); |       restore_machine_regs(); | ||||||
|       setregs(); |       setregs(); | ||||||
|       Yap_PrologMode = UserMode; |       LOCAL_PrologMode = UserMode; | ||||||
|       Yap_CloseSlots( PASS_REGS1 ); |       Yap_CloseSlots( PASS_REGS1 ); | ||||||
|       if (!SREG) { |       if (!SREG) { | ||||||
| 	FAIL(); | 	FAIL(); | ||||||
| @@ -7326,7 +7326,7 @@ Yap_absmi(int inp) | |||||||
|       restore_args(PREG->u.OtapFs.s); |       restore_args(PREG->u.OtapFs.s); | ||||||
|       ENDCACHE_Y(); |       ENDCACHE_Y(); | ||||||
|  |  | ||||||
|       Yap_PrologMode = UserCCallMode; |       LOCAL_PrologMode = UserCCallMode; | ||||||
|       SET_ASP(YREG, E_CB*sizeof(CELL)); |       SET_ASP(YREG, E_CB*sizeof(CELL)); | ||||||
|       /* for slots to work */ |       /* for slots to work */ | ||||||
|       Yap_StartSlots( PASS_REGS1 ); |       Yap_StartSlots( PASS_REGS1 ); | ||||||
| @@ -7336,7 +7336,7 @@ Yap_absmi(int inp) | |||||||
|       EX = 0L; |       EX = 0L; | ||||||
|       restore_machine_regs(); |       restore_machine_regs(); | ||||||
|       setregs(); |       setregs(); | ||||||
|       Yap_PrologMode = UserMode; |       LOCAL_PrologMode = UserMode; | ||||||
|       Yap_CloseSlots( PASS_REGS1 ); |       Yap_CloseSlots( PASS_REGS1 ); | ||||||
|       if (!SREG) { |       if (!SREG) { | ||||||
| #ifdef CUT_C | #ifdef CUT_C | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								C/agc.c
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								C/agc.c
									
									
									
									
									
								
							| @@ -29,20 +29,12 @@ static char     SccsId[] = "@(#)agc.c	1.3 3/15/90"; | |||||||
| /* #define DEBUG_RESTORE1 1 */ | /* #define DEBUG_RESTORE1 1 */ | ||||||
| /* #define DEBUG_RESTORE2 1 */ | /* #define DEBUG_RESTORE2 1 */ | ||||||
| /* #define DEBUG_RESTORE3 1 */ | /* #define DEBUG_RESTORE3 1 */ | ||||||
| #define errout Yap_stderr | #define errout GLOBAL_stderr | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| STATIC_PROTO(void  RestoreEntries, (PropEntry *, int USES_REGS)); | STATIC_PROTO(void  RestoreEntries, (PropEntry *, int USES_REGS)); | ||||||
| STATIC_PROTO(void  CleanCode, (PredEntry * USES_REGS)); | STATIC_PROTO(void  CleanCode, (PredEntry * USES_REGS)); | ||||||
|  |  | ||||||
| static int agc_calls; |  | ||||||
|  |  | ||||||
| static YAP_ULONG_LONG agc_collected; |  | ||||||
|  |  | ||||||
| static Int tot_agc_time = 0; /* total time spent in GC */ |  | ||||||
|  |  | ||||||
| static Int tot_agc_recovered = 0; /* number of heap objects in all garbage collections */ |  | ||||||
|  |  | ||||||
| #define AtomMarkedBit 1 | #define AtomMarkedBit 1 | ||||||
|  |  | ||||||
| static inline void | static inline void | ||||||
| @@ -392,12 +384,12 @@ clean_atom_list(AtomHashEntry *HashPtr) | |||||||
| #ifdef DEBUG_RESTORE3 | #ifdef DEBUG_RESTORE3 | ||||||
| 	fprintf(stderr, "Purged %p:%S\n", at, at->WStrOfAE); | 	fprintf(stderr, "Purged %p:%S\n", at, at->WStrOfAE); | ||||||
| #endif | #endif | ||||||
| 	agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE); | 	GLOBAL_agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE); | ||||||
|       } else { |       } else { | ||||||
| #ifdef DEBUG_RESTORE3 | #ifdef DEBUG_RESTORE3 | ||||||
| 	fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE); | 	fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE); | ||||||
| #endif | #endif | ||||||
| 	agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE); | 	GLOBAL_agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE); | ||||||
|       } |       } | ||||||
|       *patm = atm = at->NextOfAE; |       *patm = atm = at->NextOfAE; | ||||||
|       Yap_FreeCodeSpace((char *)at); |       Yap_FreeCodeSpace((char *)at); | ||||||
| @@ -447,13 +439,13 @@ atom_gc(USES_REGS1) | |||||||
|   if (Yap_GetValue(AtomGcTrace) != TermNil) |   if (Yap_GetValue(AtomGcTrace) != TermNil) | ||||||
|     gc_trace = 1; |     gc_trace = 1; | ||||||
|  |  | ||||||
|   agc_calls++; |   GLOBAL_agc_calls++; | ||||||
|   agc_collected = 0; |   GLOBAL_agc_collected = 0; | ||||||
|    |    | ||||||
|   if (gc_trace) { |   if (gc_trace) { | ||||||
|     fprintf(Yap_stderr, "%% agc:\n"); |     fprintf(GLOBAL_stderr, "%% agc:\n"); | ||||||
|   } else if (gc_verbose) { |   } else if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   Start of atom garbage collection %d:\n", agc_calls); |     fprintf(GLOBAL_stderr, "%%   Start of atom garbage collection %d:\n", GLOBAL_agc_calls); | ||||||
|   } |   } | ||||||
|   time_start = Yap_cputime(); |   time_start = Yap_cputime(); | ||||||
|   /* get the number of active registers */ |   /* get the number of active registers */ | ||||||
| @@ -464,15 +456,15 @@ atom_gc(USES_REGS1) | |||||||
|   clean_atoms(); |   clean_atoms(); | ||||||
|   YAPLeaveCriticalSection(); |   YAPLeaveCriticalSection(); | ||||||
|   agc_time = Yap_cputime()-time_start; |   agc_time = Yap_cputime()-time_start; | ||||||
|   tot_agc_time += agc_time; |   GLOBAL_tot_agc_time += agc_time; | ||||||
|   tot_agc_recovered += agc_collected; |   GLOBAL_tot_agc_recovered += GLOBAL_agc_collected; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     fprintf(Yap_stderr, "%%   Collected %I64d bytes.\n", agc_collected); |     fprintf(GLOBAL_stderr, "%%   Collected %I64d bytes.\n", GLOBAL_agc_collected); | ||||||
| #else | #else | ||||||
|     fprintf(Yap_stderr, "%%   Collected %lld bytes.\n", agc_collected); |     fprintf(GLOBAL_stderr, "%%   Collected %lld bytes.\n", GLOBAL_agc_collected); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%%   GC %d took %g sec, total of %g sec doing GC so far.\n", agc_calls, (double)agc_time/1000, (double)tot_agc_time/1000); |     fprintf(GLOBAL_stderr, "%%   GC %d took %g sec, total of %g sec doing GC so far.\n", GLOBAL_agc_calls, (double)agc_time/1000, (double)GLOBAL_tot_agc_time/1000); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -494,9 +486,9 @@ p_atom_gc(USES_REGS1) | |||||||
| static Int | static Int | ||||||
| p_inform_agc(USES_REGS1) | p_inform_agc(USES_REGS1) | ||||||
| { | { | ||||||
|   Term tn = MkIntegerTerm(tot_agc_time); |   Term tn = MkIntegerTerm(GLOBAL_tot_agc_time); | ||||||
|   Term tt = MkIntegerTerm(agc_calls); |   Term tt = MkIntegerTerm(GLOBAL_agc_calls); | ||||||
|   Term ts = MkIntegerTerm(tot_agc_recovered); |   Term ts = MkIntegerTerm(GLOBAL_tot_agc_recovered); | ||||||
|  |  | ||||||
|   return |   return | ||||||
|     Yap_unify(tn, ARG2) && |     Yap_unify(tn, ARG2) && | ||||||
|   | |||||||
							
								
								
									
										92
									
								
								C/alloc.c
									
									
									
									
									
								
							
							
						
						
									
										92
									
								
								C/alloc.c
									
									
									
									
									
								
							| @@ -128,6 +128,7 @@ long long unsigned int tmalloc; | |||||||
| static inline char * | static inline char * | ||||||
| call_malloc(unsigned long int size) | call_malloc(unsigned long int size) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
|   char *out; |   char *out; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   LOCK(DLMallocLock); |   LOCK(DLMallocLock); | ||||||
| @@ -137,13 +138,13 @@ call_malloc(unsigned long int size) | |||||||
|   tmalloc += size; |   tmalloc += size; | ||||||
|   size += sizeof(CELL); |   size += sizeof(CELL); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode |= MallocMode; |   LOCAL_PrologMode |= MallocMode; | ||||||
|   out = (char *) my_malloc(size); |   out = (char *) my_malloc(size); | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|   *(CELL*)out = size-sizeof(CELL); |   *(CELL*)out = size-sizeof(CELL); | ||||||
|   out += sizeof(CELL); |   out += sizeof(CELL); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode &= ~MallocMode; |   LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   UNLOCK(DLMallocLock); |   UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -160,6 +161,7 @@ Yap_AllocCodeSpace(unsigned long int size) | |||||||
| static inline char * | static inline char * | ||||||
| call_realloc(char *p, unsigned long int size) | call_realloc(char *p, unsigned long int size) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
|   char *out; |   char *out; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   LOCK(DLMallocLock); |   LOCK(DLMallocLock); | ||||||
| @@ -171,13 +173,13 @@ call_realloc(char *p, unsigned long int size) | |||||||
|   p -= sizeof(CELL); |   p -= sizeof(CELL); | ||||||
|   tmalloc -= *(CELL*)p; |   tmalloc -= *(CELL*)p; | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode |= MallocMode; |   LOCAL_PrologMode |= MallocMode; | ||||||
|   out = (char *) my_realloc0(p, size); |   out = (char *) my_realloc0(p, size); | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|   *(CELL*)out = size-sizeof(CELL); |   *(CELL*)out = size-sizeof(CELL); | ||||||
|   out += sizeof(CELL); |   out += sizeof(CELL); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode &= ~MallocMode; |   LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   UNLOCK(DLMallocLock); |   UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -194,17 +196,18 @@ Yap_ReallocCodeSpace(char *p, unsigned long int size) | |||||||
| void | void | ||||||
| Yap_FreeCodeSpace(char *p) | Yap_FreeCodeSpace(char *p) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   LOCK(DLMallocLock); |   LOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode |= MallocMode; |   LOCAL_PrologMode |= MallocMode; | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|   p -= sizeof(CELL); |   p -= sizeof(CELL); | ||||||
|   tmalloc -= *(CELL*)p; |   tmalloc -= *(CELL*)p; | ||||||
|   frees++; |   frees++; | ||||||
| #endif | #endif | ||||||
|   my_free (p); |   my_free (p); | ||||||
|   Yap_PrologMode &= ~MallocMode; |   LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   UNLOCK(DLMallocLock); |   UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -220,17 +223,18 @@ Yap_AllocAtomSpace(unsigned long int size) | |||||||
| void | void | ||||||
| Yap_FreeAtomSpace(char *p) | Yap_FreeAtomSpace(char *p) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   LOCK(DLMallocLock); |   LOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode |= MallocMode; |   LOCAL_PrologMode |= MallocMode; | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|   p -= sizeof(CELL); |   p -= sizeof(CELL); | ||||||
|   tmalloc -= *(CELL*)p; |   tmalloc -= *(CELL*)p; | ||||||
|   frees++; |   frees++; | ||||||
| #endif | #endif | ||||||
|   my_free (p); |   my_free (p); | ||||||
|   Yap_PrologMode &= ~MallocMode; |   LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   UNLOCK(DLMallocLock); |   UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -250,14 +254,14 @@ Yap_InitPreAllocCodeSpace(void) | |||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|     LOCK(DLMallocLock); |     LOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|     Yap_PrologMode |= MallocMode; |     LOCAL_PrologMode |= MallocMode; | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|     mallocs++; |     mallocs++; | ||||||
|     tmalloc += sz; |     tmalloc += sz; | ||||||
|     sz += sizeof(CELL); |     sz += sizeof(CELL); | ||||||
| #endif | #endif | ||||||
|     while (!(ptr = my_malloc(sz))) { |     while (!(ptr = my_malloc(sz))) { | ||||||
|       Yap_PrologMode &= ~MallocMode; |       LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|       UNLOCK(DLMallocLock); |       UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -273,9 +277,9 @@ Yap_InitPreAllocCodeSpace(void) | |||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|       LOCK(DLMallocLock); |       LOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|       Yap_PrologMode |= MallocMode; |       LOCAL_PrologMode |= MallocMode; | ||||||
|     } |     } | ||||||
|     Yap_PrologMode &= ~MallocMode; |     LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|     UNLOCK(DLMallocLock); |     UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -305,20 +309,20 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe) | |||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   LOCK(DLMallocLock); |   LOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode |= MallocMode; |   LOCAL_PrologMode |= MallocMode; | ||||||
| #if INSTRUMENT_MALLOC | #if INSTRUMENT_MALLOC | ||||||
|   reallocs++; |   reallocs++; | ||||||
|   tmalloc -= LOCAL_ScratchPad.sz; |   tmalloc -= LOCAL_ScratchPad.sz; | ||||||
|   tmalloc += sz; |   tmalloc += sz; | ||||||
| #endif | #endif | ||||||
|   if (!(ptr = my_realloc(LOCAL_ScratchPad.ptr, sz, LOCAL_ScratchPad.sz, safe))) { |   if (!(ptr = my_realloc(LOCAL_ScratchPad.ptr, sz, LOCAL_ScratchPad.sz, safe))) { | ||||||
|     Yap_PrologMode &= ~MallocMode; |     LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|     UNLOCK(DLMallocLock); |     UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
|     return NULL; |     return NULL; | ||||||
|   } |   } | ||||||
|   Yap_PrologMode &= ~MallocMode; |   LOCAL_PrologMode &= ~MallocMode; | ||||||
| #if USE_DL_MALLOC | #if USE_DL_MALLOC | ||||||
|   UNLOCK(DLMallocLock); |   UNLOCK(DLMallocLock); | ||||||
| #endif | #endif | ||||||
| @@ -375,7 +379,7 @@ InitExStacks(int Trail, int Stack) | |||||||
|  AuxSp = NULL; |  AuxSp = NULL; | ||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_output_msg) { |   if (GLOBAL_output_msg) { | ||||||
|     UInt ta; |     UInt ta; | ||||||
|  |  | ||||||
|     fprintf(stderr, "HeapBase = %p  GlobalBase = %p\n  LocalBase = %p  TrailTop = %p\n", |     fprintf(stderr, "HeapBase = %p  GlobalBase = %p\n  LocalBase = %p  TrailTop = %p\n", | ||||||
| @@ -818,9 +822,9 @@ static int | |||||||
| ExtendWorkSpace(Int s, int fixed_allocation) | ExtendWorkSpace(Int s, int fixed_allocation) | ||||||
| { | { | ||||||
|   LPVOID b = brk; |   LPVOID b = brk; | ||||||
|   prolog_exec_mode OldPrologMode = Yap_PrologMode; |   prolog_exec_mode OldPrologMode = LOCAL_PrologMode; | ||||||
|  |  | ||||||
|   Yap_PrologMode = ExtendStackMode; |   LOCAL_PrologMode = ExtendStackMode; | ||||||
|  |  | ||||||
| #if DEBUG_WIN32_ALLOC | #if DEBUG_WIN32_ALLOC | ||||||
|   fprintf(stderr,"trying: %p (" Int_FORMAT "K) %d\n",b, s/1024, fixed_allocation); |   fprintf(stderr,"trying: %p (" Int_FORMAT "K) %d\n",b, s/1024, fixed_allocation); | ||||||
| @@ -834,7 +838,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if (!b) { |   if (!b) { | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
| #if DEBUG_WIN32_ALLOC | #if DEBUG_WIN32_ALLOC | ||||||
|     { |     { | ||||||
|       char msg[256]; |       char msg[256]; | ||||||
| @@ -853,7 +857,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "VirtualAlloc could not commit %ld bytes", | 	      "VirtualAlloc could not commit %ld bytes", | ||||||
| 	      (long int)s); | 	      (long int)s); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
| #if DEBUG_WIN32_ALLOC | #if DEBUG_WIN32_ALLOC | ||||||
|     fprintf(stderr,"NOT OK2: %p--%p\n",b,brk); |     fprintf(stderr,"NOT OK2: %p--%p\n",b,brk); | ||||||
| #endif | #endif | ||||||
| @@ -863,7 +867,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
| #if DEBUG_WIN32_ALLOC | #if DEBUG_WIN32_ALLOC | ||||||
|   fprintf(stderr,"OK: %p--%p " Int_FORMAT "\n",b, brk, s); |   fprintf(stderr,"OK: %p--%p " Int_FORMAT "\n",b, brk, s); | ||||||
| #endif | #endif | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1126,16 +1130,16 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
|   return(FALSE); |   return(FALSE); | ||||||
| #else | #else | ||||||
|   MALLOC_T a; |   MALLOC_T a; | ||||||
|   prolog_exec_mode OldPrologMode = Yap_PrologMode; |   prolog_exec_mode OldPrologMode = LOCAL_PrologMode; | ||||||
|   MALLOC_T base = WorkSpaceTop; |   MALLOC_T base = WorkSpaceTop; | ||||||
|  |  | ||||||
|   if (fixed_allocation == MAP_FIXED) |   if (fixed_allocation == MAP_FIXED) | ||||||
|     base = WorkSpaceTop; |     base = WorkSpaceTop; | ||||||
|   else |   else | ||||||
|     base = 0L; |     base = 0L; | ||||||
|   Yap_PrologMode = ExtendStackMode; |   LOCAL_PrologMode = ExtendStackMode; | ||||||
|   a = mmap_extension(s, base, fixed_allocation); |   a = mmap_extension(s, base, fixed_allocation); | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   if (a == (MALLOC_T) - 1) { |   if (a == (MALLOC_T) - 1) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
| #if HAVE_STRERROR | #if HAVE_STRERROR | ||||||
| @@ -1153,7 +1157,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
|       LOCAL_ErrorMessage = LOCAL_ErrorSay; |       LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|       snprintf5(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |       snprintf5(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 		"mmap could not grow memory at %p, got %p", WorkSpaceTop, a ); | 		"mmap could not grow memory at %p, got %p", WorkSpaceTop, a ); | ||||||
|       Yap_PrologMode = OldPrologMode; |       LOCAL_PrologMode = OldPrologMode; | ||||||
|       return FALSE; |       return FALSE; | ||||||
|     } |     } | ||||||
|   } else if (a < WorkSpaceTop) { |   } else if (a < WorkSpaceTop) { | ||||||
| @@ -1164,7 +1168,7 @@ ExtendWorkSpace(Int s, int fixed_allocation) | |||||||
|     return res; |     return res; | ||||||
|   } |   } | ||||||
|   WorkSpaceTop = (char *) a + s; |   WorkSpaceTop = (char *) a + s; | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| #endif /* YAPOR */ | #endif /* YAPOR */ | ||||||
| } | } | ||||||
| @@ -1215,33 +1219,33 @@ ExtendWorkSpace(Int s) | |||||||
| { | { | ||||||
|   MALLOC_T ptr; |   MALLOC_T ptr; | ||||||
|   int shm_id; |   int shm_id; | ||||||
|   prolog_exec_mode OldPrologMode = Yap_PrologMode; |   prolog_exec_mode OldPrologMode = LOCAL_PrologMode; | ||||||
|  |  | ||||||
|   Yap_PrologMode = ExtendStackMode; |   LOCAL_PrologMode = ExtendStackMode; | ||||||
|   /* mapping heap area */ |   /* mapping heap area */ | ||||||
|   if((shm_id = shmget(IPC_PRIVATE, (size_t)s, SHM_R|SHM_W)) == -1) { |   if((shm_id = shmget(IPC_PRIVATE, (size_t)s, SHM_R|SHM_W)) == -1) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not shmget %d bytes", s); | 	      "could not shmget %d bytes", s); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return(FALSE); |     return(FALSE); | ||||||
|    } |    } | ||||||
|   if((ptr = (MALLOC_T)shmat(shm_id, WorkSpaceTop, 0)) == (MALLOC_T) -1) { |   if((ptr = (MALLOC_T)shmat(shm_id, WorkSpaceTop, 0)) == (MALLOC_T) -1) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not shmat at %p", MMAP_ADDR); | 	      "could not shmat at %p", MMAP_ADDR); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return(FALSE); |     return(FALSE); | ||||||
|   } |   } | ||||||
|   if (shmctl(shm_id, IPC_RMID, 0) != 0) { |   if (shmctl(shm_id, IPC_RMID, 0) != 0) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not remove shm segment", shm_id); | 	      "could not remove shm segment", shm_id); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return(FALSE); |     return(FALSE); | ||||||
|   } |   } | ||||||
|   WorkSpaceTop = (char *) ptr + s; |   WorkSpaceTop = (char *) ptr + s; | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   return(TRUE); |   return(TRUE); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1290,17 +1294,17 @@ static int | |||||||
| ExtendWorkSpace(Int s) | ExtendWorkSpace(Int s) | ||||||
| { | { | ||||||
|   MALLOC_T ptr = (MALLOC_T)sbrk(s); |   MALLOC_T ptr = (MALLOC_T)sbrk(s); | ||||||
|   prolog_exec_mode OldPrologMode = Yap_PrologMode; |   prolog_exec_mode OldPrologMode = LOCAL_PrologMode; | ||||||
|  |  | ||||||
|   Yap_PrologMode = ExtendStackMode; |   LOCAL_PrologMode = ExtendStackMode; | ||||||
|   if (ptr == ((MALLOC_T) - 1)) { |   if (ptr == ((MALLOC_T) - 1)) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not expand stacks over %d bytes", s); | 	      "could not expand stacks over %d bytes", s); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return(FALSE); |     return(FALSE); | ||||||
|   } |   } | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1420,9 +1424,9 @@ static int | |||||||
| ExtendWorkSpace(Int s) | ExtendWorkSpace(Int s) | ||||||
| { | { | ||||||
|   MALLOC_T ptr; |   MALLOC_T ptr; | ||||||
|   prolog_exec_mode OldPrologMode = Yap_PrologMode; |   prolog_exec_mode OldPrologMode = LOCAL_PrologMode; | ||||||
|  |  | ||||||
|   Yap_PrologMode = ExtendStackMode; |   LOCAL_PrologMode = ExtendStackMode; | ||||||
|   total_space += s; |   total_space += s; | ||||||
|   if (total_space < MAX_SPACE) return TRUE; |   if (total_space < MAX_SPACE) return TRUE; | ||||||
|   ptr = (MALLOC_T)realloc((void *)Yap_HeapBase, total_space); |   ptr = (MALLOC_T)realloc((void *)Yap_HeapBase, total_space); | ||||||
| @@ -1430,24 +1434,24 @@ ExtendWorkSpace(Int s) | |||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not allocate %d bytes", s); | 	      "could not allocate %d bytes", s); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   } |   } | ||||||
|   if (ptr != (MALLOC_T)Yap_HeapBase) { |   if (ptr != (MALLOC_T)Yap_HeapBase) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf4(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "could not expand contiguous stacks  %d bytes", s); | 	      "could not expand contiguous stacks  %d bytes", s); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   } |   } | ||||||
|   if ((CELL)ptr & MBIT) { |   if ((CELL)ptr & MBIT) { | ||||||
|     LOCAL_ErrorMessage = LOCAL_ErrorSay; |     LOCAL_ErrorMessage = LOCAL_ErrorSay; | ||||||
|     snprintf5(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, |     snprintf5(LOCAL_ErrorMessage, MAX_ERROR_MSG_SIZE, | ||||||
| 	      "memory at %p conflicts with MBIT %lx", ptr, (unsigned long)MBIT); | 	      "memory at %p conflicts with MBIT %lx", ptr, (unsigned long)MBIT); | ||||||
|     Yap_PrologMode = OldPrologMode; |     LOCAL_PrologMode = OldPrologMode; | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   } |   } | ||||||
|   Yap_PrologMode = OldPrologMode; |   LOCAL_PrologMode = OldPrologMode; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1530,11 +1534,11 @@ Yap_InitMemory(UInt Trail, UInt Heap, UInt Stack) | |||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
| #if SIZEOF_INT_P!=SIZEOF_INT | #if SIZEOF_INT_P!=SIZEOF_INT | ||||||
|   if (Yap_output_msg) { |   if (GLOBAL_output_msg) { | ||||||
|     fprintf(stderr, "HeapBase = %p  GlobalBase = %p\n  LocalBase = %p  TrailTop = %p\n", |     fprintf(stderr, "HeapBase = %p  GlobalBase = %p\n  LocalBase = %p  TrailTop = %p\n", | ||||||
| 	       Yap_HeapBase, LOCAL_GlobalBase, LOCAL_LocalBase, LOCAL_TrailTop); | 	       Yap_HeapBase, LOCAL_GlobalBase, LOCAL_LocalBase, LOCAL_TrailTop); | ||||||
| #else | #else | ||||||
|   if (Yap_output_msg) { |   if (GLOBAL_output_msg) { | ||||||
|     fprintf(stderr, "HeapBase = %x  GlobalBase = %x\n  LocalBase = %x  TrailTop = %x\n", |     fprintf(stderr, "HeapBase = %x  GlobalBase = %x\n  LocalBase = %x  TrailTop = %x\n", | ||||||
| 	       (UInt) Yap_HeapBase, (UInt) LOCAL_GlobalBase, | 	       (UInt) Yap_HeapBase, (UInt) LOCAL_GlobalBase, | ||||||
| 	       (UInt) LOCAL_LocalBase, (UInt) LOCAL_TrailTop); | 	       (UInt) LOCAL_LocalBase, (UInt) LOCAL_TrailTop); | ||||||
|   | |||||||
| @@ -434,8 +434,8 @@ DumpOpCodes(void) | |||||||
|  |  | ||||||
|   while (i < 30) { |   while (i < 30) { | ||||||
|     for (j = i; j <= _std_top; j += 25) |     for (j = i; j <= _std_top; j += 25) | ||||||
|       fprintf(Yap_stderr, "%5d %6lx", j, absmadr(j)); |       fprintf(GLOBAL_stderr, "%5d %6lx", j, absmadr(j)); | ||||||
|     fputc('\n',Yap_stderr); |     fputc('\n',GLOBAL_stderr); | ||||||
|     ++i; |     ++i; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										644
									
								
								C/analyst.c
									
									
									
									
									
								
							
							
						
						
									
										644
									
								
								C/analyst.c
									
									
									
									
									
								
							| @@ -28,9 +28,7 @@ static char SccsId[] = "%W% %G%"; | |||||||
| #include <string.h> | #include <string.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| YAP_ULONG_LONG Yap_opcount[_std_top + 1]; |  | ||||||
|  |  | ||||||
| YAP_ULONG_LONG Yap_2opcount[_std_top + 1][_std_top + 1]; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| STATIC_PROTO(Int p_reset_op_counters, (void)); | STATIC_PROTO(Int p_reset_op_counters, (void)); | ||||||
| @@ -43,7 +41,7 @@ p_reset_op_counters() | |||||||
|   int i; |   int i; | ||||||
|  |  | ||||||
|   for (i = 0; i <= _std_top; ++i) |   for (i = 0; i <= _std_top; ++i) | ||||||
|     Yap_opcount[i] = 0; |     GLOBAL_opcount[i] = 0; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -52,26 +50,26 @@ print_instruction(int inst) | |||||||
| { | { | ||||||
|   int j; |   int j; | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "%s", Yap_op_names[inst]); |   fprintf(GLOBAL_stderr, "%s", Yap_op_names[inst]); | ||||||
|   for (j = strlen(Yap_op_names[inst]); j < 25; j++) |   for (j = strlen(Yap_op_names[inst]); j < 25; j++) | ||||||
|     putc(' ', Yap_stderr); |     putc(' ', GLOBAL_stderr); | ||||||
|   j = Yap_opcount[inst]; |   j = GLOBAL_opcount[inst]; | ||||||
|   if (j < 100000000) { |   if (j < 100000000) { | ||||||
|     putc(' ', Yap_stderr); |     putc(' ', GLOBAL_stderr); | ||||||
|     if (j < 10000000) { |     if (j < 10000000) { | ||||||
|       putc(' ', Yap_stderr); |       putc(' ', GLOBAL_stderr); | ||||||
|       if (j < 1000000) { |       if (j < 1000000) { | ||||||
| 	putc(' ', Yap_stderr); | 	putc(' ', GLOBAL_stderr); | ||||||
| 	if (j < 100000) { | 	if (j < 100000) { | ||||||
| 	  putc(' ', Yap_stderr); | 	  putc(' ', GLOBAL_stderr); | ||||||
| 	  if (j < 10000) { | 	  if (j < 10000) { | ||||||
| 	    putc(' ', Yap_stderr); | 	    putc(' ', GLOBAL_stderr); | ||||||
| 	    if (j < 1000) { | 	    if (j < 1000) { | ||||||
| 	      putc(' ', Yap_stderr); | 	      putc(' ', GLOBAL_stderr); | ||||||
| 	      if (j < 100) { | 	      if (j < 100) { | ||||||
| 		putc(' ', Yap_stderr); | 		putc(' ', GLOBAL_stderr); | ||||||
| 		if (j < 10) { | 		if (j < 10) { | ||||||
| 		  putc(' ', Yap_stderr); | 		  putc(' ', GLOBAL_stderr); | ||||||
| 		} | 		} | ||||||
| 	      } | 	      } | ||||||
| 	    } | 	    } | ||||||
| @@ -80,7 +78,7 @@ print_instruction(int inst) | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   fprintf(Yap_stderr, "%llu\n", Yap_opcount[inst]); |   fprintf(GLOBAL_stderr, "%llu\n", GLOBAL_opcount[inst]); | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int  | static Int  | ||||||
| @@ -98,18 +96,18 @@ p_show_op_counters() | |||||||
|       wchar_t *program; |       wchar_t *program; | ||||||
|  |  | ||||||
|       program = RepAtom(at1)->WStrOfAE; |       program = RepAtom(at1)->WStrOfAE; | ||||||
|       fprintf(Yap_stderr, "\n Instructions Executed in %S\n", program); |       fprintf(GLOBAL_stderr, "\n Instructions Executed in %S\n", program); | ||||||
|     } else { |     } else { | ||||||
|       char *program; |       char *program; | ||||||
|  |  | ||||||
|       program = RepAtom(at1)->StrOfAE; |       program = RepAtom(at1)->StrOfAE; | ||||||
|       fprintf(Yap_stderr, "\n Instructions Executed in %s\n", program); |       fprintf(GLOBAL_stderr, "\n Instructions Executed in %s\n", program); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   for (i = 0; i <= _std_top; ++i) |   for (i = 0; i <= _std_top; ++i) | ||||||
|     print_instruction(i); |     print_instruction(i); | ||||||
|   fprintf(Yap_stderr, "\n Control Instructions \n"); |   fprintf(GLOBAL_stderr, "\n Control Instructions \n"); | ||||||
|   print_instruction(_op_fail); |   print_instruction(_op_fail); | ||||||
|   print_instruction(_execute); |   print_instruction(_execute); | ||||||
|   print_instruction(_dexecute); |   print_instruction(_dexecute); | ||||||
| @@ -121,7 +119,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_allocate); |   print_instruction(_allocate); | ||||||
|   print_instruction(_deallocate); |   print_instruction(_deallocate); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Choice Point Manipulation Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Choice Point Manipulation Instructions\n"); | ||||||
|   print_instruction(_try_me); |   print_instruction(_try_me); | ||||||
|   print_instruction(_retry_me); |   print_instruction(_retry_me); | ||||||
|   print_instruction(_trust_me); |   print_instruction(_trust_me); | ||||||
| @@ -130,38 +128,38 @@ p_show_op_counters() | |||||||
|   print_instruction(_retry); |   print_instruction(_retry); | ||||||
|   print_instruction(_trust); |   print_instruction(_trust); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Disjunction Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Disjunction Instructions\n"); | ||||||
|   print_instruction(_either); |   print_instruction(_either); | ||||||
|   print_instruction(_or_else); |   print_instruction(_or_else); | ||||||
|   print_instruction(_or_last); |   print_instruction(_or_last); | ||||||
|   print_instruction(_jump); |   print_instruction(_jump); | ||||||
|   print_instruction(_move_back); |   print_instruction(_move_back); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Dynamic Predicates Choicepoint Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Dynamic Predicates Choicepoint Instructions\n"); | ||||||
|   print_instruction(_try_and_mark); |   print_instruction(_try_and_mark); | ||||||
|   print_instruction(_retry_and_mark); |   print_instruction(_retry_and_mark); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n C Predicates Choicepoint Instructions\n"); |   fprintf(GLOBAL_stderr, "\n C Predicates Choicepoint Instructions\n"); | ||||||
|   print_instruction(_try_c); |   print_instruction(_try_c); | ||||||
|   print_instruction(_retry_c); |   print_instruction(_retry_c); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Indexing Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Indexing Instructions\n"); | ||||||
|   fprintf(Yap_stderr, "\n  Switch on Type\n"); |   fprintf(GLOBAL_stderr, "\n  Switch on Type\n"); | ||||||
|   print_instruction(_switch_on_type); |   print_instruction(_switch_on_type); | ||||||
|   print_instruction(_switch_list_nl); |   print_instruction(_switch_list_nl); | ||||||
|   print_instruction(_switch_on_arg_type); |   print_instruction(_switch_on_arg_type); | ||||||
|   print_instruction(_switch_on_sub_arg_type); |   print_instruction(_switch_on_sub_arg_type); | ||||||
|   fprintf(Yap_stderr, "\n  Switch on Value\n"); |   fprintf(GLOBAL_stderr, "\n  Switch on Value\n"); | ||||||
|   print_instruction(_if_cons); |   print_instruction(_if_cons); | ||||||
|   print_instruction(_go_on_cons); |   print_instruction(_go_on_cons); | ||||||
|   print_instruction(_switch_on_cons); |   print_instruction(_switch_on_cons); | ||||||
|   print_instruction(_if_func); |   print_instruction(_if_func); | ||||||
|   print_instruction(_go_on_func); |   print_instruction(_go_on_func); | ||||||
|   print_instruction(_switch_on_func); |   print_instruction(_switch_on_func); | ||||||
|   fprintf(Yap_stderr, "\n  Other Switches\n"); |   fprintf(GLOBAL_stderr, "\n  Other Switches\n"); | ||||||
|   print_instruction(_if_not_then); |   print_instruction(_if_not_then); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Get Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Get Instructions\n"); | ||||||
|   print_instruction(_get_x_var); |   print_instruction(_get_x_var); | ||||||
|   print_instruction(_get_y_var); |   print_instruction(_get_y_var); | ||||||
|   print_instruction(_get_x_val); |   print_instruction(_get_x_val); | ||||||
| @@ -174,7 +172,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_get_6atoms); |   print_instruction(_get_6atoms); | ||||||
|   print_instruction(_get_list); |   print_instruction(_get_list); | ||||||
|   print_instruction(_get_struct); |   print_instruction(_get_struct); | ||||||
|   fprintf(Yap_stderr, "\n   Optimised Get Instructions\n"); |   fprintf(GLOBAL_stderr, "\n   Optimised Get Instructions\n"); | ||||||
|   print_instruction(_glist_valx); |   print_instruction(_glist_valx); | ||||||
|   print_instruction(_glist_valy); |   print_instruction(_glist_valy); | ||||||
|   print_instruction(_gl_void_varx); |   print_instruction(_gl_void_varx); | ||||||
| @@ -182,7 +180,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_gl_void_valx); |   print_instruction(_gl_void_valx); | ||||||
|   print_instruction(_gl_void_valy); |   print_instruction(_gl_void_valy); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Unify Read Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Unify Read Instructions\n"); | ||||||
|   print_instruction(_unify_x_var); |   print_instruction(_unify_x_var); | ||||||
|   print_instruction(_unify_x_var2); |   print_instruction(_unify_x_var2); | ||||||
|   print_instruction(_unify_y_var); |   print_instruction(_unify_y_var); | ||||||
| @@ -195,7 +193,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_unify_n_voids); |   print_instruction(_unify_n_voids); | ||||||
|   print_instruction(_unify_list); |   print_instruction(_unify_list); | ||||||
|   print_instruction(_unify_struct); |   print_instruction(_unify_struct); | ||||||
|   fprintf(Yap_stderr, "\n   Unify Last Read Instructions\n"); |   fprintf(GLOBAL_stderr, "\n   Unify Last Read Instructions\n"); | ||||||
|   print_instruction(_unify_l_x_var); |   print_instruction(_unify_l_x_var); | ||||||
|   print_instruction(_unify_l_x_var2); |   print_instruction(_unify_l_x_var2); | ||||||
|   print_instruction(_unify_l_y_var); |   print_instruction(_unify_l_y_var); | ||||||
| @@ -208,7 +206,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_unify_l_list); |   print_instruction(_unify_l_list); | ||||||
|   print_instruction(_unify_l_struc); |   print_instruction(_unify_l_struc); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Unify Write Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Unify Write Instructions\n"); | ||||||
|   print_instruction(_unify_x_var_write); |   print_instruction(_unify_x_var_write); | ||||||
|   print_instruction(_unify_x_var2_write); |   print_instruction(_unify_x_var2_write); | ||||||
|   print_instruction(_unify_y_var_write); |   print_instruction(_unify_y_var_write); | ||||||
| @@ -221,7 +219,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_unify_n_voids_write); |   print_instruction(_unify_n_voids_write); | ||||||
|   print_instruction(_unify_list_write); |   print_instruction(_unify_list_write); | ||||||
|   print_instruction(_unify_struct_write); |   print_instruction(_unify_struct_write); | ||||||
|   fprintf(Yap_stderr, "\n   Unify Last Read Instructions\n"); |   fprintf(GLOBAL_stderr, "\n   Unify Last Read Instructions\n"); | ||||||
|   print_instruction(_unify_l_x_var_write); |   print_instruction(_unify_l_x_var_write); | ||||||
|   print_instruction(_unify_l_x_var2_write); |   print_instruction(_unify_l_x_var2_write); | ||||||
|   print_instruction(_unify_l_y_var_write); |   print_instruction(_unify_l_y_var_write); | ||||||
| @@ -234,7 +232,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_unify_l_list_write); |   print_instruction(_unify_l_list_write); | ||||||
|   print_instruction(_unify_l_struc_write); |   print_instruction(_unify_l_struc_write); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Put Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Put Instructions\n"); | ||||||
|   print_instruction(_put_x_var); |   print_instruction(_put_x_var); | ||||||
|   print_instruction(_put_y_var); |   print_instruction(_put_y_var); | ||||||
|   print_instruction(_put_x_val); |   print_instruction(_put_x_val); | ||||||
| @@ -245,7 +243,7 @@ p_show_op_counters() | |||||||
|   print_instruction(_put_list); |   print_instruction(_put_list); | ||||||
|   print_instruction(_put_struct); |   print_instruction(_put_struct); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Write Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Write Instructions\n"); | ||||||
|   print_instruction(_write_x_var); |   print_instruction(_write_x_var); | ||||||
|   print_instruction(_write_y_var); |   print_instruction(_write_y_var); | ||||||
|   print_instruction(_write_x_val); |   print_instruction(_write_x_val); | ||||||
| @@ -257,11 +255,11 @@ p_show_op_counters() | |||||||
|   print_instruction(_write_n_voids); |   print_instruction(_write_n_voids); | ||||||
|   print_instruction(_write_list); |   print_instruction(_write_list); | ||||||
|   print_instruction(_write_struct); |   print_instruction(_write_struct); | ||||||
|   fprintf(Yap_stderr, "\n   Last Write Instructions\n"); |   fprintf(GLOBAL_stderr, "\n   Last Write Instructions\n"); | ||||||
|   print_instruction(_write_l_list); |   print_instruction(_write_l_list); | ||||||
|   print_instruction(_write_l_struc); |   print_instruction(_write_l_struc); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Miscellaneous Instructions\n"); |   fprintf(GLOBAL_stderr, "\n Miscellaneous Instructions\n"); | ||||||
|   print_instruction(_cut); |   print_instruction(_cut); | ||||||
|   print_instruction(_cut_t); |   print_instruction(_cut_t); | ||||||
|   print_instruction(_cut_e); |   print_instruction(_cut_e); | ||||||
| @@ -292,11 +290,11 @@ p_show_op_counters() | |||||||
|  |  | ||||||
| typedef struct { | typedef struct { | ||||||
|   int nxvar, nxval, nyvar, nyval, ncons, nlist, nstru, nmisc; |   int nxvar, nxval, nyvar, nyval, ncons, nlist, nstru, nmisc; | ||||||
| } uYap_opcount; | } uGLOBAL_opcount; | ||||||
|  |  | ||||||
| typedef struct { | typedef struct { | ||||||
|   int ncalls, nexecs, nproceeds, ncallbips, ncuts, nallocs, ndeallocs; |   int ncalls, nexecs, nproceeds, ncallbips, ncuts, nallocs, ndeallocs; | ||||||
| } cYap_opcount; | } cGLOBAL_opcount; | ||||||
|  |  | ||||||
| typedef struct { | typedef struct { | ||||||
|   int ntries, nretries, ntrusts; |   int ntries, nretries, ntrusts; | ||||||
| @@ -306,8 +304,8 @@ static Int | |||||||
| p_show_ops_by_group(void) | p_show_ops_by_group(void) | ||||||
| { | { | ||||||
|  |  | ||||||
|   uYap_opcount c_get, c_unify, c_put, c_write; |   uGLOBAL_opcount c_get, c_unify, c_put, c_write; | ||||||
|   cYap_opcount c_control; |   cGLOBAL_opcount c_control; | ||||||
|   ccpcount c_cp; |   ccpcount c_cp; | ||||||
|   int gets, unifies, puts, writes, controls, choice_pts, indexes, misc, |   int gets, unifies, puts, writes, controls, choice_pts, indexes, misc, | ||||||
|     total; |     total; | ||||||
| @@ -322,261 +320,261 @@ p_show_ops_by_group(void) | |||||||
|     wchar_t *program; |     wchar_t *program; | ||||||
|  |  | ||||||
|     program = RepAtom(at1)->WStrOfAE; |     program = RepAtom(at1)->WStrOfAE; | ||||||
|     fprintf(Yap_stderr, "\n Instructions Executed in %S\n", program); |     fprintf(GLOBAL_stderr, "\n Instructions Executed in %S\n", program); | ||||||
|   } else { |   } else { | ||||||
|     char *program; |     char *program; | ||||||
|  |  | ||||||
|     program = RepAtom(at1)->StrOfAE; |     program = RepAtom(at1)->StrOfAE; | ||||||
|     fprintf(Yap_stderr, "\n Instructions Executed in %s\n", program); |     fprintf(GLOBAL_stderr, "\n Instructions Executed in %s\n", program); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   c_get.nxvar = |   c_get.nxvar = | ||||||
|     Yap_opcount[_get_x_var]; |     GLOBAL_opcount[_get_x_var]; | ||||||
|   c_get.nyvar = |   c_get.nyvar = | ||||||
|     Yap_opcount[_get_y_var]; |     GLOBAL_opcount[_get_y_var]; | ||||||
|   c_get.nxval = |   c_get.nxval = | ||||||
|     Yap_opcount[_get_x_val]; |     GLOBAL_opcount[_get_x_val]; | ||||||
|   c_get.nyval = |   c_get.nyval = | ||||||
|     Yap_opcount[_get_y_val]; |     GLOBAL_opcount[_get_y_val]; | ||||||
|   c_get.ncons = |   c_get.ncons = | ||||||
|     Yap_opcount[_get_atom]+ |     GLOBAL_opcount[_get_atom]+ | ||||||
|     Yap_opcount[_get_2atoms]+ |     GLOBAL_opcount[_get_2atoms]+ | ||||||
|     Yap_opcount[_get_3atoms]+ |     GLOBAL_opcount[_get_3atoms]+ | ||||||
|     Yap_opcount[_get_4atoms]+ |     GLOBAL_opcount[_get_4atoms]+ | ||||||
|     Yap_opcount[_get_5atoms]+ |     GLOBAL_opcount[_get_5atoms]+ | ||||||
|     Yap_opcount[_get_6atoms]; |     GLOBAL_opcount[_get_6atoms]; | ||||||
|   c_get.nlist = |   c_get.nlist = | ||||||
|     Yap_opcount[_get_list] + |     GLOBAL_opcount[_get_list] + | ||||||
|     Yap_opcount[_glist_valx] + |     GLOBAL_opcount[_glist_valx] + | ||||||
|     Yap_opcount[_glist_valy] + |     GLOBAL_opcount[_glist_valy] + | ||||||
|     Yap_opcount[_gl_void_varx] + |     GLOBAL_opcount[_gl_void_varx] + | ||||||
|     Yap_opcount[_gl_void_vary] + |     GLOBAL_opcount[_gl_void_vary] + | ||||||
|     Yap_opcount[_gl_void_valx] + |     GLOBAL_opcount[_gl_void_valx] + | ||||||
|     Yap_opcount[_gl_void_valy]; |     GLOBAL_opcount[_gl_void_valy]; | ||||||
|   c_get.nstru = |   c_get.nstru = | ||||||
|     Yap_opcount[_get_struct]; |     GLOBAL_opcount[_get_struct]; | ||||||
|  |  | ||||||
|   gets = c_get.nxvar + c_get.nyvar + c_get.nxval + c_get.nyval + |   gets = c_get.nxvar + c_get.nyvar + c_get.nxval + c_get.nyval + | ||||||
|     c_get.ncons + c_get.nlist + c_get.nstru; |     c_get.ncons + c_get.nlist + c_get.nstru; | ||||||
|  |  | ||||||
|   c_unify.nxvar = |   c_unify.nxvar = | ||||||
|     Yap_opcount[_unify_x_var] + |     GLOBAL_opcount[_unify_x_var] + | ||||||
|     Yap_opcount[_unify_void] + |     GLOBAL_opcount[_unify_void] + | ||||||
|     Yap_opcount[_unify_n_voids] + |     GLOBAL_opcount[_unify_n_voids] + | ||||||
|     2 * Yap_opcount[_unify_x_var2] + |     2 * GLOBAL_opcount[_unify_x_var2] + | ||||||
|     2 * Yap_opcount[_gl_void_varx] + |     2 * GLOBAL_opcount[_gl_void_varx] + | ||||||
|     Yap_opcount[_gl_void_vary] + |     GLOBAL_opcount[_gl_void_vary] + | ||||||
|     Yap_opcount[_gl_void_valx] + |     GLOBAL_opcount[_gl_void_valx] + | ||||||
|     Yap_opcount[_unify_l_x_var] + |     GLOBAL_opcount[_unify_l_x_var] + | ||||||
|     Yap_opcount[_unify_l_void] + |     GLOBAL_opcount[_unify_l_void] + | ||||||
|     Yap_opcount[_unify_l_n_voids] + |     GLOBAL_opcount[_unify_l_n_voids] + | ||||||
|     2 * Yap_opcount[_unify_l_x_var2] + |     2 * GLOBAL_opcount[_unify_l_x_var2] + | ||||||
|     Yap_opcount[_unify_x_var_write] + |     GLOBAL_opcount[_unify_x_var_write] + | ||||||
|     Yap_opcount[_unify_void_write] + |     GLOBAL_opcount[_unify_void_write] + | ||||||
|     Yap_opcount[_unify_n_voids_write] + |     GLOBAL_opcount[_unify_n_voids_write] + | ||||||
|     2 * Yap_opcount[_unify_x_var2_write] + |     2 * GLOBAL_opcount[_unify_x_var2_write] + | ||||||
|     Yap_opcount[_unify_l_x_var_write] + |     GLOBAL_opcount[_unify_l_x_var_write] + | ||||||
|     Yap_opcount[_unify_l_void_write] + |     GLOBAL_opcount[_unify_l_void_write] + | ||||||
|     Yap_opcount[_unify_l_n_voids_write] + |     GLOBAL_opcount[_unify_l_n_voids_write] + | ||||||
|     2 * Yap_opcount[_unify_l_x_var2_write]; |     2 * GLOBAL_opcount[_unify_l_x_var2_write]; | ||||||
|   c_unify.nyvar = |   c_unify.nyvar = | ||||||
|     Yap_opcount[_unify_y_var] + |     GLOBAL_opcount[_unify_y_var] + | ||||||
|     Yap_opcount[_gl_void_vary] + |     GLOBAL_opcount[_gl_void_vary] + | ||||||
|     Yap_opcount[_unify_l_y_var] + |     GLOBAL_opcount[_unify_l_y_var] + | ||||||
|     Yap_opcount[_unify_y_var_write] + |     GLOBAL_opcount[_unify_y_var_write] + | ||||||
|     Yap_opcount[_unify_l_y_var_write]; |     GLOBAL_opcount[_unify_l_y_var_write]; | ||||||
|   c_unify.nxval = |   c_unify.nxval = | ||||||
|     Yap_opcount[_unify_x_val] + |     GLOBAL_opcount[_unify_x_val] + | ||||||
|     Yap_opcount[_unify_x_loc] + |     GLOBAL_opcount[_unify_x_loc] + | ||||||
|     Yap_opcount[_glist_valx] + |     GLOBAL_opcount[_glist_valx] + | ||||||
|     Yap_opcount[_gl_void_valx] + |     GLOBAL_opcount[_gl_void_valx] + | ||||||
|     Yap_opcount[_unify_l_x_val] + |     GLOBAL_opcount[_unify_l_x_val] + | ||||||
|     Yap_opcount[_unify_l_x_loc] + |     GLOBAL_opcount[_unify_l_x_loc] + | ||||||
|     Yap_opcount[_unify_x_val_write] + |     GLOBAL_opcount[_unify_x_val_write] + | ||||||
|     Yap_opcount[_unify_x_loc_write] + |     GLOBAL_opcount[_unify_x_loc_write] + | ||||||
|     Yap_opcount[_unify_l_x_val_write] + |     GLOBAL_opcount[_unify_l_x_val_write] + | ||||||
|     Yap_opcount[_unify_l_x_loc_write]; |     GLOBAL_opcount[_unify_l_x_loc_write]; | ||||||
|   c_unify.nyval = |   c_unify.nyval = | ||||||
|     Yap_opcount[_unify_y_val] + |     GLOBAL_opcount[_unify_y_val] + | ||||||
|     Yap_opcount[_unify_y_loc] + |     GLOBAL_opcount[_unify_y_loc] + | ||||||
|     Yap_opcount[_glist_valy] + |     GLOBAL_opcount[_glist_valy] + | ||||||
|     Yap_opcount[_gl_void_valy] + |     GLOBAL_opcount[_gl_void_valy] + | ||||||
|     Yap_opcount[_unify_l_y_val] + |     GLOBAL_opcount[_unify_l_y_val] + | ||||||
|     Yap_opcount[_unify_l_y_loc] + |     GLOBAL_opcount[_unify_l_y_loc] + | ||||||
|     Yap_opcount[_unify_y_val_write] + |     GLOBAL_opcount[_unify_y_val_write] + | ||||||
|     Yap_opcount[_unify_y_loc_write] + |     GLOBAL_opcount[_unify_y_loc_write] + | ||||||
|     Yap_opcount[_unify_l_y_val_write] + |     GLOBAL_opcount[_unify_l_y_val_write] + | ||||||
|     Yap_opcount[_unify_l_y_loc_write]; |     GLOBAL_opcount[_unify_l_y_loc_write]; | ||||||
|   c_unify.ncons = |   c_unify.ncons = | ||||||
|     Yap_opcount[_unify_atom] + |     GLOBAL_opcount[_unify_atom] + | ||||||
|     Yap_opcount[_unify_n_atoms] + |     GLOBAL_opcount[_unify_n_atoms] + | ||||||
|     Yap_opcount[_unify_l_atom] + |     GLOBAL_opcount[_unify_l_atom] + | ||||||
|     Yap_opcount[_unify_atom_write] + |     GLOBAL_opcount[_unify_atom_write] + | ||||||
|     Yap_opcount[_unify_n_atoms_write] + |     GLOBAL_opcount[_unify_n_atoms_write] + | ||||||
|     Yap_opcount[_unify_l_atom_write]; |     GLOBAL_opcount[_unify_l_atom_write]; | ||||||
|   c_unify.nlist = |   c_unify.nlist = | ||||||
|     Yap_opcount[_unify_list] + |     GLOBAL_opcount[_unify_list] + | ||||||
|     Yap_opcount[_unify_l_list] + |     GLOBAL_opcount[_unify_l_list] + | ||||||
|     Yap_opcount[_unify_list_write] + |     GLOBAL_opcount[_unify_list_write] + | ||||||
|     Yap_opcount[_unify_l_list_write]; |     GLOBAL_opcount[_unify_l_list_write]; | ||||||
|   c_unify.nstru = |   c_unify.nstru = | ||||||
|     Yap_opcount[_unify_struct] + |     GLOBAL_opcount[_unify_struct] + | ||||||
|     Yap_opcount[_unify_l_struc] + |     GLOBAL_opcount[_unify_l_struc] + | ||||||
|     Yap_opcount[_unify_struct_write] + |     GLOBAL_opcount[_unify_struct_write] + | ||||||
|     Yap_opcount[_unify_l_struc_write]; |     GLOBAL_opcount[_unify_l_struc_write]; | ||||||
|   c_unify.nmisc = |   c_unify.nmisc = | ||||||
|     Yap_opcount[_pop] + |     GLOBAL_opcount[_pop] + | ||||||
|     Yap_opcount[_pop_n]; |     GLOBAL_opcount[_pop_n]; | ||||||
|  |  | ||||||
|   unifies = c_unify.nxvar + c_unify.nyvar + c_unify.nxval + c_unify.nyval + |   unifies = c_unify.nxvar + c_unify.nyvar + c_unify.nxval + c_unify.nyval + | ||||||
|     c_unify.ncons + c_unify.nlist + c_unify.nstru + c_unify.nmisc; |     c_unify.ncons + c_unify.nlist + c_unify.nstru + c_unify.nmisc; | ||||||
|  |  | ||||||
|   c_put.nxvar = |   c_put.nxvar = | ||||||
|     Yap_opcount[_put_x_var]; |     GLOBAL_opcount[_put_x_var]; | ||||||
|   c_put.nyvar = |   c_put.nyvar = | ||||||
|     Yap_opcount[_put_y_var]; |     GLOBAL_opcount[_put_y_var]; | ||||||
|   c_put.nxval = |   c_put.nxval = | ||||||
|     Yap_opcount[_put_x_val]+ |     GLOBAL_opcount[_put_x_val]+ | ||||||
|     2*Yap_opcount[_put_xx_val]; |     2*GLOBAL_opcount[_put_xx_val]; | ||||||
|   c_put.nyval = |   c_put.nyval = | ||||||
|     Yap_opcount[_put_y_val]; |     GLOBAL_opcount[_put_y_val]; | ||||||
|   c_put.ncons = |   c_put.ncons = | ||||||
|     Yap_opcount[_put_atom]; |     GLOBAL_opcount[_put_atom]; | ||||||
|   c_put.nlist = |   c_put.nlist = | ||||||
|     Yap_opcount[_put_list]; |     GLOBAL_opcount[_put_list]; | ||||||
|   c_put.nstru = |   c_put.nstru = | ||||||
|     Yap_opcount[_put_struct]; |     GLOBAL_opcount[_put_struct]; | ||||||
|  |  | ||||||
|   puts = c_put.nxvar + c_put.nyvar + c_put.nxval + c_put.nyval + |   puts = c_put.nxvar + c_put.nyvar + c_put.nxval + c_put.nyval + | ||||||
|     c_put.ncons + c_put.nlist + c_put.nstru; |     c_put.ncons + c_put.nlist + c_put.nstru; | ||||||
|  |  | ||||||
|   c_write.nxvar = |   c_write.nxvar = | ||||||
|     Yap_opcount[_write_x_var] + |     GLOBAL_opcount[_write_x_var] + | ||||||
|     Yap_opcount[_write_void] + |     GLOBAL_opcount[_write_void] + | ||||||
|     Yap_opcount[_write_n_voids]; |     GLOBAL_opcount[_write_n_voids]; | ||||||
|   c_write.nyvar = |   c_write.nyvar = | ||||||
|     Yap_opcount[_write_y_var]; |     GLOBAL_opcount[_write_y_var]; | ||||||
|   c_write.nxval = |   c_write.nxval = | ||||||
|     Yap_opcount[_write_x_val]; |     GLOBAL_opcount[_write_x_val]; | ||||||
|   c_write.nyval = |   c_write.nyval = | ||||||
|     Yap_opcount[_write_y_val]; |     GLOBAL_opcount[_write_y_val]; | ||||||
|   c_write.ncons = |   c_write.ncons = | ||||||
|     Yap_opcount[_write_atom]; |     GLOBAL_opcount[_write_atom]; | ||||||
|   c_write.nlist = |   c_write.nlist = | ||||||
|     Yap_opcount[_write_list]; |     GLOBAL_opcount[_write_list]; | ||||||
|   c_write.nstru = |   c_write.nstru = | ||||||
|     Yap_opcount[_write_struct]; |     GLOBAL_opcount[_write_struct]; | ||||||
|  |  | ||||||
|   writes = c_write.nxvar + c_write.nyvar + c_write.nxval + c_write.nyval + |   writes = c_write.nxvar + c_write.nyvar + c_write.nxval + c_write.nyval + | ||||||
|     c_write.ncons + c_write.nlist + c_write.nstru; |     c_write.ncons + c_write.nlist + c_write.nstru; | ||||||
|  |  | ||||||
|   c_control.nexecs = |   c_control.nexecs = | ||||||
|     Yap_opcount[_execute] + |     GLOBAL_opcount[_execute] + | ||||||
|     Yap_opcount[_dexecute]; |     GLOBAL_opcount[_dexecute]; | ||||||
|  |  | ||||||
|   c_control.ncalls = |   c_control.ncalls = | ||||||
|     Yap_opcount[_call] + |     GLOBAL_opcount[_call] + | ||||||
|     Yap_opcount[_fcall]; |     GLOBAL_opcount[_fcall]; | ||||||
|  |  | ||||||
|   c_control.nproceeds = |   c_control.nproceeds = | ||||||
|     Yap_opcount[_procceed]; |     GLOBAL_opcount[_procceed]; | ||||||
|  |  | ||||||
|   c_control.ncallbips = |   c_control.ncallbips = | ||||||
|     Yap_opcount[_call_cpred] + |     GLOBAL_opcount[_call_cpred] + | ||||||
|     Yap_opcount[_call_c_wfail] + |     GLOBAL_opcount[_call_c_wfail] + | ||||||
|     Yap_opcount[_try_c] + |     GLOBAL_opcount[_try_c] + | ||||||
|     Yap_opcount[_retry_c] + |     GLOBAL_opcount[_retry_c] + | ||||||
|     Yap_opcount[_op_fail] + |     GLOBAL_opcount[_op_fail] + | ||||||
|     Yap_opcount[_trust_fail] + |     GLOBAL_opcount[_trust_fail] + | ||||||
|     Yap_opcount[_p_atom_x] + |     GLOBAL_opcount[_p_atom_x] + | ||||||
|     Yap_opcount[_p_atom_y] + |     GLOBAL_opcount[_p_atom_y] + | ||||||
|     Yap_opcount[_p_atomic_x] + |     GLOBAL_opcount[_p_atomic_x] + | ||||||
|     Yap_opcount[_p_atomic_y] + |     GLOBAL_opcount[_p_atomic_y] + | ||||||
|     Yap_opcount[_p_compound_x] + |     GLOBAL_opcount[_p_compound_x] + | ||||||
|     Yap_opcount[_p_compound_y] + |     GLOBAL_opcount[_p_compound_y] + | ||||||
|     Yap_opcount[_p_float_x] + |     GLOBAL_opcount[_p_float_x] + | ||||||
|     Yap_opcount[_p_float_y] + |     GLOBAL_opcount[_p_float_y] + | ||||||
|     Yap_opcount[_p_integer_x] + |     GLOBAL_opcount[_p_integer_x] + | ||||||
|     Yap_opcount[_p_integer_y] + |     GLOBAL_opcount[_p_integer_y] + | ||||||
|     Yap_opcount[_p_nonvar_x] + |     GLOBAL_opcount[_p_nonvar_x] + | ||||||
|     Yap_opcount[_p_nonvar_y] + |     GLOBAL_opcount[_p_nonvar_y] + | ||||||
|     Yap_opcount[_p_number_x] + |     GLOBAL_opcount[_p_number_x] + | ||||||
|     Yap_opcount[_p_number_y] + |     GLOBAL_opcount[_p_number_y] + | ||||||
|     Yap_opcount[_p_var_x] + |     GLOBAL_opcount[_p_var_x] + | ||||||
|     Yap_opcount[_p_var_y] + |     GLOBAL_opcount[_p_var_y] + | ||||||
|     Yap_opcount[_p_db_ref_x] + |     GLOBAL_opcount[_p_db_ref_x] + | ||||||
|     Yap_opcount[_p_db_ref_y] + |     GLOBAL_opcount[_p_db_ref_y] + | ||||||
|     Yap_opcount[_p_cut_by_x] + |     GLOBAL_opcount[_p_cut_by_x] + | ||||||
|     Yap_opcount[_p_cut_by_y] + |     GLOBAL_opcount[_p_cut_by_y] + | ||||||
|     Yap_opcount[_p_primitive_x] + |     GLOBAL_opcount[_p_primitive_x] + | ||||||
|     Yap_opcount[_p_primitive_y] + |     GLOBAL_opcount[_p_primitive_y] + | ||||||
|     Yap_opcount[_p_equal] + |     GLOBAL_opcount[_p_equal] + | ||||||
|     Yap_opcount[_p_plus_vv] + |     GLOBAL_opcount[_p_plus_vv] + | ||||||
|     Yap_opcount[_p_plus_vc] + |     GLOBAL_opcount[_p_plus_vc] + | ||||||
|     Yap_opcount[_p_plus_y_vv] + |     GLOBAL_opcount[_p_plus_y_vv] + | ||||||
|     Yap_opcount[_p_plus_y_vc] + |     GLOBAL_opcount[_p_plus_y_vc] + | ||||||
|     Yap_opcount[_p_minus_vv] + |     GLOBAL_opcount[_p_minus_vv] + | ||||||
|     Yap_opcount[_p_minus_cv] + |     GLOBAL_opcount[_p_minus_cv] + | ||||||
|     Yap_opcount[_p_minus_y_vv] + |     GLOBAL_opcount[_p_minus_y_vv] + | ||||||
|     Yap_opcount[_p_minus_y_cv] + |     GLOBAL_opcount[_p_minus_y_cv] + | ||||||
|     Yap_opcount[_p_times_vv] + |     GLOBAL_opcount[_p_times_vv] + | ||||||
|     Yap_opcount[_p_times_vc] + |     GLOBAL_opcount[_p_times_vc] + | ||||||
|     Yap_opcount[_p_times_y_vv] + |     GLOBAL_opcount[_p_times_y_vv] + | ||||||
|     Yap_opcount[_p_times_y_vc] + |     GLOBAL_opcount[_p_times_y_vc] + | ||||||
|     Yap_opcount[_p_div_vv] + |     GLOBAL_opcount[_p_div_vv] + | ||||||
|     Yap_opcount[_p_div_vc] + |     GLOBAL_opcount[_p_div_vc] + | ||||||
|     Yap_opcount[_p_div_cv] + |     GLOBAL_opcount[_p_div_cv] + | ||||||
|     Yap_opcount[_p_div_y_vv] + |     GLOBAL_opcount[_p_div_y_vv] + | ||||||
|     Yap_opcount[_p_div_y_vc] + |     GLOBAL_opcount[_p_div_y_vc] + | ||||||
|     Yap_opcount[_p_div_y_cv] + |     GLOBAL_opcount[_p_div_y_cv] + | ||||||
|     Yap_opcount[_p_or_vv] + |     GLOBAL_opcount[_p_or_vv] + | ||||||
|     Yap_opcount[_p_or_vc] + |     GLOBAL_opcount[_p_or_vc] + | ||||||
|     Yap_opcount[_p_or_y_vv] + |     GLOBAL_opcount[_p_or_y_vv] + | ||||||
|     Yap_opcount[_p_or_y_vc] + |     GLOBAL_opcount[_p_or_y_vc] + | ||||||
|     Yap_opcount[_p_and_vv] + |     GLOBAL_opcount[_p_and_vv] + | ||||||
|     Yap_opcount[_p_and_vc] + |     GLOBAL_opcount[_p_and_vc] + | ||||||
|     Yap_opcount[_p_and_y_vv] + |     GLOBAL_opcount[_p_and_y_vv] + | ||||||
|     Yap_opcount[_p_and_y_vc] + |     GLOBAL_opcount[_p_and_y_vc] + | ||||||
|     Yap_opcount[_p_sll_vv] + |     GLOBAL_opcount[_p_sll_vv] + | ||||||
|     Yap_opcount[_p_sll_vc] + |     GLOBAL_opcount[_p_sll_vc] + | ||||||
|     Yap_opcount[_p_sll_y_vv] + |     GLOBAL_opcount[_p_sll_y_vv] + | ||||||
|     Yap_opcount[_p_sll_y_vc] + |     GLOBAL_opcount[_p_sll_y_vc] + | ||||||
|     Yap_opcount[_p_slr_vv] + |     GLOBAL_opcount[_p_slr_vv] + | ||||||
|     Yap_opcount[_p_slr_vc] + |     GLOBAL_opcount[_p_slr_vc] + | ||||||
|     Yap_opcount[_p_slr_y_vv] + |     GLOBAL_opcount[_p_slr_y_vv] + | ||||||
|     Yap_opcount[_p_slr_y_vc] + |     GLOBAL_opcount[_p_slr_y_vc] + | ||||||
|     Yap_opcount[_p_dif] + |     GLOBAL_opcount[_p_dif] + | ||||||
|     Yap_opcount[_p_eq] + |     GLOBAL_opcount[_p_eq] + | ||||||
|     Yap_opcount[_p_arg_vv] + |     GLOBAL_opcount[_p_arg_vv] + | ||||||
|     Yap_opcount[_p_arg_cv] + |     GLOBAL_opcount[_p_arg_cv] + | ||||||
|     Yap_opcount[_p_arg_y_vv] + |     GLOBAL_opcount[_p_arg_y_vv] + | ||||||
|     Yap_opcount[_p_arg_y_cv] + |     GLOBAL_opcount[_p_arg_y_cv] + | ||||||
|     Yap_opcount[_p_functor] + |     GLOBAL_opcount[_p_functor] + | ||||||
|     Yap_opcount[_p_func2s_vv] + |     GLOBAL_opcount[_p_func2s_vv] + | ||||||
|     Yap_opcount[_p_func2s_cv] + |     GLOBAL_opcount[_p_func2s_cv] + | ||||||
|     Yap_opcount[_p_func2s_vc] + |     GLOBAL_opcount[_p_func2s_vc] + | ||||||
|     Yap_opcount[_p_func2s_y_vv] + |     GLOBAL_opcount[_p_func2s_y_vv] + | ||||||
|     Yap_opcount[_p_func2s_y_cv] + |     GLOBAL_opcount[_p_func2s_y_cv] + | ||||||
|     Yap_opcount[_p_func2s_y_vc] + |     GLOBAL_opcount[_p_func2s_y_vc] + | ||||||
|     Yap_opcount[_p_func2f_xx] + |     GLOBAL_opcount[_p_func2f_xx] + | ||||||
|     Yap_opcount[_p_func2f_xy] + |     GLOBAL_opcount[_p_func2f_xy] + | ||||||
|     Yap_opcount[_p_func2f_yx] + |     GLOBAL_opcount[_p_func2f_yx] + | ||||||
|     Yap_opcount[_p_func2f_yy]; |     GLOBAL_opcount[_p_func2f_yy]; | ||||||
|  |  | ||||||
|   c_control.ncuts = |   c_control.ncuts = | ||||||
|     Yap_opcount[_cut] + |     GLOBAL_opcount[_cut] + | ||||||
|     Yap_opcount[_cut_t] + |     GLOBAL_opcount[_cut_t] + | ||||||
|     Yap_opcount[_cut_e] + |     GLOBAL_opcount[_cut_e] + | ||||||
|     Yap_opcount[_commit_b_x] + |     GLOBAL_opcount[_commit_b_x] + | ||||||
|     Yap_opcount[_commit_b_y]; |     GLOBAL_opcount[_commit_b_y]; | ||||||
|  |  | ||||||
|   c_control.nallocs = |   c_control.nallocs = | ||||||
|     Yap_opcount[_allocate] + |     GLOBAL_opcount[_allocate] + | ||||||
|     Yap_opcount[_fcall]; |     GLOBAL_opcount[_fcall]; | ||||||
|  |  | ||||||
|   c_control.ndeallocs = |   c_control.ndeallocs = | ||||||
|     Yap_opcount[_dexecute] + |     GLOBAL_opcount[_dexecute] + | ||||||
|     Yap_opcount[_deallocate]; |     GLOBAL_opcount[_deallocate]; | ||||||
|  |  | ||||||
|   controls = |   controls = | ||||||
|     c_control.nexecs + |     c_control.nexecs + | ||||||
| @@ -585,30 +583,30 @@ p_show_ops_by_group(void) | |||||||
|     c_control.ncuts + |     c_control.ncuts + | ||||||
|     c_control.nallocs + |     c_control.nallocs + | ||||||
|     c_control.ndeallocs + |     c_control.ndeallocs + | ||||||
|     Yap_opcount[_jump] + |     GLOBAL_opcount[_jump] + | ||||||
|     Yap_opcount[_move_back] + |     GLOBAL_opcount[_move_back] + | ||||||
|     Yap_opcount[_try_in]; |     GLOBAL_opcount[_try_in]; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   c_cp.ntries = |   c_cp.ntries = | ||||||
|     Yap_opcount[_try_me] + |     GLOBAL_opcount[_try_me] + | ||||||
|     Yap_opcount[_try_and_mark] + |     GLOBAL_opcount[_try_and_mark] + | ||||||
|     Yap_opcount[_try_c] + |     GLOBAL_opcount[_try_c] + | ||||||
|     Yap_opcount[_try_clause] + |     GLOBAL_opcount[_try_clause] + | ||||||
|     Yap_opcount[_either]; |     GLOBAL_opcount[_either]; | ||||||
|  |  | ||||||
|   c_cp.nretries = |   c_cp.nretries = | ||||||
|     Yap_opcount[_retry_me] + |     GLOBAL_opcount[_retry_me] + | ||||||
|     Yap_opcount[_retry_and_mark] + |     GLOBAL_opcount[_retry_and_mark] + | ||||||
|     Yap_opcount[_retry_c] + |     GLOBAL_opcount[_retry_c] + | ||||||
|     Yap_opcount[_retry] + |     GLOBAL_opcount[_retry] + | ||||||
|     Yap_opcount[_or_else]; |     GLOBAL_opcount[_or_else]; | ||||||
|  |  | ||||||
|   c_cp.ntrusts = |   c_cp.ntrusts = | ||||||
|     Yap_opcount[_trust_me] + |     GLOBAL_opcount[_trust_me] + | ||||||
|     Yap_opcount[_trust] + |     GLOBAL_opcount[_trust] + | ||||||
|     Yap_opcount[_or_last]; |     GLOBAL_opcount[_or_last]; | ||||||
|  |  | ||||||
|   choice_pts = |   choice_pts = | ||||||
|     c_cp.ntries + |     c_cp.ntries + | ||||||
| @@ -616,70 +614,70 @@ p_show_ops_by_group(void) | |||||||
|     c_cp.ntrusts; |     c_cp.ntrusts; | ||||||
|  |  | ||||||
|   indexes = |   indexes = | ||||||
|     Yap_opcount[_jump_if_var] + |     GLOBAL_opcount[_jump_if_var] + | ||||||
|     Yap_opcount[_switch_on_type] + |     GLOBAL_opcount[_switch_on_type] + | ||||||
|     Yap_opcount[_switch_list_nl] + |     GLOBAL_opcount[_switch_list_nl] + | ||||||
|     Yap_opcount[_switch_on_arg_type] + |     GLOBAL_opcount[_switch_on_arg_type] + | ||||||
|     Yap_opcount[_switch_on_sub_arg_type] + |     GLOBAL_opcount[_switch_on_sub_arg_type] + | ||||||
|     Yap_opcount[_switch_on_cons] + |     GLOBAL_opcount[_switch_on_cons] + | ||||||
|     Yap_opcount[_go_on_cons] + |     GLOBAL_opcount[_go_on_cons] + | ||||||
|     Yap_opcount[_if_cons] + |     GLOBAL_opcount[_if_cons] + | ||||||
|     Yap_opcount[_switch_on_func] + |     GLOBAL_opcount[_switch_on_func] + | ||||||
|     Yap_opcount[_go_on_func] + |     GLOBAL_opcount[_go_on_func] + | ||||||
|     Yap_opcount[_if_func] + |     GLOBAL_opcount[_if_func] + | ||||||
|     Yap_opcount[_if_not_then]; |     GLOBAL_opcount[_if_not_then]; | ||||||
|   misc = |   misc = | ||||||
|     c_control.ncallbips + |     c_control.ncallbips + | ||||||
|     Yap_opcount[_Ystop] + |     GLOBAL_opcount[_Ystop] + | ||||||
|     Yap_opcount[_Nstop] + |     GLOBAL_opcount[_Nstop] + | ||||||
|     Yap_opcount[_index_pred] + |     GLOBAL_opcount[_index_pred] + | ||||||
|     Yap_opcount[_lock_pred] + |     GLOBAL_opcount[_lock_pred] + | ||||||
| #if THREADS | #if THREADS | ||||||
|     Yap_opcount[_thread_local] + |     GLOBAL_opcount[_thread_local] + | ||||||
| #endif | #endif | ||||||
|     Yap_opcount[_save_b_x] + |     GLOBAL_opcount[_save_b_x] + | ||||||
|     Yap_opcount[_save_b_y] + |     GLOBAL_opcount[_save_b_y] + | ||||||
|     Yap_opcount[_undef_p] + |     GLOBAL_opcount[_undef_p] + | ||||||
|     Yap_opcount[_spy_pred] + |     GLOBAL_opcount[_spy_pred] + | ||||||
|     Yap_opcount[_spy_or_trymark] + |     GLOBAL_opcount[_spy_or_trymark] + | ||||||
|     Yap_opcount[_save_pair_x] + |     GLOBAL_opcount[_save_pair_x] + | ||||||
|     Yap_opcount[_save_pair_y] + |     GLOBAL_opcount[_save_pair_y] + | ||||||
|     Yap_opcount[_save_pair_x_write] + |     GLOBAL_opcount[_save_pair_x_write] + | ||||||
|     Yap_opcount[_save_pair_y_write] + |     GLOBAL_opcount[_save_pair_y_write] + | ||||||
|     Yap_opcount[_save_appl_x] + |     GLOBAL_opcount[_save_appl_x] + | ||||||
|     Yap_opcount[_save_appl_y] + |     GLOBAL_opcount[_save_appl_y] + | ||||||
|     Yap_opcount[_save_appl_x_write] + |     GLOBAL_opcount[_save_appl_x_write] + | ||||||
|     Yap_opcount[_save_appl_y_write]; |     GLOBAL_opcount[_save_appl_y_write]; | ||||||
|   total = gets + unifies + puts + writes + controls + choice_pts + indexes + misc; |   total = gets + unifies + puts + writes + controls + choice_pts + indexes + misc; | ||||||
|  |  | ||||||
|   /*  for (i = 0; i <= _std_top; ++i) |   /*  for (i = 0; i <= _std_top; ++i) | ||||||
|    * print_instruction(i); |    * print_instruction(i); | ||||||
|    */ |    */ | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "Groups are\n\n"); |   fprintf(GLOBAL_stderr, "Groups are\n\n"); | ||||||
|   fprintf(Yap_stderr, "  GET               instructions: %8d (%3d%%)\n", gets, |   fprintf(GLOBAL_stderr, "  GET               instructions: %8d (%3d%%)\n", gets, | ||||||
| 	     (gets * 100) / total); | 	     (gets * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  UNIFY             instructions: %8d (%3d%%)\n", unifies, |   fprintf(GLOBAL_stderr, "  UNIFY             instructions: %8d (%3d%%)\n", unifies, | ||||||
| 	     (unifies * 100) / total); | 	     (unifies * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  PUT               instructions: %8d (%3d%%)\n", puts, |   fprintf(GLOBAL_stderr, "  PUT               instructions: %8d (%3d%%)\n", puts, | ||||||
| 	     (puts * 100) / total); | 	     (puts * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  WRITE             instructions: %8d (%3d%%)\n", writes, |   fprintf(GLOBAL_stderr, "  WRITE             instructions: %8d (%3d%%)\n", writes, | ||||||
| 	     (writes * 100) / total); | 	     (writes * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  CONTROL           instructions: %8d (%3d%%)\n", controls, |   fprintf(GLOBAL_stderr, "  CONTROL           instructions: %8d (%3d%%)\n", controls, | ||||||
| 	     (controls * 100) / total); | 	     (controls * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  CHOICE POINT      instructions: %8d (%3d%%)\n", choice_pts, |   fprintf(GLOBAL_stderr, "  CHOICE POINT      instructions: %8d (%3d%%)\n", choice_pts, | ||||||
| 	     (choice_pts * 100) / total); | 	     (choice_pts * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  INDEXING          instructions: %8d (%3d%%)\n", indexes, |   fprintf(GLOBAL_stderr, "  INDEXING          instructions: %8d (%3d%%)\n", indexes, | ||||||
| 	     (indexes * 100) / total); | 	     (indexes * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  MISCELLANEOUS     instructions: %8d (%3d%%)\n", misc, |   fprintf(GLOBAL_stderr, "  MISCELLANEOUS     instructions: %8d (%3d%%)\n", misc, | ||||||
| 	     (misc * 100) / total); | 	     (misc * 100) / total); | ||||||
|   fprintf(Yap_stderr, "_______________________________________________\n"); |   fprintf(GLOBAL_stderr, "_______________________________________________\n"); | ||||||
|   fprintf(Yap_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, |   fprintf(GLOBAL_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, | ||||||
| 	     (total * 100) / total); | 	     (total * 100) / total); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Analysis of Unification Instructions in %s \n", program); |   fprintf(GLOBAL_stderr, "\n Analysis of Unification Instructions in %s \n", program); | ||||||
|   fprintf(Yap_stderr, "           XVAR,   YVAR,    XVAL,    YVAL,     CONS,     LIST,  STRUCT\n"); |   fprintf(GLOBAL_stderr, "           XVAR,   YVAR,    XVAL,    YVAL,     CONS,     LIST,  STRUCT\n"); | ||||||
|   fprintf(Yap_stderr, "  GET: %8d %8d %8d %8d %8d %8d %8d\n", |   fprintf(GLOBAL_stderr, "  GET: %8d %8d %8d %8d %8d %8d %8d\n", | ||||||
| 	     c_get.nxvar, | 	     c_get.nxvar, | ||||||
| 	     c_get.nyvar, | 	     c_get.nyvar, | ||||||
| 	     c_get.nxval, | 	     c_get.nxval, | ||||||
| @@ -687,7 +685,7 @@ p_show_ops_by_group(void) | |||||||
| 	     c_get.ncons, | 	     c_get.ncons, | ||||||
| 	     c_get.nlist, | 	     c_get.nlist, | ||||||
| 	     c_get.nstru); | 	     c_get.nstru); | ||||||
|   fprintf(Yap_stderr, "UNIFY: %8d %8d %8d %8d %8d %8d %8d\n", |   fprintf(GLOBAL_stderr, "UNIFY: %8d %8d %8d %8d %8d %8d %8d\n", | ||||||
| 	     c_unify.nxvar, | 	     c_unify.nxvar, | ||||||
| 	     c_unify.nyvar, | 	     c_unify.nyvar, | ||||||
| 	     c_unify.nxval, | 	     c_unify.nxval, | ||||||
| @@ -695,7 +693,7 @@ p_show_ops_by_group(void) | |||||||
| 	     c_unify.ncons, | 	     c_unify.ncons, | ||||||
| 	     c_unify.nlist, | 	     c_unify.nlist, | ||||||
| 	     c_unify.nstru); | 	     c_unify.nstru); | ||||||
|   fprintf(Yap_stderr, "  PUT: %8d %8d %8d %8d %8d %8d %8d\n", |   fprintf(GLOBAL_stderr, "  PUT: %8d %8d %8d %8d %8d %8d %8d\n", | ||||||
| 	     c_put.nxvar, | 	     c_put.nxvar, | ||||||
| 	     c_put.nyvar, | 	     c_put.nyvar, | ||||||
| 	     c_put.nxval, | 	     c_put.nxval, | ||||||
| @@ -703,7 +701,7 @@ p_show_ops_by_group(void) | |||||||
| 	     c_put.ncons, | 	     c_put.ncons, | ||||||
| 	     c_put.nlist, | 	     c_put.nlist, | ||||||
| 	     c_put.nstru); | 	     c_put.nstru); | ||||||
|   fprintf(Yap_stderr, "WRITE: %8d %8d %8d %8d %8d %8d %8d\n", |   fprintf(GLOBAL_stderr, "WRITE: %8d %8d %8d %8d %8d %8d %8d\n", | ||||||
| 	     c_write.nxvar, | 	     c_write.nxvar, | ||||||
| 	     c_write.nyvar, | 	     c_write.nyvar, | ||||||
| 	     c_write.nxval, | 	     c_write.nxval, | ||||||
| @@ -711,8 +709,8 @@ p_show_ops_by_group(void) | |||||||
| 	     c_write.ncons, | 	     c_write.ncons, | ||||||
| 	     c_write.nlist, | 	     c_write.nlist, | ||||||
| 	     c_write.nstru); | 	     c_write.nstru); | ||||||
|   fprintf(Yap_stderr, "      ___________________________________________________\n"); |   fprintf(GLOBAL_stderr, "      ___________________________________________________\n"); | ||||||
|   fprintf(Yap_stderr, "TOTAL: %8d %8d %8d %8d %8d %8d %8d\n", |   fprintf(GLOBAL_stderr, "TOTAL: %8d %8d %8d %8d %8d %8d %8d\n", | ||||||
| 	     c_get.nxvar + c_unify.nxvar + c_put.nxvar + c_write.nxvar, | 	     c_get.nxvar + c_unify.nxvar + c_put.nxvar + c_write.nxvar, | ||||||
| 	     c_get.nyvar + c_unify.nyvar + c_put.nyvar + c_write.nyvar, | 	     c_get.nyvar + c_unify.nyvar + c_put.nyvar + c_write.nyvar, | ||||||
| 	     c_get.nxval + c_unify.nxval + c_put.nxval + c_write.nxval, | 	     c_get.nxval + c_unify.nxval + c_put.nxval + c_write.nxval, | ||||||
| @@ -722,9 +720,9 @@ p_show_ops_by_group(void) | |||||||
| 	     c_get.nstru + c_unify.nstru + c_put.nstru + c_write.nstru | 	     c_get.nstru + c_unify.nstru + c_put.nstru + c_write.nstru | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Analysis of Unification Instructions in %s \n", program); |   fprintf(GLOBAL_stderr, "\n Analysis of Unification Instructions in %s \n", program); | ||||||
|   fprintf(Yap_stderr, "           XVAR,   YVAR,    XVAL,    YVAL,     CONS,     LIST,  STRUCT\n"); |   fprintf(GLOBAL_stderr, "           XVAR,   YVAR,    XVAL,    YVAL,     CONS,     LIST,  STRUCT\n"); | ||||||
|   fprintf(Yap_stderr, "  GET:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", |   fprintf(GLOBAL_stderr, "  GET:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", | ||||||
| 	     (((double) c_get.nxvar) * 100) / total, | 	     (((double) c_get.nxvar) * 100) / total, | ||||||
| 	     (((double) c_get.nyvar) * 100) / total, | 	     (((double) c_get.nyvar) * 100) / total, | ||||||
| 	     (((double) c_get.nxval) * 100) / total, | 	     (((double) c_get.nxval) * 100) / total, | ||||||
| @@ -732,7 +730,7 @@ p_show_ops_by_group(void) | |||||||
| 	     (((double) c_get.ncons) * 100) / total, | 	     (((double) c_get.ncons) * 100) / total, | ||||||
| 	     (((double) c_get.nlist) * 100) / total, | 	     (((double) c_get.nlist) * 100) / total, | ||||||
| 	     (((double) c_get.nstru) * 100) / total); | 	     (((double) c_get.nstru) * 100) / total); | ||||||
|   fprintf(Yap_stderr, "UNIFY:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", |   fprintf(GLOBAL_stderr, "UNIFY:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", | ||||||
| 	     (((double) c_unify.nxvar) * 100) / total, | 	     (((double) c_unify.nxvar) * 100) / total, | ||||||
| 	     (((double) c_unify.nyvar) * 100) / total, | 	     (((double) c_unify.nyvar) * 100) / total, | ||||||
| 	     (((double) c_unify.nxval) * 100) / total, | 	     (((double) c_unify.nxval) * 100) / total, | ||||||
| @@ -740,7 +738,7 @@ p_show_ops_by_group(void) | |||||||
| 	     (((double) c_unify.ncons) * 100) / total, | 	     (((double) c_unify.ncons) * 100) / total, | ||||||
| 	     (((double) c_unify.nlist) * 100) / total, | 	     (((double) c_unify.nlist) * 100) / total, | ||||||
| 	     (((double) c_unify.nstru) * 100) / total); | 	     (((double) c_unify.nstru) * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  PUT:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", |   fprintf(GLOBAL_stderr, "  PUT:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", | ||||||
| 	     (((double) c_put.nxvar) * 100) / total, | 	     (((double) c_put.nxvar) * 100) / total, | ||||||
| 	     (((double) c_put.nyvar) * 100) / total, | 	     (((double) c_put.nyvar) * 100) / total, | ||||||
| 	     (((double) c_put.nxval) * 100) / total, | 	     (((double) c_put.nxval) * 100) / total, | ||||||
| @@ -748,7 +746,7 @@ p_show_ops_by_group(void) | |||||||
| 	     (((double) c_put.ncons) * 100) / total, | 	     (((double) c_put.ncons) * 100) / total, | ||||||
| 	     (((double) c_put.nlist) * 100) / total, | 	     (((double) c_put.nlist) * 100) / total, | ||||||
| 	     (((double) c_put.nstru) * 100) / total); | 	     (((double) c_put.nstru) * 100) / total); | ||||||
|   fprintf(Yap_stderr, "WRITE:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", |   fprintf(GLOBAL_stderr, "WRITE:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", | ||||||
| 	     (((double) c_write.nxvar) * 100) / total, | 	     (((double) c_write.nxvar) * 100) / total, | ||||||
| 	     (((double) c_write.nyvar) * 100) / total, | 	     (((double) c_write.nyvar) * 100) / total, | ||||||
| 	     (((double) c_write.nxval) * 100) / total, | 	     (((double) c_write.nxval) * 100) / total, | ||||||
| @@ -756,8 +754,8 @@ p_show_ops_by_group(void) | |||||||
| 	     (((double) c_write.ncons) * 100) / total, | 	     (((double) c_write.ncons) * 100) / total, | ||||||
| 	     (((double) c_write.nlist) * 100) / total, | 	     (((double) c_write.nlist) * 100) / total, | ||||||
| 	     (((double) c_write.nstru) * 100) / total); | 	     (((double) c_write.nstru) * 100) / total); | ||||||
|   fprintf(Yap_stderr, "      ___________________________________________________\n"); |   fprintf(GLOBAL_stderr, "      ___________________________________________________\n"); | ||||||
|   fprintf(Yap_stderr, "TOTAL:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", |   fprintf(GLOBAL_stderr, "TOTAL:  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%  %3.2f%%\n", | ||||||
| 	     (((double) c_get.nxvar + c_unify.nxvar + c_put.nxvar + c_write.nxvar) * 100) / total, | 	     (((double) c_get.nxvar + c_unify.nxvar + c_put.nxvar + c_write.nxvar) * 100) / total, | ||||||
| 	     (((double) c_get.nyvar + c_unify.nyvar + c_put.nyvar + c_write.nyvar) * 100) / total, | 	     (((double) c_get.nyvar + c_unify.nyvar + c_put.nyvar + c_write.nyvar) * 100) / total, | ||||||
| 	     (((double) c_get.nxval + c_unify.nxval + c_put.nxval + c_write.nxval) * 100) / total, | 	     (((double) c_get.nxval + c_unify.nxval + c_put.nxval + c_write.nxval) * 100) / total, | ||||||
| @@ -767,36 +765,36 @@ p_show_ops_by_group(void) | |||||||
| 	     (((double) c_get.nstru + c_unify.nstru + c_put.nstru + c_write.nstru) * 100) / total | 	     (((double) c_get.nstru + c_unify.nstru + c_put.nstru + c_write.nstru) * 100) / total | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Control Instructions Executed in %s \n", program); |   fprintf(GLOBAL_stderr, "\n Control Instructions Executed in %s \n", program); | ||||||
|   fprintf(Yap_stderr, "Grouped as\n\n"); |   fprintf(GLOBAL_stderr, "Grouped as\n\n"); | ||||||
|   fprintf(Yap_stderr, "  CALL              instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  CALL              instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.ncalls, (c_control.ncalls * 100) / total); | 	     c_control.ncalls, (c_control.ncalls * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  PROCEED           instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  PROCEED           instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.nproceeds, (c_control.nproceeds * 100) / total); | 	     c_control.nproceeds, (c_control.nproceeds * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  EXECUTE           instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  EXECUTE           instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.nexecs, (c_control.nexecs * 100) / total); | 	     c_control.nexecs, (c_control.nexecs * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  CUT               instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  CUT               instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.ncuts, (c_control.ncuts * 100) / total); | 	     c_control.ncuts, (c_control.ncuts * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  CALL_BIP          instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  CALL_BIP          instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.ncallbips, (c_control.ncallbips * 100) / total); | 	     c_control.ncallbips, (c_control.ncallbips * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  ALLOCATE          instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  ALLOCATE          instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.nallocs, (c_control.nallocs * 100) / total); | 	     c_control.nallocs, (c_control.nallocs * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  DEALLOCATE        instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  DEALLOCATE        instructions: %8d (%3d%%)\n", | ||||||
| 	     c_control.ndeallocs, (c_control.ndeallocs * 100) / total); | 	     c_control.ndeallocs, (c_control.ndeallocs * 100) / total); | ||||||
|   fprintf(Yap_stderr, "_______________________________________________\n"); |   fprintf(GLOBAL_stderr, "_______________________________________________\n"); | ||||||
|   fprintf(Yap_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, |   fprintf(GLOBAL_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, | ||||||
| 	     (total * 100) / total); | 	     (total * 100) / total); | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "\n Choice Point Manipulation Instructions Executed in %s \n", program); |   fprintf(GLOBAL_stderr, "\n Choice Point Manipulation Instructions Executed in %s \n", program); | ||||||
|   fprintf(Yap_stderr, "Grouped as\n\n"); |   fprintf(GLOBAL_stderr, "Grouped as\n\n"); | ||||||
|   fprintf(Yap_stderr, "  TRY              instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  TRY              instructions: %8d (%3d%%)\n", | ||||||
| 	     c_cp.ntries, (c_cp.ntries * 100) / total); | 	     c_cp.ntries, (c_cp.ntries * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  RETRY            instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  RETRY            instructions: %8d (%3d%%)\n", | ||||||
| 	     c_cp.nretries, (c_cp.nretries * 100) / total); | 	     c_cp.nretries, (c_cp.nretries * 100) / total); | ||||||
|   fprintf(Yap_stderr, "  TRUST            instructions: %8d (%3d%%)\n", |   fprintf(GLOBAL_stderr, "  TRUST            instructions: %8d (%3d%%)\n", | ||||||
| 	     c_cp.ntrusts, (c_cp.ntrusts * 100) / total); | 	     c_cp.ntrusts, (c_cp.ntrusts * 100) / total); | ||||||
|   fprintf(Yap_stderr, "_______________________________________________\n"); |   fprintf(GLOBAL_stderr, "_______________________________________________\n"); | ||||||
|   fprintf(Yap_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, |   fprintf(GLOBAL_stderr, "   TOTAL            instructions: %8d (%3d%%)\n\n", total, | ||||||
| 	     (total * 100) / total); | 	     (total * 100) / total); | ||||||
|  |  | ||||||
|   return TRUE; |   return TRUE; | ||||||
| @@ -828,7 +826,7 @@ p_show_sequences(void) | |||||||
|     return FALSE; |     return FALSE; | ||||||
|   } |   } | ||||||
|   for (i = 0; i <= _std_top; ++i) { |   for (i = 0; i <= _std_top; ++i) { | ||||||
|     sum += Yap_opcount[i]; |     sum += GLOBAL_opcount[i]; | ||||||
|   } |   } | ||||||
|   for (i = 0; i <= _std_top; ++i) { |   for (i = 0; i <= _std_top; ++i) { | ||||||
|     for (j = 0; j <= _std_top; ++j) { |     for (j = 0; j <= _std_top; ++j) { | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								C/arrays.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								C/arrays.c
									
									
									
									
									
								
							| @@ -158,12 +158,11 @@ typedef struct MMAP_ARRAY_BLOCK { | |||||||
|   struct MMAP_ARRAY_BLOCK *next; |   struct MMAP_ARRAY_BLOCK *next; | ||||||
| } mmap_array_block; | } mmap_array_block; | ||||||
|  |  | ||||||
| static mmap_array_block *mmap_arrays = NULL; |  | ||||||
|  |  | ||||||
| static Int | static Int | ||||||
| CloseMmappedArray(StaticArrayEntry *pp, void *area USES_REGS) | CloseMmappedArray(StaticArrayEntry *pp, void *area USES_REGS) | ||||||
| { | { | ||||||
|   mmap_array_block *ptr = mmap_arrays, *optr = mmap_arrays; |   mmap_array_block *ptr = GLOBAL_mmap_arrays, *optr = GLOBAL_mmap_arrays; | ||||||
|  |  | ||||||
|   while (ptr != NULL && ptr->start != area) { |   while (ptr != NULL && ptr->start != area) { | ||||||
|     ptr = ptr->next; |     ptr = ptr->next; | ||||||
| @@ -193,7 +192,7 @@ CloseMmappedArray(StaticArrayEntry *pp, void *area USES_REGS) | |||||||
| static void | static void | ||||||
| ResizeMmappedArray(StaticArrayEntry *pp, Int dim, void *area USES_REGS) | ResizeMmappedArray(StaticArrayEntry *pp, Int dim, void *area USES_REGS) | ||||||
| { | { | ||||||
|   mmap_array_block *ptr = mmap_arrays; |   mmap_array_block *ptr = GLOBAL_mmap_arrays; | ||||||
|   size_t total_size;  |   size_t total_size;  | ||||||
|   while (ptr != NULL && ptr->start != area) { |   while (ptr != NULL && ptr->start != area) { | ||||||
|     ptr = ptr->next; |     ptr = ptr->next; | ||||||
| @@ -1383,8 +1382,8 @@ p_create_mmapped_array( USES_REGS1 ) | |||||||
|       ptr->items = size; |       ptr->items = size; | ||||||
|       ptr->start = (void *)array_addr; |       ptr->start = (void *)array_addr; | ||||||
|       ptr->fd = fd; |       ptr->fd = fd; | ||||||
|       ptr->next = mmap_arrays; |       ptr->next = GLOBAL_mmap_arrays; | ||||||
|       mmap_arrays = ptr; |       GLOBAL_mmap_arrays = ptr; | ||||||
|       WRITE_UNLOCK(pp->ArRWLock); |       WRITE_UNLOCK(pp->ArRWLock); | ||||||
|       WRITE_UNLOCK(ae->ARWLock); |       WRITE_UNLOCK(ae->ARWLock); | ||||||
|       return TRUE; |       return TRUE; | ||||||
| @@ -2244,7 +2243,7 @@ static Int | |||||||
| p_sync_mmapped_arrays( USES_REGS1 ) | p_sync_mmapped_arrays( USES_REGS1 ) | ||||||
| { | { | ||||||
| #ifdef HAVE_MMAP | #ifdef HAVE_MMAP | ||||||
|   mmap_array_block *ptr = mmap_arrays; |   mmap_array_block *ptr = GLOBAL_mmap_arrays; | ||||||
|   while (ptr != NULL) { |   while (ptr != NULL) { | ||||||
|     msync(ptr->start, ptr->size, MS_SYNC); |     msync(ptr->start, ptr->size, MS_SYNC); | ||||||
|     ptr = ptr->next; |     ptr = ptr->next; | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								C/attvar.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								C/attvar.c
									
									
									
									
									
								
							| @@ -1044,11 +1044,11 @@ void Yap_InitAttVarPreds(void) | |||||||
|   Term OldCurrentModule = CurrentModule; |   Term OldCurrentModule = CurrentModule; | ||||||
|   CurrentModule = ATTRIBUTES_MODULE; |   CurrentModule = ATTRIBUTES_MODULE; | ||||||
| #ifdef COROUTINING | #ifdef COROUTINING | ||||||
|   attas[attvars_ext].bind_op = WakeAttVar; |   GLOBAL_attas[attvars_ext].bind_op = WakeAttVar; | ||||||
|   attas[attvars_ext].copy_term_op = CopyAttVar; |   GLOBAL_attas[attvars_ext].copy_term_op = CopyAttVar; | ||||||
|   attas[attvars_ext].to_term_op = AttVarToTerm; |   GLOBAL_attas[attvars_ext].to_term_op = AttVarToTerm; | ||||||
|   attas[attvars_ext].term_to_op = TermToAttVar; |   GLOBAL_attas[attvars_ext].term_to_op = TermToAttVar; | ||||||
|   attas[attvars_ext].mark_op = mark_attvar; |   GLOBAL_attas[attvars_ext].mark_op = mark_attvar; | ||||||
|   Yap_InitCPred("get_att", 4, p_get_att, SafePredFlag); |   Yap_InitCPred("get_att", 4, p_get_att, SafePredFlag); | ||||||
|   Yap_InitCPred("get_module_atts", 2, p_get_atts, SafePredFlag); |   Yap_InitCPred("get_module_atts", 2, p_get_atts, SafePredFlag); | ||||||
|   Yap_InitCPred("has_module_atts", 2, p_has_atts, SafePredFlag); |   Yap_InitCPred("has_module_atts", 2, p_has_atts, SafePredFlag); | ||||||
|   | |||||||
| @@ -2138,9 +2138,9 @@ run_emulator(YAP_dogoalinfo *dgi) | |||||||
|   int out; |   int out; | ||||||
|   BACKUP_MACHINE_REGS(); |   BACKUP_MACHINE_REGS(); | ||||||
|  |  | ||||||
|   Yap_PrologMode = UserMode; |   LOCAL_PrologMode = UserMode; | ||||||
|   out = Yap_absmi(0); |   out = Yap_absmi(0); | ||||||
|   Yap_PrologMode = UserCCallMode; |   LOCAL_PrologMode = UserCCallMode; | ||||||
|   myB = (choiceptr)(LCL0-dgi->b); |   myB = (choiceptr)(LCL0-dgi->b); | ||||||
|   CP = myB->cp_cp; |   CP = myB->cp_cp; | ||||||
|   if (!out ) { |   if (!out ) { | ||||||
| @@ -2274,9 +2274,9 @@ YAP_RunGoal(Term t) | |||||||
|   BACKUP_MACHINE_REGS(); |   BACKUP_MACHINE_REGS(); | ||||||
|  |  | ||||||
|   LOCAL_AllowRestart = FALSE; |   LOCAL_AllowRestart = FALSE; | ||||||
|   Yap_PrologMode = UserMode; |   LOCAL_PrologMode = UserMode; | ||||||
|   out = Yap_RunTopGoal(t); |   out = Yap_RunTopGoal(t); | ||||||
|   Yap_PrologMode = UserCCallMode; |   LOCAL_PrologMode = UserCCallMode; | ||||||
|   if (out) { |   if (out) { | ||||||
|     P = (yamop *)ENV[E_CP]; |     P = (yamop *)ENV[E_CP]; | ||||||
|     ENV = (CELL *)ENV[E_E]; |     ENV = (CELL *)ENV[E_E]; | ||||||
| @@ -2300,9 +2300,9 @@ YAP_RunGoalOnce(Term t) | |||||||
|   yamop *old_CP = CP; |   yamop *old_CP = CP; | ||||||
|   BACKUP_MACHINE_REGS(); |   BACKUP_MACHINE_REGS(); | ||||||
|  |  | ||||||
|   Yap_PrologMode = UserMode; |   LOCAL_PrologMode = UserMode; | ||||||
|   out = Yap_RunTopGoal(t); |   out = Yap_RunTopGoal(t); | ||||||
|   Yap_PrologMode = UserCCallMode; |   LOCAL_PrologMode = UserCCallMode; | ||||||
|   if (out) { |   if (out) { | ||||||
|     choiceptr cut_pt; |     choiceptr cut_pt; | ||||||
|  |  | ||||||
| @@ -2338,9 +2338,9 @@ YAP_RestartGoal(void) | |||||||
|   if (LOCAL_AllowRestart) { |   if (LOCAL_AllowRestart) { | ||||||
|     P = (yamop *)FAILCODE; |     P = (yamop *)FAILCODE; | ||||||
|     do_putcf = myputc; |     do_putcf = myputc; | ||||||
|     Yap_PrologMode = UserMode; |     LOCAL_PrologMode = UserMode; | ||||||
|     out = Yap_exec_absmi(TRUE); |     out = Yap_exec_absmi(TRUE); | ||||||
|     Yap_PrologMode = UserCCallMode; |     LOCAL_PrologMode = UserCCallMode; | ||||||
|     if (out == FALSE) { |     if (out == FALSE) { | ||||||
|       /* cleanup */ |       /* cleanup */ | ||||||
|       Yap_CloseSlots( PASS_REGS1 ); |       Yap_CloseSlots( PASS_REGS1 ); | ||||||
| @@ -2396,12 +2396,13 @@ YAP_ShutdownGoal(int backtrack) | |||||||
| X_API int | X_API int | ||||||
| YAP_ContinueGoal(void) | YAP_ContinueGoal(void) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
|   int out; |   int out; | ||||||
|   BACKUP_MACHINE_REGS(); |   BACKUP_MACHINE_REGS(); | ||||||
|  |  | ||||||
|   Yap_PrologMode = UserMode; |   LOCAL_PrologMode = UserMode; | ||||||
|   out = Yap_exec_absmi(TRUE); |   out = Yap_exec_absmi(TRUE); | ||||||
|   Yap_PrologMode = UserCCallMode; |   LOCAL_PrologMode = UserCCallMode; | ||||||
|  |  | ||||||
|   RECOVER_MACHINE_REGS(); |   RECOVER_MACHINE_REGS(); | ||||||
|   return(out); |   return(out); | ||||||
| @@ -2708,14 +2709,16 @@ YAP_Init(YAP_init_args *yap_init) | |||||||
|   CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0; |   CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0; | ||||||
|   static char boot_file[256]; |   static char boot_file[256]; | ||||||
|  |  | ||||||
|   /* Init signal handling, time and memory page size, required by later functions */ |   Yap_InitPageSize(); | ||||||
|   Yap_InitSysbits (); |   //Yap_InitSysbits(); | ||||||
| #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | ||||||
|   Yap_init_yapor_global_local_memory(); |   Yap_init_yapor_global_local_memory(); | ||||||
|   LOCAL = REMOTE(0); |   LOCAL = REMOTE(0); | ||||||
| #endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */ | #endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */ | ||||||
|   Yap_argv = yap_init->Argv; | /* Init signal handling, time and memory page size, required by later functions */ | ||||||
|   Yap_argc = yap_init->Argc; |   Yap_InitSysbits(); | ||||||
|  |   GLOBAL_argv = yap_init->Argv; | ||||||
|  |   GLOBAL_argc = yap_init->Argc; | ||||||
| #if !BOOT_FROM_SAVED_STATE | #if !BOOT_FROM_SAVED_STATE | ||||||
|   if (yap_init->SavedState) { |   if (yap_init->SavedState) { | ||||||
|     fprintf(stderr,"[ WARNING: threaded YAP will ignore saved state %s ]\n",yap_init->SavedState); |     fprintf(stderr,"[ WARNING: threaded YAP will ignore saved state %s ]\n",yap_init->SavedState); | ||||||
| @@ -2760,7 +2763,7 @@ YAP_Init(YAP_init_args *yap_init) | |||||||
|   } else { |   } else { | ||||||
|     Heap = yap_init->HeapSize; |     Heap = yap_init->HeapSize; | ||||||
|   } |   } | ||||||
|   Yap_PrologShouldHandleInterrupts = yap_init->PrologShouldHandleInterrupts; |   GLOBAL_PrologShouldHandleInterrupts = yap_init->PrologShouldHandleInterrupts; | ||||||
|   Yap_InitWorkspace(Heap, Stack, Trail, Atts, |   Yap_InitWorkspace(Heap, Stack, Trail, Atts, | ||||||
| 	      yap_init->MaxTableSpaceSize, | 	      yap_init->MaxTableSpaceSize, | ||||||
| 	      yap_init->NumberWorkers, | 	      yap_init->NumberWorkers, | ||||||
| @@ -3056,7 +3059,7 @@ X_API void | |||||||
| YAP_SetOutputMessage(void) | YAP_SetOutputMessage(void) | ||||||
| { | { | ||||||
| #if DEBUG | #if DEBUG | ||||||
|   Yap_output_msg = TRUE; |   GLOBAL_output_msg = TRUE; | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -3096,11 +3099,12 @@ YAP_Throw(Term t) | |||||||
|  |  | ||||||
| X_API void | X_API void | ||||||
| YAP_AsyncThrow(Term t) | YAP_AsyncThrow(Term t) | ||||||
| { | {  | ||||||
|  |   CACHE_REGS | ||||||
|   BACKUP_MACHINE_REGS(); |   BACKUP_MACHINE_REGS(); | ||||||
|   Yap_PrologMode |= AsyncIntMode; |   LOCAL_PrologMode |= AsyncIntMode; | ||||||
|   Yap_JumpToEnv(t); |   Yap_JumpToEnv(t); | ||||||
|   Yap_PrologMode &= ~AsyncIntMode; |   LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|   RECOVER_MACHINE_REGS(); |   RECOVER_MACHINE_REGS(); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -958,7 +958,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc) | |||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Term tmod = ap->ModuleOfPred; |     Term tmod = ap->ModuleOfPred; | ||||||
|     if (!tmod) |     if (!tmod) | ||||||
|       tmod = TermProlog; |       tmod = TermProlog; | ||||||
| @@ -1017,7 +1017,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc) | |||||||
|     ap->OpcodeOfPred = ap->CodeOfPred->opc; |     ap->OpcodeOfPred = ap->CodeOfPred->opc; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) |   if (GLOBAL_Option['i' - 'a' + 1]) | ||||||
|     Yap_DebugPutc(LOCAL_c_error_stream,'\n'); |     Yap_DebugPutc(LOCAL_c_error_stream,'\n'); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3547,7 +3547,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) | |||||||
|     if (LOCAL_ErrorMessage) |     if (LOCAL_ErrorMessage) | ||||||
|       return (0); |       return (0); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if (Yap_Option['g' - 96]) |     if (GLOBAL_Option['g' - 96]) | ||||||
|       Yap_ShowCode(&cglobs.cint); |       Yap_ShowCode(&cglobs.cint); | ||||||
| #endif | #endif | ||||||
|   } else { |   } else { | ||||||
| @@ -3580,7 +3580,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) | |||||||
|     if (LOCAL_ErrorMessage) |     if (LOCAL_ErrorMessage) | ||||||
|       return (0); |       return (0); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if (Yap_Option['g' - 96]) |     if (GLOBAL_Option['g' - 96]) | ||||||
|       Yap_ShowCode(&cglobs.cint); |       Yap_ShowCode(&cglobs.cint); | ||||||
| #endif | #endif | ||||||
|     /* phase 2: classify variables and optimize temporaries          */ |     /* phase 2: classify variables and optimize temporaries          */ | ||||||
| @@ -3596,7 +3596,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) | |||||||
|   /* eliminate superfluous pop's and unify_var's                   */ |   /* eliminate superfluous pop's and unify_var's                   */ | ||||||
|   c_optimize(cglobs.cint.CodeStart); |   c_optimize(cglobs.cint.CodeStart); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['f' - 96]) |   if (GLOBAL_Option['f' - 96]) | ||||||
|     Yap_ShowCode(&cglobs.cint); |     Yap_ShowCode(&cglobs.cint); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -75,12 +75,7 @@ STATIC_PROTO (void ShowOp, (char *, struct PSEUDO *)); | |||||||
|  * afterwards  |  * afterwards  | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #ifdef DEBUG |  | ||||||
|  |  | ||||||
| char            Yap_Option[20]; |  | ||||||
|  |  | ||||||
| YP_FILE *Yap_logfile; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| typedef struct mem_blk { | typedef struct mem_blk { | ||||||
|   union { |   union { | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								C/dbase.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								C/dbase.c
									
									
									
									
									
								
							| @@ -160,7 +160,6 @@ typedef struct db_globs { | |||||||
|   UInt     sz;		/* total size */ |   UInt     sz;		/* total size */ | ||||||
| } dbglobs; | } dbglobs; | ||||||
|  |  | ||||||
| static dbglobs *s_dbg; |  | ||||||
|  |  | ||||||
| #ifdef SUPPORT_HASH_TABLES | #ifdef SUPPORT_HASH_TABLES | ||||||
| typedef struct { | typedef struct { | ||||||
| @@ -368,7 +367,7 @@ static Int cmpclls(CELL *a,CELL *b,Int n) | |||||||
| #if !THREADS | #if !THREADS | ||||||
| int Yap_DBTrailOverflow() | int Yap_DBTrailOverflow() | ||||||
| { | { | ||||||
|   return((CELL *)s_dbg->lr > (CELL *)s_dbg->tofref - 2048); |   return((CELL *)LOCAL_s_dbg->lr > (CELL *)LOCAL_s_dbg->tofref - 2048); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -906,7 +905,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, | |||||||
| 	     the variable, the constraint in some cannonical form, what type | 	     the variable, the constraint in some cannonical form, what type | ||||||
| 	     of constraint, and a list pointer */ | 	     of constraint, and a list pointer */ | ||||||
| 	  t[0] = (CELL)ptd0; | 	  t[0] = (CELL)ptd0; | ||||||
| 	  t[1] = attas[ExtFromCell(ptd0)].to_term_op(ptd0); | 	  t[1] = GLOBAL_attas[ExtFromCell(ptd0)].to_term_op(ptd0); | ||||||
| 	  t[2] = MkIntegerTerm(ExtFromCell(ptd0)); | 	  t[2] = MkIntegerTerm(ExtFromCell(ptd0)); | ||||||
| 	  t[3] = ConstraintsTerm; | 	  t[3] = ConstraintsTerm; | ||||||
| 	  ConstraintsTerm = Yap_MkApplTerm(FunctorClist, 4, t); | 	  ConstraintsTerm = Yap_MkApplTerm(FunctorClist, 4, t); | ||||||
| @@ -1647,7 +1646,7 @@ record(int Flag, Term key, Term t_data, Term t_code USES_REGS) | |||||||
|   int needs_vars; |   int needs_vars; | ||||||
|   struct db_globs dbg; |   struct db_globs dbg; | ||||||
|  |  | ||||||
|   s_dbg = &dbg; |   LOCAL_s_dbg = &dbg; | ||||||
|   dbg.found_one = NULL; |   dbg.found_one = NULL; | ||||||
| #ifdef SFUNC | #ifdef SFUNC | ||||||
|   FathersPlace = NIL; |   FathersPlace = NIL; | ||||||
| @@ -1724,7 +1723,7 @@ record_at(int Flag, DBRef r0, Term t_data, Term t_code USES_REGS) | |||||||
|   int needs_vars; |   int needs_vars; | ||||||
|   struct db_globs dbg; |   struct db_globs dbg; | ||||||
|  |  | ||||||
|   s_dbg = &dbg; |   LOCAL_s_dbg = &dbg; | ||||||
| #ifdef SFUNC | #ifdef SFUNC | ||||||
|   FathersPlace = NIL; |   FathersPlace = NIL; | ||||||
| #endif | #endif | ||||||
| @@ -1799,6 +1798,7 @@ record_at(int Flag, DBRef r0, Term t_data, Term t_code USES_REGS) | |||||||
| static LogUpdClause * | static LogUpdClause * | ||||||
| new_lu_db_entry(Term t, PredEntry *pe) | new_lu_db_entry(Term t, PredEntry *pe) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
|   DBTerm *x; |   DBTerm *x; | ||||||
|   LogUpdClause *cl; |   LogUpdClause *cl; | ||||||
|   yamop *ipc; |   yamop *ipc; | ||||||
| @@ -1811,7 +1811,7 @@ new_lu_db_entry(Term t, PredEntry *pe) | |||||||
|   if (!(pe->PredFlags & ThreadLocalPredFlag)) |   if (!(pe->PredFlags & ThreadLocalPredFlag)) | ||||||
|     d_flag |= InQueue; |     d_flag |= InQueue; | ||||||
| #endif | #endif | ||||||
|   s_dbg = &dbg; |   LOCAL_s_dbg = &dbg; | ||||||
|   ipc = NEXTOP(((LogUpdClause *)NULL)->ClCode,e); |   ipc = NEXTOP(((LogUpdClause *)NULL)->ClCode,e); | ||||||
|   if ((x = (DBTerm *)CreateDBStruct(t, NULL, d_flag, &needs_vars, (UInt)ipc, &dbg)) == NULL) { |   if ((x = (DBTerm *)CreateDBStruct(t, NULL, d_flag, &needs_vars, (UInt)ipc, &dbg)) == NULL) { | ||||||
|     return NULL; /* crash */ |     return NULL; /* crash */ | ||||||
| @@ -2358,7 +2358,7 @@ copy_attachments(CELL *ts USES_REGS) | |||||||
|   while (TRUE) { |   while (TRUE) { | ||||||
|     /* store away in case there is an overflow */ |     /* store away in case there is an overflow */ | ||||||
|  |  | ||||||
|     if (attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0] PASS_REGS)  == FALSE) { |     if (GLOBAL_attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0] PASS_REGS)  == FALSE) { | ||||||
|       /* oops, we did not have enough space to copy the elements */ |       /* oops, we did not have enough space to copy the elements */ | ||||||
|       /* reset queue of woken up goals */ |       /* reset queue of woken up goals */ | ||||||
|       TR = tr0; |       TR = tr0; | ||||||
| @@ -2466,9 +2466,9 @@ GetDBTerm(DBTerm *DBSP USES_REGS) | |||||||
|     } |     } | ||||||
|     pt = CellPtr(DBSP->Contents); |     pt = CellPtr(DBSP->Contents); | ||||||
|     if (H+NOf > ASP-CalculateStackGap()/sizeof(CELL)) { |     if (H+NOf > ASP-CalculateStackGap()/sizeof(CELL)) { | ||||||
|       if (Yap_PrologMode & InErrorMode) { |       if (LOCAL_PrologMode & InErrorMode) { | ||||||
| 	if (H+NOf > ASP) | 	if (H+NOf > ASP) | ||||||
| 	  fprintf(Yap_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n"); | 	  fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n"); | ||||||
| 	  Yap_exit( 1); | 	  Yap_exit( 1); | ||||||
|       } else { |       } else { | ||||||
| 	LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; | 	LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; | ||||||
| @@ -4197,7 +4197,7 @@ MyEraseClause(DynamicClause *clau USES_REGS) | |||||||
|     Yap_FreeCodeSpace((char *)clau); |     Yap_FreeCodeSpace((char *)clau); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if (ref->NOfRefsTo) |     if (ref->NOfRefsTo) | ||||||
|       fprintf(Yap_stderr, "Error: references to dynamic clause\n"); |       fprintf(GLOBAL_stderr, "Error: references to dynamic clause\n"); | ||||||
| #endif | #endif | ||||||
|     RemoveDBEntry(ref PASS_REGS); |     RemoveDBEntry(ref PASS_REGS); | ||||||
|   } |   } | ||||||
| @@ -5048,7 +5048,7 @@ StoreTermInDB(Term t, int nargs USES_REGS) | |||||||
|   int needs_vars; |   int needs_vars; | ||||||
|   struct db_globs dbg; |   struct db_globs dbg; | ||||||
|  |  | ||||||
|   s_dbg = &dbg; |   LOCAL_s_dbg = &dbg; | ||||||
|   LOCAL_Error_Size = 0; |   LOCAL_Error_Size = 0; | ||||||
|   while ((x = (DBTerm *)CreateDBStruct(t, (DBProp)NULL, |   while ((x = (DBTerm *)CreateDBStruct(t, (DBProp)NULL, | ||||||
| 			  InQueue, &needs_vars, 0, &dbg)) == NULL) { | 			  InQueue, &needs_vars, 0, &dbg)) == NULL) { | ||||||
| @@ -5076,11 +5076,12 @@ Yap_StoreTermInDB(Term t, int nargs) { | |||||||
|  |  | ||||||
| DBTerm * | DBTerm * | ||||||
| Yap_StoreTermInDBPlusExtraSpace(Term t, UInt extra_size, UInt *sz) { | Yap_StoreTermInDBPlusExtraSpace(Term t, UInt extra_size, UInt *sz) { | ||||||
|  |   CACHE_REGS | ||||||
|   int needs_vars; |   int needs_vars; | ||||||
|   struct db_globs dbg; |   struct db_globs dbg; | ||||||
|   DBTerm *o; |   DBTerm *o; | ||||||
|  |  | ||||||
|   s_dbg = &dbg; |   LOCAL_s_dbg = &dbg; | ||||||
|   o = (DBTerm *)CreateDBStruct(t, (DBProp)NULL, |   o = (DBTerm *)CreateDBStruct(t, (DBProp)NULL, | ||||||
| 			       InQueue, &needs_vars, extra_size, &dbg); | 			       InQueue, &needs_vars, extra_size, &dbg); | ||||||
|   *sz = dbg.sz; |   *sz = dbg.sz; | ||||||
|   | |||||||
							
								
								
									
										42
									
								
								C/errors.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								C/errors.c
									
									
									
									
									
								
							| @@ -264,7 +264,7 @@ dump_stack( USES_REGS1 ) | |||||||
|     return; |     return; | ||||||
| #if DEBUG | #if DEBUG | ||||||
|   fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,H,TR,HeapTop); |   fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,H,TR,HeapTop); | ||||||
|   fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)Yap_PrologMode); |   fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)LOCAL_PrologMode); | ||||||
|   if (LOCAL_ErrorMessage) |   if (LOCAL_ErrorMessage) | ||||||
|     fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage); |     fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage); | ||||||
| #endif | #endif | ||||||
| @@ -352,7 +352,7 @@ static void | |||||||
| error_exit_yap (int value) | error_exit_yap (int value) | ||||||
| { | { | ||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   if (!(Yap_PrologMode & BootMode)) { |   if (!(LOCAL_PrologMode & BootMode)) { | ||||||
|     dump_stack( PASS_REGS1 ); |     dump_stack( PASS_REGS1 ); | ||||||
| #if DEBUG | #if DEBUG | ||||||
| #endif | #endif | ||||||
| @@ -395,10 +395,10 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|   if (where == 0L) |   if (where == 0L) | ||||||
|     where = TermNil; |     where = TermNil; | ||||||
| #if DEBUG_STRICT | #if DEBUG_STRICT | ||||||
|   if (Yap_heap_regs && !(Yap_PrologMode & BootMode))  |   if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))  | ||||||
|     fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)LOCAL_ActiveSignals,Yap_PrologMode,format); |     fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)LOCAL_ActiveSignals,LOCAL_PrologMode,format); | ||||||
|   else |   else | ||||||
|     fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format); |     fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,LOCAL_PrologMode,format); | ||||||
| #endif | #endif | ||||||
|   if (type == INTERRUPT_ERROR) { |   if (type == INTERRUPT_ERROR) { | ||||||
|     fprintf(stderr,"%% YAP exiting: cannot handle signal %d\n", |     fprintf(stderr,"%% YAP exiting: cannot handle signal %d\n", | ||||||
| @@ -406,7 +406,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     Yap_exit(1); |     Yap_exit(1); | ||||||
|   } |   } | ||||||
|   /* disallow recursive error handling */  |   /* disallow recursive error handling */  | ||||||
|   if (Yap_PrologMode & InErrorMode) { |   if (LOCAL_PrologMode & InErrorMode) { | ||||||
|     /* error within error */ |     /* error within error */ | ||||||
|     va_start (ap, format); |     va_start (ap, format); | ||||||
|     /* now build the error string */ |     /* now build the error string */ | ||||||
| @@ -444,7 +444,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     }  else { |     }  else { | ||||||
|       tmpbuf[0] = '\0'; |       tmpbuf[0] = '\0'; | ||||||
|     } |     } | ||||||
|     if (Yap_PrologMode == UserCCallMode) { |     if (LOCAL_PrologMode == UserCCallMode) { | ||||||
|       fprintf(stderr,"%%\n%%\n"); |       fprintf(stderr,"%%\n%%\n"); | ||||||
|       fprintf(stderr,"%% YAP OOOPS in USER C-CODE: %s.\n",tmpbuf); |       fprintf(stderr,"%% YAP OOOPS in USER C-CODE: %s.\n",tmpbuf); | ||||||
|       fprintf(stderr,"%%\n%%\n"); |       fprintf(stderr,"%%\n%%\n"); | ||||||
| @@ -458,12 +458,12 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|   if (P == (yamop *)(FAILCODE)) |   if (P == (yamop *)(FAILCODE)) | ||||||
|    return P; |    return P; | ||||||
|   /* PURE_ABORT may not have set where correctly, BootMode may not have the data terms ready */ |   /* PURE_ABORT may not have set where correctly, BootMode may not have the data terms ready */ | ||||||
|   if (type == PURE_ABORT || Yap_PrologMode & BootMode) { |   if (type == PURE_ABORT || LOCAL_PrologMode & BootMode) { | ||||||
|     where = TermNil; |     where = TermNil; | ||||||
|     Yap_PrologMode &= ~AbortMode; |     LOCAL_PrologMode &= ~AbortMode; | ||||||
|     Yap_PrologMode |= InErrorMode; |     LOCAL_PrologMode |= InErrorMode; | ||||||
|     /* make sure failure will be seen at next port */ |     /* make sure failure will be seen at next port */ | ||||||
|     if (Yap_PrologMode & AsyncIntMode) |     if (LOCAL_PrologMode & AsyncIntMode) | ||||||
|       Yap_signal(YAP_FAIL_SIGNAL); |       Yap_signal(YAP_FAIL_SIGNAL); | ||||||
|     P = FAILCODE; |     P = FAILCODE; | ||||||
|   } else { |   } else { | ||||||
| @@ -474,8 +474,8 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|       where = Deref(where); |       where = Deref(where); | ||||||
|     } |     } | ||||||
|     /* Exit Abort Mode, if we were there */ |     /* Exit Abort Mode, if we were there */ | ||||||
|     Yap_PrologMode &= ~AbortMode; |     LOCAL_PrologMode &= ~AbortMode; | ||||||
|     Yap_PrologMode |= InErrorMode; |     LOCAL_PrologMode |= InErrorMode; | ||||||
|     if (!(where = Yap_CopyTerm(where))) { |     if (!(where = Yap_CopyTerm(where))) { | ||||||
|       where = TermNil; |       where = TermNil; | ||||||
|     } |     } | ||||||
| @@ -493,7 +493,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|   else |   else | ||||||
|     tmpbuf[0] = '\0'; |     tmpbuf[0] = '\0'; | ||||||
|   va_end (ap); |   va_end (ap); | ||||||
|   if (Yap_PrologMode & BootMode) { |   if (LOCAL_PrologMode & BootMode) { | ||||||
|     /* crash in flames! */ |     /* crash in flames! */ | ||||||
|     fprintf(stderr,"%% YAP Fatal Error: %s exiting....\n",tmpbuf); |     fprintf(stderr,"%% YAP Fatal Error: %s exiting....\n",tmpbuf); | ||||||
|     error_exit_yap (1); |     error_exit_yap (1); | ||||||
| @@ -506,7 +506,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     { |     { | ||||||
|       fprintf(stderr,"%% Internal YAP Error: %s exiting....\n",tmpbuf); |       fprintf(stderr,"%% Internal YAP Error: %s exiting....\n",tmpbuf); | ||||||
|       serious = TRUE; |       serious = TRUE; | ||||||
|       if (Yap_PrologMode & BootMode) { |       if (LOCAL_PrologMode & BootMode) { | ||||||
| 	fprintf(stderr,"%% YAP crashed while booting %s\n",tmpbuf); | 	fprintf(stderr,"%% YAP crashed while booting %s\n",tmpbuf); | ||||||
|       } else { |       } else { | ||||||
| 	detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, tmpbuf, YAP_BUF_SIZE); | 	detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, tmpbuf, YAP_BUF_SIZE); | ||||||
| @@ -535,7 +535,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     LOCAL_RetriesCounterOn = FALSE; |     LOCAL_RetriesCounterOn = FALSE; | ||||||
|     Yap_JumpToEnv(MkAtomTerm(AtomCallCounter)); |     Yap_JumpToEnv(MkAtomTerm(AtomCallCounter)); | ||||||
|     P = (yamop *)FAILCODE; |     P = (yamop *)FAILCODE; | ||||||
|     Yap_PrologMode &= ~InErrorMode; |     LOCAL_PrologMode &= ~InErrorMode; | ||||||
|     return(P); |     return(P); | ||||||
|   case PRED_ENTRY_COUNTER_UNDERFLOW: |   case PRED_ENTRY_COUNTER_UNDERFLOW: | ||||||
|     /* Do a long jump */ |     /* Do a long jump */ | ||||||
| @@ -544,7 +544,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     LOCAL_RetriesCounterOn = FALSE; |     LOCAL_RetriesCounterOn = FALSE; | ||||||
|     Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter)); |     Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter)); | ||||||
|     P = (yamop *)FAILCODE; |     P = (yamop *)FAILCODE; | ||||||
|     Yap_PrologMode &= ~InErrorMode; |     LOCAL_PrologMode &= ~InErrorMode; | ||||||
|     return(P); |     return(P); | ||||||
|   case RETRY_COUNTER_UNDERFLOW: |   case RETRY_COUNTER_UNDERFLOW: | ||||||
|     /* Do a long jump */ |     /* Do a long jump */ | ||||||
| @@ -553,7 +553,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) | |||||||
|     LOCAL_RetriesCounterOn = FALSE; |     LOCAL_RetriesCounterOn = FALSE; | ||||||
|     Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter)); |     Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter)); | ||||||
|     P = (yamop *)FAILCODE; |     P = (yamop *)FAILCODE; | ||||||
|     Yap_PrologMode &= ~InErrorMode; |     LOCAL_PrologMode &= ~InErrorMode; | ||||||
|     return(P); |     return(P); | ||||||
|   case CONSISTENCY_ERROR: |   case CONSISTENCY_ERROR: | ||||||
|     { |     { | ||||||
| @@ -1861,7 +1861,7 @@ E); | |||||||
|     /* disable active signals at this point */ |     /* disable active signals at this point */ | ||||||
|     LOCAL_ActiveSignals = 0; |     LOCAL_ActiveSignals = 0; | ||||||
|     CreepFlag = CalculateStackGap(); |     CreepFlag = CalculateStackGap(); | ||||||
|     Yap_PrologMode &= ~InErrorMode; |     LOCAL_PrologMode &= ~InErrorMode; | ||||||
|     LOCK(LOCAL_SignalLock); |     LOCK(LOCAL_SignalLock); | ||||||
|     /* we might be in the middle of a critical region */ |     /* we might be in the middle of a critical region */ | ||||||
|     if (LOCAL_InterruptsDisabled) { |     if (LOCAL_InterruptsDisabled) { | ||||||
| @@ -1877,7 +1877,7 @@ E); | |||||||
|     /* wait if we we are in user code, |     /* wait if we we are in user code, | ||||||
|        it's up to her to decide */ |        it's up to her to decide */ | ||||||
|  |  | ||||||
|     if (Yap_PrologMode & UserCCallMode) { |     if (LOCAL_PrologMode & UserCCallMode) { | ||||||
|       if (!(EX = Yap_StoreTermInDB(Yap_MkApplTerm(fun, 2, nt), 0))) { |       if (!(EX = Yap_StoreTermInDB(Yap_MkApplTerm(fun, 2, nt), 0))) { | ||||||
| 	/* fat chance */ | 	/* fat chance */ | ||||||
| 	siglongjmp(LOCAL_RestartEnv,1); | 	siglongjmp(LOCAL_RestartEnv,1); | ||||||
| @@ -1890,7 +1890,7 @@ E); | |||||||
|       P = (yamop *)FAILCODE; |       P = (yamop *)FAILCODE; | ||||||
|     } |     } | ||||||
|   } else { |   } else { | ||||||
|     Yap_PrologMode &= ~InErrorMode; |     LOCAL_PrologMode &= ~InErrorMode; | ||||||
|   } |   } | ||||||
|   return P; |   return P; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								C/eval.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								C/eval.c
									
									
									
									
									
								
							| @@ -34,7 +34,7 @@ static char     SccsId[] = "%W% %G%"; | |||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| yap_error_number Yap_matherror = YAP_NO_ERROR; |  | ||||||
|  |  | ||||||
| static Term | static Term | ||||||
| Eval(Term t USES_REGS) | Eval(Term t USES_REGS) | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								C/exec.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								C/exec.c
									
									
									
									
									
								
							| @@ -951,7 +951,7 @@ exec_absmi(int top USES_REGS) | |||||||
|     case 1: |     case 1: | ||||||
|       { /* restart */ |       { /* restart */ | ||||||
| 	/* otherwise, SetDBForThrow will fail entering critical mode */ | 	/* otherwise, SetDBForThrow will fail entering critical mode */ | ||||||
| 	Yap_PrologMode = UserMode; | 	LOCAL_PrologMode = UserMode; | ||||||
| 	/* find out where to cut to */ | 	/* find out where to cut to */ | ||||||
| 	/* siglongjmp resets the TR hardware register */ | 	/* siglongjmp resets the TR hardware register */ | ||||||
| 	/* TR and B are crucial, they might have been changed, or not */ | 	/* TR and B are crucial, they might have been changed, or not */ | ||||||
| @@ -966,7 +966,7 @@ exec_absmi(int top USES_REGS) | |||||||
| 	/* forget any signals active, we're reborne */ | 	/* forget any signals active, we're reborne */ | ||||||
| 	LOCAL_ActiveSignals = 0; | 	LOCAL_ActiveSignals = 0; | ||||||
| 	CreepFlag = CalculateStackGap(); | 	CreepFlag = CalculateStackGap(); | ||||||
| 	Yap_PrologMode = UserMode; | 	LOCAL_PrologMode = UserMode; | ||||||
| 	UNLOCK(LOCAL_SignalLock); | 	UNLOCK(LOCAL_SignalLock); | ||||||
| 	P = (yamop *)FAILCODE; | 	P = (yamop *)FAILCODE; | ||||||
|       } |       } | ||||||
| @@ -975,11 +975,11 @@ exec_absmi(int top USES_REGS) | |||||||
|       { |       { | ||||||
| 	/* arithmetic exception */ | 	/* arithmetic exception */ | ||||||
| 	/* must be done here, otherwise siglongjmp will clobber all the registers */ | 	/* must be done here, otherwise siglongjmp will clobber all the registers */ | ||||||
| 	Yap_Error(Yap_matherror,TermNil,NULL); | 	Yap_Error(LOCAL_matherror ,TermNil,NULL); | ||||||
| 	/* reset the registers so that we don't have trash in abstract machine */ | 	/* reset the registers so that we don't have trash in abstract machine */ | ||||||
| 	Yap_set_fpu_exceptions(yap_flags[LANGUAGE_MODE_FLAG] == 1); | 	Yap_set_fpu_exceptions(yap_flags[LANGUAGE_MODE_FLAG] == 1); | ||||||
| 	P = (yamop *)FAILCODE; | 	P = (yamop *)FAILCODE; | ||||||
| 	Yap_PrologMode = UserMode; | 	LOCAL_PrologMode = UserMode; | ||||||
|       } |       } | ||||||
|       break; |       break; | ||||||
|     case 3: |     case 3: | ||||||
| @@ -988,10 +988,10 @@ exec_absmi(int top USES_REGS) | |||||||
|       } |       } | ||||||
|     default: |     default: | ||||||
|       /* do nothing */ |       /* do nothing */ | ||||||
|       Yap_PrologMode = UserMode; |       LOCAL_PrologMode = UserMode; | ||||||
|     } |     } | ||||||
|   } else { |   } else { | ||||||
|     Yap_PrologMode = UserMode; |     LOCAL_PrologMode = UserMode; | ||||||
|   } |   } | ||||||
|   Yap_CloseSlots( PASS_REGS1 ); |   Yap_CloseSlots( PASS_REGS1 ); | ||||||
|   YENV = ASP; |   YENV = ASP; | ||||||
| @@ -1280,7 +1280,7 @@ Yap_RunTopGoal(Term t) | |||||||
|   UNLOCK(ppe->PELock); |   UNLOCK(ppe->PELock); | ||||||
| #if !USE_SYSTEM_MALLOC | #if !USE_SYSTEM_MALLOC | ||||||
|   if (LOCAL_TrailTop - HeapTop < 2048) { |   if (LOCAL_TrailTop - HeapTop < 2048) { | ||||||
|     Yap_PrologMode = BootMode; |     LOCAL_PrologMode = BootMode; | ||||||
|     Yap_Error(OUT_OF_TRAIL_ERROR,TermNil, |     Yap_Error(OUT_OF_TRAIL_ERROR,TermNil, | ||||||
| 	  "unable to boot because of too little Trail space"); | 	  "unable to boot because of too little Trail space"); | ||||||
|   } |   } | ||||||
| @@ -1515,7 +1515,7 @@ JumpToEnv(Term t USES_REGS) { | |||||||
| 	LOCAL_BallTerm = NULL; | 	LOCAL_BallTerm = NULL; | ||||||
| 	P = (yamop *)FAILCODE; | 	P = (yamop *)FAILCODE; | ||||||
| 	/* make sure failure will be seen at next port */ | 	/* make sure failure will be seen at next port */ | ||||||
| 	if (Yap_PrologMode & AsyncIntMode) { | 	if (LOCAL_PrologMode & AsyncIntMode) { | ||||||
| 	  Yap_signal(YAP_FAIL_SIGNAL); | 	  Yap_signal(YAP_FAIL_SIGNAL); | ||||||
| 	} | 	} | ||||||
| 	HB = B->cp_h; | 	HB = B->cp_h; | ||||||
| @@ -1560,7 +1560,7 @@ JumpToEnv(Term t USES_REGS) { | |||||||
|   /* B->cp_h = H; */ |   /* B->cp_h = H; */ | ||||||
|   /* I could backtrack here, but it is easier to leave the unwinding |   /* I could backtrack here, but it is easier to leave the unwinding | ||||||
|      to the emulator */ |      to the emulator */ | ||||||
|   if (Yap_PrologMode & AsyncIntMode) { |   if (LOCAL_PrologMode & AsyncIntMode) { | ||||||
|     Yap_signal(YAP_FAIL_SIGNAL); |     Yap_signal(YAP_FAIL_SIGNAL); | ||||||
|   } |   } | ||||||
|   P = (yamop *)FAILCODE; |   P = (yamop *)FAILCODE; | ||||||
| @@ -1575,7 +1575,7 @@ JumpToEnv(Term t USES_REGS) { | |||||||
| Int | Int | ||||||
| Yap_JumpToEnv(Term t) { | Yap_JumpToEnv(Term t) { | ||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   if (Yap_PrologMode & BootMode) { |   if (LOCAL_PrologMode & BootMode) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   }  |   }  | ||||||
|   return JumpToEnv(t PASS_REGS); |   return JumpToEnv(t PASS_REGS); | ||||||
|   | |||||||
| @@ -474,7 +474,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop | |||||||
| 	CELL new; | 	CELL new; | ||||||
|  |  | ||||||
| 	bp = to_visit; | 	bp = to_visit; | ||||||
| 	if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | 	if (!GLOBAL_attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | ||||||
| 	  goto overflow; | 	  goto overflow; | ||||||
| 	} | 	} | ||||||
| 	to_visit = bp; | 	to_visit = bp; | ||||||
|   | |||||||
							
								
								
									
										195
									
								
								C/gprof.c
									
									
									
									
									
								
							
							
						
						
									
										195
									
								
								C/gprof.c
									
									
									
									
									
								
							| @@ -123,13 +123,13 @@ typedef greg_t context_reg; | |||||||
| #include <ucontext.h> | #include <ucontext.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static Int ProfCalls, ProfGCs, ProfHGrows, ProfSGrows, ProfMallocs, ProfOn, ProfOns; |  | ||||||
|  |  | ||||||
| #define TIMER_DEFAULT 100 | #define TIMER_DEFAULT 100 | ||||||
| #define PROFILING_FILE 1 | #define PROFILING_FILE 1 | ||||||
| #define PROFPREDS_FILE 2 | #define PROFPREDS_FILE 2 | ||||||
|  |  | ||||||
| static char *DIRNAME=NULL; |  | ||||||
|  |  | ||||||
| typedef struct RB_red_blk_node { | typedef struct RB_red_blk_node { | ||||||
|   yamop *key; /* first address */ |   yamop *key; /* first address */ | ||||||
| @@ -142,7 +142,7 @@ typedef struct RB_red_blk_node { | |||||||
|   struct RB_red_blk_node* parent; |   struct RB_red_blk_node* parent; | ||||||
| } rb_red_blk_node; | } rb_red_blk_node; | ||||||
|  |  | ||||||
| static rb_red_blk_node *ProfilerRoot, *ProfilerNil; |  | ||||||
|  |  | ||||||
| static rb_red_blk_node * | static rb_red_blk_node * | ||||||
| RBMalloc(UInt size) | RBMalloc(UInt size) | ||||||
| @@ -162,14 +162,14 @@ RBTreeCreate(void) { | |||||||
|  |  | ||||||
|   /*  see the comment in the rb_red_blk_tree structure in red_black_tree.h */ |   /*  see the comment in the rb_red_blk_tree structure in red_black_tree.h */ | ||||||
|   /*  for information on nil and root */ |   /*  for information on nil and root */ | ||||||
|   temp=ProfilerNil= RBMalloc(sizeof(rb_red_blk_node)); |   temp=GLOBAL_ProfilerNil= RBMalloc(sizeof(rb_red_blk_node)); | ||||||
|   temp->parent=temp->left=temp->right=temp; |   temp->parent=temp->left=temp->right=temp; | ||||||
|   temp->pcs=0; |   temp->pcs=0; | ||||||
|   temp->red=0; |   temp->red=0; | ||||||
|   temp->key=temp->lim=NULL; |   temp->key=temp->lim=NULL; | ||||||
|   temp->pe=NULL; |   temp->pe=NULL; | ||||||
|   temp = RBMalloc(sizeof(rb_red_blk_node)); |   temp = RBMalloc(sizeof(rb_red_blk_node)); | ||||||
|   temp->parent=temp->left=temp->right=ProfilerNil; |   temp->parent=temp->left=temp->right=GLOBAL_ProfilerNil; | ||||||
|   temp->key=temp->lim=NULL; |   temp->key=temp->lim=NULL; | ||||||
|   temp->pe=NULL; |   temp->pe=NULL; | ||||||
|   temp->pcs=0; |   temp->pcs=0; | ||||||
| @@ -199,7 +199,7 @@ RBTreeCreate(void) { | |||||||
| static void | static void | ||||||
| LeftRotate(rb_red_blk_node* x) { | LeftRotate(rb_red_blk_node* x) { | ||||||
|   rb_red_blk_node* y; |   rb_red_blk_node* y; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|  |  | ||||||
|   /*  I originally wrote this function to use the sentinel for */ |   /*  I originally wrote this function to use the sentinel for */ | ||||||
|   /*  nil to avoid checking for nil.  However this introduces a */ |   /*  nil to avoid checking for nil.  However this introduces a */ | ||||||
| @@ -230,7 +230,7 @@ LeftRotate(rb_red_blk_node* x) { | |||||||
|   x->parent=y; |   x->parent=y; | ||||||
|  |  | ||||||
| #ifdef DEBUG_ASSERT | #ifdef DEBUG_ASSERT | ||||||
|   Assert(!ProfilerNil->red,"nil not red in LeftRotate"); |   Assert(!GLOBAL_ProfilerNil->red,"nil not red in LeftRotate"); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -255,7 +255,7 @@ LeftRotate(rb_red_blk_node* x) { | |||||||
| static void | static void | ||||||
| RightRotate(rb_red_blk_node* y) { | RightRotate(rb_red_blk_node* y) { | ||||||
|   rb_red_blk_node* x; |   rb_red_blk_node* x; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|  |  | ||||||
|   /*  I originally wrote this function to use the sentinel for */ |   /*  I originally wrote this function to use the sentinel for */ | ||||||
|   /*  nil to avoid checking for nil.  However this introduces a */ |   /*  nil to avoid checking for nil.  However this introduces a */ | ||||||
| @@ -285,7 +285,7 @@ RightRotate(rb_red_blk_node* y) { | |||||||
|   y->parent=x; |   y->parent=x; | ||||||
|  |  | ||||||
| #ifdef DEBUG_ASSERT | #ifdef DEBUG_ASSERT | ||||||
|   Assert(!ProfilerNil->red,"nil not red in RightRotate"); |   Assert(!GLOBAL_ProfilerNil->red,"nil not red in RightRotate"); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -309,11 +309,11 @@ TreeInsertHelp(rb_red_blk_node* z) { | |||||||
|   /*  This function should only be called by InsertRBTree (see above) */ |   /*  This function should only be called by InsertRBTree (see above) */ | ||||||
|   rb_red_blk_node* x; |   rb_red_blk_node* x; | ||||||
|   rb_red_blk_node* y; |   rb_red_blk_node* y; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|    |    | ||||||
|   z->left=z->right=nil; |   z->left=z->right=nil; | ||||||
|   y=ProfilerRoot; |   y=GLOBAL_ProfilerRoot; | ||||||
|   x=ProfilerRoot->left; |   x=GLOBAL_ProfilerRoot->left; | ||||||
|   while( x != nil) { |   while( x != nil) { | ||||||
|     y=x; |     y=x; | ||||||
|     if (x->key > z->key) { /* x.key > z.key */ |     if (x->key > z->key) { /* x.key > z.key */ | ||||||
| @@ -323,7 +323,7 @@ TreeInsertHelp(rb_red_blk_node* z) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   z->parent=y; |   z->parent=y; | ||||||
|   if ( (y == ProfilerRoot) || |   if ( (y == GLOBAL_ProfilerRoot) || | ||||||
|        (y->key > z->key)) { /* y.key > z.key */ |        (y->key > z->key)) { /* y.key > z.key */ | ||||||
|     y->left=z; |     y->left=z; | ||||||
|   } else { |   } else { | ||||||
| @@ -331,7 +331,7 @@ TreeInsertHelp(rb_red_blk_node* z) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| #ifdef DEBUG_ASSERT | #ifdef DEBUG_ASSERT | ||||||
|   Assert(!ProfilerNil->red,"nil not red in TreeInsertHelp"); |   Assert(!GLOBAL_ProfilerNil->red,"nil not red in TreeInsertHelp"); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -403,12 +403,12 @@ RBTreeInsert(yamop *key, yamop *lim) { | |||||||
|       }  |       }  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   ProfilerRoot->left->red=0; |   GLOBAL_ProfilerRoot->left->red=0; | ||||||
|   return newNode; |   return newNode; | ||||||
|  |  | ||||||
| #ifdef DEBUG_ASSERT | #ifdef DEBUG_ASSERT | ||||||
|   Assert(!ProfilerNil->red,"nil not red in RBTreeInsert"); |   Assert(!GLOBAL_ProfilerNil->red,"nil not red in RBTreeInsert"); | ||||||
|   Assert(!ProfilerRoot->red,"root not red in RBTreeInsert"); |   Assert(!GLOBAL_ProfilerRoot->red,"root not red in RBTreeInsert"); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -429,10 +429,10 @@ RBTreeInsert(yamop *key, yamop *lim) { | |||||||
| static rb_red_blk_node* | static rb_red_blk_node* | ||||||
| RBExactQuery(yamop* q) { | RBExactQuery(yamop* q) { | ||||||
|   rb_red_blk_node* x; |   rb_red_blk_node* x; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|  |  | ||||||
|   if (!ProfilerRoot) return NULL; |   if (!GLOBAL_ProfilerRoot) return NULL; | ||||||
|   x=ProfilerRoot->left; |   x=GLOBAL_ProfilerRoot->left; | ||||||
|   if (x == nil) return NULL; |   if (x == nil) return NULL; | ||||||
|   while(x->key != q) {/*assignemnt*/ |   while(x->key != q) {/*assignemnt*/ | ||||||
|     if (x->key > q) { /* x->key > q */ |     if (x->key > q) { /* x->key > q */ | ||||||
| @@ -450,10 +450,10 @@ static rb_red_blk_node* | |||||||
| RBLookup(yamop *entry) { | RBLookup(yamop *entry) { | ||||||
|   rb_red_blk_node *current; |   rb_red_blk_node *current; | ||||||
|  |  | ||||||
|   if (!ProfilerRoot) |   if (!GLOBAL_ProfilerRoot) | ||||||
|     return NULL; |     return NULL; | ||||||
|   current = ProfilerRoot->left; |   current = GLOBAL_ProfilerRoot->left; | ||||||
|   while (current != ProfilerNil) { |   while (current != GLOBAL_ProfilerNil) { | ||||||
|     if (current->key <= entry && current->lim >= entry) { |     if (current->key <= entry && current->lim >= entry) { | ||||||
|       return current; |       return current; | ||||||
|     } |     } | ||||||
| @@ -483,7 +483,7 @@ RBLookup(yamop *entry) { | |||||||
| /***********************************************************************/ | /***********************************************************************/ | ||||||
|  |  | ||||||
| static void RBDeleteFixUp(rb_red_blk_node* x) { | static void RBDeleteFixUp(rb_red_blk_node* x) { | ||||||
|   rb_red_blk_node* root=ProfilerRoot->left; |   rb_red_blk_node* root=GLOBAL_ProfilerRoot->left; | ||||||
|   rb_red_blk_node *w; |   rb_red_blk_node *w; | ||||||
|  |  | ||||||
|   while( (!x->red) && (root != x)) { |   while( (!x->red) && (root != x)) { | ||||||
| @@ -563,8 +563,8 @@ static void RBDeleteFixUp(rb_red_blk_node* x) { | |||||||
| static rb_red_blk_node* | static rb_red_blk_node* | ||||||
| TreeSuccessor(rb_red_blk_node* x) {  | TreeSuccessor(rb_red_blk_node* x) {  | ||||||
|   rb_red_blk_node* y; |   rb_red_blk_node* y; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|   rb_red_blk_node* root=ProfilerRoot; |   rb_red_blk_node* root=GLOBAL_ProfilerRoot; | ||||||
|  |  | ||||||
|   if (nil != (y = x->right)) { /* assignment to y is intentional */ |   if (nil != (y = x->right)) { /* assignment to y is intentional */ | ||||||
|     while(y->left != nil) { /* returns the minium of the right subtree of x */ |     while(y->left != nil) { /* returns the minium of the right subtree of x */ | ||||||
| @@ -602,8 +602,8 @@ static void | |||||||
| RBDelete(rb_red_blk_node* z){ | RBDelete(rb_red_blk_node* z){ | ||||||
|   rb_red_blk_node* y; |   rb_red_blk_node* y; | ||||||
|   rb_red_blk_node* x; |   rb_red_blk_node* x; | ||||||
|   rb_red_blk_node* nil=ProfilerNil; |   rb_red_blk_node* nil=GLOBAL_ProfilerNil; | ||||||
|   rb_red_blk_node* root=ProfilerRoot; |   rb_red_blk_node* root=GLOBAL_ProfilerRoot; | ||||||
|  |  | ||||||
|   y= ((z->left == nil) || (z->right == nil)) ? z : TreeSuccessor(z); |   y= ((z->left == nil) || (z->right == nil)) ? z : TreeSuccessor(z); | ||||||
|   x= (y->left == nil) ? y->right : y->left; |   x= (y->left == nil) ? y->right : y->left; | ||||||
| @@ -656,21 +656,21 @@ int size=0; | |||||||
|  |  | ||||||
|     if (name!=NULL) { |     if (name!=NULL) { | ||||||
|       size=strlen(name)+1; |       size=strlen(name)+1; | ||||||
|       if (DIRNAME!=NULL) free(DIRNAME); |       if (GLOBAL_DIRNAME!=NULL) free(GLOBAL_DIRNAME); | ||||||
|       DIRNAME=malloc(size); |       GLOBAL_DIRNAME=malloc(size); | ||||||
|       if (DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } |       if (GLOBAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } | ||||||
|       strcpy(DIRNAME,name); |       strcpy(GLOBAL_DIRNAME,name); | ||||||
|     }  |     }  | ||||||
|     if (DIRNAME==NULL) { |     if (GLOBAL_DIRNAME==NULL) { | ||||||
|       do { |       do { | ||||||
|         if (DIRNAME!=NULL) free(DIRNAME); |         if (GLOBAL_DIRNAME!=NULL) free(GLOBAL_DIRNAME); | ||||||
|         size+=20; |         size+=20; | ||||||
|         DIRNAME=malloc(size); |         GLOBAL_DIRNAME=malloc(size); | ||||||
|         if (DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } |         if (GLOBAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } | ||||||
|       } while (getcwd(DIRNAME, size-15)==NULL);  |       } while (getcwd(GLOBAL_DIRNAME, size-15)==NULL);  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| return DIRNAME; | return GLOBAL_DIRNAME; | ||||||
| } | } | ||||||
|  |  | ||||||
| char *profile_names(int); | char *profile_names(int); | ||||||
| @@ -678,12 +678,12 @@ char *profile_names(int k) { | |||||||
| static char *FNAME=NULL; | static char *FNAME=NULL; | ||||||
| int size=200; | int size=200; | ||||||
|     |     | ||||||
|   if (DIRNAME==NULL) set_profile_dir(NULL); |   if (GLOBAL_DIRNAME==NULL) set_profile_dir(NULL); | ||||||
|   size=strlen(DIRNAME)+40; |   size=strlen(GLOBAL_DIRNAME)+40; | ||||||
|   if (FNAME!=NULL) free(FNAME); |   if (FNAME!=NULL) free(FNAME); | ||||||
|   FNAME=malloc(size); |   FNAME=malloc(size); | ||||||
|   if (FNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } |   if (FNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } | ||||||
|   strcpy(FNAME,DIRNAME); |   strcpy(FNAME,GLOBAL_DIRNAME); | ||||||
|  |  | ||||||
|   if (k==PROFILING_FILE) { |   if (k==PROFILING_FILE) { | ||||||
|     sprintf(FNAME,"%s/PROFILING_%d",FNAME,getpid()); |     sprintf(FNAME,"%s/PROFILING_%d",FNAME,getpid()); | ||||||
| @@ -697,7 +697,7 @@ int size=200; | |||||||
|  |  | ||||||
| void del_profile_files(void); | void del_profile_files(void); | ||||||
| void del_profile_files() { | void del_profile_files() { | ||||||
|   if (DIRNAME!=NULL) { |   if (GLOBAL_DIRNAME!=NULL) { | ||||||
|     remove(profile_names(PROFPREDS_FILE)); |     remove(profile_names(PROFPREDS_FILE)); | ||||||
|     remove(profile_names(PROFILING_FILE)); |     remove(profile_names(PROFILING_FILE)); | ||||||
|   } |   } | ||||||
| @@ -708,7 +708,7 @@ Yap_inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe, | |||||||
| static Int order=0; | static Int order=0; | ||||||
|   |   | ||||||
|   ProfPreds++; |   ProfPreds++; | ||||||
|   ProfOn = TRUE; |   GLOBAL_ProfOn = TRUE; | ||||||
|   if (FPreds != NULL) { |   if (FPreds != NULL) { | ||||||
|     Int temp; |     Int temp; | ||||||
|  |  | ||||||
| @@ -716,7 +716,7 @@ static Int order=0; | |||||||
|     if (index_code) temp=-order; else temp=order; |     if (index_code) temp=-order; else temp=order; | ||||||
|     fprintf(FPreds,"+%p %p %p %ld\n",code_start,code_end, pe, (long int)temp); |     fprintf(FPreds,"+%p %p %p %ld\n",code_start,code_end, pe, (long int)temp); | ||||||
|   } |   } | ||||||
|   ProfOn = FALSE; |   GLOBAL_ProfOn = FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
| typedef struct clause_entry { | typedef struct clause_entry { | ||||||
| @@ -731,7 +731,7 @@ static Int profend( USES_REGS1 ); | |||||||
|  |  | ||||||
| static void | static void | ||||||
| clean_tree(rb_red_blk_node* node) { | clean_tree(rb_red_blk_node* node) { | ||||||
|   if (node == ProfilerNil) |   if (node == GLOBAL_ProfilerNil) | ||||||
|     return; |     return; | ||||||
|   clean_tree(node->left); |   clean_tree(node->left); | ||||||
|   clean_tree(node->right); |   clean_tree(node->right); | ||||||
| @@ -740,18 +740,18 @@ clean_tree(rb_red_blk_node* node) { | |||||||
|  |  | ||||||
| static void | static void | ||||||
| reset_tree(void) { | reset_tree(void) { | ||||||
|   clean_tree(ProfilerRoot); |   clean_tree(GLOBAL_ProfilerRoot); | ||||||
|   Yap_FreeCodeSpace((char *)ProfilerNil); |   Yap_FreeCodeSpace((char *)GLOBAL_ProfilerNil); | ||||||
|   ProfilerNil = ProfilerRoot = NULL; |   GLOBAL_ProfilerNil = GLOBAL_ProfilerRoot = NULL; | ||||||
|   ProfCalls = ProfGCs = ProfHGrows = ProfSGrows = ProfMallocs = ProfOns = 0L; |   GLOBAL_ProfCalls = GLOBAL_ProfGCs = GLOBAL_ProfHGrows = GLOBAL_ProfSGrows = GLOBAL_ProfMallocs = GLOBAL_ProfOns = 0L; | ||||||
| } | } | ||||||
|  |  | ||||||
| static int | static int | ||||||
| InitProfTree(void) | InitProfTree(void) | ||||||
| { | { | ||||||
|   if (ProfilerRoot)  |   if (GLOBAL_ProfilerRoot)  | ||||||
|     reset_tree(); |     reset_tree(); | ||||||
|   while (!(ProfilerRoot = RBTreeCreate())) { |   while (!(GLOBAL_ProfilerRoot = RBTreeCreate())) { | ||||||
|     if (!Yap_growheap(FALSE, 0, NULL)) { |     if (!Yap_growheap(FALSE, 0, NULL)) { | ||||||
|       Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler"); |       Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler"); | ||||||
|       return FALSE; |       return FALSE; | ||||||
| @@ -807,10 +807,10 @@ static void RemoveCode(CODEADDR clau) | |||||||
|   PredEntry *pp; |   PredEntry *pp; | ||||||
|   UInt count; |   UInt count; | ||||||
|  |  | ||||||
|   if (!ProfilerRoot) return; |   if (!GLOBAL_ProfilerRoot) return; | ||||||
|   if (!(x = RBExactQuery((yamop *)clau))) { |   if (!(x = RBExactQuery((yamop *)clau))) { | ||||||
|     /* send message */ |     /* send message */ | ||||||
|     ProfOn = FALSE; |     GLOBAL_ProfOn = FALSE; | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   pp = x->pe; |   pp = x->pe; | ||||||
| @@ -823,7 +823,7 @@ static void RemoveCode(CODEADDR clau) | |||||||
|     node->pe = pp; |     node->pe = pp; | ||||||
|     node->pcs = count; |     node->pcs = count; | ||||||
|     /* send message */ |     /* send message */ | ||||||
|     ProfOn = FALSE; |     GLOBAL_ProfOn = FALSE; | ||||||
|     return; |     return; | ||||||
|   } else { |   } else { | ||||||
|     node->pcs += count; |     node->pcs += count; | ||||||
| @@ -872,7 +872,7 @@ showprofres( USES_REGS1 ) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   fclose(FProf); |   fclose(FProf); | ||||||
|   if (ProfCalls==0)  |   if (GLOBAL_ProfCalls==0)  | ||||||
|     return TRUE; |     return TRUE; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| @@ -909,7 +909,7 @@ p_test( USES_REGS1 ) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   fclose(FProf); |   fclose(FProf); | ||||||
|   if (ProfCalls==0)  |   if (GLOBAL_ProfCalls==0)  | ||||||
|     return TRUE; |     return TRUE; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| @@ -920,39 +920,40 @@ p_test( USES_REGS1 ) { | |||||||
|  |  | ||||||
| static void | static void | ||||||
| prof_alrm(int signo, siginfo_t *si, void *scv) | prof_alrm(int signo, siginfo_t *si, void *scv) | ||||||
| { | {  | ||||||
|  |   CACHE_REGS | ||||||
|   void * oldpc=(void *) CONTEXT_PC(scv); |   void * oldpc=(void *) CONTEXT_PC(scv); | ||||||
|   yamop *current_p; |   yamop *current_p; | ||||||
|  |  | ||||||
|   ProfCalls++; |   GLOBAL_ProfCalls++; | ||||||
|   /* skip an interrupt */ |   /* skip an interrupt */ | ||||||
|   if (ProfOn) { |   if (GLOBAL_ProfOn) { | ||||||
|     ProfOns++; |     GLOBAL_ProfOns++; | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   ProfOn = TRUE; |   GLOBAL_ProfOn = TRUE; | ||||||
|   if (Yap_PrologMode & TestMode) { |   if (LOCAL_PrologMode & TestMode) { | ||||||
|     if (Yap_PrologMode & GCMode) { |     if (LOCAL_PrologMode & GCMode) { | ||||||
|       ProfGCs++; |       GLOBAL_ProfGCs++; | ||||||
|       ProfOn = FALSE; |       GLOBAL_ProfOn = FALSE; | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (Yap_PrologMode & MallocMode) { |     if (LOCAL_PrologMode & MallocMode) { | ||||||
|       ProfMallocs++; |       GLOBAL_ProfMallocs++; | ||||||
|       ProfOn = FALSE; |       GLOBAL_ProfOn = FALSE; | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (Yap_PrologMode & GrowHeapMode) { |     if (LOCAL_PrologMode & GrowHeapMode) { | ||||||
|       ProfHGrows++; |       GLOBAL_ProfHGrows++; | ||||||
|       ProfOn = FALSE; |       GLOBAL_ProfOn = FALSE; | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|    |    | ||||||
|     if (Yap_PrologMode & GrowStackMode) { |     if (LOCAL_PrologMode & GrowStackMode) { | ||||||
|       ProfSGrows++; |       GLOBAL_ProfSGrows++; | ||||||
|       ProfOn = FALSE; |       GLOBAL_ProfOn = FALSE; | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     |     | ||||||
| @@ -987,34 +988,34 @@ prof_alrm(int signo, siginfo_t *si, void *scv) | |||||||
| #if DEBUG | #if DEBUG | ||||||
|     fprintf(stderr,"Oops: %p, %p\n", oldpc, current_p); |     fprintf(stderr,"Oops: %p, %p\n", oldpc, current_p); | ||||||
| #endif | #endif | ||||||
|     ProfOn = FALSE; |     GLOBAL_ProfOn = FALSE; | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   if (Yap_OffLineProfiler) { |   if (Yap_OffLineProfiler) { | ||||||
|     fprintf(FProf,"%p\n", current_p); |     fprintf(FProf,"%p\n", current_p); | ||||||
|     ProfOn = FALSE; |     GLOBAL_ProfOn = FALSE; | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   LookupNode(current_p); |   LookupNode(current_p); | ||||||
|   ProfOn = FALSE; |   GLOBAL_ProfOn = FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void | void | ||||||
| Yap_InformOfRemoval(CODEADDR clau) | Yap_InformOfRemoval(CODEADDR clau) | ||||||
| { | { | ||||||
|   ProfOn = TRUE; |   GLOBAL_ProfOn = TRUE; | ||||||
|   if (FPreds != NULL) { |   if (FPreds != NULL) { | ||||||
|     /* just store info about what is going on  */ |     /* just store info about what is going on  */ | ||||||
|     fprintf(FPreds,"-%p\n",clau); |     fprintf(FPreds,"-%p\n",clau); | ||||||
|     ProfOn = FALSE; |     GLOBAL_ProfOn = FALSE; | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   RemoveCode(clau); |   RemoveCode(clau); | ||||||
|   ProfOn = FALSE; |   GLOBAL_ProfOn = FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int profend( USES_REGS1 );  | static Int profend( USES_REGS1 );  | ||||||
| @@ -1024,25 +1025,25 @@ profnode( USES_REGS1 ) { | |||||||
|   Term t1 = Deref(ARG1), tleft, tright; |   Term t1 = Deref(ARG1), tleft, tright; | ||||||
|   rb_red_blk_node *node; |   rb_red_blk_node *node; | ||||||
|  |  | ||||||
|   if (!ProfilerRoot) |   if (!GLOBAL_ProfilerRoot) | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   if (!(node = (rb_red_blk_node *)IntegerOfTerm(t1))) |   if (!(node = (rb_red_blk_node *)IntegerOfTerm(t1))) | ||||||
|     node = ProfilerRoot; |     node = GLOBAL_ProfilerRoot; | ||||||
|   /* |   /* | ||||||
|     if (node->key) |     if (node->key) | ||||||
|     fprintf(stderr,"%p: %p,%p,%d,%p(%d),%p,%p\n",node,node->key,node->lim,node->pcs,node->pe,node->pe->ArityOfPE,node->right,node->left); |     fprintf(stderr,"%p: %p,%p,%d,%p(%d),%p,%p\n",node,node->key,node->lim,node->pcs,node->pe,node->pe->ArityOfPE,node->right,node->left); | ||||||
|   */ |   */ | ||||||
|   if (node->left == ProfilerNil) { |   if (node->left == GLOBAL_ProfilerNil) { | ||||||
|     tleft = TermNil; |     tleft = TermNil; | ||||||
|   } else { |   } else { | ||||||
|     tleft = MkIntegerTerm((Int)node->left); |     tleft = MkIntegerTerm((Int)node->left); | ||||||
|   } |   } | ||||||
|   if (node->left == ProfilerNil) { |   if (node->left == GLOBAL_ProfilerNil) { | ||||||
|     tleft = TermNil; |     tleft = TermNil; | ||||||
|   } else { |   } else { | ||||||
|     tleft = MkIntegerTerm((Int)node->left); |     tleft = MkIntegerTerm((Int)node->left); | ||||||
|   } |   } | ||||||
|   if (node->right == ProfilerNil) { |   if (node->right == GLOBAL_ProfilerNil) { | ||||||
|     tright = TermNil; |     tright = TermNil; | ||||||
|   } else { |   } else { | ||||||
|     tright = MkIntegerTerm((Int)node->right); |     tright = MkIntegerTerm((Int)node->right); | ||||||
| @@ -1058,12 +1059,12 @@ profnode( USES_REGS1 ) { | |||||||
| static Int | static Int | ||||||
| profglobs( USES_REGS1 ) { | profglobs( USES_REGS1 ) { | ||||||
|   return  |   return  | ||||||
|     Yap_unify(ARG1,MkIntegerTerm(ProfCalls)) && |     Yap_unify(ARG1,MkIntegerTerm(GLOBAL_ProfCalls)) && | ||||||
|     Yap_unify(ARG2,MkIntegerTerm(ProfGCs)) && |     Yap_unify(ARG2,MkIntegerTerm(GLOBAL_ProfGCs)) && | ||||||
|     Yap_unify(ARG3,MkIntegerTerm(ProfHGrows)) && |     Yap_unify(ARG3,MkIntegerTerm(GLOBAL_ProfHGrows)) && | ||||||
|     Yap_unify(ARG4,MkIntegerTerm(ProfSGrows)) && |     Yap_unify(ARG4,MkIntegerTerm(GLOBAL_ProfSGrows)) && | ||||||
|     Yap_unify(ARG5,MkIntegerTerm(ProfMallocs)) && |     Yap_unify(ARG5,MkIntegerTerm(GLOBAL_ProfMallocs)) && | ||||||
|     Yap_unify(ARG6,MkIntegerTerm(ProfOns)) ; |     Yap_unify(ARG6,MkIntegerTerm(GLOBAL_ProfOns)) ; | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int | static Int | ||||||
| @@ -1169,14 +1170,14 @@ static Int profoff( USES_REGS1 ) { | |||||||
|   return FALSE; |   return FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int profon( USES_REGS1 ) {  | static Int ProfOn( USES_REGS1 ) {  | ||||||
|   Term p; |   Term p; | ||||||
|   profoff( PASS_REGS1 ); |   profoff( PASS_REGS1 ); | ||||||
|   p=Deref(ARG1); |   p=Deref(ARG1); | ||||||
|   return(start_profilers(IntOfTerm(p))); |   return(start_profilers(IntOfTerm(p))); | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int profon0( USES_REGS1 ) {  | static Int ProfOn0( USES_REGS1 ) {  | ||||||
|   profoff( PASS_REGS1 ); |   profoff( PASS_REGS1 ); | ||||||
|   return(start_profilers(TIMER_DEFAULT)); |   return(start_profilers(TIMER_DEFAULT)); | ||||||
| } | } | ||||||
| @@ -1187,7 +1188,7 @@ static Int profison( USES_REGS1 ) { | |||||||
|  |  | ||||||
| static Int profalt( USES_REGS1 ) {  | static Int profalt( USES_REGS1 ) {  | ||||||
|   if (ProfilerOn==0) return(FALSE); |   if (ProfilerOn==0) return(FALSE); | ||||||
|   if (ProfilerOn==-1) return profon( PASS_REGS1 ); |   if (ProfilerOn==-1) return ProfOn( PASS_REGS1 ); | ||||||
|   return profoff( PASS_REGS1 ); |   return profoff( PASS_REGS1 ); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1248,15 +1249,15 @@ void | |||||||
| Yap_InitLowProf(void) | Yap_InitLowProf(void) | ||||||
| { | { | ||||||
| #if LOW_PROF | #if LOW_PROF | ||||||
|   ProfCalls = 0; |   GLOBAL_ProfCalls = 0; | ||||||
|   ProfilerOn = FALSE; |   ProfilerOn = FALSE; | ||||||
|   Yap_OffLineProfiler = FALSE; |   Yap_OffLineProfiler = FALSE; | ||||||
|   Yap_InitCPred("profinit",0, profinit, SafePredFlag); |   Yap_InitCPred("profinit",0, profinit, SafePredFlag); | ||||||
|   Yap_InitCPred("profinit",1, profinit1, SafePredFlag); |   Yap_InitCPred("profinit",1, profinit1, SafePredFlag); | ||||||
|   Yap_InitCPred("$proftype",1, proftype, SafePredFlag); |   Yap_InitCPred("$proftype",1, proftype, SafePredFlag); | ||||||
|   Yap_InitCPred("profend" ,0, profend, SafePredFlag); |   Yap_InitCPred("profend" ,0, profend, SafePredFlag); | ||||||
|   Yap_InitCPred("profon" , 0, profon0, SafePredFlag); |   Yap_InitCPred("ProfOn" , 0, ProfOn0, SafePredFlag); | ||||||
|   Yap_InitCPred("profon" , 1, profon, SafePredFlag); |   Yap_InitCPred("ProfOn" , 1, ProfOn, SafePredFlag); | ||||||
|   Yap_InitCPred("profoff", 0, profoff, SafePredFlag); |   Yap_InitCPred("profoff", 0, profoff, SafePredFlag); | ||||||
|   Yap_InitCPred("profalt", 0, profalt, SafePredFlag); |   Yap_InitCPred("profalt", 0, profalt, SafePredFlag); | ||||||
|   Yap_InitCPred("$offline_showprofres", 0, profres0, SafePredFlag); |   Yap_InitCPred("$offline_showprofres", 0, profres0, SafePredFlag); | ||||||
|   | |||||||
							
								
								
									
										157
									
								
								C/grow.c
									
									
									
									
									
								
							
							
						
						
									
										157
									
								
								C/grow.c
									
									
									
									
									
								
							| @@ -42,20 +42,7 @@ typedef enum { | |||||||
|   STACK_INCREMENTAL_COPYING = 2 |   STACK_INCREMENTAL_COPYING = 2 | ||||||
| } what_stack_copying; | } what_stack_copying; | ||||||
|  |  | ||||||
| static int heap_overflows = 0; |  | ||||||
| static Int total_heap_overflow_time = 0; |  | ||||||
|  |  | ||||||
| int stack_overflows = 0; |  | ||||||
| static Int total_stack_overflow_time = 0; |  | ||||||
|  |  | ||||||
| int delay_overflows = 0; |  | ||||||
| static Int total_delay_overflow_time = 0; |  | ||||||
|  |  | ||||||
| static int trail_overflows = 0; |  | ||||||
| static Int total_trail_overflow_time = 0; |  | ||||||
|  |  | ||||||
| static int atom_table_overflows = 0; |  | ||||||
| static Int total_atom_table_overflow_time = 0; |  | ||||||
|  |  | ||||||
| STATIC_PROTO(Int p_growheap, ( USES_REGS1 )); | STATIC_PROTO(Int p_growheap, ( USES_REGS1 )); | ||||||
| STATIC_PROTO(Int p_growstack, ( USES_REGS1 )); | STATIC_PROTO(Int p_growstack, ( USES_REGS1 )); | ||||||
| @@ -85,10 +72,11 @@ STATIC_PROTO(Term AdjustGlobTerm, (Term CACHE_TYPE)); | |||||||
| static void | static void | ||||||
| LeaveGrowMode(prolog_exec_mode grow_mode) | LeaveGrowMode(prolog_exec_mode grow_mode) | ||||||
| { | { | ||||||
|   Yap_PrologMode &= ~grow_mode; |   CACHE_REGS | ||||||
|   if (Yap_PrologMode & AbortMode) { |   LOCAL_PrologMode &= ~grow_mode; | ||||||
|  |   if (LOCAL_PrologMode & AbortMode) { | ||||||
|     CACHE_REGS |     CACHE_REGS | ||||||
|     Yap_PrologMode &= ~AbortMode; |     LOCAL_PrologMode &= ~AbortMode; | ||||||
|     Yap_Error(PURE_ABORT, TermNil, ""); |     Yap_Error(PURE_ABORT, TermNil, ""); | ||||||
|     /* in case someone mangles the P register */ |     /* in case someone mangles the P register */ | ||||||
|     save_machine_regs(); |     save_machine_regs(); | ||||||
| @@ -121,7 +109,7 @@ static void | |||||||
| SetHeapRegs(int copying_threads USES_REGS) | SetHeapRegs(int copying_threads USES_REGS) | ||||||
| { | { | ||||||
| #ifdef undf7 | #ifdef undf7 | ||||||
|   fprintf(Yap_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, LOCAL_GlobalBase, H, LCL0, ASP); |   fprintf(GLOBAL_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, LOCAL_GlobalBase, H, LCL0, ASP); | ||||||
| #endif | #endif | ||||||
|   /* The old stack pointers */ |   /* The old stack pointers */ | ||||||
|   LOCAL_OldLCL0 = LCL0; |   LOCAL_OldLCL0 = LCL0; | ||||||
| @@ -373,7 +361,7 @@ AdjustAppl(register CELL t0 USES_REGS) | |||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   else { |   else { | ||||||
|     /* strange cell */ |     /* strange cell */ | ||||||
|     /*    fprintf(Yap_stderr,"% garbage appl %lx found in stacks by stack shifter\n", t0);*/ |     /*    fprintf(GLOBAL_stderr,"% garbage appl %lx found in stacks by stack shifter\n", t0);*/ | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|   return(t0); |   return(t0); | ||||||
| @@ -391,7 +379,7 @@ AdjustPair(register CELL t0 USES_REGS) | |||||||
|   else if (IsHeapP(t)) |   else if (IsHeapP(t)) | ||||||
|     return (AbsPair(CellPtoHeapAdjust(t))); |     return (AbsPair(CellPtoHeapAdjust(t))); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   /* fprintf(Yap_stderr,"% garbage pair %lx found in stacks by stack shifter\n", t0);*/ |   /* fprintf(GLOBAL_stderr,"% garbage pair %lx found in stacks by stack shifter\n", t0);*/ | ||||||
| #endif | #endif | ||||||
|   return(t0); |   return(t0); | ||||||
| } | } | ||||||
| @@ -788,13 +776,13 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o | |||||||
|   } |   } | ||||||
|   start_growth_time = Yap_cputime(); |   start_growth_time = Yap_cputime(); | ||||||
|   gc_verbose = Yap_is_gc_verbose(); |   gc_verbose = Yap_is_gc_verbose(); | ||||||
|   heap_overflows++; |   LOCAL_heap_overflows++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #if  defined(YAPOR_THREADS) | #if  defined(YAPOR_THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Database Overflow %d\n", heap_overflows); |     fprintf(GLOBAL_stderr, "%% Database Overflow %d\n", LOCAL_heap_overflows); | ||||||
|     fprintf(Yap_stderr, "%%   growing the heap %ld bytes\n", size); |     fprintf(GLOBAL_stderr, "%%   growing the heap %ld bytes\n", size); | ||||||
|   } |   } | ||||||
|   /* CreepFlag is set to force heap expansion */ |   /* CreepFlag is set to force heap expansion */ | ||||||
|   if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { |   if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { | ||||||
| @@ -835,10 +823,10 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o | |||||||
|   if (minimal_request)  |   if (minimal_request)  | ||||||
|     Yap_AllocHole(minimal_request, size); |     Yap_AllocHole(minimal_request, size); | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_heap_overflow_time += growth_time; |   LOCAL_total_heap_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   took %g sec\n", (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%%   took %g sec\n", (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% Total of %g sec expanding Database\n", (double)total_heap_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% Total of %g sec expanding Database\n", (double)LOCAL_total_heap_overflow_time/1000); | ||||||
|   } |   } | ||||||
|   return(TRUE); |   return(TRUE); | ||||||
| } | } | ||||||
| @@ -900,7 +888,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) | |||||||
|   } |   } | ||||||
|   /* adjust to a multiple of 256) */ |   /* adjust to a multiple of 256) */ | ||||||
|   LOCAL_ErrorMessage = NULL; |   LOCAL_ErrorMessage = NULL; | ||||||
|   Yap_PrologMode |= GrowStackMode; |   LOCAL_PrologMode |= GrowStackMode; | ||||||
|   start_growth_time = Yap_cputime(); |   start_growth_time = Yap_cputime(); | ||||||
|   if (do_grow) { |   if (do_grow) { | ||||||
|     if (!GLOBAL_AllowGlobalExpansion) { |     if (!GLOBAL_AllowGlobalExpansion) { | ||||||
| @@ -922,7 +910,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   gc_verbose = Yap_is_gc_verbose(); |   gc_verbose = Yap_is_gc_verbose(); | ||||||
|   delay_overflows++; |   LOCAL_delay_overflows++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     if (hsplit) { |     if (hsplit) { | ||||||
|       if (hsplit > H0) { |       if (hsplit > H0) { | ||||||
| @@ -937,10 +925,10 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) | |||||||
|       vb_msg2 = "Delay"; |       vb_msg2 = "Delay"; | ||||||
|     } |     } | ||||||
| #if  defined(YAPOR_THREADS) | #if  defined(YAPOR_THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, delay_overflows); |     fprintf(GLOBAL_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, LOCAL_delay_overflows); | ||||||
|     fprintf(Yap_stderr, "%% %cO   growing the stacks %ld bytes\n", vb_msg1, size); |     fprintf(GLOBAL_stderr, "%% %cO   growing the stacks %ld bytes\n", vb_msg1, size); | ||||||
|   } |   } | ||||||
|   ASP -= 256; |   ASP -= 256; | ||||||
|   YAPEnterCriticalSection(); |   YAPEnterCriticalSection(); | ||||||
| @@ -1019,10 +1007,10 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) | |||||||
|     Yap_AllocHole(minimal_request, size); |     Yap_AllocHole(minimal_request, size); | ||||||
|   } |   } | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_delay_overflow_time += growth_time; |   LOCAL_total_delay_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%% %cO   took %g sec\n", vb_msg1, (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%% %cO   took %g sec\n", vb_msg1, (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% %cO Total of %g sec expanding stacks \n", vb_msg1, (double)total_delay_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% %cO Total of %g sec expanding stacks \n", vb_msg1, (double)LOCAL_total_delay_overflow_time/1000); | ||||||
|   } |   } | ||||||
|   LeaveGrowMode(GrowStackMode); |   LeaveGrowMode(GrowStackMode); | ||||||
|   if (hsplit) { |   if (hsplit) { | ||||||
| @@ -1246,7 +1234,7 @@ static int | |||||||
| do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS) | do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep USES_REGS) | ||||||
| { | { | ||||||
|   unsigned long size = sizeof(CELL) * K16; |   unsigned long size = sizeof(CELL) * K16; | ||||||
|   int shift_factor = (heap_overflows > 8 ? 8 : heap_overflows); |   int shift_factor = (LOCAL_heap_overflows > 8 ? 8 : LOCAL_heap_overflows); | ||||||
|   unsigned long sz =  size << shift_factor; |   unsigned long sz =  size << shift_factor; | ||||||
|  |  | ||||||
|   if (sz < in_size) { |   if (sz < in_size) { | ||||||
| @@ -1355,13 +1343,13 @@ growatomtable( USES_REGS1 ) | |||||||
| #endif | #endif | ||||||
|       return FALSE; |       return FALSE; | ||||||
|   } |   } | ||||||
|   atom_table_overflows++; |   LOCAL_atom_table_overflows ++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #if  defined(YAPOR_THREADS) | #if  defined(YAPOR_THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Atom Table Overflow %d\n", atom_table_overflows); |     fprintf(GLOBAL_stderr, "%% Atom Table Overflow %d\n", LOCAL_atom_table_overflows ); | ||||||
|     fprintf(Yap_stderr, "%%    growing the atom table to %ld entries\n", (long int)(nsize)); |     fprintf(GLOBAL_stderr, "%%    growing the atom table to %ld entries\n", (long int)(nsize)); | ||||||
|   } |   } | ||||||
|   YAPEnterCriticalSection(); |   YAPEnterCriticalSection(); | ||||||
|   init_new_table(ntb, nsize); |   init_new_table(ntb, nsize); | ||||||
| @@ -1371,10 +1359,10 @@ growatomtable( USES_REGS1 ) | |||||||
|   AtomHashTableSize = nsize; |   AtomHashTableSize = nsize; | ||||||
|   YAPLeaveCriticalSection(); |   YAPLeaveCriticalSection(); | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_atom_table_overflow_time += growth_time; |   LOCAL_total_atom_table_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   took %g sec\n", (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%%   took %g sec\n", (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% Total of %g sec expanding atom table \n", (double)total_atom_table_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% Total of %g sec expanding atom table \n", (double)LOCAL_total_atom_table_overflow_time/1000); | ||||||
|   } |   } | ||||||
| #if USE_SYSTEM_MALLOC | #if USE_SYSTEM_MALLOC | ||||||
|   return TRUE; |   return TRUE; | ||||||
| @@ -1480,7 +1468,7 @@ Yap_growstack(long size) | |||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   int res; |   int res; | ||||||
|  |  | ||||||
|   Yap_PrologMode |= GrowStackMode; |   LOCAL_PrologMode |= GrowStackMode; | ||||||
|   res=growstack(size PASS_REGS); |   res=growstack(size PASS_REGS); | ||||||
|   LeaveGrowMode(GrowStackMode); |   LeaveGrowMode(GrowStackMode); | ||||||
|   return res; |   return res; | ||||||
| @@ -1602,25 +1590,25 @@ growstack(long size USES_REGS) | |||||||
|   LOCAL_ErrorMessage = NULL; |   LOCAL_ErrorMessage = NULL; | ||||||
|   start_growth_time = Yap_cputime(); |   start_growth_time = Yap_cputime(); | ||||||
|   gc_verbose = Yap_is_gc_verbose(); |   gc_verbose = Yap_is_gc_verbose(); | ||||||
|   stack_overflows++; |   LOCAL_stack_overflows++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #if  defined(YAPOR) || defined(THREADS) | #if  defined(YAPOR) || defined(THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Stack Overflow %d\n", stack_overflows); |     fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); | ||||||
|     fprintf(Yap_stderr, "%%   Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H); |     fprintf(GLOBAL_stderr, "%%   Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H); | ||||||
|     fprintf(Yap_stderr, "%%   Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); |     fprintf(GLOBAL_stderr, "%%   Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); | ||||||
|     fprintf(Yap_stderr, "%%   Trail:%8ld cells (%p-%p)\n", |     fprintf(GLOBAL_stderr, "%%   Trail:%8ld cells (%p-%p)\n", | ||||||
| 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | ||||||
|     fprintf(Yap_stderr, "%% Growing the stacks %ld bytes\n", size); |     fprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", size); | ||||||
|   } |   } | ||||||
|   if (!execute_growstack(size, FALSE, FALSE, NULL, NULL, NULL PASS_REGS)) |   if (!execute_growstack(size, FALSE, FALSE, NULL, NULL, NULL PASS_REGS)) | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_stack_overflow_time += growth_time; |   LOCAL_total_stack_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   took %g sec\n", (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%%   took %g sec\n", (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); | ||||||
|   } |   } | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| @@ -1634,33 +1622,33 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep) | |||||||
|   UInt start_growth_time, growth_time; |   UInt start_growth_time, growth_time; | ||||||
|   int gc_verbose; |   int gc_verbose; | ||||||
|  |  | ||||||
|   Yap_PrologMode |= GrowStackMode; |   LOCAL_PrologMode |= GrowStackMode; | ||||||
|   /* adjust to a multiple of 256) */ |   /* adjust to a multiple of 256) */ | ||||||
|   size = AdjustPageSize((ADDR)LCL0-LOCAL_GlobalBase); |   size = AdjustPageSize((ADDR)LCL0-LOCAL_GlobalBase); | ||||||
|   LOCAL_ErrorMessage = NULL; |   LOCAL_ErrorMessage = NULL; | ||||||
|   start_growth_time = Yap_cputime(); |   start_growth_time = Yap_cputime(); | ||||||
|   gc_verbose = Yap_is_gc_verbose(); |   gc_verbose = Yap_is_gc_verbose(); | ||||||
|   stack_overflows++; |   LOCAL_stack_overflows++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #if  defined(YAPOR) || defined(THREADS) | #if  defined(YAPOR) || defined(THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Stack Overflow %d\n", stack_overflows); |     fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); | ||||||
|     fprintf(Yap_stderr, "%%   Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H); |     fprintf(GLOBAL_stderr, "%%   Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H); | ||||||
|     fprintf(Yap_stderr, "%%   Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); |     fprintf(GLOBAL_stderr, "%%   Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); | ||||||
|     fprintf(Yap_stderr, "%%   Trail:%8ld cells (%p-%p)\n", |     fprintf(GLOBAL_stderr, "%%   Trail:%8ld cells (%p-%p)\n", | ||||||
| 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | ||||||
|     fprintf(Yap_stderr, "%% Growing the stacks %ld bytes\n", (unsigned long int)size); |     fprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", (unsigned long int)size); | ||||||
|   } |   } | ||||||
|   if (!execute_growstack(size, FALSE, TRUE, old_trp, tksp, vep PASS_REGS)) { |   if (!execute_growstack(size, FALSE, TRUE, old_trp, tksp, vep PASS_REGS)) { | ||||||
|     LeaveGrowMode(GrowStackMode); |     LeaveGrowMode(GrowStackMode); | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   } |   } | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_stack_overflow_time += growth_time; |   LOCAL_total_stack_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   took %g sec\n", (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%%   took %g sec\n", (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); | ||||||
|   } |   } | ||||||
|   LeaveGrowMode(GrowStackMode); |   LeaveGrowMode(GrowStackMode); | ||||||
|   return TRUE; |   return TRUE; | ||||||
| @@ -1688,19 +1676,19 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr | |||||||
|     size=size0; |     size=size0; | ||||||
|   /* adjust to a multiple of 256) */ |   /* adjust to a multiple of 256) */ | ||||||
|   size = AdjustPageSize(size); |   size = AdjustPageSize(size); | ||||||
|   trail_overflows++; |   LOCAL_trail_overflows++; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Trail Overflow %d\n", trail_overflows); |     fprintf(GLOBAL_stderr, "%% Trail Overflow %d\n", LOCAL_trail_overflows); | ||||||
| #if USE_SYSTEM_MALLOC | #if USE_SYSTEM_MALLOC | ||||||
|     fprintf(Yap_stderr, "%%  Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,H); |     fprintf(GLOBAL_stderr, "%%  Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,H); | ||||||
|     fprintf(Yap_stderr, "%%  Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); |     fprintf(GLOBAL_stderr, "%%  Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); | ||||||
|     fprintf(Yap_stderr, "%%  Trail:%8ld cells (%p-%p)\n", |     fprintf(GLOBAL_stderr, "%%  Trail:%8ld cells (%p-%p)\n", | ||||||
| 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% growing the trail %ld bytes\n", size); |     fprintf(GLOBAL_stderr, "%% growing the trail %ld bytes\n", size); | ||||||
|   } |   } | ||||||
|   LOCAL_ErrorMessage = NULL; |   LOCAL_ErrorMessage = NULL; | ||||||
|   if (!GLOBAL_AllowTrailExpansion) { |   if (!GLOBAL_AllowTrailExpansion) { | ||||||
| @@ -1714,7 +1702,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr | |||||||
|     LOCAL_ErrorMessage = NULL; |     LOCAL_ErrorMessage = NULL; | ||||||
|     if (contiguous_only) { |     if (contiguous_only) { | ||||||
|       /* I can't expand in this case */ |       /* I can't expand in this case */ | ||||||
|       trail_overflows--; |       LOCAL_trail_overflows--; | ||||||
|       return FALSE; |       return FALSE; | ||||||
|     } |     } | ||||||
|     execute_growstack(size, TRUE, in_parser, old_trp, tksp, vep PASS_REGS); |     execute_growstack(size, TRUE, in_parser, old_trp, tksp, vep PASS_REGS); | ||||||
| @@ -1729,10 +1717,10 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr | |||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|   growth_time = Yap_cputime()-start_growth_time; |   growth_time = Yap_cputime()-start_growth_time; | ||||||
|   total_trail_overflow_time += growth_time; |   LOCAL_total_trail_overflow_time += growth_time; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%  took %g sec\n", (double)growth_time/1000); |     fprintf(GLOBAL_stderr, "%%  took %g sec\n", (double)growth_time/1000); | ||||||
|     fprintf(Yap_stderr, "%% Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000); |     fprintf(GLOBAL_stderr, "%% Total of %g sec expanding trail \n", (double)LOCAL_total_trail_overflow_time/1000); | ||||||
|   } |   } | ||||||
|   LOCK(LOCAL_SignalLock); |   LOCK(LOCAL_SignalLock); | ||||||
|   if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) { |   if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) { | ||||||
| @@ -1801,8 +1789,8 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp) | |||||||
| static Int | static Int | ||||||
| p_inform_trail_overflows( USES_REGS1 ) | p_inform_trail_overflows( USES_REGS1 ) | ||||||
| { | { | ||||||
|   Term tn = MkIntTerm(trail_overflows); |   Term tn = MkIntTerm(LOCAL_trail_overflows); | ||||||
|   Term tt = MkIntegerTerm(total_trail_overflow_time); |   Term tt = MkIntegerTerm(LOCAL_total_trail_overflow_time); | ||||||
|   |   | ||||||
|   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); |   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); | ||||||
| } | } | ||||||
| @@ -1831,8 +1819,8 @@ p_growheap( USES_REGS1 ) | |||||||
| static Int | static Int | ||||||
| p_inform_heap_overflows( USES_REGS1 ) | p_inform_heap_overflows( USES_REGS1 ) | ||||||
| { | { | ||||||
|   Term tn = MkIntTerm(heap_overflows); |   Term tn = MkIntTerm(LOCAL_heap_overflows); | ||||||
|   Term tt = MkIntegerTerm(total_heap_overflow_time); |   Term tt = MkIntegerTerm(LOCAL_total_heap_overflow_time); | ||||||
|   |   | ||||||
|   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); |   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); | ||||||
| } | } | ||||||
| @@ -1929,8 +1917,8 @@ p_growstack( USES_REGS1 ) | |||||||
| static Int | static Int | ||||||
| p_inform_stack_overflows( USES_REGS1 ) | p_inform_stack_overflows( USES_REGS1 ) | ||||||
| {				/*  */ | {				/*  */ | ||||||
|   Term tn = MkIntTerm(stack_overflows); |   Term tn = MkIntTerm(LOCAL_stack_overflows); | ||||||
|   Term tt = MkIntegerTerm(total_stack_overflow_time); |   Term tt = MkIntegerTerm(LOCAL_total_stack_overflow_time); | ||||||
|   |   | ||||||
|   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); |   return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); | ||||||
|  |  | ||||||
| @@ -1939,9 +1927,10 @@ p_inform_stack_overflows( USES_REGS1 ) | |||||||
| Int | Int | ||||||
| Yap_total_stack_shift_time(void) | Yap_total_stack_shift_time(void) | ||||||
| { | { | ||||||
|   return(total_heap_overflow_time+ |   CACHE_REGS | ||||||
| 	 total_stack_overflow_time+ |   return(LOCAL_total_heap_overflow_time+ | ||||||
| 	 total_trail_overflow_time); | 	 LOCAL_total_stack_overflow_time+ | ||||||
|  | 	 LOCAL_total_trail_overflow_time); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
|   | |||||||
							
								
								
									
										132
									
								
								C/heapgc.c
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								C/heapgc.c
									
									
									
									
									
								
							| @@ -978,17 +978,17 @@ inc_vars_of_type(CELL *curr,gc_types val) { | |||||||
| static void | static void | ||||||
| put_type_info(unsigned long total) | put_type_info(unsigned long total) | ||||||
| { | { | ||||||
|   fprintf(Yap_stderr,"%%  type info for %lu cells\n", total); |   fprintf(GLOBAL_stderr,"%%  type info for %lu cells\n", total); | ||||||
|   fprintf(Yap_stderr,"%%      %lu vars\n", vars[gc_var]); |   fprintf(GLOBAL_stderr,"%%      %lu vars\n", vars[gc_var]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu refs\n", vars[gc_ref]); |   fprintf(GLOBAL_stderr,"%%      %lu refs\n", vars[gc_ref]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu references from env\n", env_vars); |   fprintf(GLOBAL_stderr,"%%      %lu references from env\n", env_vars); | ||||||
|   fprintf(Yap_stderr,"%%      %lu atoms\n", vars[gc_atom]); |   fprintf(GLOBAL_stderr,"%%      %lu atoms\n", vars[gc_atom]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu small ints\n", vars[gc_int]); |   fprintf(GLOBAL_stderr,"%%      %lu small ints\n", vars[gc_int]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu other numbers\n", vars[gc_num]); |   fprintf(GLOBAL_stderr,"%%      %lu other numbers\n", vars[gc_num]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu lists\n", vars[gc_list]); |   fprintf(GLOBAL_stderr,"%%      %lu lists\n", vars[gc_list]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu compound terms\n", vars[gc_appl]); |   fprintf(GLOBAL_stderr,"%%      %lu compound terms\n", vars[gc_appl]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu functors\n", vars[gc_func]); |   fprintf(GLOBAL_stderr,"%%      %lu functors\n", vars[gc_func]); | ||||||
|   fprintf(Yap_stderr,"%%      %lu suspensions\n", vars[gc_susp]); |   fprintf(GLOBAL_stderr,"%%      %lu suspensions\n", vars[gc_susp]); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -1214,7 +1214,7 @@ mark_variable(CELL_PTR current USES_REGS) | |||||||
|       goto begin; |       goto begin; | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     } else if (next < (CELL *)LOCAL_GlobalBase || next > (CELL *)LOCAL_TrailTop) { |     } else if (next < (CELL *)LOCAL_GlobalBase || next > (CELL *)LOCAL_TrailTop) { | ||||||
|       fprintf(Yap_stderr, "OOPS in GC: marking, current=%p, *current=" UInt_FORMAT " next=%p\n", current, ccur, next); |       fprintf(GLOBAL_stderr, "OOPS in GC: marking, current=%p, *current=" UInt_FORMAT " next=%p\n", current, ccur, next); | ||||||
| #endif | #endif | ||||||
|     } else { |     } else { | ||||||
| #ifdef COROUTING | #ifdef COROUTING | ||||||
| @@ -1455,7 +1455,7 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap USES_REGS) | |||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if (size <  0 || size > 512) |     if (size <  0 || size > 512) | ||||||
|       fprintf(Yap_stderr,"OOPS in GC: env size for %p is " UInt_FORMAT "\n", gc_ENV, (CELL)size); |       fprintf(GLOBAL_stderr,"OOPS in GC: env size for %p is " UInt_FORMAT "\n", gc_ENV, (CELL)size); | ||||||
| #endif | #endif | ||||||
|     mark_db_fixed((CELL *)gc_ENV[E_CP] PASS_REGS); |     mark_db_fixed((CELL *)gc_ENV[E_CP] PASS_REGS); | ||||||
|     /* for each saved variable */ |     /* for each saved variable */ | ||||||
| @@ -1533,14 +1533,14 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap USES_REGS) | |||||||
| 	PredEntry *pe = EnvPreg(gc_ENV[E_CP]); | 	PredEntry *pe = EnvPreg(gc_ENV[E_CP]); | ||||||
| 	op_numbers op = Yap_op_from_opcode(ENV_ToOp(gc_ENV[E_CP])); | 	op_numbers op = Yap_op_from_opcode(ENV_ToOp(gc_ENV[E_CP])); | ||||||
| #if defined(ANALYST) || defined(DEBUG) | #if defined(ANALYST) || defined(DEBUG) | ||||||
| 	fprintf(Yap_stderr,"ENV %p-%p(%d) %s\n", gc_ENV, pvbmap, size-EnvSizeInCells, Yap_op_names[op]); | 	fprintf(GLOBAL_stderr,"ENV %p-%p(%d) %s\n", gc_ENV, pvbmap, size-EnvSizeInCells, Yap_op_names[op]); | ||||||
| #else | #else | ||||||
| 	fprintf(Yap_stderr,"ENV %p-%p(%d) %d\n", gc_ENV, pvbmap, size-EnvSizeInCells, (int)op); | 	fprintf(GLOBAL_stderr,"ENV %p-%p(%d) %d\n", gc_ENV, pvbmap, size-EnvSizeInCells, (int)op); | ||||||
| #endif | #endif | ||||||
| 	if (pe->ArityOfPE) | 	if (pe->ArityOfPE) | ||||||
| 	  fprintf(Yap_stderr,"   %s/%d\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE); | 	  fprintf(GLOBAL_stderr,"   %s/%d\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE); | ||||||
| 	else | 	else | ||||||
| 	  fprintf(Yap_stderr,"   %s\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE); | 	  fprintf(GLOBAL_stderr,"   %s\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE); | ||||||
|       } |       } | ||||||
| #endif | #endif | ||||||
|     gc_ENV = (CELL_PTR) gc_ENV[E_E];	/* link to prev |     gc_ENV = (CELL_PTR) gc_ENV[E_E];	/* link to prev | ||||||
| @@ -1899,19 +1899,19 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose | |||||||
|       PredEntry *pe = Yap_PredForChoicePt(gc_B); |       PredEntry *pe = Yap_PredForChoicePt(gc_B); | ||||||
| #if defined(ANALYST) || defined(DEBUG) | #if defined(ANALYST) || defined(DEBUG) | ||||||
|       if (pe == NULL) { |       if (pe == NULL) { | ||||||
| 	fprintf(Yap_stderr,"%%       marked %ld (%s)\n", LOCAL_total_marked, Yap_op_names[opnum]); | 	fprintf(GLOBAL_stderr,"%%       marked %ld (%s)\n", LOCAL_total_marked, Yap_op_names[opnum]); | ||||||
|       } else if (pe->ArityOfPE) { |       } else if (pe->ArityOfPE) { | ||||||
| 	fprintf(Yap_stderr,"%%       %s/%d marked %ld (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]); | 	fprintf(GLOBAL_stderr,"%%       %s/%d marked %ld (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]); | ||||||
|       } else { |       } else { | ||||||
| 	fprintf(Yap_stderr,"%%       %s marked %ld (%s)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, Yap_op_names[opnum]); | 	fprintf(GLOBAL_stderr,"%%       %s marked %ld (%s)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, Yap_op_names[opnum]); | ||||||
|       } |       } | ||||||
| #else | #else | ||||||
|       if (pe == NULL) { |       if (pe == NULL) { | ||||||
| 	fprintf(Yap_stderr,"%%       marked %ld (%u)\n", LOCAL_total_marked, (unsigned int)opnum); | 	fprintf(GLOBAL_stderr,"%%       marked %ld (%u)\n", LOCAL_total_marked, (unsigned int)opnum); | ||||||
|       } else if (pe->ArityOfPE) { |       } else if (pe->ArityOfPE) { | ||||||
| 	fprintf(Yap_stderr,"%%       %s/%d marked %ld (%u)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, (unsigned int)opnum); | 	fprintf(GLOBAL_stderr,"%%       %s/%d marked %ld (%u)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, (unsigned int)opnum); | ||||||
|       } else { |       } else { | ||||||
| 	fprintf(Yap_stderr,"%%       %s marked %ld (%u)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, (unsigned int)opnum); | 	fprintf(GLOBAL_stderr,"%%       %s marked %ld (%u)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, (unsigned int)opnum); | ||||||
|       } |       } | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
| @@ -2205,7 +2205,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose | |||||||
| 	nargs = rtp->u.Otapl.s; | 	nargs = rtp->u.Otapl.s; | ||||||
| 	break; | 	break; | ||||||
|       default: |       default: | ||||||
| 	fprintf(Yap_stderr, "OOPS in GC: Unexpected opcode: %d\n", opnum); | 	fprintf(GLOBAL_stderr, "OOPS in GC: Unexpected opcode: %d\n", opnum); | ||||||
| 	nargs = 0; | 	nargs = 0; | ||||||
| #else | #else | ||||||
|       default: |       default: | ||||||
| @@ -2644,27 +2644,27 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS) | |||||||
|   LOCAL_new_TR = dest; |   LOCAL_new_TR = dest; | ||||||
|   if (is_gc_verbose()) { |   if (is_gc_verbose()) { | ||||||
|     if (old_TR != (tr_fr_ptr)LOCAL_TrailBase) |     if (old_TR != (tr_fr_ptr)LOCAL_TrailBase) | ||||||
|       fprintf(Yap_stderr, |       fprintf(GLOBAL_stderr, | ||||||
| 		 "%%       Trail: discarded %d (%ld%%) cells out of %ld\n", | 		 "%%       Trail: discarded %d (%ld%%) cells out of %ld\n", | ||||||
| 		 LOCAL_discard_trail_entries, | 		 LOCAL_discard_trail_entries, | ||||||
| 		 (unsigned long int)(LOCAL_discard_trail_entries*100/(old_TR-(tr_fr_ptr)LOCAL_TrailBase)), | 		 (unsigned long int)(LOCAL_discard_trail_entries*100/(old_TR-(tr_fr_ptr)LOCAL_TrailBase)), | ||||||
| 		 (unsigned long int)(old_TR-(tr_fr_ptr)LOCAL_TrailBase)); | 		 (unsigned long int)(old_TR-(tr_fr_ptr)LOCAL_TrailBase)); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if (hp_entrs > 0) |     if (hp_entrs > 0) | ||||||
|       fprintf(Yap_stderr, |       fprintf(GLOBAL_stderr, | ||||||
| 		 "%%       Trail: unmarked %ld dbentries (%ld%%) out of %ld\n", | 		 "%%       Trail: unmarked %ld dbentries (%ld%%) out of %ld\n", | ||||||
| 		 (long int)hp_not_in_use, | 		 (long int)hp_not_in_use, | ||||||
| 		 (long int)(hp_not_in_use*100/hp_entrs), | 		 (long int)(hp_not_in_use*100/hp_entrs), | ||||||
| 		 (long int)hp_entrs); | 		 (long int)hp_entrs); | ||||||
|     if (hp_in_use_erased > 0 && hp_erased > 0) |     if (hp_in_use_erased > 0 && hp_erased > 0) | ||||||
|       fprintf(Yap_stderr, |       fprintf(GLOBAL_stderr, | ||||||
| 		 "%%       Trail: deleted %ld dbentries (%ld%%) out of %ld\n", | 		 "%%       Trail: deleted %ld dbentries (%ld%%) out of %ld\n", | ||||||
| 		 (long int)hp_erased, | 		 (long int)hp_erased, | ||||||
| 		 (long int)(hp_erased*100/(hp_erased+hp_in_use_erased)), | 		 (long int)(hp_erased*100/(hp_erased+hp_in_use_erased)), | ||||||
| 		 (long int)(hp_erased+hp_in_use_erased)); | 		 (long int)(hp_erased+hp_in_use_erased)); | ||||||
| #endif | #endif | ||||||
|     if (OldHeapUsed) { |     if (OldHeapUsed) { | ||||||
|       fprintf(Yap_stderr, |       fprintf(GLOBAL_stderr, | ||||||
| 	      "%%       Heap: recovered %ld bytes (%ld%%) out of %ld\n", | 	      "%%       Heap: recovered %ld bytes (%ld%%) out of %ld\n", | ||||||
| 	      (unsigned long int)(OldHeapUsed-HeapUsed), | 	      (unsigned long int)(OldHeapUsed-HeapUsed), | ||||||
| 	      (unsigned long int)((OldHeapUsed-HeapUsed)/(OldHeapUsed/100)), | 	      (unsigned long int)((OldHeapUsed-HeapUsed)/(OldHeapUsed/100)), | ||||||
| @@ -2832,7 +2832,7 @@ sweep_choicepoints(choiceptr gc_B USES_REGS) | |||||||
|  |  | ||||||
|   restart_cp: |   restart_cp: | ||||||
|     /* |     /* | ||||||
|      * fprintf(Yap_stderr,"sweeping cps: %x, %x, %x\n", |      * fprintf(GLOBAL_stderr,"sweeping cps: %x, %x, %x\n", | ||||||
|      * *gc_B,CP_Extra(gc_B),CP_Nargs(gc_B));  |      * *gc_B,CP_Extra(gc_B),CP_Nargs(gc_B));  | ||||||
|      */ |      */ | ||||||
|     /* any choice point */ |     /* any choice point */ | ||||||
| @@ -3279,12 +3279,12 @@ compact_heap( USES_REGS1 ) | |||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (dest != start_from-1) |   if (dest != start_from-1) | ||||||
|     fprintf(Yap_stderr,"%% Bad Dest (%lu): %p should be %p\n", |     fprintf(GLOBAL_stderr,"%% Bad Dest (%lu): %p should be %p\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    dest, | 	    dest, | ||||||
| 	    start_from-1); | 	    start_from-1); | ||||||
|   if (LOCAL_total_marked != found_marked) |   if (LOCAL_total_marked != found_marked) | ||||||
|     fprintf(Yap_stderr,"%% Upward (%lu): %lu total against %lu found\n", |     fprintf(GLOBAL_stderr,"%% Upward (%lu): %lu total against %lu found\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    (unsigned long int)LOCAL_total_marked, | 	    (unsigned long int)LOCAL_total_marked, | ||||||
| 	    (unsigned long int)found_marked); | 	    (unsigned long int)found_marked); | ||||||
| @@ -3343,7 +3343,7 @@ compact_heap( USES_REGS1 ) | |||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (LOCAL_total_marked != found_marked) |   if (LOCAL_total_marked != found_marked) | ||||||
|     fprintf(Yap_stderr,"%% Downward (%lu): %lu total against %lu found\n", |     fprintf(GLOBAL_stderr,"%% Downward (%lu): %lu total against %lu found\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    (unsigned long int)LOCAL_total_marked, | 	    (unsigned long int)LOCAL_total_marked, | ||||||
| 	    (unsigned long int)found_marked); | 	    (unsigned long int)found_marked); | ||||||
| @@ -3452,12 +3452,12 @@ icompact_heap( USES_REGS1 ) | |||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (dest != H0-1) |   if (dest != H0-1) | ||||||
|     fprintf(Yap_stderr,"%% Bad Dest (%lu): %p should be %p\n", |     fprintf(GLOBAL_stderr,"%% Bad Dest (%lu): %p should be %p\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    dest, | 	    dest, | ||||||
| 	    H0-1); | 	    H0-1); | ||||||
|   if (LOCAL_total_marked != found_marked) |   if (LOCAL_total_marked != found_marked) | ||||||
|     fprintf(Yap_stderr,"%% Upward (%lu): %lu total against %lu found\n", |     fprintf(GLOBAL_stderr,"%% Upward (%lu): %lu total against %lu found\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    (unsigned long int)LOCAL_total_marked, | 	    (unsigned long int)LOCAL_total_marked, | ||||||
| 	    (unsigned long int)found_marked); | 	    (unsigned long int)found_marked); | ||||||
| @@ -3515,12 +3515,12 @@ icompact_heap( USES_REGS1 ) | |||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (H0+LOCAL_total_marked != dest) |   if (H0+LOCAL_total_marked != dest) | ||||||
|     fprintf(Yap_stderr,"%% Downward (%lu): %p total against %p found\n", |     fprintf(GLOBAL_stderr,"%% Downward (%lu): %p total against %p found\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    H0+LOCAL_total_marked, | 	    H0+LOCAL_total_marked, | ||||||
| 	    dest); | 	    dest); | ||||||
|   if (LOCAL_total_marked != found_marked) |   if (LOCAL_total_marked != found_marked) | ||||||
|     fprintf(Yap_stderr,"%% Downward (%lu): %lu total against %lu found\n", |     fprintf(GLOBAL_stderr,"%% Downward (%lu): %lu total against %lu found\n", | ||||||
| 	    (unsigned long int)LOCAL_GcCalls, | 	    (unsigned long int)LOCAL_GcCalls, | ||||||
| 	    (unsigned long int)LOCAL_total_marked, | 	    (unsigned long int)LOCAL_total_marked, | ||||||
| 	    (unsigned long int)found_marked); | 	    (unsigned long int)found_marked); | ||||||
| @@ -3643,12 +3643,12 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS) | |||||||
| 	-LOCAL_total_smarked | 	-LOCAL_total_smarked | ||||||
| #endif | #endif | ||||||
| 	!= LOCAL_iptop-(CELL_PTR *)H && LOCAL_iptop < (CELL_PTR *)ASP -1024) | 	!= LOCAL_iptop-(CELL_PTR *)H && LOCAL_iptop < (CELL_PTR *)ASP -1024) | ||||||
|       fprintf(Yap_stderr,"%% Oops on LOCAL_iptop-H (%ld) vs %ld\n", (unsigned long int)(LOCAL_iptop-(CELL_PTR *)H), LOCAL_total_marked); |       fprintf(GLOBAL_stderr,"%% Oops on LOCAL_iptop-H (%ld) vs %ld\n", (unsigned long int)(LOCAL_iptop-(CELL_PTR *)H), LOCAL_total_marked); | ||||||
|     */ |     */ | ||||||
| #endif | #endif | ||||||
| #if DEBUGX | #if DEBUGX | ||||||
|     int effectiveness = (((H-H0)-LOCAL_total_marked)*100)/(H-H0); |     int effectiveness = (((H-H0)-LOCAL_total_marked)*100)/(H-H0); | ||||||
|     fprintf(Yap_stderr,"%% using pointers (%d)\n", effectiveness); |     fprintf(GLOBAL_stderr,"%% using pointers (%d)\n", effectiveness); | ||||||
| #endif | #endif | ||||||
|     if (CurrentH0) { |     if (CurrentH0) { | ||||||
|       H0 = CurrentH0; |       H0 = CurrentH0; | ||||||
| @@ -3719,15 +3719,15 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
|   if (Yap_GetValue(AtomGcTrace) != TermNil) |   if (Yap_GetValue(AtomGcTrace) != TermNil) | ||||||
|     gc_trace = 1; |     gc_trace = 1; | ||||||
|   if (gc_trace) { |   if (gc_trace) { | ||||||
|     fprintf(Yap_stderr, "%% gc\n"); |     fprintf(GLOBAL_stderr, "%% gc\n"); | ||||||
|   } else if (gc_verbose) { |   } else if (gc_verbose) { | ||||||
| #if  defined(YAPOR) || defined(THREADS) | #if  defined(YAPOR) || defined(THREADS) | ||||||
|     fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); |     fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); | ||||||
| #endif | #endif | ||||||
|     fprintf(Yap_stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls); |     fprintf(GLOBAL_stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls); | ||||||
|     fprintf(Yap_stderr, "%%       Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,H); |     fprintf(GLOBAL_stderr, "%%       Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,H); | ||||||
|     fprintf(Yap_stderr, "%%       Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); |     fprintf(GLOBAL_stderr, "%%       Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); | ||||||
|     fprintf(Yap_stderr, "%%       Trail:%8ld cells (%p-%p)\n", |     fprintf(GLOBAL_stderr, "%%       Trail:%8ld cells (%p-%p)\n", | ||||||
| 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | 	       (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); | ||||||
|   } |   } | ||||||
| #if !USE_SYSTEM_MALLOC | #if !USE_SYSTEM_MALLOC | ||||||
| @@ -3826,21 +3826,21 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
|   } else |   } else | ||||||
|     effectiveness = 0; |     effectiveness = 0; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   Mark: Marked %ld cells of %ld (efficiency: %ld%%) in %g sec\n", |     fprintf(GLOBAL_stderr, "%%   Mark: Marked %ld cells of %ld (efficiency: %ld%%) in %g sec\n", | ||||||
| 	       (long int)tot, (long int)heap_cells, (long int)effectiveness, (double)(m_time-time_start)/1000); | 	       (long int)tot, (long int)heap_cells, (long int)effectiveness, (double)(m_time-time_start)/1000); | ||||||
|     if (LOCAL_HGEN-H0) |     if (LOCAL_HGEN-H0) | ||||||
|       fprintf(Yap_stderr,"%%       previous generation has size " UInt_FORMAT ", with " UInt_FORMAT " (" UInt_FORMAT "%%) unmarked\n", (UInt)(LOCAL_HGEN-H0), (UInt)((LOCAL_HGEN-H0)-LOCAL_total_oldies), (UInt)(100*((LOCAL_HGEN-H0)-LOCAL_total_oldies)/(LOCAL_HGEN-H0))); |       fprintf(GLOBAL_stderr,"%%       previous generation has size " UInt_FORMAT ", with " UInt_FORMAT " (" UInt_FORMAT "%%) unmarked\n", (UInt)(LOCAL_HGEN-H0), (UInt)((LOCAL_HGEN-H0)-LOCAL_total_oldies), (UInt)(100*((LOCAL_HGEN-H0)-LOCAL_total_oldies)/(LOCAL_HGEN-H0))); | ||||||
| #ifdef INSTRUMENT_GC | #ifdef INSTRUMENT_GC | ||||||
|     { |     { | ||||||
|       int i; |       int i; | ||||||
|       for (i=0; i<16; i++) { |       for (i=0; i<16; i++) { | ||||||
| 	if (chain[i]) { | 	if (chain[i]) { | ||||||
| 	  fprintf(Yap_stderr, "%%     chain[%d]=%lu\n", i, chain[i]); | 	  fprintf(GLOBAL_stderr, "%%     chain[%d]=%lu\n", i, chain[i]); | ||||||
| 	} | 	} | ||||||
|       } |       } | ||||||
|       put_type_info((unsigned long int)tot); |       put_type_info((unsigned long int)tot); | ||||||
|       fprintf(Yap_stderr,"%%  %lu/%ld before and %lu/%ld after\n", old_vars, (unsigned long int)(B->cp_h-H0), new_vars, (unsigned long int)(H-B->cp_h)); |       fprintf(GLOBAL_stderr,"%%  %lu/%ld before and %lu/%ld after\n", old_vars, (unsigned long int)(B->cp_h-H0), new_vars, (unsigned long int)(H-B->cp_h)); | ||||||
|       fprintf(Yap_stderr,"%%  %ld choicepoints\n", num_bs); |       fprintf(GLOBAL_stderr,"%%  %ld choicepoints\n", num_bs); | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|   } |   } | ||||||
| @@ -3849,7 +3849,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
|   TR = old_TR; |   TR = old_TR; | ||||||
|   pop_registers(predarity, nextop PASS_REGS); |   pop_registers(predarity, nextop PASS_REGS); | ||||||
|   TR = LOCAL_new_TR; |   TR = LOCAL_new_TR; | ||||||
|   /*  fprintf(Yap_stderr,"NEW LOCAL_HGEN %ld (%ld)\n", H-H0, LOCAL_HGEN-H0);*/ |   /*  fprintf(GLOBAL_stderr,"NEW LOCAL_HGEN %ld (%ld)\n", H-H0, LOCAL_HGEN-H0);*/ | ||||||
|   { |   { | ||||||
|     Term t = MkVarTerm(); |     Term t = MkVarTerm(); | ||||||
|     Yap_UpdateTimedVar(LOCAL_GcGeneration, t); |     Yap_UpdateTimedVar(LOCAL_GcGeneration, t); | ||||||
| @@ -3857,14 +3857,14 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
|   Yap_UpdateTimedVar(LOCAL_GcPhase, MkIntegerTerm(LOCAL_GcCurrentPhase)); |   Yap_UpdateTimedVar(LOCAL_GcPhase, MkIntegerTerm(LOCAL_GcCurrentPhase)); | ||||||
|   c_time = Yap_cputime(); |   c_time = Yap_cputime(); | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%%   Compress: took %g sec\n", (double)(c_time-time_start)/1000); |     fprintf(GLOBAL_stderr, "%%   Compress: took %g sec\n", (double)(c_time-time_start)/1000); | ||||||
|   } |   } | ||||||
|   gc_time += (c_time-time_start); |   gc_time += (c_time-time_start); | ||||||
|   LOCAL_TotGcTime += gc_time; |   LOCAL_TotGcTime += gc_time; | ||||||
|   LOCAL_TotGcRecovered += heap_cells-tot; |   LOCAL_TotGcRecovered += heap_cells-tot; | ||||||
|   if (gc_verbose) { |   if (gc_verbose) { | ||||||
|     fprintf(Yap_stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000); |     fprintf(GLOBAL_stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000); | ||||||
|     fprintf(Yap_stderr, "%%  Left %ld cells free in stacks.\n", |     fprintf(GLOBAL_stderr, "%%  Left %ld cells free in stacks.\n", | ||||||
| 	       (unsigned long int)(ASP-H)); | 	       (unsigned long int)(ASP-H)); | ||||||
|   } |   } | ||||||
|   check_global(); |   check_global(); | ||||||
| @@ -3874,7 +3874,8 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
| static int | static int | ||||||
| is_gc_verbose(void) | is_gc_verbose(void) | ||||||
| { | { | ||||||
|   if (Yap_PrologMode == BootMode) |   CACHE_REGS | ||||||
|  |   if (LOCAL_PrologMode == BootMode) | ||||||
|     return FALSE; |     return FALSE; | ||||||
| #ifdef INSTRUMENT_GC | #ifdef INSTRUMENT_GC | ||||||
|   /* always give info when we are debugging gc */ |   /* always give info when we are debugging gc */ | ||||||
| @@ -3894,7 +3895,8 @@ Yap_is_gc_verbose(void) | |||||||
| static int | static int | ||||||
| is_gc_very_verbose(void) | is_gc_very_verbose(void) | ||||||
| { | { | ||||||
|   if (Yap_PrologMode == BootMode) |   CACHE_REGS | ||||||
|  |   if (LOCAL_PrologMode == BootMode) | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   return Yap_GetValue(AtomGcVeryVerbose) != TermNil; |   return Yap_GetValue(AtomGcVeryVerbose) != TermNil; | ||||||
| } | } | ||||||
| @@ -3947,7 +3949,7 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
|   if (gc_margin < gc_lim) |   if (gc_margin < gc_lim) | ||||||
|     gc_margin = gc_lim; |     gc_margin = gc_lim; | ||||||
|   LOCAL_HGEN = VarOfTerm(Yap_ReadTimedVar(LOCAL_GcGeneration)); |   LOCAL_HGEN = VarOfTerm(Yap_ReadTimedVar(LOCAL_GcGeneration)); | ||||||
|   if (gc_on && !(Yap_PrologMode & InErrorMode) && |   if (gc_on && !(LOCAL_PrologMode & InErrorMode) && | ||||||
|       /* make sure there is a point in collecting the heap */ |       /* make sure there is a point in collecting the heap */ | ||||||
|       (ASP-H0)*sizeof(CELL) > gc_lim &&  |       (ASP-H0)*sizeof(CELL) > gc_lim &&  | ||||||
|       H-LOCAL_HGEN > (LCL0-ASP)/2) { |       H-LOCAL_HGEN > (LCL0-ASP)/2) { | ||||||
| @@ -3979,10 +3981,10 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS) | |||||||
| static void | static void | ||||||
| LeaveGCMode( USES_REGS1 ) | LeaveGCMode( USES_REGS1 ) | ||||||
| { | { | ||||||
|   if (Yap_PrologMode & GCMode) |   if (LOCAL_PrologMode & GCMode) | ||||||
|     Yap_PrologMode &= ~GCMode; |     LOCAL_PrologMode &= ~GCMode; | ||||||
|   if (Yap_PrologMode & AbortMode) { |   if (LOCAL_PrologMode & AbortMode) { | ||||||
|     Yap_PrologMode &= ~AbortMode; |     LOCAL_PrologMode &= ~AbortMode; | ||||||
|     Yap_Error(PURE_ABORT, TermNil, ""); |     Yap_Error(PURE_ABORT, TermNil, ""); | ||||||
|     P = FAILCODE; |     P = FAILCODE; | ||||||
|   } |   } | ||||||
| @@ -3993,11 +3995,11 @@ Yap_gc(Int predarity, CELL *current_env, yamop *nextop) | |||||||
| { | { | ||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   int res; |   int res; | ||||||
|   Yap_PrologMode |= GCMode; |   LOCAL_PrologMode |= GCMode; | ||||||
|   res=call_gc(4096, predarity, current_env, nextop PASS_REGS); |   res=call_gc(4096, predarity, current_env, nextop PASS_REGS); | ||||||
|   LeaveGCMode( PASS_REGS1 ); |   LeaveGCMode( PASS_REGS1 ); | ||||||
|   if (Yap_PrologMode & GCMode) |   if (LOCAL_PrologMode & GCMode) | ||||||
|     Yap_PrologMode &= ~GCMode; |     LOCAL_PrologMode &= ~GCMode; | ||||||
|   return res; |   return res; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -4008,7 +4010,7 @@ Yap_gcl(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop) | |||||||
|   int res; |   int res; | ||||||
|   UInt min = CalculateStackGap()*sizeof(CELL); |   UInt min = CalculateStackGap()*sizeof(CELL); | ||||||
|  |  | ||||||
|   Yap_PrologMode |= GCMode; |   LOCAL_PrologMode |= GCMode; | ||||||
|   if (gc_lim < min) |   if (gc_lim < min) | ||||||
|     gc_lim = min; |     gc_lim = min; | ||||||
|   res = call_gc(gc_lim, predarity, current_env, nextop PASS_REGS); |   res = call_gc(gc_lim, predarity, current_env, nextop PASS_REGS); | ||||||
| @@ -4021,7 +4023,7 @@ static Int | |||||||
| p_gc( USES_REGS1 ) | p_gc( USES_REGS1 ) | ||||||
| { | { | ||||||
|   int res; |   int res; | ||||||
|   Yap_PrologMode |= GCMode; |   LOCAL_PrologMode |= GCMode; | ||||||
|   if (P->opc == Yap_opcode(_execute_cpred)) |   if (P->opc == Yap_opcode(_execute_cpred)) | ||||||
|     res = do_gc(0, ENV, CP PASS_REGS) >= 0; |     res = do_gc(0, ENV, CP PASS_REGS) >= 0; | ||||||
|   else |   else | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								C/index.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								C/index.c
									
									
									
									
									
								
							| @@ -3449,7 +3449,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) | |||||||
|     return FAILCODE; |     return FAILCODE; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Yap_ShowCode(&cint); |     Yap_ShowCode(&cint); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
| @@ -4572,7 +4572,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) { | |||||||
|     expand_clauses = NULL; |     expand_clauses = NULL; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Term tmod = ap->ModuleOfPred; |     Term tmod = ap->ModuleOfPred; | ||||||
|     if (!tmod) tmod = TermProlog; |     if (!tmod) tmod = TermProlog; | ||||||
| #if THREADS | #if THREADS | ||||||
| @@ -4634,7 +4634,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) { | |||||||
|     return FAILCODE; |     return FAILCODE; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Yap_ShowCode(&cint); |     Yap_ShowCode(&cint); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
| @@ -6046,7 +6046,7 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) { | |||||||
|   LOCAL_Error_Size = 0; |   LOCAL_Error_Size = 0; | ||||||
|   LOCAL_ErrorMessage = NULL; |   LOCAL_ErrorMessage = NULL; | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Term tmod = ap->ModuleOfPred; |     Term tmod = ap->ModuleOfPred; | ||||||
|     if (!tmod) tmod = TermProlog; |     if (!tmod) tmod = TermProlog; | ||||||
|     Yap_DebugPutc(LOCAL_c_error_stream,'+'); |     Yap_DebugPutc(LOCAL_c_error_stream,'+'); | ||||||
| @@ -6530,7 +6530,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) { | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['i' - 'a' + 1]) { |   if (GLOBAL_Option['i' - 'a' + 1]) { | ||||||
|     Term tmod = ap->ModuleOfPred; |     Term tmod = ap->ModuleOfPred; | ||||||
|  |  | ||||||
|     if (!tmod) tmod = TermProlog; |     if (!tmod) tmod = TermProlog; | ||||||
|   | |||||||
							
								
								
									
										69
									
								
								C/init.c
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								C/init.c
									
									
									
									
									
								
							| @@ -55,7 +55,6 @@ static char     SccsId[] = "%W% %G%"; | |||||||
|  |  | ||||||
| #define	LOGFILE	"logfile" | #define	LOGFILE	"logfile" | ||||||
|  |  | ||||||
| int  Yap_output_msg = FALSE; |  | ||||||
|  |  | ||||||
| #ifdef MACC | #ifdef MACC | ||||||
| STATIC_PROTO(void  InTTYLine, (char *)); | STATIC_PROTO(void  InTTYLine, (char *)); | ||||||
| @@ -82,45 +81,6 @@ static void InitWorker(int wid); | |||||||
| /************* variables related to memory allocation ***************/ | /************* variables related to memory allocation ***************/ | ||||||
| ADDR Yap_HeapBase; | ADDR Yap_HeapBase; | ||||||
|  |  | ||||||
| #if defined(THREADS) |  | ||||||
| pthread_t Yap_master_thread; |  | ||||||
| #endif /* THREADS */ |  | ||||||
|  |  | ||||||
| /******** whether Yap is responsible for signal handling******************/ |  | ||||||
| int             Yap_PrologShouldHandleInterrupts; |  | ||||||
|  |  | ||||||
| /********* readline support	*****/ |  | ||||||
| #if HAVE_LIBREADLINE |  | ||||||
|  |  | ||||||
| char *_line = (char *) NULL; |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /********* Prolog State ********************************************/ |  | ||||||
|  |  | ||||||
| Int      Yap_PrologMode = BootMode; |  | ||||||
|  |  | ||||||
| int      Yap_CritLocks = 0; |  | ||||||
|  |  | ||||||
| /********* streams ********************************************/ |  | ||||||
|  |  | ||||||
| YP_FILE *Yap_stdout; |  | ||||||
| YP_FILE *Yap_stderr; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************** Access to yap initial arguments ***************************/ |  | ||||||
|  |  | ||||||
| char          **Yap_argv; |  | ||||||
| int             Yap_argc; |  | ||||||
|  |  | ||||||
| /************** Extensions to Terms ***************************************/ |  | ||||||
|  |  | ||||||
| #ifdef COROUTINING |  | ||||||
| /* array with the ops for your favourite extensions */ |  | ||||||
| ext_op attas[attvars_ext+1]; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /**************	declarations local to init.c ************************/ | /**************	declarations local to init.c ************************/ | ||||||
| static char    *optypes[] = | static char    *optypes[] = | ||||||
| {"", "xfx", "xfy", "yfx", "xf", "yf", "fx", "fy"}; | {"", "xfx", "xfy", "yfx", "xf", "yf", "fx", "fy"}; | ||||||
| @@ -133,10 +93,6 @@ int Yap_page_size; | |||||||
| void **Yap_ABSMI_OPCODES; | void **Yap_ABSMI_OPCODES; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if   USE_SOCKET |  | ||||||
| int Yap_sockets_io=0; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if DEBUG | #if DEBUG | ||||||
| #if COROUTINING | #if COROUTINING | ||||||
| int  Yap_Portray_delays = FALSE; | int  Yap_Portray_delays = FALSE; | ||||||
| @@ -242,7 +198,7 @@ static void | |||||||
| SetOp(int p, int type, char *at, Term m) | SetOp(int p, int type, char *at, Term m) | ||||||
| { | { | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option[5]) |   if (GLOBAL_Option[5]) | ||||||
|     fprintf(stderr,"[setop %d %s %s]\n", p, optypes[type], at); |     fprintf(stderr,"[setop %d %s %s]\n", p, optypes[type], at); | ||||||
| #endif | #endif | ||||||
|   OpDec(p, optypes[type], Yap_LookupAtom(at), m); |   OpDec(p, optypes[type], Yap_LookupAtom(at), m); | ||||||
| @@ -384,8 +340,8 @@ InitDebug(void) | |||||||
|   int i; |   int i; | ||||||
|  |  | ||||||
|   for (i = 1; i < 20; ++i) |   for (i = 1; i < 20; ++i) | ||||||
|     Yap_Option[i] = 0; |     GLOBAL_Option[i] = 0; | ||||||
|   if (Yap_output_msg) { |   if (GLOBAL_output_msg) { | ||||||
|     char            ch; |     char            ch; | ||||||
|  |  | ||||||
| #if HAVE_ISATTY | #if HAVE_ISATTY | ||||||
| @@ -400,10 +356,10 @@ InitDebug(void) | |||||||
|     fprintf(stderr,"m Machine\t p parser\n"); |     fprintf(stderr,"m Machine\t p parser\n"); | ||||||
|     while ((ch = YP_putchar(YP_getchar())) != '\n') |     while ((ch = YP_putchar(YP_getchar())) != '\n') | ||||||
|       if (ch >= 'a' && ch <= 'z') |       if (ch >= 'a' && ch <= 'z') | ||||||
| 	Yap_Option[ch - 'a' + 1] = 1; | 	GLOBAL_Option[ch - 'a' + 1] = 1; | ||||||
|     if (Yap_Option['l' - 96]) { |     if (GLOBAL_Option['l' - 96]) { | ||||||
|       Yap_logfile = fopen(LOGFILE, "w"); |       GLOBAL_logfile = fopen(LOGFILE, "w"); | ||||||
|       if (Yap_logfile == NULL) { |       if (GLOBAL_logfile == NULL) { | ||||||
| 	fprintf(stderr,"can not open %s\n", LOGFILE); | 	fprintf(stderr,"can not open %s\n", LOGFILE); | ||||||
| 	getchar(); | 	getchar(); | ||||||
| 	exit(0); | 	exit(0); | ||||||
| @@ -1292,8 +1248,9 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s | |||||||
|     return; |     return; | ||||||
|   pthread_key_create(&Yap_yaamregs_key, NULL); |   pthread_key_create(&Yap_yaamregs_key, NULL); | ||||||
|   pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs); |   pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs); | ||||||
|   LOCAL = REMOTE(0); |   //printf(" -> -> %p  \n", &Yap_REGS); | ||||||
|   Yap_master_thread = pthread_self(); |   //LOCAL = REMOTE(0); | ||||||
|  |   GLOBAL_master_thread = pthread_self(); | ||||||
| #else | #else | ||||||
|   /* In this case we need to initialise the abstract registers */ |   /* In this case we need to initialise the abstract registers */ | ||||||
|   Yap_regp = &Yap_standard_regs; |   Yap_regp = &Yap_standard_regs; | ||||||
| @@ -1304,6 +1261,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s | |||||||
|  |  | ||||||
| #ifdef THREADS | #ifdef THREADS | ||||||
|   Yap_regp = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key)); |   Yap_regp = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key)); | ||||||
|  |   LOCAL = REMOTE(0); | ||||||
| #endif /* THREADS */ | #endif /* THREADS */ | ||||||
|   if (Heap < MinHeapSpace) |   if (Heap < MinHeapSpace) | ||||||
|     Heap = MinHeapSpace; |     Heap = MinHeapSpace; | ||||||
| @@ -1345,7 +1303,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s | |||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|   Yap_AttsSize = Atts; |   Yap_AttsSize = Atts; | ||||||
|   Yap_InitTime (); |   Yap_InitTime(); | ||||||
|   /* InitAbsmi must be done before InitCodes */ |   /* InitAbsmi must be done before InitCodes */ | ||||||
|   /* This must be done before initialising predicates */ |   /* This must be done before initialising predicates */ | ||||||
|   for (i = 0; i <= LAST_FLAG; i++) { |   for (i = 0; i <= LAST_FLAG; i++) { | ||||||
| @@ -1398,11 +1356,12 @@ run_halt_hooks(int code) | |||||||
| void | void | ||||||
| Yap_exit (int value) | Yap_exit (int value) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
| #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | ||||||
|   Yap_unmap_optyap_memory(); |   Yap_unmap_optyap_memory(); | ||||||
| #endif  | #endif  | ||||||
|  |  | ||||||
|   if (! (Yap_PrologMode & BootMode) ) { |   if (! (LOCAL_PrologMode & BootMode) ) { | ||||||
| #ifdef LOW_PROF | #ifdef LOW_PROF | ||||||
|     remove("PROFPREDS"); |     remove("PROFPREDS"); | ||||||
|     remove("PROFILING"); |     remove("PROFILING"); | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								C/iopreds.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								C/iopreds.c
									
									
									
									
									
								
							| @@ -183,17 +183,17 @@ Yap_DebugGetc() | |||||||
|   } |   } | ||||||
|   if ((ch = *lp++) == 0) |   if ((ch = *lp++) == 0) | ||||||
|     ch = '\n', eolflg = 1; |     ch = '\n', eolflg = 1; | ||||||
|   if (Yap_Option['l' - 96]) |   if (GLOBAL_Option['l' - 96]) | ||||||
|     putc(ch, Yap_logfile); |     putc(ch, GLOBAL_logfile); | ||||||
|   return (ch); |   return (ch); | ||||||
| } | } | ||||||
|  |  | ||||||
| int  | int  | ||||||
| Yap_DebugPutc(int sno, wchar_t ch) | Yap_DebugPutc(int sno, wchar_t ch) | ||||||
| { | { | ||||||
|   if (Yap_Option['l' - 96]) |   if (GLOBAL_Option['l' - 96]) | ||||||
|     (void) putc(ch, Yap_logfile); |     (void) putc(ch, GLOBAL_logfile); | ||||||
|   return (putc(ch, Yap_stderr)); |   return (putc(ch, GLOBAL_stderr)); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| @@ -1103,8 +1103,6 @@ Yap_InitBackIO (void) | |||||||
| void | void | ||||||
| Yap_InitIOPreds(void) | Yap_InitIOPreds(void) | ||||||
| { | { | ||||||
|   Yap_stdout = stdout; |  | ||||||
|   Yap_stderr = stderr; |  | ||||||
|   if (!Stream) |   if (!Stream) | ||||||
|     Stream = (StreamDesc *)Yap_AllocCodeSpace(sizeof(StreamDesc)*MaxStreams); |     Stream = (StreamDesc *)Yap_AllocCodeSpace(sizeof(StreamDesc)*MaxStreams); | ||||||
|   /* here the Input/Output predicates */ |   /* here the Input/Output predicates */ | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
| #include "Foreign.h" | #include "Foreign.h" | ||||||
|  |  | ||||||
| #ifdef A_OUT | #ifdef A_OUT | ||||||
|  | this code is no being maintained anymore | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #if STDC_HEADERS | #if STDC_HEADERS | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| @@ -43,7 +43,7 @@ | |||||||
| #endif | #endif | ||||||
| #include <a.out.h> | #include <a.out.h> | ||||||
|  |  | ||||||
| static char YapExecutable[YAP_FILE_MAX]; |  | ||||||
|  |  | ||||||
| #define oktox(n) \ | #define oktox(n) \ | ||||||
| 	(0==stat(n,&stbuf)&&(stbuf.st_mode&S_IFMT)==S_IFREG&&0==access(n,X_OK)) | 	(0==stat(n,&stbuf)&&(stbuf.st_mode&S_IFMT)==S_IFREG&&0==access(n,X_OK)) | ||||||
| @@ -64,10 +64,10 @@ Yap_FindExecutable(char *name) | |||||||
|   cp = (char *)getenv("PATH"); |   cp = (char *)getenv("PATH"); | ||||||
|   if (cp == NULL) |   if (cp == NULL) | ||||||
|     cp = ".:/usr/ucb:/bin:/usr/bin:/usr/local/bin"; |     cp = ".:/usr/ucb:/bin:/usr/bin:/usr/local/bin"; | ||||||
|   if (*Yap_argv[0] == '/') { |   if (*GLOBAL_argv[0] == '/') { | ||||||
|     if (oktox(Yap_argv[0])) { |     if (oktox(GLOBAL_argv[0])) { | ||||||
|       strcpy(LOCAL_FileNameBuf, Yap_argv[0]); |       strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]); | ||||||
|       Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |       Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -82,21 +82,21 @@ Yap_FindExecutable(char *name) | |||||||
|     for (cp2 = LOCAL_FileNameBuf; (*cp) != 0 && (*cp) != ':';) |     for (cp2 = LOCAL_FileNameBuf; (*cp) != 0 && (*cp) != ':';) | ||||||
|       *cp2++ = *cp++; |       *cp2++ = *cp++; | ||||||
|     *cp2++ = '/'; |     *cp2++ = '/'; | ||||||
|     strcpy(cp2, Yap_argv[0]); |     strcpy(cp2, GLOBAL_argv[0]); | ||||||
|     if (*cp) |     if (*cp) | ||||||
|       cp++; |       cp++; | ||||||
|     if (!oktox(LOCAL_FileNameBuf)) |     if (!oktox(LOCAL_FileNameBuf)) | ||||||
|       continue; |       continue; | ||||||
|     Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |     Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   /* one last try for dual systems */ |   /* one last try for dual systems */ | ||||||
|   strcpy(LOCAL_FileNameBuf, Yap_argv[0]); |   strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]); | ||||||
|   Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |   Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|   if (oktox(YapExecutable)) |   if (oktox(GLOBAL_Executable)) | ||||||
|     return; |     return; | ||||||
|   else |   else | ||||||
|     Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(YapExecutable)), |     Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)), | ||||||
| 	  "cannot find file being executed"); | 	  "cannot find file being executed"); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -174,12 +174,12 @@ LoadForeign(StringList ofiles, | |||||||
|  |  | ||||||
|   /* prepare the magic */ |   /* prepare the magic */ | ||||||
|   if (strlen(o_files) + strlen(l_files) + strlen(proc_name) + |   if (strlen(o_files) + strlen(l_files) + strlen(proc_name) + | ||||||
| 	    strlen(YapExecutable) > 2*MAXPATHLEN) { | 	    strlen(GLOBAL_Executable) > 2*MAXPATHLEN) { | ||||||
|     strcpy(LOCAL_ErrorSay, " too many parameters in load_foreign/3 "); |     strcpy(LOCAL_ErrorSay, " too many parameters in load_foreign/3 "); | ||||||
|     return LOAD_FAILLED; |     return LOAD_FAILLED; | ||||||
|   } |   } | ||||||
|   sprintf(command, "/usr/bin/ld -N -A %s -o %s -u _%s %s %s -lc", |   sprintf(command, "/usr/bin/ld -N -A %s -o %s -u _%s %s %s -lc", | ||||||
| 	  YapExecutable, | 	  GLOBAL_Executable, | ||||||
| 	  tfile, proc_name, o_files, l_files); | 	  tfile, proc_name, o_files, l_files); | ||||||
|   /* now, do the magic */ |   /* now, do the magic */ | ||||||
|   if (system(command) != 0) { |   if (system(command) != 0) { | ||||||
| @@ -209,7 +209,7 @@ LoadForeign(StringList ofiles, | |||||||
|   } |   } | ||||||
|   /* now, a new incantation to load the new foreign code */ |   /* now, a new incantation to load the new foreign code */ | ||||||
|   sprintf(command, "/usr/bin/ld -N -A %s -T %lx -o %s -u _%s %s %s -lc", |   sprintf(command, "/usr/bin/ld -N -A %s -T %lx -o %s -u _%s %s %s -lc", | ||||||
| 	  YapExecutable, | 	  GLOBAL_Executable, | ||||||
| 	  (unsigned long) FCodeBase, | 	  (unsigned long) FCodeBase, | ||||||
| 	  tfile, proc_name, o_files, l_files); | 	  tfile, proc_name, o_files, l_files); | ||||||
|   /* and do it */  |   /* and do it */  | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| #include "Foreign.h" | #include "Foreign.h" | ||||||
|  |  | ||||||
| #ifdef COFF | #ifdef COFF | ||||||
|  | this code is no being maintained anymore | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| @@ -45,8 +45,6 @@ | |||||||
|  |  | ||||||
| #define N_TXTOFF(x) (sizeof(struct filehdr)+(x).f_opthdr+(x).f_nscns*sizeof(struct scnhdr)) | #define N_TXTOFF(x) (sizeof(struct filehdr)+(x).f_opthdr+(x).f_nscns*sizeof(struct scnhdr)) | ||||||
|  |  | ||||||
| static char YapExecutable[YAP_FILE_MAX]; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  *   YAP_FindExecutable(argv[0]) should be called on yap initialization to |  *   YAP_FindExecutable(argv[0]) should be called on yap initialization to | ||||||
| @@ -62,10 +60,10 @@ Yap_FindExecutable(char *name) | |||||||
|   cp = (char *)getenv("PATH"); |   cp = (char *)getenv("PATH"); | ||||||
|   if (cp == NULL) |   if (cp == NULL) | ||||||
|     cp = ".:/usr/ucb:/bin:/usr/bin:/usr/local/bin"; |     cp = ".:/usr/ucb:/bin:/usr/bin:/usr/local/bin"; | ||||||
|   if (*Yap_argv[0] == '/') { |   if (*GLOBAL_argv[0] == '/') { | ||||||
|     if (oktox(Yap_argv[0])) { |     if (oktox(GLOBAL_argv[0])) { | ||||||
|       strcpy(LOCAL_FileNameBuf, Yap_argv[0]); |       strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]); | ||||||
|       Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |       Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -80,21 +78,21 @@ Yap_FindExecutable(char *name) | |||||||
|     for (cp2 = LOCAL_FileNameBuf; (*cp) != 0 && (*cp) != ':';) |     for (cp2 = LOCAL_FileNameBuf; (*cp) != 0 && (*cp) != ':';) | ||||||
|       *cp2++ = *cp++; |       *cp2++ = *cp++; | ||||||
|     *cp2++ = '/'; |     *cp2++ = '/'; | ||||||
|     strcpy(cp2, Yap_argv[0]); |     strcpy(cp2, GLOBAL_argv[0]); | ||||||
|     if (*cp) |     if (*cp) | ||||||
|       cp++; |       cp++; | ||||||
|     if (!oktox(LOCAL_FileNameBuf)) |     if (!oktox(LOCAL_FileNameBuf)) | ||||||
|       continue; |       continue; | ||||||
|     Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |     Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   /* one last try for dual systems */ |   /* one last try for dual systems */ | ||||||
|   strcpy(LOCAL_FileNameBuf, Yap_argv[0]); |   strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]); | ||||||
|   Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE); |   Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE); | ||||||
|   if (oktox(YapExecutable)) |   if (oktox(GLOBAL_Executable)) | ||||||
|     return; |     return; | ||||||
|   else |   else | ||||||
|     Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(YapExecutable)), |     Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)), | ||||||
| 	  "cannot find file being executed"); | 	  "cannot find file being executed"); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -175,12 +173,12 @@ LoadForeign(StringList ofiles, | |||||||
|  |  | ||||||
|   /* prepare the magic */ |   /* prepare the magic */ | ||||||
|   if (strlen(o_files) + strlen(l_files) + strlen(proc_name) + |   if (strlen(o_files) + strlen(l_files) + strlen(proc_name) + | ||||||
| 	    strlen(YapExecutable) > 2*MAXPATHLEN) { | 	    strlen(GLOBAL_Executable) > 2*MAXPATHLEN) { | ||||||
|     strcpy(LOCAL_ErrorSay, " too many parameters in load_foreign/3 "); |     strcpy(LOCAL_ErrorSay, " too many parameters in load_foreign/3 "); | ||||||
|     return LOAD_FAILLED; |     return LOAD_FAILLED; | ||||||
|   } |   } | ||||||
|   sprintf(command, "/usr/bin/ld -N -A %s -o %s %s %s -lc", |   sprintf(command, "/usr/bin/ld -N -A %s -o %s %s %s -lc", | ||||||
| 	  YapExecutable, | 	  GLOBAL_Executable, | ||||||
| 	  tfile, o_files, l_files); | 	  tfile, o_files, l_files); | ||||||
|   /* now, do the magic */ |   /* now, do the magic */ | ||||||
|   if (system(command) != 0) { |   if (system(command) != 0) { | ||||||
|   | |||||||
| @@ -20,8 +20,7 @@ | |||||||
| #include <malloc.h> | #include <malloc.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  |  | ||||||
| static char YapExecutable[YAP_FILE_MAX]; | this code is no being maintained anymore | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  *   YAP_FindExecutable(argv[0]) should be called on yap initialization to |  *   YAP_FindExecutable(argv[0]) should be called on yap initialization to | ||||||
| @@ -33,9 +32,9 @@ Yap_FindExecutable(char *name) | |||||||
|   /* use dld_find_executable */ |   /* use dld_find_executable */ | ||||||
|   char *res; |   char *res; | ||||||
|   if(name != NULL && (res=dld_find_executable(name))) { |   if(name != NULL && (res=dld_find_executable(name))) { | ||||||
|     strcpy(YapExecutable,res); |     strcpy(GLOBAL_Executable,res); | ||||||
|   } else { |   } else { | ||||||
|     strcpy(YapExecutable,"./yap"); |     strcpy(GLOBAL_Executable,"./yap"); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -71,7 +70,7 @@ LoadForeign(StringList ofiles, StringList libs, | |||||||
|   int error; |   int error; | ||||||
|    |    | ||||||
|   if(firstTime) { |   if(firstTime) { | ||||||
|     error = dld_init(YapExecutable); |     error = dld_init(GLOBAL_Executable); | ||||||
|     if(error) { |     if(error) { | ||||||
|       strcpy(LOCAL_ErrorSay,dld_strerror(error)); |       strcpy(LOCAL_ErrorSay,dld_strerror(error)); | ||||||
|       return LOAD_FAILLED; |       return LOAD_FAILLED; | ||||||
|   | |||||||
| @@ -28,13 +28,13 @@ | |||||||
| */ | */ | ||||||
| #import <mach-o/dyld.h> | #import <mach-o/dyld.h> | ||||||
|  |  | ||||||
| static int dl_errno; |  | ||||||
|  |  | ||||||
| static char * | static char * | ||||||
| mydlerror(void) | mydlerror(void) | ||||||
| { | { | ||||||
|   char *errString; |   char *errString; | ||||||
|   switch(dl_errno) { |   switch(LOCAL_dl_errno) { | ||||||
|   default: |   default: | ||||||
|   case NSObjectFileImageFailure: |   case NSObjectFileImageFailure: | ||||||
|   case NSObjectFileImageFormat: |   case NSObjectFileImageFormat: | ||||||
| @@ -76,7 +76,7 @@ mydlopen(char *path) | |||||||
|     NSModule handle = NULL; |     NSModule handle = NULL; | ||||||
|     dyld_result = NSCreateObjectFileImageFromFile(path, &ofile); |     dyld_result = NSCreateObjectFileImageFromFile(path, &ofile); | ||||||
|     if (dyld_result != NSObjectFileImageSuccess) { |     if (dyld_result != NSObjectFileImageSuccess) { | ||||||
|       dl_errno = dyld_result; |       LOCAL_dl_errno = dyld_result; | ||||||
|     } else { |     } else { | ||||||
|       /* NSLinkModule will cause the run to abort on any link error's */ |       /* NSLinkModule will cause the run to abort on any link error's */ | ||||||
|       /* not very friendly but the error recovery functionality is limited */ |       /* not very friendly but the error recovery functionality is limited */ | ||||||
|   | |||||||
| @@ -225,10 +225,10 @@ p_open_shared_objects( USES_REGS1 ) { | |||||||
| void | void | ||||||
| Yap_InitLoadForeign( void ) | Yap_InitLoadForeign( void ) | ||||||
| { | { | ||||||
|   if (Yap_argv == NULL) |   if (GLOBAL_argv == NULL) | ||||||
|     Yap_FindExecutable("yap"); |     Yap_FindExecutable("yap"); | ||||||
|   else |   else | ||||||
|     Yap_FindExecutable(Yap_argv[0]); |     Yap_FindExecutable(GLOBAL_argv[0]); | ||||||
|   Yap_InitCPred("$load_foreign_files", 3, p_load_foreign, SafePredFlag|SyncPredFlag|HiddenPredFlag); |   Yap_InitCPred("$load_foreign_files", 3, p_load_foreign, SafePredFlag|SyncPredFlag|HiddenPredFlag); | ||||||
|   Yap_InitCPred("$open_shared_objects", 0, p_open_shared_objects, SafePredFlag|HiddenPredFlag); |   Yap_InitCPred("$open_shared_objects", 0, p_open_shared_objects, SafePredFlag|HiddenPredFlag); | ||||||
|   Yap_InitCPred("$open_shared_object", 3, p_open_shared_object, SyncPredFlag|HiddenPredFlag); |   Yap_InitCPred("$open_shared_object", 3, p_open_shared_object, SyncPredFlag|HiddenPredFlag); | ||||||
|   | |||||||
| @@ -122,8 +122,8 @@ Yap_LookupVar(char *var)	/* lookup variable in variables table   */ | |||||||
|   VarEntry *p; |   VarEntry *p; | ||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option[4]) |   if (GLOBAL_Option[4]) | ||||||
|     fprintf(Yap_stderr,"[LookupVar %s]", var); |     fprintf(GLOBAL_stderr,"[LookupVar %s]", var); | ||||||
| #endif | #endif | ||||||
|   if (var[0] != '_' || var[1] != '\0') { |   if (var[0] != '_' || var[1] != '\0') { | ||||||
|     VarEntry **op = &LOCAL_VarTable; |     VarEntry **op = &LOCAL_VarTable; | ||||||
| @@ -690,7 +690,7 @@ ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) | |||||||
|     break; |     break; | ||||||
|   } |   } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   if (Yap_Option['p' - 'a' + 1]) { |   if (GLOBAL_Option['p' - 'a' + 1]) { | ||||||
|     Yap_DebugPutc(LOCAL_c_error_stream,'['); |     Yap_DebugPutc(LOCAL_c_error_stream,'['); | ||||||
|     Yap_DebugPlWrite(t); |     Yap_DebugPlWrite(t); | ||||||
|     Yap_DebugPutc(LOCAL_c_error_stream,']'); |     Yap_DebugPutc(LOCAL_c_error_stream,']'); | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								C/save.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								C/save.c
									
									
									
									
									
								
							| @@ -227,7 +227,7 @@ static int      splfild = 0; | |||||||
| #ifdef DEBUG_RESTORE4 | #ifdef DEBUG_RESTORE4 | ||||||
| static FILE    *errout; | static FILE    *errout; | ||||||
| #else | #else | ||||||
| #define errout Yap_stderr | #define errout GLOBAL_stderr | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #endif				/* DEBUG */ | #endif				/* DEBUG */ | ||||||
| @@ -1337,7 +1337,7 @@ ShowEntries(pp) | |||||||
| 	PropEntry      *pp; | 	PropEntry      *pp; | ||||||
| { | { | ||||||
|   while (!EndOfPAEntr(pp)) { |   while (!EndOfPAEntr(pp)) { | ||||||
|     fprintf(Yap_stderr,"Estou a ver a prop %x em %x\n", pp->KindOfPE, pp); |     fprintf(GLOBAL_stderr,"Estou a ver a prop %x em %x\n", pp->KindOfPE, pp); | ||||||
|     pp = RepProp(pp->NextOfPE); |     pp = RepProp(pp->NextOfPE); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @@ -1352,7 +1352,7 @@ ShowAtoms() | |||||||
|       AtomEntry      *at; |       AtomEntry      *at; | ||||||
|       at = RepAtom(HashPtr->Entry); |       at = RepAtom(HashPtr->Entry); | ||||||
|       do { |       do { | ||||||
| 	fprintf(Yap_stderr,"Passei ao %s em %x\n", at->StrOfAE, at); | 	fprintf(GLOBAL_stderr,"Passei ao %s em %x\n", at->StrOfAE, at); | ||||||
| 	ShowEntries(RepProp(at->PropsOfAE)); | 	ShowEntries(RepProp(at->PropsOfAE)); | ||||||
|       } while (!EndOfPAEntr(at = RepAtom(at->NextOfAE))); |       } while (!EndOfPAEntr(at = RepAtom(at->NextOfAE))); | ||||||
|     } |     } | ||||||
| @@ -1364,7 +1364,7 @@ ShowAtoms() | |||||||
|       AtomEntry      *at; |       AtomEntry      *at; | ||||||
|       at = RepAtom(HashPtr->Entry); |       at = RepAtom(HashPtr->Entry); | ||||||
|       do { |       do { | ||||||
| 	fprintf(Yap_stderr,"Passei ao %s em %x\n", at->StrOfAE, at); | 	fprintf(GLOBAL_stderr,"Passei ao %s em %x\n", at->StrOfAE, at); | ||||||
| 	ShowEntries(RepProp(at->PropsOfAE)); | 	ShowEntries(RepProp(at->PropsOfAE)); | ||||||
|       } while (!EndOfPAEntr(at = RepAtom(at->NextOfAE))); |       } while (!EndOfPAEntr(at = RepAtom(at->NextOfAE))); | ||||||
|     } |     } | ||||||
| @@ -1383,7 +1383,7 @@ commit_to_saved_state(char *s, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *A | |||||||
|  |  | ||||||
|   if ((mode = check_header(Astate,ATrail,AStack,AHeap PASS_REGS)) == FAIL_RESTORE) |   if ((mode = check_header(Astate,ATrail,AStack,AHeap PASS_REGS)) == FAIL_RESTORE) | ||||||
|     return(FAIL_RESTORE); |     return(FAIL_RESTORE); | ||||||
|   Yap_PrologMode = BootMode; |   LOCAL_PrologMode = BootMode; | ||||||
|   if (Yap_HeapBase) { |   if (Yap_HeapBase) { | ||||||
|     extern void Scleanup(void); |     extern void Scleanup(void); | ||||||
|     if (!yap_flags[HALT_AFTER_CONSULT_FLAG] && !yap_flags[QUIET_MODE_FLAG]) { |     if (!yap_flags[HALT_AFTER_CONSULT_FLAG] && !yap_flags[QUIET_MODE_FLAG]) { | ||||||
| @@ -1397,7 +1397,7 @@ commit_to_saved_state(char *s, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *A | |||||||
|   /* |   /* | ||||||
|    * This should be another file, like the log file  |    * This should be another file, like the log file  | ||||||
|    */ |    */ | ||||||
|   errout = Yap_stderr; |   errout = GLOBAL_stderr; | ||||||
| #endif | #endif | ||||||
|   return mode; |   return mode; | ||||||
| } | } | ||||||
| @@ -1448,7 +1448,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac | |||||||
|   if (inpf[0] != '/') { |   if (inpf[0] != '/') { | ||||||
| #if __simplescalar__ | #if __simplescalar__ | ||||||
|     /* does not implement getcwd */ |     /* does not implement getcwd */ | ||||||
|     strncpy(LOCAL_FileNameBuf,yap_pwd,YAP_FILENAME_MAX); |     strncpy(LOCAL_FileNameBuf,GLOBAL_pwd,YAP_FILENAME_MAX); | ||||||
| #elif HAVE_GETCWD | #elif HAVE_GETCWD | ||||||
|     if (getcwd (LOCAL_FileNameBuf, YAP_FILENAME_MAX) == NULL) |     if (getcwd (LOCAL_FileNameBuf, YAP_FILENAME_MAX) == NULL) | ||||||
|       LOCAL_FileNameBuf[0] = '\0'; |       LOCAL_FileNameBuf[0] = '\0'; | ||||||
| @@ -1558,11 +1558,12 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac | |||||||
| static void  | static void  | ||||||
| CloseRestore(void) | CloseRestore(void) | ||||||
| { | { | ||||||
|  |  CACHE_REGS | ||||||
| #ifdef DEBUG_RESTORE3 | #ifdef DEBUG_RESTORE3 | ||||||
|   ShowAtoms(); |   ShowAtoms(); | ||||||
| #endif | #endif | ||||||
|   close_file(); |   close_file(); | ||||||
|   Yap_PrologMode = UserMode; |   LOCAL_PrologMode = UserMode; | ||||||
| } | } | ||||||
|  |  | ||||||
| #if !defined(_WIN32) | #if !defined(_WIN32) | ||||||
|   | |||||||
| @@ -1245,12 +1245,12 @@ Yap_tokenizer(IOSTREAM *inp_stream, Term *tposp) | |||||||
|  |  | ||||||
|     default: |     default: | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|       fprintf(Yap_stderr, "\n++++ token: wrong char type %c %d\n", ch, chtype(ch)); |       fprintf(GLOBAL_stderr, "\n++++ token: wrong char type %c %d\n", ch, chtype(ch)); | ||||||
| #endif | #endif | ||||||
|       t->Tok = Ord(kind = eot_tok); |       t->Tok = Ord(kind = eot_tok); | ||||||
|     } |     } | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|     if(Yap_Option[2]) fprintf(Yap_stderr,"[Token %d %ld]",Ord(kind),(unsigned long int)t->TokInfo); |     if(GLOBAL_Option[2]) fprintf(GLOBAL_stderr,"[Token %d %ld]",Ord(kind),(unsigned long int)t->TokInfo); | ||||||
| #endif | #endif | ||||||
|     if (LOCAL_ErrorMessage) { |     if (LOCAL_ErrorMessage) { | ||||||
|       /* insert an error token to inform the system of what happened */ |       /* insert an error token to inform the system of what happened */ | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								C/stdpreds.c
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								C/stdpreds.c
									
									
									
									
									
								
							| @@ -3135,7 +3135,7 @@ p_debug( USES_REGS1 ) | |||||||
|   int             i = IntOfTerm(Deref(ARG1)); |   int             i = IntOfTerm(Deref(ARG1)); | ||||||
|  |  | ||||||
|   if (i >= 'a' && i <= 'z') |   if (i >= 'a' && i <= 'z') | ||||||
|     Yap_Option[i - 96] = !Yap_Option[i - 96]; |     GLOBAL_Option[i - 96] = !GLOBAL_Option[i - 96]; | ||||||
|   return (1); |   return (1); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| @@ -3329,21 +3329,21 @@ Yap_show_statistics(void) | |||||||
| #endif | #endif | ||||||
|   frag  = (100.0*(heap_space_taken-HeapUsed))/heap_space_taken; |   frag  = (100.0*(heap_space_taken-HeapUsed))/heap_space_taken; | ||||||
|  |  | ||||||
|   fprintf(Yap_stderr, "Code Space:  %ld (%ld bytes needed, %ld bytes used, fragmentation %.3f%%).\n",  |   fprintf(GLOBAL_stderr, "Code Space:  %ld (%ld bytes needed, %ld bytes used, fragmentation %.3f%%).\n",  | ||||||
| 	     (unsigned long int)(Unsigned (H0) - Unsigned (Yap_HeapBase)), | 	     (unsigned long int)(Unsigned (H0) - Unsigned (Yap_HeapBase)), | ||||||
| 	     (unsigned long int)(Unsigned(HeapTop)-Unsigned(Yap_HeapBase)), | 	     (unsigned long int)(Unsigned(HeapTop)-Unsigned(Yap_HeapBase)), | ||||||
| 	     (unsigned long int)(HeapUsed), | 	     (unsigned long int)(HeapUsed), | ||||||
| 	     frag); | 	     frag); | ||||||
|   fprintf(Yap_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n",  |   fprintf(GLOBAL_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n",  | ||||||
| 	     (unsigned long int)(sizeof(CELL)*(LCL0-H0)), | 	     (unsigned long int)(sizeof(CELL)*(LCL0-H0)), | ||||||
| 	     (unsigned long int)(sizeof(CELL)*(H-H0)), | 	     (unsigned long int)(sizeof(CELL)*(H-H0)), | ||||||
| 	     (unsigned long int)(sizeof(CELL)*(LCL0-ASP))); | 	     (unsigned long int)(sizeof(CELL)*(LCL0-ASP))); | ||||||
|   fprintf(Yap_stderr, "Trail Space: %ld (%ld used).\n",  |   fprintf(GLOBAL_stderr, "Trail Space: %ld (%ld used).\n",  | ||||||
| 	     (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(LOCAL_TrailTop)-Unsigned(LOCAL_TrailBase))), | 	     (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(LOCAL_TrailTop)-Unsigned(LOCAL_TrailBase))), | ||||||
| 	     (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(TR)-Unsigned(LOCAL_TrailBase)))); | 	     (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(TR)-Unsigned(LOCAL_TrailBase)))); | ||||||
|   fprintf(Yap_stderr, "Runtime: %lds.\n", (unsigned long int)(runtime ( PASS_REGS1 ))); |   fprintf(GLOBAL_stderr, "Runtime: %lds.\n", (unsigned long int)(runtime ( PASS_REGS1 ))); | ||||||
|   fprintf(Yap_stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime ())); |   fprintf(GLOBAL_stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime ())); | ||||||
|   fprintf(Yap_stderr, "Walltime: %lds.\n", (unsigned long int)(Yap_walltime ())); |   fprintf(GLOBAL_stderr, "Walltime: %lds.\n", (unsigned long int)(Yap_walltime ())); | ||||||
| } | } | ||||||
|  |  | ||||||
| static Int | static Int | ||||||
| @@ -3623,8 +3623,8 @@ mk_argc_list( USES_REGS1 ) | |||||||
| { | { | ||||||
|   int i =0; |   int i =0; | ||||||
|   Term t = TermNil; |   Term t = TermNil; | ||||||
|   while (i < Yap_argc) { |   while (i < GLOBAL_argc) { | ||||||
|     char *arg = Yap_argv[i]; |     char *arg = GLOBAL_argv[i]; | ||||||
|     /* check for -L -- */ |     /* check for -L -- */ | ||||||
|     if (arg[0] == '-' && arg[1] == 'L') { |     if (arg[0] == '-' && arg[1] == 'L') { | ||||||
|       arg += 2; |       arg += 2; | ||||||
| @@ -3633,15 +3633,15 @@ mk_argc_list( USES_REGS1 ) | |||||||
|       if (*arg == '-' && arg[1] == '-' && arg[2] == '\0') { |       if (*arg == '-' && arg[1] == '-' && arg[2] == '\0') { | ||||||
| 	/* we found the separator */ | 	/* we found the separator */ | ||||||
| 	int j; | 	int j; | ||||||
| 	for (j = Yap_argc-1; j > i+1; --j) { | 	for (j = GLOBAL_argc-1; j > i+1; --j) { | ||||||
| 	  t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(Yap_argv[j])),t); | 	  t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(GLOBAL_argv[j])),t); | ||||||
| 	} | 	} | ||||||
| 	return t; | 	return t; | ||||||
|       } else if (Yap_argv[i+1] && Yap_argv[i+1][0] == '-' && Yap_argv[i+1][1] == '-'  && Yap_argv[i+1][2] == '\0') { |       } else if (GLOBAL_argv[i+1] && GLOBAL_argv[i+1][0] == '-' && GLOBAL_argv[i+1][1] == '-'  && GLOBAL_argv[i+1][2] == '\0') { | ||||||
| 	/* we found the separator */ | 	/* we found the separator */ | ||||||
| 	int j; | 	int j; | ||||||
| 	for (j = Yap_argc-1; j > i+2; --j) { | 	for (j = GLOBAL_argc-1; j > i+2; --j) { | ||||||
| 	  t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(Yap_argv[j])),t); | 	  t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(GLOBAL_argv[j])),t); | ||||||
| 	} | 	} | ||||||
| 	return t; | 	return t; | ||||||
|       } |       } | ||||||
| @@ -3649,8 +3649,8 @@ mk_argc_list( USES_REGS1 ) | |||||||
|     if (arg[0] == '-' && arg[1] == '-' && arg[2] == '\0') { |     if (arg[0] == '-' && arg[1] == '-' && arg[2] == '\0') { | ||||||
|       /* we found the separator */ |       /* we found the separator */ | ||||||
|       int j; |       int j; | ||||||
|       for (j = Yap_argc-1; j > i; --j) { |       for (j = GLOBAL_argc-1; j > i; --j) { | ||||||
| 	t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(Yap_argv[j])),t); | 	t = MkPairTerm(MkAtomTerm(Yap_LookupAtom(GLOBAL_argv[j])),t); | ||||||
|       } |       } | ||||||
|       return(t); |       return(t); | ||||||
|     } |     } | ||||||
| @@ -3670,7 +3670,7 @@ static Int | |||||||
| p_executable( USES_REGS1 ) | p_executable( USES_REGS1 ) | ||||||
| { | { | ||||||
|    |    | ||||||
|   Yap_TrueFileName (Yap_argv[0], LOCAL_FileNameBuf, FALSE); |   Yap_TrueFileName (GLOBAL_argv[0], LOCAL_FileNameBuf, FALSE); | ||||||
|   return Yap_unify(MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),ARG1); |   return Yap_unify(MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),ARG1); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -3904,9 +3904,9 @@ p_system_mode( USES_REGS1 ) | |||||||
| { | { | ||||||
|   Int i = IntegerOfTerm(Deref(ARG1)); |   Int i = IntegerOfTerm(Deref(ARG1)); | ||||||
|   if (i == 0)  |   if (i == 0)  | ||||||
|     Yap_PrologMode &= ~SystemMode; |     LOCAL_PrologMode &= ~SystemMode; | ||||||
|   else |   else | ||||||
|     Yap_PrologMode |= SystemMode; |     LOCAL_PrologMode |= SystemMode; | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										90
									
								
								C/sysbits.c
									
									
									
									
									
								
							
							
						
						
									
										90
									
								
								C/sysbits.c
									
									
									
									
									
								
							| @@ -88,7 +88,7 @@ static char SccsId[] = "%W% %G%"; | |||||||
| #include <readline/readline.h> | #include <readline/readline.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| STATIC_PROTO (void InitPageSize, (void)); |  | ||||||
| STATIC_PROTO (void InitTime, (void)); | STATIC_PROTO (void InitTime, (void)); | ||||||
| STATIC_PROTO (void InitWTime, (void)); | STATIC_PROTO (void InitWTime, (void)); | ||||||
| STATIC_PROTO (Int p_sh, ( USES_REGS1 )); | STATIC_PROTO (Int p_sh, ( USES_REGS1 )); | ||||||
| @@ -107,9 +107,6 @@ STATIC_PROTO (int chdir, (char *)); | |||||||
| /* #define signal	skel_signal */ | /* #define signal	skel_signal */ | ||||||
| #endif /* MACYAP */ | #endif /* MACYAP */ | ||||||
|  |  | ||||||
| #if  __simplescalar__ |  | ||||||
| char yap_pwd[YAP_FILENAME_MAX]; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| STD_PROTO (void exit, (int)); | STD_PROTO (void exit, (int)); | ||||||
|  |  | ||||||
| @@ -287,8 +284,8 @@ p_dir_sp ( USES_REGS1 ) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static void | void | ||||||
| InitPageSize(void) | Yap_InitPageSize(void) | ||||||
| { | { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|   SYSTEM_INFO si; |   SYSTEM_INFO si; | ||||||
| @@ -1211,6 +1208,7 @@ HandleSIGSEGV(int   sig,   siginfo_t   *sip, ucontext_t *uap) | |||||||
| static void | static void | ||||||
| HandleMatherr(int  sig, siginfo_t *sip, ucontext_t *uap) | HandleMatherr(int  sig, siginfo_t *sip, ucontext_t *uap) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
|   yap_error_number error_no; |   yap_error_number error_no; | ||||||
|  |  | ||||||
|   /* reset the registers so that we don't have trash in abstract machine */ |   /* reset the registers so that we don't have trash in abstract machine */ | ||||||
| @@ -1308,6 +1306,7 @@ STATIC_PROTO (void my_signal, (int, void (*)(int))); | |||||||
| static RETSIGTYPE | static RETSIGTYPE | ||||||
| HandleMatherr(int sig) | HandleMatherr(int sig) | ||||||
| { | { | ||||||
|  |   CACHE_REGS | ||||||
| #if HAVE_FETESTEXCEPT | #if HAVE_FETESTEXCEPT | ||||||
|  |  | ||||||
|   /* This should work in Linux, but it doesn't seem to. */ |   /* This should work in Linux, but it doesn't seem to. */ | ||||||
| @@ -1315,19 +1314,19 @@ HandleMatherr(int sig) | |||||||
|   int raised = fetestexcept(FE_ALL_EXCEPT); |   int raised = fetestexcept(FE_ALL_EXCEPT); | ||||||
|  |  | ||||||
|   if (raised & FE_OVERFLOW) { |   if (raised & FE_OVERFLOW) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_FLOAT_OVERFLOW; |     LOCAL_matherror  = EVALUATION_ERROR_FLOAT_OVERFLOW; | ||||||
|   } else if (raised & (FE_INVALID|FE_INEXACT)) { |   } else if (raised & (FE_INVALID|FE_INEXACT)) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_UNDEFINED; |     LOCAL_matherror  = EVALUATION_ERROR_UNDEFINED; | ||||||
|   } else if (raised & FE_DIVBYZERO) { |   } else if (raised & FE_DIVBYZERO) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_ZERO_DIVISOR; |     LOCAL_matherror  = EVALUATION_ERROR_ZERO_DIVISOR; | ||||||
|   } else if (raised & FE_UNDERFLOW) { |   } else if (raised & FE_UNDERFLOW) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_FLOAT_UNDERFLOW; |     LOCAL_matherror  = EVALUATION_ERROR_FLOAT_UNDERFLOW; | ||||||
|   } else |   } else | ||||||
| #endif | #endif | ||||||
|     Yap_matherror = EVALUATION_ERROR_UNDEFINED; |     LOCAL_matherror  = EVALUATION_ERROR_UNDEFINED; | ||||||
|   /* something very bad happened on the way to the forum */ |   /* something very bad happened on the way to the forum */ | ||||||
|   set_fpu_exceptions(FALSE); |   set_fpu_exceptions(FALSE); | ||||||
|   Yap_Error(Yap_matherror, TermNil, ""); |   Yap_Error(LOCAL_matherror , TermNil, ""); | ||||||
| } | } | ||||||
|  |  | ||||||
| #if HAVE_SIGSEGV && !defined(THREADS)  | #if HAVE_SIGSEGV && !defined(THREADS)  | ||||||
| @@ -1376,7 +1375,7 @@ SearchForTrailFault(siginfo_t *siginfo) | |||||||
| static RETSIGTYPE | static RETSIGTYPE | ||||||
| HandleSIGSEGV(int   sig, siginfo_t *siginfo, void *context) | HandleSIGSEGV(int   sig, siginfo_t *siginfo, void *context) | ||||||
| { | { | ||||||
|   if (Yap_PrologMode & ExtendStackMode) { |   if (LOCAL_PrologMode & ExtendStackMode) { | ||||||
|     Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop); |     Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop); | ||||||
|   } |   } | ||||||
|   SearchForTrailFault(siginfo); |   SearchForTrailFault(siginfo); | ||||||
| @@ -1445,19 +1444,19 @@ HandleMatherr(int sig) | |||||||
|   int raised = fetestexcept(FE_ALL_EXCEPT); |   int raised = fetestexcept(FE_ALL_EXCEPT); | ||||||
|  |  | ||||||
|   if (raised & FE_OVERFLOW) { |   if (raised & FE_OVERFLOW) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_FLOAT_OVERFLOW; |     LOCAL_matherror  = EVALUATION_ERROR_FLOAT_OVERFLOW; | ||||||
|   } else if (raised & (FE_INVALID|FE_INEXACT)) { |   } else if (raised & (FE_INVALID|FE_INEXACT)) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_UNDEFINED; |     LOCAL_matherror  = EVALUATION_ERROR_UNDEFINED; | ||||||
|   } else if (raised & FE_DIVBYZERO) { |   } else if (raised & FE_DIVBYZERO) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_ZERO_DIVISOR; |     LOCAL_matherror  = EVALUATION_ERROR_ZERO_DIVISOR; | ||||||
|   } else if (raised & FE_UNDERFLOW) { |   } else if (raised & FE_UNDERFLOW) { | ||||||
|     Yap_matherror = EVALUATION_ERROR_FLOAT_UNDERFLOW; |     LOCAL_matherror  = EVALUATION_ERROR_FLOAT_UNDERFLOW; | ||||||
|   } else |   } else | ||||||
| #endif | #endif | ||||||
|     Yap_matherror = EVALUATION_ERROR_UNDEFINED; |     LOCAL_matherror  = EVALUATION_ERROR_UNDEFINED; | ||||||
|   /* something very bad happened on the way to the forum */ |   /* something very bad happened on the way to the forum */ | ||||||
|   set_fpu_exceptions(FALSE); |   set_fpu_exceptions(FALSE); | ||||||
|   Yap_Error(Yap_matherror, TermNil, ""); |   Yap_Error(LOCAL_matherror , TermNil, ""); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -1493,7 +1492,7 @@ SearchForTrailFault(void) | |||||||
| static RETSIGTYPE | static RETSIGTYPE | ||||||
| HandleSIGSEGV(int   sig) | HandleSIGSEGV(int   sig) | ||||||
| { | { | ||||||
|   if (Yap_PrologMode & ExtendStackMode) { |   if (LOCAL_PrologMode & ExtendStackMode) { | ||||||
|     CACHE_REGS |     CACHE_REGS | ||||||
|     Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop); |     Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop); | ||||||
|   } |   } | ||||||
| @@ -1554,71 +1553,71 @@ void (*handler)(int); | |||||||
| static int | static int | ||||||
| InteractSIGINT(int ch) { | InteractSIGINT(int ch) { | ||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   Yap_PrologMode |= AsyncIntMode; |   LOCAL_PrologMode |= AsyncIntMode; | ||||||
|   switch (ch) { |   switch (ch) { | ||||||
|   case 'a': |   case 'a': | ||||||
|     /* abort computation */ |     /* abort computation */ | ||||||
|     if (Yap_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) { |     if (LOCAL_PrologMode & (GCMode|ConsoleGetcMode|GrowStackMode|GrowHeapMode)) { | ||||||
|       Yap_PrologMode |= AbortMode; |       LOCAL_PrologMode |= AbortMode; | ||||||
|     } else { |     } else { | ||||||
|       Yap_Error(PURE_ABORT, TermNil, "abort from console"); |       Yap_Error(PURE_ABORT, TermNil, "abort from console"); | ||||||
|       /* in case someone mangles the P register */ |       /* in case someone mangles the P register */ | ||||||
|     } |     } | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     siglongjmp(LOCAL_RestartEnv,1); |     siglongjmp(LOCAL_RestartEnv,1); | ||||||
|     return -1; |     return -1; | ||||||
|   case 'b': |   case 'b': | ||||||
|     /* continue */ |     /* continue */ | ||||||
|     Yap_signal (YAP_BREAK_SIGNAL); |     Yap_signal (YAP_BREAK_SIGNAL); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return 1; |     return 1; | ||||||
|   case 'c': |   case 'c': | ||||||
|     /* continue */ |     /* continue */ | ||||||
|     return 1; |     return 1; | ||||||
|   case 'd': |   case 'd': | ||||||
|     Yap_signal (YAP_DEBUG_SIGNAL); |     Yap_signal (YAP_DEBUG_SIGNAL); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     /* enter debug mode */ |     /* enter debug mode */ | ||||||
|     return 1; |     return 1; | ||||||
|   case 'e': |   case 'e': | ||||||
|     /* exit */ |     /* exit */ | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     Yap_exit(0); |     Yap_exit(0); | ||||||
|     return -1; |     return -1; | ||||||
|   case 'g': |   case 'g': | ||||||
|     /* exit */ |     /* exit */ | ||||||
|     Yap_signal (YAP_STACK_DUMP_SIGNAL); |     Yap_signal (YAP_STACK_DUMP_SIGNAL); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return -1; |     return -1; | ||||||
|   case 't': |   case 't': | ||||||
|     /* start tracing */ |     /* start tracing */ | ||||||
|     Yap_signal (YAP_TRACE_SIGNAL); |     Yap_signal (YAP_TRACE_SIGNAL); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return 1; |     return 1; | ||||||
| #ifdef LOW_LEVEL_TRACER | #ifdef LOW_LEVEL_TRACER | ||||||
|   case 'T': |   case 'T': | ||||||
|     toggle_low_level_trace(); |     toggle_low_level_trace(); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return 1; |     return 1; | ||||||
| #endif | #endif | ||||||
|   case 's': |   case 's': | ||||||
|     /* show some statistics */ |     /* show some statistics */ | ||||||
|     Yap_signal (YAP_STATISTICS_SIGNAL); |     Yap_signal (YAP_STATISTICS_SIGNAL); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return 1; |     return 1; | ||||||
|   case EOF: |   case EOF: | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return(0); |     return(0); | ||||||
|     break; |     break; | ||||||
|   case 'h': |   case 'h': | ||||||
|   case '?': |   case '?': | ||||||
|   default: |   default: | ||||||
|     /* show an helpful message */ |     /* show an helpful message */ | ||||||
|     fprintf(Yap_stderr, "Please press one of:\n"); |     fprintf(GLOBAL_stderr, "Please press one of:\n"); | ||||||
|     fprintf(Yap_stderr, "  a for abort\n  c for continue\n  d for debug\n"); |     fprintf(GLOBAL_stderr, "  a for abort\n  c for continue\n  d for debug\n"); | ||||||
|     fprintf(Yap_stderr, "  e for exit\n  g for stack dump\n  s for statistics\n  t for trace\n"); |     fprintf(GLOBAL_stderr, "  e for exit\n  g for stack dump\n  s for statistics\n  t for trace\n"); | ||||||
|     fprintf(Yap_stderr, "  b for break\n"); |     fprintf(GLOBAL_stderr, "  b for break\n"); | ||||||
|     Yap_PrologMode &= ~AsyncIntMode; |     LOCAL_PrologMode &= ~AsyncIntMode; | ||||||
|     return(0); |     return(0); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @@ -1666,7 +1665,7 @@ HandleSIGINT (int sig) | |||||||
|   my_signal(SIGINT, HandleSIGINT); |   my_signal(SIGINT, HandleSIGINT); | ||||||
|   /* do this before we act */ |   /* do this before we act */ | ||||||
| #if HAVE_ISATTY | #if HAVE_ISATTY | ||||||
|   if (!isatty(0)  && !Yap_sockets_io) { |   if (!isatty(0)) { | ||||||
|     Yap_Error(INTERRUPT_ERROR,MkIntTerm(SIGINT),NULL); |     Yap_Error(INTERRUPT_ERROR,MkIntTerm(SIGINT),NULL); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| @@ -1674,8 +1673,8 @@ HandleSIGINT (int sig) | |||||||
|   if (LOCAL_InterruptsDisabled) { |   if (LOCAL_InterruptsDisabled) { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (Yap_PrologMode & (CritMode|ConsoleGetcMode)) { |   if (LOCAL_PrologMode & (CritMode|ConsoleGetcMode)) { | ||||||
|     Yap_PrologMode |= InterruptMode; |     LOCAL_PrologMode |= InterruptMode; | ||||||
|   } |   } | ||||||
| #ifdef HAVE_SETBUF | #ifdef HAVE_SETBUF | ||||||
|   /* make sure we are not waiting for the end of line */ |   /* make sure we are not waiting for the end of line */ | ||||||
| @@ -1777,7 +1776,7 @@ ReceiveSignal (int s) | |||||||
|       break; |       break; | ||||||
| #endif /* defined(SIGHUP) */ | #endif /* defined(SIGHUP) */ | ||||||
|     default: |     default: | ||||||
|       fprintf(Yap_stderr, "\n[ Unexpected signal ]\n"); |       fprintf(GLOBAL_stderr, "\n[ Unexpected signal ]\n"); | ||||||
|       exit (EXIT_FAILURE); |       exit (EXIT_FAILURE); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1793,7 +1792,7 @@ MSCHandleSignal(DWORD dwCtrlType) { | |||||||
|   case CTRL_C_EVENT: |   case CTRL_C_EVENT: | ||||||
|   case CTRL_BREAK_EVENT: |   case CTRL_BREAK_EVENT: | ||||||
|     Yap_signal(YAP_ALARM_SIGNAL); |     Yap_signal(YAP_ALARM_SIGNAL); | ||||||
|     Yap_PrologMode |= InterruptMode; |     LOCAL_PrologMode |= InterruptMode; | ||||||
|     return(TRUE); |     return(TRUE); | ||||||
|   default: |   default: | ||||||
|     return(FALSE); |     return(FALSE); | ||||||
| @@ -1805,7 +1804,7 @@ MSCHandleSignal(DWORD dwCtrlType) { | |||||||
| static void | static void | ||||||
| InitSignals (void) | InitSignals (void) | ||||||
| { | { | ||||||
|   if (Yap_PrologShouldHandleInterrupts) { |   if (GLOBAL_PrologShouldHandleInterrupts) { | ||||||
| #if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)  | #if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)  | ||||||
|     my_signal (SIGQUIT, ReceiveSignal); |     my_signal (SIGQUIT, ReceiveSignal); | ||||||
|     my_signal (SIGKILL, ReceiveSignal); |     my_signal (SIGKILL, ReceiveSignal); | ||||||
| @@ -1878,7 +1877,7 @@ int Yap_getcwd(const char *buf, int len) | |||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
| #if __simplescalar__ | #if __simplescalar__ | ||||||
|   /* does not implement getcwd */ |   /* does not implement getcwd */ | ||||||
|   strncpy(Yap_buf,yap_pwd,len); |   strncpy(Yap_buf,GLOBAL_pwd,len); | ||||||
| #elif HAVE_GETCWD | #elif HAVE_GETCWD | ||||||
|   if (getcwd ((char *)buf, len) == NULL) { |   if (getcwd ((char *)buf, len) == NULL) { | ||||||
| #if HAVE_STRERROR | #if HAVE_STRERROR | ||||||
| @@ -2730,10 +2729,9 @@ Yap_InitSysbits (void) | |||||||
| #if  __simplescalar__ | #if  __simplescalar__ | ||||||
|   { |   { | ||||||
|     char *pwd = getenv("PWD"); |     char *pwd = getenv("PWD"); | ||||||
|     strncpy(yap_pwd,pwd,YAP_FILENAME_MAX); |     strncpy(GLOBAL_pwd,pwd,YAP_FILENAME_MAX); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|   InitPageSize(); |  | ||||||
|   InitWTime (); |   InitWTime (); | ||||||
|   InitRandom (); |   InitRandom (); | ||||||
|   /* let the caller control signals as it sees fit */ |   /* let the caller control signals as it sees fit */ | ||||||
|   | |||||||
| @@ -405,7 +405,7 @@ Yap_thread_create_engine(thread_attr *ops) | |||||||
|     ops->sysize = 0; |     ops->sysize = 0; | ||||||
|     ops->egoal = t; |     ops->egoal = t; | ||||||
|   } |   } | ||||||
|   if (pthread_self() != Yap_master_thread) { |   if (pthread_self() != GLOBAL_master_thread) { | ||||||
|     /* we are worker_id 0 for now, lock master thread so that no one messes with us */  |     /* we are worker_id 0 for now, lock master thread so that no one messes with us */  | ||||||
|     pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs); |     pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs); | ||||||
|     pthread_mutex_lock(&(REMOTE_ThreadHandle(0).tlock)); |     pthread_mutex_lock(&(REMOTE_ThreadHandle(0).tlock)); | ||||||
| @@ -416,7 +416,7 @@ Yap_thread_create_engine(thread_attr *ops) | |||||||
|   REMOTE_ThreadHandle(new_id).id = new_id; |   REMOTE_ThreadHandle(new_id).id = new_id; | ||||||
|   REMOTE_ThreadHandle(new_id).ref_count = 0; |   REMOTE_ThreadHandle(new_id).ref_count = 0; | ||||||
|   setup_engine(new_id, FALSE); |   setup_engine(new_id, FALSE); | ||||||
|   if (pthread_self() != Yap_master_thread) { |   if (pthread_self() != GLOBAL_master_thread) { | ||||||
|     pthread_setspecific(Yap_yaamregs_key, NULL); |     pthread_setspecific(Yap_yaamregs_key, NULL); | ||||||
|     pthread_mutex_unlock(&(REMOTE_ThreadHandle(0).tlock)); |     pthread_mutex_unlock(&(REMOTE_ThreadHandle(0).tlock)); | ||||||
|   } |   } | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								C/tracer.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								C/tracer.c
									
									
									
									
									
								
							| @@ -28,12 +28,12 @@ | |||||||
| STATIC_PROTO(int  TracePutchar, (int, int)); | STATIC_PROTO(int  TracePutchar, (int, int)); | ||||||
| STATIC_PROTO(void  send_tracer_message, (char *, char *, Int, char *, CELL *)); | STATIC_PROTO(void  send_tracer_message, (char *, char *, Int, char *, CELL *)); | ||||||
|  |  | ||||||
| static int do_trace_primitives = TRUE; |  | ||||||
|  |  | ||||||
| static int | static int | ||||||
| TracePutchar(int sno, int ch) | TracePutchar(int sno, int ch) | ||||||
| { | { | ||||||
|   return(putc(ch, Yap_stderr)); /* use standard error stream, which is supposed to be 2*/ |   return(putc(ch, GLOBAL_stderr)); /* use standard error stream, which is supposed to be 2*/ | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -42,24 +42,24 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args) | |||||||
|   CACHE_REGS |   CACHE_REGS | ||||||
|   if (name == NULL) { |   if (name == NULL) { | ||||||
| #ifdef  YAPOR | #ifdef  YAPOR | ||||||
|     fprintf(Yap_stderr, "(%d)%s", worker_id, start); |     fprintf(GLOBAL_stderr, "(%d)%s", worker_id, start); | ||||||
| #else | #else | ||||||
|     fprintf(Yap_stderr, "%s", start); |     fprintf(GLOBAL_stderr, "%s", start); | ||||||
| #endif | #endif | ||||||
|   } else { |   } else { | ||||||
|     int i; |     int i; | ||||||
|  |  | ||||||
|     if (arity) { |     if (arity) { | ||||||
|       if (args) |       if (args) | ||||||
| 	fprintf(Yap_stderr, "%s %s:%s(", start, mname, name); | 	fprintf(GLOBAL_stderr, "%s %s:%s(", start, mname, name); | ||||||
|       else |       else | ||||||
| 	fprintf(Yap_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity); | 	fprintf(GLOBAL_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity); | ||||||
|     } else { |     } else { | ||||||
|       fprintf(Yap_stderr, "%s %s:%s", start, mname, name); |       fprintf(GLOBAL_stderr, "%s %s:%s", start, mname, name); | ||||||
|     } |     } | ||||||
|     if (args) { |     if (args) { | ||||||
|       for (i= 0; i < arity; i++) { |       for (i= 0; i < arity; i++) { | ||||||
| 	if (i > 0) fprintf(Yap_stderr, ","); | 	if (i > 0) fprintf(GLOBAL_stderr, ","); | ||||||
| #if DEBUG | #if DEBUG | ||||||
| #if COROUTINING | #if COROUTINING | ||||||
| 	Yap_Portray_delays = TRUE; | 	Yap_Portray_delays = TRUE; | ||||||
| @@ -73,11 +73,11 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args) | |||||||
| #endif | #endif | ||||||
|       } |       } | ||||||
|       if (arity) { |       if (arity) { | ||||||
| 	fprintf(Yap_stderr, ")"); | 	fprintf(GLOBAL_stderr, ")"); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   fprintf(Yap_stderr, "\n"); |   fprintf(GLOBAL_stderr, "\n"); | ||||||
| } | } | ||||||
|  |  | ||||||
| #if defined(__GNUC__) | #if defined(__GNUC__) | ||||||
| @@ -293,16 +293,16 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) | |||||||
|       printf("\n"); |       printf("\n"); | ||||||
|  } |  } | ||||||
| #endif | #endif | ||||||
|   fprintf(Yap_stderr,"%lld ",vsc_count); |   fprintf(GLOBAL_stderr,"%lld ",vsc_count); | ||||||
| #if defined(THREADS) || defined(YAPOR) | #if defined(THREADS) || defined(YAPOR) | ||||||
|   fprintf(Yap_stderr,"(%d)", worker_id); |   fprintf(GLOBAL_stderr,"(%d)", worker_id); | ||||||
| #endif | #endif | ||||||
|   /* check_trail_consistency(); */ |   /* check_trail_consistency(); */ | ||||||
|   if (pred == NULL) { |   if (pred == NULL) { | ||||||
|     UNLOCK(Yap_heap_regs->low_level_trace_lock); |     UNLOCK(Yap_heap_regs->low_level_trace_lock); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (pred->ModuleOfPred == 0 && !do_trace_primitives) { |   if (pred->ModuleOfPred == 0 && !LOCAL_do_trace_primitives) { | ||||||
|     UNLOCK(Yap_heap_regs->low_level_trace_lock); |     UNLOCK(Yap_heap_regs->low_level_trace_lock); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| @@ -425,7 +425,7 @@ static Int p_start_low_level_trace2( USES_REGS1 ) | |||||||
| static Int p_stop_low_level_trace( USES_REGS1 ) | static Int p_stop_low_level_trace( USES_REGS1 ) | ||||||
| { | { | ||||||
|   Yap_do_low_level_trace = FALSE; |   Yap_do_low_level_trace = FALSE; | ||||||
|   do_trace_primitives = TRUE; |   LOCAL_do_trace_primitives = TRUE; | ||||||
|   return(TRUE); |   return(TRUE); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -244,7 +244,7 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, | |||||||
| 	CELL new; | 	CELL new; | ||||||
|  |  | ||||||
| 	bp = to_visit; | 	bp = to_visit; | ||||||
| 	if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | 	if (!GLOBAL_attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | ||||||
| 	  goto overflow; | 	  goto overflow; | ||||||
| 	} | 	} | ||||||
| 	to_visit = bp; | 	to_visit = bp; | ||||||
| @@ -1400,7 +1400,7 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, | |||||||
| 	CELL new; | 	CELL new; | ||||||
|  |  | ||||||
| 	bp = to_visit; | 	bp = to_visit; | ||||||
| 	if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | 	if (!GLOBAL_attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { | ||||||
| 	  goto overflow; | 	  goto overflow; | ||||||
| 	} | 	} | ||||||
| 	to_visit = bp; | 	to_visit = bp; | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								H/Regs.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								H/Regs.h
									
									
									
									
									
								
							| @@ -208,7 +208,6 @@ extern REGSTORE Yap_REGS; | |||||||
| #define MinTrailGap (sizeof(CELL)*1024) | #define MinTrailGap (sizeof(CELL)*1024) | ||||||
| #define MinHeapGap  (sizeof(CELL)*4096) | #define MinHeapGap  (sizeof(CELL)*4096) | ||||||
| #define MinStackGap (sizeof(CELL)*8*1024) | #define MinStackGap (sizeof(CELL)*8*1024) | ||||||
| extern int Yap_stack_overflows; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #define ENV  Yap_REGS.ENV_	/* current environment                    */ | #define ENV  Yap_REGS.ENV_	/* current environment                    */ | ||||||
|   | |||||||
| @@ -136,8 +136,7 @@ typedef enum | |||||||
| exts; | exts; | ||||||
|  |  | ||||||
|  |  | ||||||
| /* array with the ops for your favourite extensions */ |  | ||||||
| extern ext_op attas[attvars_ext + 1]; |  | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										211
									
								
								H/Yap.h
									
									
									
									
									
								
							
							
						
						
									
										211
									
								
								H/Yap.h
									
									
									
									
									
								
							| @@ -109,8 +109,8 @@ | |||||||
| #ifdef __MINGW32__ | #ifdef __MINGW32__ | ||||||
| #ifndef _WIN32 | #ifndef _WIN32 | ||||||
| #define _WIN32 1 | #define _WIN32 1 | ||||||
| #endif | #endif /* _WIN32 */ | ||||||
| #endif | #endif /* __MINGW32__ */ | ||||||
|  |  | ||||||
| #if HAVE_GCC | #if HAVE_GCC | ||||||
| #define MIN_ARRAY 0 | #define MIN_ARRAY 0 | ||||||
| @@ -118,13 +118,13 @@ | |||||||
| #else | #else | ||||||
| #define MIN_ARRAY 1 | #define MIN_ARRAY 1 | ||||||
| #define DUMMY_FILLER_FOR_ABS_TYPE int dummy; | #define DUMMY_FILLER_FOR_ABS_TYPE int dummy; | ||||||
| #endif | #endif /* HAVE_GCC */ | ||||||
|  |  | ||||||
| #ifndef ADTDEFS_C | #ifndef ADTDEFS_C | ||||||
| #define EXTERN  static | #define EXTERN  static | ||||||
| #else | #else | ||||||
| #define EXTERN | #define EXTERN | ||||||
| #endif | #endif /* ADTDEFS_C */ | ||||||
|  |  | ||||||
| /* truth-values */ | /* truth-values */ | ||||||
| #define	 TRUE	1 | #define	 TRUE	1 | ||||||
| @@ -144,10 +144,10 @@ | |||||||
| #if USE_PTHREAD_LOCKING | #if USE_PTHREAD_LOCKING | ||||||
| #ifndef _XOPEN_SOURCE | #ifndef _XOPEN_SOURCE | ||||||
| #define _XOPEN_SOURCE 600 | #define _XOPEN_SOURCE 600 | ||||||
| #endif | #endif  /* !_XOPEN_SOURCE */ | ||||||
| #endif | #endif /* USE_PTHREAD_LOCKING */ | ||||||
| #include <pthread.h> | #include <pthread.h> | ||||||
| #endif | #endif /* THREADS */ | ||||||
|  |  | ||||||
| #if SIZEOF_INT_P==4 | #if SIZEOF_INT_P==4 | ||||||
|  |  | ||||||
| @@ -242,16 +242,13 @@ typedef unsigned long int YAP_ULONG_LONG; | |||||||
| #define LOW_PROF 1 | #define LOW_PROF 1 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef DEBUG |  | ||||||
| extern char Yap_Option[20]; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* #define FORCE_SECOND_QUADRANT 1 */ | /* #define FORCE_SECOND_QUADRANT 1 */ | ||||||
|  |  | ||||||
| #if defined(FORCE_SECOND_QUADRANT) | #if defined(FORCE_SECOND_QUADRANT) | ||||||
| #define IN_SECOND_QUADRANT 1 | #define IN_SECOND_QUADRANT 1 | ||||||
| #define MMAP_ADDR 0x42000000 | #define MMAP_ADDR 0x42000000 | ||||||
| #endif | #endif /* FORCE_SECOND_QUADRANT */ | ||||||
|  |  | ||||||
| #if !defined(IN_SECOND_QUADRANT) | #if !defined(IN_SECOND_QUADRANT) | ||||||
| #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(mips) || defined(__APPLE__) || defined(__DragonFly__) | #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(mips) || defined(__APPLE__) || defined(__DragonFly__) | ||||||
| @@ -269,10 +266,10 @@ extern char Yap_Option[20]; | |||||||
| #define MMAP_ADDR 0x20000000 | #define MMAP_ADDR 0x20000000 | ||||||
| #else | #else | ||||||
| #define MMAP_ADDR 0x10000000 | #define MMAP_ADDR 0x10000000 | ||||||
| #endif | #endif /* YAPOR && __alpha */ | ||||||
| #elif __svr4__ || defined(__SVR4) | #elif __svr4__ || defined(__SVR4) | ||||||
| #define MMAP_ADDR 0x02000000 | #define MMAP_ADDR 0x02000000 | ||||||
| #endif | #endif /* __linux__ || __FreeBSD__ || __NetBSD__ || mips || __APPLE__ || __DragonFly__ */ | ||||||
| #endif /* !IN_SECOND_QUADRANT */ | #endif /* !IN_SECOND_QUADRANT */ | ||||||
|  |  | ||||||
| /* #define RANDOMIZE_START_ADDRESS 1 */ | /* #define RANDOMIZE_START_ADDRESS 1 */ | ||||||
| @@ -280,15 +277,15 @@ extern char Yap_Option[20]; | |||||||
| #ifdef USE_SYSTEM_MALLOC | #ifdef USE_SYSTEM_MALLOC | ||||||
| #define HEAP_INIT_BASE  0L | #define HEAP_INIT_BASE  0L | ||||||
| #define AtomBase        NULL | #define AtomBase        NULL | ||||||
| #else | #else /* !USE_SYSTEM_MALLOC */ | ||||||
| #if defined(MMAP_ADDR) && (defined(USE_MMAP) || USE_SHMAT) && !defined(__simplescalar__) && !defined(RANDOMIZE_START_ADDRESS) | #if defined(MMAP_ADDR) && (defined(USE_MMAP) || USE_SHMAT) && !defined(__simplescalar__) && !defined(RANDOMIZE_START_ADDRESS) | ||||||
| #define HEAP_INIT_BASE  (MMAP_ADDR) | #define HEAP_INIT_BASE  (MMAP_ADDR) | ||||||
| #define AtomBase        ((char *)MMAP_ADDR) | #define AtomBase        ((char *)MMAP_ADDR) | ||||||
| #else | #else /*! (MMAP_ADDR && (USE_MMAP || USE_SHMAT) && !__simplescalar__ && !RANDOMIZE_START_ADDRESS) */ | ||||||
| #define HEAP_INIT_BASE  ((CELL)Yap_HeapBase) | #define HEAP_INIT_BASE  ((CELL)Yap_HeapBase) | ||||||
| #define AtomBase        (Yap_HeapBase) | #define AtomBase        (Yap_HeapBase) | ||||||
| #endif | #endif /* MMAP_ADDR && (USE_MMAP || USE_SHMAT) && !__simplescalar__ && !RANDOMIZE_START_ADDRESS */ | ||||||
| #endif | #endif /* USE_SYSTEM_MALLOC */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -308,7 +305,9 @@ extern char Yap_Option[20]; | |||||||
| #define M1   ((CELL)(1024*1024)) | #define M1   ((CELL)(1024*1024)) | ||||||
| #define M2   ((CELL)(2048*1024)) | #define M2   ((CELL)(2048*1024)) | ||||||
|  |  | ||||||
| /*  basic data types  */ | /************************************************************************************************* | ||||||
|  |                                         basic data types | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| typedef UInt CELL; | typedef UInt CELL; | ||||||
| typedef UShort BITS16; | typedef UShort BITS16; | ||||||
| @@ -329,7 +328,9 @@ typedef unsigned char *CODEADDR; | |||||||
| #define CellSize     sizeof(CELL) | #define CellSize     sizeof(CELL) | ||||||
| #define SmallSize    sizeof(SMALLUNSGN) | #define SmallSize    sizeof(SMALLUNSGN) | ||||||
|  |  | ||||||
| /* type	casting	macros		*/ | /************************************************************************************************* | ||||||
|  |                                         type casting macros | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #define	Addr(V)		((ADDR) (V)) | #define	Addr(V)		((ADDR) (V)) | ||||||
| #define	Unsigned(V)	((CELL) (V)) | #define	Unsigned(V)	((CELL) (V)) | ||||||
| @@ -344,7 +345,9 @@ typedef unsigned char *CODEADDR; | |||||||
| #define DisplPtr(V)	((DISPREG *)(V)) | #define DisplPtr(V)	((DISPREG *)(V)) | ||||||
| #define TermPtr(V)	((Term *) (V)) | #define TermPtr(V)	((Term *) (V)) | ||||||
|  |  | ||||||
| /*	Abstract Type Definitions for YAPProlog			       */ | /************************************************************************************************* | ||||||
|  |                               Abstract Type Definitions for YAPProlog	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| typedef CELL Term; | typedef CELL Term; | ||||||
|  |  | ||||||
| @@ -383,7 +386,9 @@ typedef pthread_rwlock_t rwlock_t; | |||||||
| #include <locks_pthread.h> | #include <locks_pthread.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /********************** use an auxiliary function for ranges ************/ | /************************************************************************************************* | ||||||
|  |                               use an auxiliary function for ranges	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||||
| #define IN_BETWEEN(MIN,X,MAX) (Unsigned((Int)(X)-(Int)(MIN)) <=  \ | #define IN_BETWEEN(MIN,X,MAX) (Unsigned((Int)(X)-(Int)(MIN)) <=  \ | ||||||
| @@ -397,19 +402,25 @@ typedef pthread_rwlock_t rwlock_t; | |||||||
| #define OUTSIDE(MIN,X,MAX) ((void *)(X) < (void *)(MIN) || (void *)(X) > (void *)(MAX)) | #define OUTSIDE(MIN,X,MAX) ((void *)(X) < (void *)(MIN) || (void *)(X) > (void *)(MAX)) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* ************************* Atoms  *************************************/ | /************************************************************************************************* | ||||||
|  |                                              Atoms	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #include "Atoms.h" | #include "Atoms.h" | ||||||
|  |  | ||||||
| /* ************************* Coroutining  **********************************/ | /************************************************************************************************* | ||||||
|  |                                              Coroutining	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef COROUTINING | #ifdef COROUTINING | ||||||
| /* Support for co-routining */ | /* Support for co-routining */ | ||||||
| #include "corout.h" | #include "corout.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /*********  abstract machine registers **********************************/ | /************************************************************************************************* | ||||||
|  |                                       abstract machine registers	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #include "amidefs.h" | #include "amidefs.h" | ||||||
|  |  | ||||||
| @@ -424,7 +435,9 @@ typedef pthread_rwlock_t rwlock_t; | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /************ variables	concerned with Error Handling *************/ | /************************************************************************************************* | ||||||
|  |                               variables concerned with Error Handling	 | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #include <setjmp.h> | #include <setjmp.h> | ||||||
|  |  | ||||||
| @@ -437,7 +450,6 @@ typedef pthread_rwlock_t rwlock_t; | |||||||
| /* Support for arrays */ | /* Support for arrays */ | ||||||
| #include "arrays.h" | #include "arrays.h" | ||||||
|  |  | ||||||
| /************ variables	concerned with Error Handling	*************/ |  | ||||||
|  |  | ||||||
| /* Types of Errors */ | /* Types of Errors */ | ||||||
| typedef enum | typedef enum | ||||||
| @@ -615,7 +627,9 @@ typedef enum | |||||||
|  |  | ||||||
| #define NUMBER_OF_YAP_FLAGS  LAST_FLAG | #define NUMBER_OF_YAP_FLAGS  LAST_FLAG | ||||||
|  |  | ||||||
| /************************  prototypes **********************************/ | /************************************************************************************************* | ||||||
|  |                                            prototypes | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #include "Yapproto.h" | #include "Yapproto.h" | ||||||
|  |  | ||||||
| @@ -733,7 +747,9 @@ typedef enum | |||||||
|  |  | ||||||
| #define	TermSize    sizeof(Term) | #define	TermSize    sizeof(Term) | ||||||
|  |  | ||||||
| /************* variables related to memory allocation *******************/ | /************************************************************************************************* | ||||||
|  |                            variables related to memory allocation  | ||||||
|  | *************************************************************************************************/ | ||||||
| /* must be before TermExt.h */ | /* must be before TermExt.h */ | ||||||
|  |  | ||||||
| extern ADDR Yap_HeapBase; | extern ADDR Yap_HeapBase; | ||||||
| @@ -743,22 +759,17 @@ extern ADDR Yap_HeapBase; | |||||||
|  |  | ||||||
| #define MAX_ERROR_MSG_SIZE YAP_FILENAME_MAX | #define MAX_ERROR_MSG_SIZE YAP_FILENAME_MAX | ||||||
|  |  | ||||||
| #ifdef THREADS |  | ||||||
| /* This is the guy who actually started the system, and who has the correct registers */ |  | ||||||
| extern pthread_t Yap_master_thread; |  | ||||||
| #endif /* THREADS */ |  | ||||||
|  |  | ||||||
| #ifdef DEBUG | /************************************************************************************************* | ||||||
| /************** Debugging Support ***************************/ |                                               ??? | ||||||
| extern int Yap_output_msg; | *************************************************************************************************/ | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /********** ??? ***********/ |  | ||||||
|  |  | ||||||
| #define MkVarTerm() MkVarTerm__( PASS_REGS1 ) | #define MkVarTerm() MkVarTerm__( PASS_REGS1 ) | ||||||
| #define MkPairTerm(A,B) MkPairTerm__( A, B PASS_REGS ) | #define MkPairTerm(A,B) MkPairTerm__( A, B PASS_REGS ) | ||||||
|  |  | ||||||
| /* applies to unbound variables */ | /************************************************************************************************* | ||||||
|  |                                    applies to unbound variables | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| inline EXTERN Term *VarOfTerm (Term t); | inline EXTERN Term *VarOfTerm (Term t); | ||||||
|  |  | ||||||
| @@ -1002,8 +1013,10 @@ IntegerOfTerm (Term t) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                 variables concerned with atoms table | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| /*************** variables concerned with atoms	table *******************/ |  | ||||||
| #define	MaxHash	    3333 | #define	MaxHash	    3333 | ||||||
| #define	MaxWideHash (MaxHash/10+1) | #define	MaxWideHash (MaxHash/10+1) | ||||||
|  |  | ||||||
| @@ -1011,14 +1024,17 @@ IntegerOfTerm (Term t) | |||||||
| #define DO_EVERYTHING 1 | #define DO_EVERYTHING 1 | ||||||
| #define DO_ONLY_CODE  2 | #define DO_ONLY_CODE  2 | ||||||
|  |  | ||||||
| /********* common instructions codes*************************/ | /************************************************************************************************* | ||||||
|  |                                    common instructions codes | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #define MAX_PROMPT  256 | #define MAX_PROMPT  256 | ||||||
|  |  | ||||||
| #if USE_THREADED_CODE | #if USE_THREADED_CODE | ||||||
|  |  | ||||||
|  | /************************************************************************************************* | ||||||
| /************ reverse lookup of instructions *****************/ |                                    reverse lookup of instructions | ||||||
|  | *************************************************************************************************/ | ||||||
| typedef struct opcode_tab_entry | typedef struct opcode_tab_entry | ||||||
| { | { | ||||||
|   OPCODE opc; |   OPCODE opc; | ||||||
| @@ -1027,9 +1043,9 @@ typedef struct opcode_tab_entry | |||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                    Prolog may be in several modes  | ||||||
| /********* Prolog may be in several modes *******************************/ | *************************************************************************************************/ | ||||||
|  |  | ||||||
| typedef enum | typedef enum | ||||||
| { | { | ||||||
| @@ -1054,29 +1070,13 @@ typedef enum | |||||||
|   InReadlineMode = 0x40000	/* YAP has just been interrupted from the outside */ |   InReadlineMode = 0x40000	/* YAP has just been interrupted from the outside */ | ||||||
| } prolog_exec_mode; | } prolog_exec_mode; | ||||||
|  |  | ||||||
| extern Int Yap_PrologMode; |  | ||||||
| extern int Yap_CritLocks; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************************************************************* | /************************************************************************************************* | ||||||
|                                   Access to yap initial arguments |                                      number of modules | ||||||
| *************************************************************************************************/ | *************************************************************************************************/ | ||||||
| extern char **Yap_argv; |  | ||||||
| extern int Yap_argc; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************************************************************* |  | ||||||
|                          whether Yap is responsible for signal handling |  | ||||||
| *************************************************************************************************/ |  | ||||||
| extern int Yap_PrologShouldHandleInterrupts; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /******************* number of modules ****************************/ |  | ||||||
|  |  | ||||||
| #define DefaultMaxModules	256 | #define DefaultMaxModules	256 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************************************************************* | /************************************************************************************************* | ||||||
|                                        Critical sections |                                        Critical sections | ||||||
| *************************************************************************************************/ | *************************************************************************************************/ | ||||||
| @@ -1087,20 +1087,20 @@ extern int Yap_PrologShouldHandleInterrupts; | |||||||
| 	    LOCK(GLOBAL_locks_heap_access);                              \ | 	    LOCK(GLOBAL_locks_heap_access);                              \ | ||||||
| 	    GLOBAL_locks_who_locked_heap = worker_id;                    \ | 	    GLOBAL_locks_who_locked_heap = worker_id;                    \ | ||||||
| 	  }                                                              \ | 	  }                                                              \ | ||||||
|           Yap_PrologMode |= CritMode;                                   \ |           LOCAL_PrologMode |= CritMode;                                   \ | ||||||
|           Yap_CritLocks++;                                              \ |           LOCAL_CritLocks++;                                              \ | ||||||
|         } |         } | ||||||
| #define YAPLeaveCriticalSection()                                        \ | #define YAPLeaveCriticalSection()                                        \ | ||||||
| 	{                                                                \ | 	{                                                                \ | ||||||
|           Yap_CritLocks--;                                              \ |           LOCAL_CritLocks--;                                              \ | ||||||
|           if (!Yap_CritLocks) {                                         \ |           if (!LOCAL_CritLocks) {                                         \ | ||||||
|             Yap_PrologMode &= ~CritMode;                                \ |             LOCAL_PrologMode &= ~CritMode;                                \ | ||||||
|             if (Yap_PrologMode & InterruptMode) {                       \ |             if (LOCAL_PrologMode & InterruptMode) {                       \ | ||||||
| 	      Yap_PrologMode &= ~InterruptMode;                         \ | 	      LOCAL_PrologMode &= ~InterruptMode;                         \ | ||||||
| 	      Yap_ProcessSIGINT();                                      \ | 	      Yap_ProcessSIGINT();                                      \ | ||||||
|             }                                                            \ |             }                                                            \ | ||||||
|             if (Yap_PrologMode & AbortMode) {                           \ |             if (LOCAL_PrologMode & AbortMode) {                           \ | ||||||
| 	      Yap_PrologMode &= ~AbortMode;                             \ | 	      LOCAL_PrologMode &= ~AbortMode;                             \ | ||||||
| 	      Yap_Error(PURE_ABORT, 0, "");                             \ | 	      Yap_Error(PURE_ABORT, 0, "");                             \ | ||||||
|             }                                                            \ |             }                                                            \ | ||||||
| 	    GLOBAL_locks_who_locked_heap = MAX_WORKERS;                  \ | 	    GLOBAL_locks_who_locked_heap = MAX_WORKERS;                  \ | ||||||
| @@ -1111,17 +1111,17 @@ extern int Yap_PrologShouldHandleInterrupts; | |||||||
| #define YAPEnterCriticalSection()                                        \ | #define YAPEnterCriticalSection()                                        \ | ||||||
| 	{                                                                \ | 	{                                                                \ | ||||||
|           /* LOCK(BGL); */                                              \ |           /* LOCK(BGL); */                                              \ | ||||||
|           Yap_PrologMode |= CritMode;                                   \ |           LOCAL_PrologMode |= CritMode;                                   \ | ||||||
|         } |         } | ||||||
| #define YAPLeaveCriticalSection()                                        \ | #define YAPLeaveCriticalSection()                                        \ | ||||||
| 	{                                                                \ | 	{                                                                \ | ||||||
|           Yap_PrologMode &= ~CritMode;                                \ |           LOCAL_PrologMode &= ~CritMode;                                \ | ||||||
|           if (Yap_PrologMode & InterruptMode) {                       \ |           if (LOCAL_PrologMode & InterruptMode) {                       \ | ||||||
| 	    Yap_PrologMode &= ~InterruptMode;                         \ | 	    LOCAL_PrologMode &= ~InterruptMode;                         \ | ||||||
| 	    Yap_ProcessSIGINT();                                      \ | 	    Yap_ProcessSIGINT();                                      \ | ||||||
|           }                                                            \ |           }                                                            \ | ||||||
|           if (Yap_PrologMode & AbortMode) {                           \ |           if (LOCAL_PrologMode & AbortMode) {                           \ | ||||||
| 	    Yap_PrologMode &= ~AbortMode;                             \ | 	    LOCAL_PrologMode &= ~AbortMode;                             \ | ||||||
| 	    Yap_Error(PURE_ABORT, 0, "");                             \ | 	    Yap_Error(PURE_ABORT, 0, "");                             \ | ||||||
|           }                                                            \ |           }                                                            \ | ||||||
|           /* UNLOCK(BGL); */                                           \ |           /* UNLOCK(BGL); */                                           \ | ||||||
| @@ -1129,20 +1129,20 @@ extern int Yap_PrologShouldHandleInterrupts; | |||||||
| #else | #else | ||||||
| #define YAPEnterCriticalSection()                                        \ | #define YAPEnterCriticalSection()                                        \ | ||||||
| 	{                                                                \ | 	{                                                                \ | ||||||
|           Yap_PrologMode |= CritMode;                                   \ |           LOCAL_PrologMode |= CritMode;                                   \ | ||||||
|           Yap_CritLocks++;                                              \ |           LOCAL_CritLocks++;                                              \ | ||||||
|         } |         } | ||||||
| #define YAPLeaveCriticalSection()                                        \ | #define YAPLeaveCriticalSection()                                        \ | ||||||
| 	{                                                                \ | 	{                                                                \ | ||||||
|           Yap_CritLocks--;                                              \ |           LOCAL_CritLocks--;                                              \ | ||||||
|           if (!Yap_CritLocks) {                                         \ |           if (!LOCAL_CritLocks) {                                         \ | ||||||
|             Yap_PrologMode &= ~CritMode;                                \ |             LOCAL_PrologMode &= ~CritMode;                                \ | ||||||
|             if (Yap_PrologMode & InterruptMode) {                       \ |             if (LOCAL_PrologMode & InterruptMode) {                       \ | ||||||
| 	      Yap_PrologMode &= ~InterruptMode;                         \ | 	      LOCAL_PrologMode &= ~InterruptMode;                         \ | ||||||
| 	      Yap_ProcessSIGINT();                                      \ | 	      Yap_ProcessSIGINT();                                      \ | ||||||
|             }                                                            \ |             }                                                            \ | ||||||
|             if (Yap_PrologMode & AbortMode) {                           \ |             if (LOCAL_PrologMode & AbortMode) {                           \ | ||||||
| 	      Yap_PrologMode &= ~AbortMode;                             \ | 	      LOCAL_PrologMode &= ~AbortMode;                             \ | ||||||
| 	      Yap_Error(PURE_ABORT, 0, "");                             \ | 	      Yap_Error(PURE_ABORT, 0, "");                             \ | ||||||
|             }                                                            \ |             }                                                            \ | ||||||
|           }                                                              \ |           }                                                              \ | ||||||
| @@ -1153,7 +1153,10 @@ extern int Yap_PrologShouldHandleInterrupts; | |||||||
| #define AT_BOOT      0 | #define AT_BOOT      0 | ||||||
| #define AT_RESTORE   1 | #define AT_RESTORE   1 | ||||||
|  |  | ||||||
| /********* mutable variables ******************/ |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                        mutable variables | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| /* I assume that the size of this structure is a multiple of the size | /* I assume that the size of this structure is a multiple of the size | ||||||
|    of CELL!!! */ |    of CELL!!! */ | ||||||
| @@ -1164,7 +1167,9 @@ typedef struct TIMED_MAVAR | |||||||
| } timed_var; | } timed_var; | ||||||
|  |  | ||||||
|  |  | ||||||
| /********* execution mode ***********************/ | /************************************************************************************************* | ||||||
|  |                                        execution mode | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| typedef enum | typedef enum | ||||||
|   { |   { | ||||||
| @@ -1175,7 +1180,10 @@ typedef enum | |||||||
|     COMPILE_ALL          /* compile all predicates */ |     COMPILE_ALL          /* compile all predicates */ | ||||||
|   } yap_exec_mode; |   } yap_exec_mode; | ||||||
|  |  | ||||||
| /********* slots ***********************/ |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                            slots | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
|  |  | ||||||
| static inline void | static inline void | ||||||
| @@ -1257,7 +1265,9 @@ typedef struct scratch_block_struct { | |||||||
| /* scanner types */ | /* scanner types */ | ||||||
| #include "ScannerTypes.h" | #include "ScannerTypes.h" | ||||||
|  |  | ||||||
| /******************** OPTYAP includes ********************/ | /************************************************************************************************* | ||||||
|  |                                        OPTYAP includes | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
| #include "opt.structs.h" | #include "opt.structs.h" | ||||||
| @@ -1269,7 +1279,10 @@ typedef struct scratch_block_struct { | |||||||
| #include "or.sba_unify.h" | #include "or.sba_unify.h" | ||||||
| #endif /* YAPOR_SBA */ | #endif /* YAPOR_SBA */ | ||||||
|  |  | ||||||
| /******************** GLOBAL and LOCAL variables ********************/ |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                   GLOBAL and LOCAL variables | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) | ||||||
| extern struct global_data *Yap_global; | extern struct global_data *Yap_global; | ||||||
| @@ -1290,12 +1303,16 @@ extern struct worker_local Yap_local; | |||||||
| #define REMOTE(wid)        (&Yap_local) | #define REMOTE(wid)        (&Yap_local) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #define YP_FILE		FILE | ||||||
| #include "hglobals.h" | #include "hglobals.h" | ||||||
| #include "dglobals.h" | #include "dglobals.h" | ||||||
| #include "hlocals.h" | #include "hlocals.h" | ||||||
| #include "dlocals.h" | #include "dlocals.h" | ||||||
|  |  | ||||||
| /*************** unification routines ***********************************/ |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                                        unification routines | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| #ifdef YAPOR_SBA | #ifdef YAPOR_SBA | ||||||
| #include "or.sba_amiops.h" | #include "or.sba_amiops.h" | ||||||
| @@ -1303,7 +1320,11 @@ extern struct worker_local Yap_local; | |||||||
| #include "amiops.h" | #include "amiops.h" | ||||||
| #endif /* YAPOR_SBA */ | #endif /* YAPOR_SBA */ | ||||||
|  |  | ||||||
| /*************** High level macros to access arguments ******************/ |  | ||||||
|  |  | ||||||
|  | /************************************************************************************************* | ||||||
|  |                            High level macros to access arguments | ||||||
|  | *************************************************************************************************/ | ||||||
|  |  | ||||||
| inline EXTERN Term ArgOfTerm (int i, Term t); | inline EXTERN Term ArgOfTerm (int i, Term t); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -328,6 +328,7 @@ void	STD_PROTO(Yap_undo_signal,(yap_signals)); | |||||||
| int	STD_PROTO(Yap_IsOpMaxPrio,(Atom)); | int	STD_PROTO(Yap_IsOpMaxPrio,(Atom)); | ||||||
|  |  | ||||||
| /* sysbits.c */ | /* sysbits.c */ | ||||||
|  | void    STD_PROTO(Yap_InitPageSize, (void)); | ||||||
| void	STD_PROTO(Yap_set_fpu_exceptions,(int)); | void	STD_PROTO(Yap_set_fpu_exceptions,(int)); | ||||||
| UInt	STD_PROTO(Yap_cputime,(void)); | UInt	STD_PROTO(Yap_cputime,(void)); | ||||||
| Int	STD_PROTO(Yap_walltime,(void)); | Int	STD_PROTO(Yap_walltime,(void)); | ||||||
|   | |||||||
| @@ -1095,12 +1095,8 @@ extern void **Yap_ABSMI_OPCODES; | |||||||
| #define absmadr(i) ((OPCODE)(i)) | #define absmadr(i) ((OPCODE)(i)) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* used to find out how many instructions of each kind are executed */ |  | ||||||
| #ifdef ANALYST |  | ||||||
| extern YAP_ULONG_LONG Yap_opcount[_std_top + 1]; |  | ||||||
|  |  | ||||||
| extern YAP_ULONG_LONG Yap_2opcount[_std_top + 1][_std_top + 1]; |  | ||||||
| #endif /* ANALYST */ |  | ||||||
|  |  | ||||||
| #if DEPTH_LIMIT | #if DEPTH_LIMIT | ||||||
| /* | /* | ||||||
|   | |||||||
							
								
								
									
										57
									
								
								H/dglobals.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								H/dglobals.h
									
									
									
									
									
								
							| @@ -44,7 +44,7 @@ | |||||||
| #define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ | #define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ | ||||||
|  |  | ||||||
| #define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ | #define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ | ||||||
| #endif | #endif	 | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
|  |  | ||||||
| #define GLOBAL_BGL Yap_global->BGL_ | #define GLOBAL_BGL Yap_global->BGL_ | ||||||
| @@ -53,3 +53,58 @@ | |||||||
| #define GLOBAL_optyap_data Yap_global->optyap_data_ | #define GLOBAL_optyap_data Yap_global->optyap_data_ | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|  | #define GLOBAL_PrologShouldHandleInterrupts Yap_global->PrologShouldHandleInterrupts_ | ||||||
|  |  | ||||||
|  | #if defined(THREADS) | ||||||
|  | #define GLOBAL_master_thread Yap_global->master_thread_ | ||||||
|  | #endif /* THREADS */ | ||||||
|  |  | ||||||
|  | #define GLOBAL_stdout Yap_global->stdout_ | ||||||
|  | #define GLOBAL_stderr Yap_global->stderr_ | ||||||
|  |  | ||||||
|  | #define GLOBAL_argv Yap_global->argv_ | ||||||
|  | #define GLOBAL_argc Yap_global->argc_ | ||||||
|  |  | ||||||
|  | #ifdef COROUTINING | ||||||
|  |  | ||||||
|  | #define GLOBAL_attas Yap_global->attas_ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #define GLOBAL_agc_calls Yap_global->agc_calls_ | ||||||
|  | #define GLOBAL_agc_collected Yap_global->agc_collected_ | ||||||
|  |  | ||||||
|  | #define GLOBAL_tot_agc_time Yap_global->tot_agc_time_ | ||||||
|  |  | ||||||
|  | #define GLOBAL_tot_agc_recovered Yap_global->tot_agc_recovered_ | ||||||
|  |  | ||||||
|  | #if HAVE_MMAP | ||||||
|  | #define GLOBAL_mmap_arrays Yap_global->mmap_arrays_ | ||||||
|  | #endif | ||||||
|  | #ifdef DEBUG | ||||||
|  |  | ||||||
|  | #define GLOBAL_Option Yap_global->Option_ | ||||||
|  | #define GLOBAL_logfile Yap_global->logfile_ | ||||||
|  |  | ||||||
|  | #define GLOBAL_output_msg Yap_global->output_msg_ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #define GLOBAL_ProfCalls Yap_global->ProfCalls_ | ||||||
|  | #define GLOBAL_ProfGCs Yap_global->ProfGCs_ | ||||||
|  | #define GLOBAL_ProfHGrows Yap_global->ProfHGrows_ | ||||||
|  | #define GLOBAL_ProfSGrows Yap_global->ProfSGrows_ | ||||||
|  | #define GLOBAL_ProfMallocs Yap_global->ProfMallocs_ | ||||||
|  | #define GLOBAL_ProfOn Yap_global->ProfOn_ | ||||||
|  | #define GLOBAL_ProfOns Yap_global->ProfOns_ | ||||||
|  | #define GLOBAL_ProfilerRoot Yap_global->ProfilerRoot_ | ||||||
|  | #define GLOBAL_ProfilerNil Yap_global->ProfilerNil_ | ||||||
|  | #define GLOBAL_DIRNAME Yap_global->DIRNAME_ | ||||||
|  | #if defined(COFF)  || defined(A_OUT) | ||||||
|  |  | ||||||
|  | #define GLOBAL_Executable Yap_global->Executable_ | ||||||
|  | #endif | ||||||
|  | #if  __simplescalar__ | ||||||
|  | #define GLOBAL_pwd Yap_global->pwd_ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								H/dlocals.h
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								H/dlocals.h
									
									
									
									
									
								
							| @@ -267,3 +267,53 @@ | |||||||
| #define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ | #define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ | ||||||
| #define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ | #define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ | ||||||
|  |  | ||||||
|  | #define LOCAL_PrologMode LOCAL->PrologMode_ | ||||||
|  | #define REMOTE_PrologMode(wid) REMOTE(wid)->PrologMode_ | ||||||
|  | #define LOCAL_CritLocks LOCAL->CritLocks_ | ||||||
|  | #define REMOTE_CritLocks(wid) REMOTE(wid)->CritLocks_ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef ANALYST | ||||||
|  | #define LOCAL_opcount LOCAL->opcount_ | ||||||
|  | #define REMOTE_opcount(wid) REMOTE(wid)->opcount_ | ||||||
|  | #define LOCAL_2opcount LOCAL->2opcount_ | ||||||
|  | #define REMOTE_2opcount(wid) REMOTE(wid)->2opcount_ | ||||||
|  | #endif /* ANALYST */ | ||||||
|  |  | ||||||
|  | #define LOCAL_s_dbg LOCAL->s_dbg_ | ||||||
|  | #define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_ | ||||||
|  |  | ||||||
|  | #define LOCAL_matherror LOCAL->matherror_ | ||||||
|  | #define REMOTE_matherror(wid) REMOTE(wid)->matherror_ | ||||||
|  |  | ||||||
|  | #define LOCAL_heap_overflows LOCAL->heap_overflows_ | ||||||
|  | #define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_ | ||||||
|  | #define LOCAL_total_heap_overflow_time LOCAL->total_heap_overflow_time_ | ||||||
|  | #define REMOTE_total_heap_overflow_time(wid) REMOTE(wid)->total_heap_overflow_time_ | ||||||
|  | #define LOCAL_stack_overflows LOCAL->stack_overflows_ | ||||||
|  | #define REMOTE_stack_overflows(wid) REMOTE(wid)->stack_overflows_ | ||||||
|  | #define LOCAL_total_stack_overflow_time LOCAL->total_stack_overflow_time_ | ||||||
|  | #define REMOTE_total_stack_overflow_time(wid) REMOTE(wid)->total_stack_overflow_time_ | ||||||
|  | #define LOCAL_delay_overflows LOCAL->delay_overflows_ | ||||||
|  | #define REMOTE_delay_overflows(wid) REMOTE(wid)->delay_overflows_ | ||||||
|  | #define LOCAL_total_delay_overflow_time LOCAL->total_delay_overflow_time_ | ||||||
|  | #define REMOTE_total_delay_overflow_time(wid) REMOTE(wid)->total_delay_overflow_time_ | ||||||
|  | #define LOCAL_trail_overflows LOCAL->trail_overflows_ | ||||||
|  | #define REMOTE_trail_overflows(wid) REMOTE(wid)->trail_overflows_ | ||||||
|  | #define LOCAL_total_trail_overflow_time LOCAL->total_trail_overflow_time_ | ||||||
|  | #define REMOTE_total_trail_overflow_time(wid) REMOTE(wid)->total_trail_overflow_time_ | ||||||
|  | #define LOCAL_atom_table_overflows LOCAL->atom_table_overflows_ | ||||||
|  | #define REMOTE_atom_table_overflows(wid) REMOTE(wid)->atom_table_overflows_ | ||||||
|  | #define LOCAL_total_atom_table_overflow_time LOCAL->total_atom_table_overflow_time_ | ||||||
|  | #define REMOTE_total_atom_table_overflow_time(wid) REMOTE(wid)->total_atom_table_overflow_time_ | ||||||
|  |  | ||||||
|  | #ifdef LOAD_DYLD | ||||||
|  | #define LOCAL_dl_errno LOCAL->dl_errno_ | ||||||
|  | #define REMOTE_dl_errno(wid) REMOTE(wid)->dl_errno_ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef LOW_LEVEL_TRACER | ||||||
|  | #define LOCAL_do_trace_primitives LOCAL->do_trace_primitives_ | ||||||
|  | #define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								H/eval.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								H/eval.h
									
									
									
									
									
								
							| @@ -161,8 +161,6 @@ Functor     STD_PROTO(EvalArg,(Term)); | |||||||
| #define FL(X)		((double)(X)) | #define FL(X)		((double)(X)) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| extern yap_error_number Yap_matherror; |  | ||||||
|  |  | ||||||
| void	STD_PROTO(Yap_InitConstExps,(void)); | void	STD_PROTO(Yap_InitConstExps,(void)); | ||||||
| void	STD_PROTO(Yap_InitUnaryExps,(void)); | void	STD_PROTO(Yap_InitUnaryExps,(void)); | ||||||
| void	STD_PROTO(Yap_InitBinaryExps,(void)); | void	STD_PROTO(Yap_InitBinaryExps,(void)); | ||||||
|   | |||||||
							
								
								
									
										57
									
								
								H/hglobals.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								H/hglobals.h
									
									
									
									
									
								
							| @@ -44,7 +44,7 @@ typedef struct global_data { | |||||||
|   UInt  ThreadsTotalTime_; |   UInt  ThreadsTotalTime_; | ||||||
|  |  | ||||||
|   lockvar  ThreadHandlesLock_; |   lockvar  ThreadHandlesLock_; | ||||||
| #endif | #endif	 | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
|  |  | ||||||
|   lockvar  BGL_; |   lockvar  BGL_; | ||||||
| @@ -52,4 +52,59 @@ typedef struct global_data { | |||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
|   struct global_optyap_data  optyap_data_; |   struct global_optyap_data  optyap_data_; | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|  |   int  PrologShouldHandleInterrupts_; | ||||||
|  |  | ||||||
|  | #if defined(THREADS) | ||||||
|  |   pthread_t  master_thread_; | ||||||
|  | #endif /* THREADS */ | ||||||
|  |  | ||||||
|  |   YP_FILE*  stdout_; | ||||||
|  |   YP_FILE*  stderr_; | ||||||
|  |  | ||||||
|  |   char**  argv_; | ||||||
|  |   int  argc_; | ||||||
|  |  | ||||||
|  | #ifdef COROUTINING | ||||||
|  |  | ||||||
|  |   ext_op  attas_[attvars_ext+1]; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |   int  agc_calls_; | ||||||
|  |   YAP_ULONG_LONG  agc_collected_; | ||||||
|  |  | ||||||
|  |   Int  tot_agc_time_; | ||||||
|  |  | ||||||
|  |   Int  tot_agc_recovered_; | ||||||
|  |  | ||||||
|  | #if HAVE_MMAP | ||||||
|  |   struct MMAP_ARRAY_BLOCK*  mmap_arrays_; | ||||||
|  | #endif | ||||||
|  | #ifdef DEBUG | ||||||
|  |  | ||||||
|  |   char  Option_[20]; | ||||||
|  |   YP_FILE*  logfile_; | ||||||
|  |  | ||||||
|  |   int  output_msg_; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |   Int  ProfCalls_; | ||||||
|  |   Int  ProfGCs_; | ||||||
|  |   Int  ProfHGrows_; | ||||||
|  |   Int  ProfSGrows_; | ||||||
|  |   Int  ProfMallocs_; | ||||||
|  |   Int  ProfOn_; | ||||||
|  |   Int  ProfOns_; | ||||||
|  |   struct RB_red_blk_node*  ProfilerRoot_; | ||||||
|  |   struct RB_red_blk_node*  ProfilerNil_; | ||||||
|  |   char*  DIRNAME_; | ||||||
|  | #if defined(COFF)  || defined(A_OUT) | ||||||
|  |  | ||||||
|  |   char  Executable_[YAP_FILENAME_MAX]; | ||||||
|  | #endif | ||||||
|  | #if  __simplescalar__ | ||||||
|  |   char  pwd_[YAP_FILENAME_MAX]; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| } w_shared; | } w_shared; | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								H/hlocals.h
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								H/hlocals.h
									
									
									
									
									
								
							| @@ -150,4 +150,36 @@ typedef struct worker_local { | |||||||
|   sigjmp_buf  RestartEnv_; |   sigjmp_buf  RestartEnv_; | ||||||
|   char  FileNameBuf_[YAP_FILENAME_MAX]; |   char  FileNameBuf_[YAP_FILENAME_MAX]; | ||||||
|   char  FileNameBuf2_[YAP_FILENAME_MAX]; |   char  FileNameBuf2_[YAP_FILENAME_MAX]; | ||||||
|  |  | ||||||
|  |   Int  PrologMode_; | ||||||
|  |   int  CritLocks_; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef ANALYST | ||||||
|  |   YAP_ULONG_LONG  opcount_[_std_top+1]; | ||||||
|  |   YAP_ULONG_LONG  2opcount[_std_top+1][_std_top+1]_; | ||||||
|  | #endif /* ANALYST */ | ||||||
|  |  | ||||||
|  |   struct db_globs*  s_dbg_; | ||||||
|  |  | ||||||
|  |   yap_error_number  matherror_; | ||||||
|  |  | ||||||
|  |   int  heap_overflows_; | ||||||
|  |   Int  total_heap_overflow_time_; | ||||||
|  |   int  stack_overflows_; | ||||||
|  |   Int  total_stack_overflow_time_; | ||||||
|  |   int  delay_overflows_; | ||||||
|  |   Int  total_delay_overflow_time_; | ||||||
|  |   int  trail_overflows_; | ||||||
|  |   Int  total_trail_overflow_time_; | ||||||
|  |   int  atom_table_overflows_; | ||||||
|  |   Int  total_atom_table_overflow_time_; | ||||||
|  |  | ||||||
|  | #ifdef LOAD_DYLD | ||||||
|  |   static  dl_errno_; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef LOW_LEVEL_TRACER | ||||||
|  |   int  do_trace_primitives_; | ||||||
|  | #endif | ||||||
| } w_local; | } w_local; | ||||||
|   | |||||||
							
								
								
									
										57
									
								
								H/iglobals.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								H/iglobals.h
									
									
									
									
									
								
							| @@ -44,7 +44,7 @@ static void InitGlobal(void) { | |||||||
|   GLOBAL_ThreadsTotalTime = 0L; |   GLOBAL_ThreadsTotalTime = 0L; | ||||||
|  |  | ||||||
|   INIT_LOCK(GLOBAL_ThreadHandlesLock); |   INIT_LOCK(GLOBAL_ThreadHandlesLock); | ||||||
| #endif | #endif	 | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
|  |  | ||||||
|   INIT_LOCK(GLOBAL_BGL); |   INIT_LOCK(GLOBAL_BGL); | ||||||
| @@ -52,4 +52,59 @@ static void InitGlobal(void) { | |||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
|  |  | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if defined(THREADS) | ||||||
|  |  | ||||||
|  | #endif /* THREADS */ | ||||||
|  |  | ||||||
|  |   GLOBAL_stdout = stdout; | ||||||
|  |   GLOBAL_stderr = stderr; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef COROUTINING | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   GLOBAL_tot_agc_time = 0; | ||||||
|  |  | ||||||
|  |   GLOBAL_tot_agc_recovered = 0; | ||||||
|  |  | ||||||
|  | #if HAVE_MMAP | ||||||
|  |   GLOBAL_mmap_arrays = NULL; | ||||||
|  | #endif | ||||||
|  | #ifdef DEBUG | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   GLOBAL_output_msg = FALSE; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   GLOBAL_DIRNAME = NULL; | ||||||
|  | #if defined(COFF)  || defined(A_OUT) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  | #if  __simplescalar__ | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								H/ilocals.h
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								H/ilocals.h
									
									
									
									
									
								
							| @@ -150,4 +150,36 @@ static void InitWorker(int wid) { | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   REMOTE_PrologMode(wid) = BootMode; | ||||||
|  |   REMOTE_CritLocks(wid) = 0; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef ANALYST | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* ANALYST */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   REMOTE_matherror(wid) = YAP_NO_ERROR; | ||||||
|  |  | ||||||
|  |   REMOTE_heap_overflows(wid) = 0; | ||||||
|  |   REMOTE_total_heap_overflow_time(wid) = 0; | ||||||
|  |   REMOTE_stack_overflows(wid) = 0; | ||||||
|  |   REMOTE_total_stack_overflow_time(wid) = 0; | ||||||
|  |   REMOTE_delay_overflows(wid) = 0; | ||||||
|  |   REMOTE_total_delay_overflow_time(wid) = 0; | ||||||
|  |   REMOTE_trail_overflows(wid) = 0; | ||||||
|  |   REMOTE_total_trail_overflow_time(wid) = 0; | ||||||
|  |   REMOTE_atom_table_overflows(wid) = 0; | ||||||
|  |   REMOTE_total_atom_table_overflow_time(wid) = 0; | ||||||
|  |  | ||||||
|  | #ifdef LOAD_DYLD | ||||||
|  |   REMOTE_dl_errno(wid) = 0; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef LOW_LEVEL_TRACER | ||||||
|  |   REMOTE_do_trace_primitives(wid) = TRUE; | ||||||
|  | #endif | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										57
									
								
								H/rglobals.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								H/rglobals.h
									
									
									
									
									
								
							| @@ -44,7 +44,7 @@ static void RestoreGlobal(void) { | |||||||
|  |  | ||||||
|  |  | ||||||
|   REINIT_LOCK(GLOBAL_ThreadHandlesLock); |   REINIT_LOCK(GLOBAL_ThreadHandlesLock); | ||||||
| #endif | #endif	 | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
|  |  | ||||||
|   REINIT_LOCK(GLOBAL_BGL); |   REINIT_LOCK(GLOBAL_BGL); | ||||||
| @@ -52,4 +52,59 @@ static void RestoreGlobal(void) { | |||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
|  |  | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if defined(THREADS) | ||||||
|  |  | ||||||
|  | #endif /* THREADS */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef COROUTINING | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if HAVE_MMAP | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  | #ifdef DEBUG | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if defined(COFF)  || defined(A_OUT) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  | #if  __simplescalar__ | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								H/rlocals.h
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								H/rlocals.h
									
									
									
									
									
								
							| @@ -150,4 +150,36 @@ static void RestoreWorker(int wid USES_REGS) { | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef ANALYST | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* ANALYST */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef LOAD_DYLD | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef LOW_LEVEL_TRACER | ||||||
|  |  | ||||||
|  | #endif | ||||||
| } | } | ||||||
|   | |||||||
| @@ -65,8 +65,6 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #define YP_FILE		FILE | #define YP_FILE		FILE | ||||||
| extern YP_FILE *Yap_stdout; |  | ||||||
| extern YP_FILE *Yap_stderr; |  | ||||||
|  |  | ||||||
| int     STD_PROTO(YP_putc,(int, int)); | int     STD_PROTO(YP_putc,(int, int)); | ||||||
|  |  | ||||||
| @@ -387,11 +385,4 @@ WideHashFunction(wchar_t *CHP) | |||||||
| #define CONTINUE_ON_PARSER_ERROR  2 | #define CONTINUE_ON_PARSER_ERROR  2 | ||||||
| #define EXCEPTION_ON_PARSER_ERROR 3 | #define EXCEPTION_ON_PARSER_ERROR 3 | ||||||
|  |  | ||||||
| #ifdef DEBUG |  | ||||||
| extern YP_FILE *Yap_logfile; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if USE_SOCKET |  | ||||||
| extern int Yap_sockets_io; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -73,7 +73,6 @@ void Yap_init_yapor_global_local_memory(void) { | |||||||
|   Yap_local = (struct worker_local *)(MMAP_ADDR - ExtraArea); |   Yap_local = (struct worker_local *)(MMAP_ADDR - ExtraArea); | ||||||
|   Yap_global = (struct global_data *)(MMAP_ADDR - sizeof(struct global_data)); |   Yap_global = (struct global_data *)(MMAP_ADDR - sizeof(struct global_data)); | ||||||
|   |   | ||||||
|  |  | ||||||
| #ifdef MMAP_MEMORY_MAPPING_SCHEME | #ifdef MMAP_MEMORY_MAPPING_SCHEME | ||||||
|   //open_mapfile(ExtraArea); |   //open_mapfile(ExtraArea); | ||||||
|    char mapfile[20]; |    char mapfile[20]; | ||||||
|   | |||||||
| @@ -388,12 +388,12 @@ static Int p_show_tabled_predicates( USES_REGS1 ) { | |||||||
|   tab_ent_ptr tab_ent; |   tab_ent_ptr tab_ent; | ||||||
|  |  | ||||||
|   tab_ent = GLOBAL_root_tab_ent; |   tab_ent = GLOBAL_root_tab_ent; | ||||||
|   fprintf(Yap_stdout, "Tabled predicates\n"); |   fprintf(GLOBAL_stdout, "Tabled predicates\n"); | ||||||
|   if (tab_ent == NULL) |   if (tab_ent == NULL) | ||||||
|     fprintf(Yap_stdout, "  NONE\n"); |     fprintf(GLOBAL_stdout, "  NONE\n"); | ||||||
|   else |   else | ||||||
|     while(tab_ent) { |     while(tab_ent) { | ||||||
|       fprintf(Yap_stdout, "  %s/%d\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); |       fprintf(GLOBAL_stdout, "  %s/%d\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); | ||||||
|       tab_ent = TabEnt_next(tab_ent); |       tab_ent = TabEnt_next(tab_ent); | ||||||
|     } |     } | ||||||
|   return (TRUE); |   return (TRUE); | ||||||
| @@ -456,35 +456,35 @@ static Int p_show_statistics_tabling( USES_REGS1 ) { | |||||||
|   long total_bytes = 0, aux_bytes; |   long total_bytes = 0, aux_bytes; | ||||||
|  |  | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Execution data structures\n"); |   fprintf(GLOBAL_stdout, "Execution data structures\n"); | ||||||
|   aux_bytes += show_statistics_table_entries(); |   aux_bytes += show_statistics_table_entries(); | ||||||
|   aux_bytes += show_statistics_subgoal_frames(); |   aux_bytes += show_statistics_subgoal_frames(); | ||||||
|   aux_bytes += show_statistics_dependency_frames(); |   aux_bytes += show_statistics_dependency_frames(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Local trie data structures\n"); |   fprintf(GLOBAL_stdout, "Local trie data structures\n"); | ||||||
|   aux_bytes += show_statistics_subgoal_trie_nodes(); |   aux_bytes += show_statistics_subgoal_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_answer_trie_nodes(); |   aux_bytes += show_statistics_answer_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_subgoal_trie_hashes(); |   aux_bytes += show_statistics_subgoal_trie_hashes(); | ||||||
|   aux_bytes += show_statistics_answer_trie_hashes(); |   aux_bytes += show_statistics_answer_trie_hashes(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Global trie data structures\n"); |   fprintf(GLOBAL_stdout, "Global trie data structures\n"); | ||||||
|   aux_bytes += show_statistics_global_trie_nodes(); |   aux_bytes += show_statistics_global_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_global_trie_hashes(); |   aux_bytes += show_statistics_global_trie_hashes(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (III):             %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (III):             %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
| #ifdef USE_PAGES_MALLOC | #ifdef USE_PAGES_MALLOC | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III):    %10ld bytes (%ld pages in use)\n", |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III):    %10ld bytes (%ld pages in use)\n", | ||||||
|           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); |           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); | ||||||
|   fprintf(Yap_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", |   fprintf(GLOBAL_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", | ||||||
|           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); |           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); | ||||||
| #else  | #else  | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III):    %10ld bytes\n", total_bytes); |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III):    %10ld bytes\n", total_bytes); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   fflush(Yap_stdout); |   fflush(GLOBAL_stdout); | ||||||
|  |  | ||||||
|   return (TRUE); |   return (TRUE); | ||||||
| } | } | ||||||
| @@ -523,8 +523,6 @@ static Int p_yapor_on( USES_REGS1 ) { | |||||||
|  |  | ||||||
|  |  | ||||||
| static Int p_start_yapor( USES_REGS1 ) { | static Int p_start_yapor( USES_REGS1 ) { | ||||||
|  |  | ||||||
| printf("------------ start yap or --------------------------\n"); |  | ||||||
| #ifdef TIMESTAMP_CHECK | #ifdef TIMESTAMP_CHECK | ||||||
|   GLOBAL_timestamp = 0; |   GLOBAL_timestamp = 0; | ||||||
| #endif /* TIMESTAMP_CHECK */ | #endif /* TIMESTAMP_CHECK */ | ||||||
| @@ -642,32 +640,32 @@ static Int p_performance( USES_REGS1 ) { | |||||||
|     return(FALSE); |     return(FALSE); | ||||||
|  |  | ||||||
|   if (GLOBAL_number_goals) { |   if (GLOBAL_number_goals) { | ||||||
|     fprintf(Yap_stdout, "[\n  Best execution times:\n"); |     fprintf(GLOBAL_stdout, "[\n  Best execution times:\n"); | ||||||
|     for (i = 1; i <= GLOBAL_number_goals; i++) { |     for (i = 1; i <= GLOBAL_number_goals; i++) { | ||||||
|       fprintf(Yap_stdout, "    %d. time: %f seconds", i, GLOBAL_best_times(i));   |       fprintf(GLOBAL_stdout, "    %d. time: %f seconds", i, GLOBAL_best_times(i));   | ||||||
|       if (one_worker_execution_time != 0) |       if (one_worker_execution_time != 0) | ||||||
|         fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )\n", |         fprintf(GLOBAL_stdout, " --> speedup %f (%6.2f %% )\n", | ||||||
|                 one_worker_execution_time / GLOBAL_best_times(i), |                 one_worker_execution_time / GLOBAL_best_times(i), | ||||||
|                 one_worker_execution_time / GLOBAL_best_times(i) / GLOBAL_number_workers* 100 ); |                 one_worker_execution_time / GLOBAL_best_times(i) / GLOBAL_number_workers* 100 ); | ||||||
|       else fprintf(Yap_stdout, "\n"); |       else fprintf(GLOBAL_stdout, "\n"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fprintf(Yap_stdout, "  Average             : %f seconds", |     fprintf(GLOBAL_stdout, "  Average             : %f seconds", | ||||||
|             GLOBAL_best_times(0) / GLOBAL_number_goals); |             GLOBAL_best_times(0) / GLOBAL_number_goals); | ||||||
|     if (one_worker_execution_time != 0) |     if (one_worker_execution_time != 0) | ||||||
|       fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )", |       fprintf(GLOBAL_stdout, " --> speedup %f (%6.2f %% )", | ||||||
|               one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0), |               one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0), | ||||||
|               one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0) / GLOBAL_number_workers* 100 ); |               one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0) / GLOBAL_number_workers* 100 ); | ||||||
|  |  | ||||||
|     if (GLOBAL_number_goals >= 3) { |     if (GLOBAL_number_goals >= 3) { | ||||||
|       fprintf(Yap_stdout, "\n  Average (best three): %f seconds", |       fprintf(GLOBAL_stdout, "\n  Average (best three): %f seconds", | ||||||
|               (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / 3); |               (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / 3); | ||||||
|       if (one_worker_execution_time != 0) |       if (one_worker_execution_time != 0) | ||||||
|         fprintf(Yap_stdout, " --> speedup %f (%6.2f %% ) ]\n\n", |         fprintf(GLOBAL_stdout, " --> speedup %f (%6.2f %% ) ]\n\n", | ||||||
|                 one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)), |                 one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)), | ||||||
|                 one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / GLOBAL_number_workers* 100 ); |                 one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / GLOBAL_number_workers* 100 ); | ||||||
|       else fprintf(Yap_stdout, "\n]\n\n"); |       else fprintf(GLOBAL_stdout, "\n]\n\n"); | ||||||
|     } else fprintf(Yap_stdout, "\n]\n\n"); |     } else fprintf(GLOBAL_stdout, "\n]\n\n"); | ||||||
|     return (TRUE); |     return (TRUE); | ||||||
|   } |   } | ||||||
|   return (FALSE); |   return (FALSE); | ||||||
| @@ -705,23 +703,23 @@ static Int p_show_statistics_or( USES_REGS1 ) { | |||||||
|   long total_bytes = 0, aux_bytes; |   long total_bytes = 0, aux_bytes; | ||||||
|  |  | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Execution data structures\n"); |   fprintf(GLOBAL_stdout, "Execution data structures\n"); | ||||||
|   aux_bytes += show_statistics_or_frames(); |   aux_bytes += show_statistics_or_frames(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Cut support data structures\n"); |   fprintf(GLOBAL_stdout, "Cut support data structures\n"); | ||||||
|   aux_bytes += show_statistics_query_goal_solution_frames(); |   aux_bytes += show_statistics_query_goal_solution_frames(); | ||||||
|   aux_bytes += show_statistics_query_goal_answer_frames(); |   aux_bytes += show_statistics_query_goal_answer_frames(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
| #ifdef USE_PAGES_MALLOC | #ifdef USE_PAGES_MALLOC | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III):    %10ld bytes (%ld pages in use)\n", |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III):    %10ld bytes (%ld pages in use)\n", | ||||||
|           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); |           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); | ||||||
|   fprintf(Yap_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", |   fprintf(GLOBAL_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", | ||||||
|           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); |           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); | ||||||
| #else  | #else  | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III):    %10ld bytes\n", total_bytes); |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III):    %10ld bytes\n", total_bytes); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|  |  | ||||||
|   return (TRUE); |   return (TRUE); | ||||||
| @@ -739,45 +737,45 @@ static Int p_show_statistics_opt( USES_REGS1 ) { | |||||||
|   long total_bytes = 0, aux_bytes; |   long total_bytes = 0, aux_bytes; | ||||||
|  |  | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Execution data structures\n"); |   fprintf(GLOBAL_stdout, "Execution data structures\n"); | ||||||
|   aux_bytes += show_statistics_table_entries(); |   aux_bytes += show_statistics_table_entries(); | ||||||
|   aux_bytes += show_statistics_subgoal_frames(); |   aux_bytes += show_statistics_subgoal_frames(); | ||||||
|   aux_bytes += show_statistics_dependency_frames(); |   aux_bytes += show_statistics_dependency_frames(); | ||||||
|   aux_bytes += show_statistics_or_frames(); |   aux_bytes += show_statistics_or_frames(); | ||||||
|   aux_bytes += show_statistics_suspension_frames(); |   aux_bytes += show_statistics_suspension_frames(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (I):               %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Local trie data structures\n"); |   fprintf(GLOBAL_stdout, "Local trie data structures\n"); | ||||||
|   aux_bytes += show_statistics_subgoal_trie_nodes(); |   aux_bytes += show_statistics_subgoal_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_answer_trie_nodes(); |   aux_bytes += show_statistics_answer_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_subgoal_trie_hashes(); |   aux_bytes += show_statistics_subgoal_trie_hashes(); | ||||||
|   aux_bytes += show_statistics_answer_trie_hashes(); |   aux_bytes += show_statistics_answer_trie_hashes(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (II):              %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Global trie data structures\n"); |   fprintf(GLOBAL_stdout, "Global trie data structures\n"); | ||||||
|   aux_bytes += show_statistics_global_trie_nodes(); |   aux_bytes += show_statistics_global_trie_nodes(); | ||||||
|   aux_bytes += show_statistics_global_trie_hashes(); |   aux_bytes += show_statistics_global_trie_hashes(); | ||||||
|   fprintf(Yap_stdout, "  Memory in use (III):             %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (III):             %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
|   aux_bytes = 0; |   aux_bytes = 0; | ||||||
|   fprintf(Yap_stdout, "Cut support data structures\n"); |   fprintf(GLOBAL_stdout, "Cut support data structures\n"); | ||||||
|   aux_bytes += show_statistics_query_goal_solution_frames(); |   aux_bytes += show_statistics_query_goal_solution_frames(); | ||||||
|   aux_bytes += show_statistics_query_goal_answer_frames(); |   aux_bytes += show_statistics_query_goal_answer_frames(); | ||||||
| #ifdef TABLING_INNER_CUTS | #ifdef TABLING_INNER_CUTS | ||||||
|   aux_bytes += show_statistics_table_subgoal_solution_frames(); |   aux_bytes += show_statistics_table_subgoal_solution_frames(); | ||||||
|   aux_bytes += show_statistics_table_subgoal_answer_frames(); |   aux_bytes += show_statistics_table_subgoal_answer_frames(); | ||||||
| #endif /* TABLING_INNER_CUTS */ | #endif /* TABLING_INNER_CUTS */ | ||||||
|   fprintf(Yap_stdout, "  Memory in use (IV):              %10ld bytes\n\n", aux_bytes); |   fprintf(GLOBAL_stdout, "  Memory in use (IV):              %10ld bytes\n\n", aux_bytes); | ||||||
|   total_bytes += aux_bytes; |   total_bytes += aux_bytes; | ||||||
| #ifdef USE_PAGES_MALLOC | #ifdef USE_PAGES_MALLOC | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n", |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n", | ||||||
|           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); |           total_bytes, Pg_str_in_use(GLOBAL_pages_void)); | ||||||
|   fprintf(Yap_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", |   fprintf(GLOBAL_stdout, "Total memory allocated:            %10ld bytes (%ld pages in total)\n", | ||||||
|           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); |           Pg_pg_alloc(GLOBAL_pages_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_pages_void)); | ||||||
| #else  | #else  | ||||||
|   fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes); |   fprintf(GLOBAL_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|  |  | ||||||
|   return (TRUE); |   return (TRUE); | ||||||
| @@ -947,19 +945,19 @@ static inline void show_answers(void) { | |||||||
|   } |   } | ||||||
|   switch(GLOBAL_answers) { |   switch(GLOBAL_answers) { | ||||||
|     case YES_ANSWER: |     case YES_ANSWER: | ||||||
|       fprintf(Yap_stderr, "[ yes"); |       fprintf(GLOBAL_stderr, "[ yes"); | ||||||
|       break; |       break; | ||||||
|     case NO_ANSWER:   |     case NO_ANSWER:   | ||||||
|       fprintf(Yap_stderr, "[ no"); |       fprintf(GLOBAL_stderr, "[ no"); | ||||||
|       break; |       break; | ||||||
|     case 1: |     case 1: | ||||||
|       fprintf(Yap_stderr, "[ 1 answer found"); |       fprintf(GLOBAL_stderr, "[ 1 answer found"); | ||||||
|       break; |       break; | ||||||
|     default: |     default: | ||||||
|          fprintf(Yap_stderr, "[ %d answers found", GLOBAL_answers); |          fprintf(GLOBAL_stderr, "[ %d answers found", GLOBAL_answers); | ||||||
|       break; |       break; | ||||||
|   } |   } | ||||||
|   fprintf(Yap_stderr, " (in %f seconds) ]\n\n", GLOBAL_execution_time); |   fprintf(GLOBAL_stderr, " (in %f seconds) ]\n\n", GLOBAL_execution_time); | ||||||
|  |  | ||||||
|   if (GLOBAL_performance_mode == PERFORMANCE_ON) { |   if (GLOBAL_performance_mode == PERFORMANCE_ON) { | ||||||
|     for (i = GLOBAL_number_goals; i > 0; i--) { |     for (i = GLOBAL_number_goals; i > 0; i--) { | ||||||
| @@ -1019,7 +1017,7 @@ static inline void answer_to_stdout(char *answer) { | |||||||
|     else break; |     else break; | ||||||
|   } |   } | ||||||
|   output[length_output] = 0; |   output[length_output] = 0; | ||||||
|   fprintf(Yap_stderr, "  %s\n", output); |   fprintf(GLOBAL_stderr, "  %s\n", output); | ||||||
|   return; |   return; | ||||||
| } | } | ||||||
| #endif /* YAPOR */ | #endif /* YAPOR */ | ||||||
| @@ -1044,10 +1042,10 @@ static inline long show_statistics_table_entries(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_table_entries, Pg_str_free(GLOBAL_pages_tab_ent) != cont); |   TABLING_ERROR_CHECKING(statistics_table_entries, Pg_str_free(GLOBAL_pages_tab_ent) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Table entries:                   %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Table entries:                   %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry), Pg_pg_alloc(GLOBAL_pages_tab_ent), Pg_str_in_use(GLOBAL_pages_tab_ent)); |           Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry), Pg_pg_alloc(GLOBAL_pages_tab_ent), Pg_str_in_use(GLOBAL_pages_tab_ent)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Table entries:                   %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Table entries:                   %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(GLOBAL_pages_tab_ent)); |           Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(GLOBAL_pages_tab_ent)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry); |   return Pg_str_in_use(GLOBAL_pages_tab_ent) * sizeof(struct table_entry); | ||||||
| @@ -1072,10 +1070,10 @@ static inline long show_statistics_subgoal_frames(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_subgoal_frames, Pg_str_free(GLOBAL_pages_sg_fr) != cont); |   TABLING_ERROR_CHECKING(statistics_subgoal_frames, Pg_str_free(GLOBAL_pages_sg_fr) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Subgoal frames:                  %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal frames:                  %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_pg_alloc(GLOBAL_pages_sg_fr), Pg_str_in_use(GLOBAL_pages_sg_fr)); |           Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_pg_alloc(GLOBAL_pages_sg_fr), Pg_str_in_use(GLOBAL_pages_sg_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Subgoal frames:                  %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal frames:                  %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(GLOBAL_pages_sg_fr)); |           Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(GLOBAL_pages_sg_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame); |   return Pg_str_in_use(GLOBAL_pages_sg_fr) * sizeof(struct subgoal_frame); | ||||||
| @@ -1100,10 +1098,10 @@ static inline long show_statistics_dependency_frames(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_dependency_frames, Pg_str_free(GLOBAL_pages_dep_fr) != cont); |   TABLING_ERROR_CHECKING(statistics_dependency_frames, Pg_str_free(GLOBAL_pages_dep_fr) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Dependency frames:               %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Dependency frames:               %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame), Pg_pg_alloc(GLOBAL_pages_dep_fr), Pg_str_in_use(GLOBAL_pages_dep_fr)); |           Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame), Pg_pg_alloc(GLOBAL_pages_dep_fr), Pg_str_in_use(GLOBAL_pages_dep_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Dependency frames:               %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Dependency frames:               %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(GLOBAL_pages_dep_fr)); |           Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(GLOBAL_pages_dep_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame); |   return Pg_str_in_use(GLOBAL_pages_dep_fr) * sizeof(struct dependency_frame); | ||||||
| @@ -1128,10 +1126,10 @@ static inline long show_statistics_subgoal_trie_nodes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_subgoal_trie_nodes, Pg_str_free(GLOBAL_pages_sg_node) != cont); |   TABLING_ERROR_CHECKING(statistics_subgoal_trie_nodes, Pg_str_free(GLOBAL_pages_sg_node) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Subgoal trie nodes:              %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal trie nodes:              %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_pg_alloc(GLOBAL_pages_sg_node), Pg_str_in_use(GLOBAL_pages_sg_node)); |           Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_pg_alloc(GLOBAL_pages_sg_node), Pg_str_in_use(GLOBAL_pages_sg_node)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Subgoal trie nodes:              %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal trie nodes:              %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(GLOBAL_pages_sg_node)); |           Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(GLOBAL_pages_sg_node)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node); |   return Pg_str_in_use(GLOBAL_pages_sg_node) * sizeof(struct subgoal_trie_node); | ||||||
| @@ -1156,10 +1154,10 @@ static inline long show_statistics_answer_trie_nodes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_answer_trie_nodes, Pg_str_free(GLOBAL_pages_ans_node) != cont); |   TABLING_ERROR_CHECKING(statistics_answer_trie_nodes, Pg_str_free(GLOBAL_pages_ans_node) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Answer trie nodes:               %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Answer trie nodes:               %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node), Pg_pg_alloc(GLOBAL_pages_ans_node), Pg_str_in_use(GLOBAL_pages_ans_node)); |           Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node), Pg_pg_alloc(GLOBAL_pages_ans_node), Pg_str_in_use(GLOBAL_pages_ans_node)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Answer trie nodes:               %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Answer trie nodes:               %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(GLOBAL_pages_ans_node)); |           Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(GLOBAL_pages_ans_node)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node); |   return Pg_str_in_use(GLOBAL_pages_ans_node) * sizeof(struct answer_trie_node); | ||||||
| @@ -1184,10 +1182,10 @@ static inline long show_statistics_subgoal_trie_hashes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_subgoal_trie_hashes, Pg_str_free(GLOBAL_pages_sg_hash) != cont); |   TABLING_ERROR_CHECKING(statistics_subgoal_trie_hashes, Pg_str_free(GLOBAL_pages_sg_hash) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Subgoal trie hashes:             %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal trie hashes:             %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_pg_alloc(GLOBAL_pages_sg_hash), Pg_str_in_use(GLOBAL_pages_sg_hash)); |           Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_pg_alloc(GLOBAL_pages_sg_hash), Pg_str_in_use(GLOBAL_pages_sg_hash)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Subgoal trie hashes:             %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Subgoal trie hashes:             %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(GLOBAL_pages_sg_hash)); |           Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(GLOBAL_pages_sg_hash)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash); |   return Pg_str_in_use(GLOBAL_pages_sg_hash) * sizeof(struct subgoal_trie_hash); | ||||||
| @@ -1212,10 +1210,10 @@ static inline long show_statistics_answer_trie_hashes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_answer_trie_hashes, Pg_str_free(GLOBAL_pages_ans_hash) != cont); |   TABLING_ERROR_CHECKING(statistics_answer_trie_hashes, Pg_str_free(GLOBAL_pages_ans_hash) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Answer trie hashes:              %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Answer trie hashes:              %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_pg_alloc(GLOBAL_pages_ans_hash), Pg_str_in_use(GLOBAL_pages_ans_hash)); |           Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_pg_alloc(GLOBAL_pages_ans_hash), Pg_str_in_use(GLOBAL_pages_ans_hash)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Answer trie hashes:              %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Answer trie hashes:              %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(GLOBAL_pages_ans_hash)); |           Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(GLOBAL_pages_ans_hash)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash); |   return Pg_str_in_use(GLOBAL_pages_ans_hash) * sizeof(struct answer_trie_hash); | ||||||
| @@ -1240,10 +1238,10 @@ static inline long show_statistics_global_trie_nodes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_global_trie_nodes, Pg_str_free(GLOBAL_pages_gt_node) != cont); |   TABLING_ERROR_CHECKING(statistics_global_trie_nodes, Pg_str_free(GLOBAL_pages_gt_node) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Global trie nodes:               %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Global trie nodes:               %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
| 	  Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node), Pg_pg_alloc(GLOBAL_pages_gt_node), Pg_str_in_use(GLOBAL_pages_gt_node)); | 	  Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node), Pg_pg_alloc(GLOBAL_pages_gt_node), Pg_str_in_use(GLOBAL_pages_gt_node)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Global trie nodes:               %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Global trie nodes:               %10ld bytes (%ld structs in use)\n",  | ||||||
| 	  Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(GLOBAL_pages_gt_node)); | 	  Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(GLOBAL_pages_gt_node)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node); |   return Pg_str_in_use(GLOBAL_pages_gt_node) * sizeof(struct global_trie_node); | ||||||
| @@ -1268,10 +1266,10 @@ static inline long show_statistics_global_trie_hashes(void) { | |||||||
|   } |   } | ||||||
|   TABLING_ERROR_CHECKING(statistics_global_trie_hashes, Pg_str_free(GLOBAL_pages_gt_hash) != cont); |   TABLING_ERROR_CHECKING(statistics_global_trie_hashes, Pg_str_free(GLOBAL_pages_gt_hash) != cont); | ||||||
| #endif /* DEBUG_TABLING */ | #endif /* DEBUG_TABLING */ | ||||||
|   fprintf(Yap_stdout, "  Global trie hashes:              %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Global trie hashes:              %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_pg_alloc(GLOBAL_pages_gt_hash), Pg_str_in_use(GLOBAL_pages_gt_hash)); |           Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_pg_alloc(GLOBAL_pages_gt_hash), Pg_str_in_use(GLOBAL_pages_gt_hash)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Global trie hashes:              %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Global trie hashes:              %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(GLOBAL_pages_gt_hash)); |           Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(GLOBAL_pages_gt_hash)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash); |   return Pg_str_in_use(GLOBAL_pages_gt_hash) * sizeof(struct global_trie_hash); | ||||||
| @@ -1298,10 +1296,10 @@ static inline long show_statistics_or_frames(void) { | |||||||
|   } |   } | ||||||
|   YAPOR_ERROR_CHECKING(statistics_or_frames, Pg_str_free(GLOBAL_pages_or_fr ) != cont); |   YAPOR_ERROR_CHECKING(statistics_or_frames, Pg_str_free(GLOBAL_pages_or_fr ) != cont); | ||||||
| #endif /* DEBUG_YAPOR */ | #endif /* DEBUG_YAPOR */ | ||||||
|   fprintf(Yap_stdout, "  Or-frames:                       %10ld bytes (%ld pages and %ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Or-frames:                       %10ld bytes (%ld pages and %ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame), Pg_pg_alloc(GLOBAL_pages_or_fr ), Pg_str_in_use(GLOBAL_pages_or_fr )); |           Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame), Pg_pg_alloc(GLOBAL_pages_or_fr ), Pg_str_in_use(GLOBAL_pages_or_fr )); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Or-frames:                       %10ld bytes (%ld structs in use)\n",  |   fprintf(GLOBAL_stdout, "  Or-frames:                       %10ld bytes (%ld structs in use)\n",  | ||||||
|           Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame), Pg_str_in_use(GLOBAL_pages_or_fr )); |           Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame), Pg_str_in_use(GLOBAL_pages_or_fr )); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame); |   return Pg_str_in_use(GLOBAL_pages_or_fr ) * sizeof(struct or_frame); | ||||||
| @@ -1326,10 +1324,10 @@ static inline long show_statistics_query_goal_solution_frames(void) { | |||||||
|   } |   } | ||||||
|   YAPOR_ERROR_CHECKING(statistics_query_goal_solution_frames, Pg_str_free(GLOBAL_pages_qg_sol_fr ) != cont); |   YAPOR_ERROR_CHECKING(statistics_query_goal_solution_frames, Pg_str_free(GLOBAL_pages_qg_sol_fr ) != cont); | ||||||
| #endif /* DEBUG_YAPOR */ | #endif /* DEBUG_YAPOR */ | ||||||
|   fprintf(Yap_stdout, "  Query goal solution frames:      %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Query goal solution frames:      %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_pg_alloc(GLOBAL_pages_qg_sol_fr ), Pg_str_in_use(GLOBAL_pages_qg_sol_fr )); |           Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_pg_alloc(GLOBAL_pages_qg_sol_fr ), Pg_str_in_use(GLOBAL_pages_qg_sol_fr )); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Query goal solution frames:      %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Query goal solution frames:      %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(GLOBAL_pages_qg_sol_fr )); |           Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(GLOBAL_pages_qg_sol_fr )); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame); |   return Pg_str_in_use(GLOBAL_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame); | ||||||
| @@ -1354,10 +1352,10 @@ static inline long show_statistics_query_goal_answer_frames(void) { | |||||||
|   } |   } | ||||||
|   YAPOR_ERROR_CHECKING(statistics_query_goal_answer_frames, Pg_str_free(GLOBAL_pages_qg_ans_fr) != cont); |   YAPOR_ERROR_CHECKING(statistics_query_goal_answer_frames, Pg_str_free(GLOBAL_pages_qg_ans_fr) != cont); | ||||||
| #endif /* DEBUG_YAPOR */ | #endif /* DEBUG_YAPOR */ | ||||||
|   fprintf(Yap_stdout, "  Query goal answer frames:        %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Query goal answer frames:        %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(GLOBAL_pages_qg_ans_fr), Pg_str_in_use(GLOBAL_pages_qg_ans_fr)); |           Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(GLOBAL_pages_qg_ans_fr), Pg_str_in_use(GLOBAL_pages_qg_ans_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Query goal answer frames:        %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Query goal answer frames:        %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(GLOBAL_pages_qg_ans_fr)); |           Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(GLOBAL_pages_qg_ans_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame); |   return Pg_str_in_use(GLOBAL_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame); | ||||||
| @@ -1384,10 +1382,10 @@ static inline long show_statistics_suspension_frames(void) { | |||||||
|   } |   } | ||||||
|   OPTYAP_ERROR_CHECKING(statistics_suspension_frames, Pg_str_free(GLOBAL_pages_susp_fr) != cont); |   OPTYAP_ERROR_CHECKING(statistics_suspension_frames, Pg_str_free(GLOBAL_pages_susp_fr) != cont); | ||||||
| #endif /* DEBUG_OPTYAP */ | #endif /* DEBUG_OPTYAP */ | ||||||
|   fprintf(Yap_stdout, "  Suspension frames:               %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Suspension frames:               %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame), Pg_pg_alloc(GLOBAL_pages_susp_fr), Pg_str_in_use(GLOBAL_pages_susp_fr)); |           Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame), Pg_pg_alloc(GLOBAL_pages_susp_fr), Pg_str_in_use(GLOBAL_pages_susp_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Suspension frames:               %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Suspension frames:               %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(GLOBAL_pages_susp_fr)); |           Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(GLOBAL_pages_susp_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame); |   return Pg_str_in_use(GLOBAL_pages_susp_fr) * sizeof(struct suspension_frame); | ||||||
| @@ -1413,10 +1411,10 @@ static inline long show_statistics_table_subgoal_solution_frames(void) { | |||||||
|   } |   } | ||||||
|   OPTYAP_ERROR_CHECKING(statistics_table_subgoal_solution_frames, Pg_str_free(GLOBAL_pages_tg_sol_fr) != cont); |   OPTYAP_ERROR_CHECKING(statistics_table_subgoal_solution_frames, Pg_str_free(GLOBAL_pages_tg_sol_fr) != cont); | ||||||
| #endif /* DEBUG_OPTYAP */ | #endif /* DEBUG_OPTYAP */ | ||||||
|   fprintf(Yap_stdout, "  Table subgoal solution frames:   %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Table subgoal solution frames:   %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_pg_alloc(GLOBAL_pages_tg_sol_fr), Pg_str_in_use(GLOBAL_pages_tg_sol_fr)); |           Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_pg_alloc(GLOBAL_pages_tg_sol_fr), Pg_str_in_use(GLOBAL_pages_tg_sol_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Table subgoal solution frames:   %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Table subgoal solution frames:   %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(GLOBAL_pages_tg_sol_fr)); |           Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(GLOBAL_pages_tg_sol_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame); |   return Pg_str_in_use(GLOBAL_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame); | ||||||
| @@ -1441,10 +1439,10 @@ static inline long show_statistics_table_subgoal_answer_frames(void) { | |||||||
|   } |   } | ||||||
|   OPTYAP_ERROR_CHECKING(statistics_table_subgoal_answer_frames, Pg_str_free(GLOBAL_pages_tg_ans_fr) != cont); |   OPTYAP_ERROR_CHECKING(statistics_table_subgoal_answer_frames, Pg_str_free(GLOBAL_pages_tg_ans_fr) != cont); | ||||||
| #endif /* DEBUG_OPTYAP */ | #endif /* DEBUG_OPTYAP */ | ||||||
|   fprintf(Yap_stdout, "  Table subgoal answer frames:     %10ld bytes (%ld pages and %ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Table subgoal answer frames:     %10ld bytes (%ld pages and %ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_pg_alloc(GLOBAL_pages_tg_ans_fr), Pg_str_in_use(GLOBAL_pages_tg_ans_fr)); |           Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_pg_alloc(GLOBAL_pages_tg_ans_fr), Pg_str_in_use(GLOBAL_pages_tg_ans_fr)); | ||||||
| #else | #else | ||||||
|   fprintf(Yap_stdout, "  Table subgoal answer frames:     %10ld bytes (%ld structs in use)\n", |   fprintf(GLOBAL_stdout, "  Table subgoal answer frames:     %10ld bytes (%ld structs in use)\n", | ||||||
|           Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(GLOBAL_pages_tg_ans_fr)); |           Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(GLOBAL_pages_tg_ans_fr)); | ||||||
| #endif /* USE_PAGES_MALLOC */ | #endif /* USE_PAGES_MALLOC */ | ||||||
|   return Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame); |   return Pg_str_in_use(GLOBAL_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame); | ||||||
|   | |||||||
| @@ -40,7 +40,6 @@ void prune_shared_branch(choiceptr prune_cp) { | |||||||
| #ifdef TABLING_INNER_CUTS | #ifdef TABLING_INNER_CUTS | ||||||
|   tg_sol_fr_ptr tg_solutions, aux_tg_solutions; |   tg_sol_fr_ptr tg_solutions, aux_tg_solutions; | ||||||
| #endif /* TABLING_INNER_CUTS */ | #endif /* TABLING_INNER_CUTS */ | ||||||
|   printf(" ---- worker_id %d -----\n", worker_id); |  | ||||||
|   leftmost_or_fr = CUT_leftmost_or_frame(); |   leftmost_or_fr = CUT_leftmost_or_frame(); | ||||||
|   leftmost_cp = GetOrFr_node(leftmost_or_fr); |   leftmost_cp = GetOrFr_node(leftmost_or_fr); | ||||||
|   qg_solutions = NULL; |   qg_solutions = NULL; | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ EXTERN inline Int unify_constant(register Term a, register Term cons) | |||||||
| 	return(IsLongIntTerm(cons) && LongIntOfTerm(a) == LongIntOfTerm(cons)); | 	return(IsLongIntTerm(cons) && LongIntOfTerm(a) == LongIntOfTerm(cons)); | ||||||
| #ifdef TERM_EXTENSIONS | #ifdef TERM_EXTENSIONS | ||||||
|       } else if (IsAttachFunc(fun)) { |       } else if (IsAttachFunc(fun)) { | ||||||
| 	return(attas[ExtFromFunctor(fun)].bind_op(SBIND,a,cons)); | 	return(GLOBAL_attas[ExtFromFunctor(fun)].bind_op(SBIND,a,cons)); | ||||||
| #endif /* TERM_EXTENSIONS */ | #endif /* TERM_EXTENSIONS */ | ||||||
|       } else |       } else | ||||||
| 	return(FALSE); | 	return(FALSE); | ||||||
|   | |||||||
| @@ -217,7 +217,6 @@ int get_work(void) { | |||||||
|   counter = 0; |   counter = 0; | ||||||
|   BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers); |   BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers); | ||||||
|   while (1) { |   while (1) { | ||||||
|     //printf(" ******** worker_id %d **********\n", worker_id); |  | ||||||
|     while (BITMAP_subset(GLOBAL_bm_idle_workers, OrFr_members(LOCAL_top_or_fr)) && |     while (BITMAP_subset(GLOBAL_bm_idle_workers, OrFr_members(LOCAL_top_or_fr)) && | ||||||
|            Get_LOCAL_top_cp() != Get_GLOBAL_root_cp()) { |            Get_LOCAL_top_cp() != Get_GLOBAL_root_cp()) { | ||||||
|       /* no busy workers here and below */ |       /* no busy workers here and below */ | ||||||
|   | |||||||
| @@ -110,7 +110,7 @@ static struct trie_statistics{ | |||||||
| #define SHOW_TABLE_ARITY_ARRAY_SIZE 10000 | #define SHOW_TABLE_ARITY_ARRAY_SIZE 10000 | ||||||
| #define SHOW_TABLE_STRUCTURE(MESG, ARGS...)      \ | #define SHOW_TABLE_STRUCTURE(MESG, ARGS...)      \ | ||||||
|         if (TrStat_show == SHOW_MODE_STRUCTURE)  \ |         if (TrStat_show == SHOW_MODE_STRUCTURE)  \ | ||||||
|           fprintf(Yap_stdout, MESG, ##ARGS) |           fprintf(GLOBAL_stdout, MESG, ##ARGS) | ||||||
|  |  | ||||||
| #define CHECK_DECREMENT_GLOBAL_TRIE_REFERENCE(REF,MODE)		                                            \ | #define CHECK_DECREMENT_GLOBAL_TRIE_REFERENCE(REF,MODE)		                                            \ | ||||||
|         if (MODE == TRAVERSE_MODE_NORMAL && IsVarTerm(REF) && REF > VarIndexOfTableTerm(MAX_TABLE_VARS)) {  \ |         if (MODE == TRAVERSE_MODE_NORMAL && IsVarTerm(REF) && REF > VarIndexOfTableTerm(MAX_TABLE_VARS)) {  \ | ||||||
| @@ -1313,9 +1313,9 @@ void show_table(tab_ent_ptr tab_ent, int show_mode) { | |||||||
| #endif /* TABLING_INNER_CUTS */ | #endif /* TABLING_INNER_CUTS */ | ||||||
|     TrStat_ans_nodes = 0; |     TrStat_ans_nodes = 0; | ||||||
|     TrStat_gt_refs = 0; |     TrStat_gt_refs = 0; | ||||||
|     fprintf(Yap_stdout, "Table statistics for predicate '%s/%d'\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); |     fprintf(GLOBAL_stdout, "Table statistics for predicate '%s/%d'\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); | ||||||
|   } else {  /* SHOW_MODE_STRUCTURE */ |   } else {  /* SHOW_MODE_STRUCTURE */ | ||||||
|     fprintf(Yap_stdout, "Table structure for predicate '%s/%d'\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); |     fprintf(GLOBAL_stdout, "Table structure for predicate '%s/%d'\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent)); | ||||||
|   } |   } | ||||||
|   sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent)); |   sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent)); | ||||||
|   if (sg_node) { |   if (sg_node) { | ||||||
| @@ -1349,21 +1349,21 @@ void show_table(tab_ent_ptr tab_ent, int show_mode) { | |||||||
|   } else |   } else | ||||||
|     SHOW_TABLE_STRUCTURE("  EMPTY\n"); |     SHOW_TABLE_STRUCTURE("  EMPTY\n"); | ||||||
|   if (show_mode == SHOW_MODE_STATISTICS) { |   if (show_mode == SHOW_MODE_STATISTICS) { | ||||||
|     fprintf(Yap_stdout, "  Subgoal trie structure\n"); |     fprintf(GLOBAL_stdout, "  Subgoal trie structure\n"); | ||||||
|     fprintf(Yap_stdout, "    Subgoals: %ld (%ld incomplete)\n", TrStat_subgoals, TrStat_sg_incomplete); |     fprintf(GLOBAL_stdout, "    Subgoals: %ld (%ld incomplete)\n", TrStat_subgoals, TrStat_sg_incomplete); | ||||||
|     fprintf(Yap_stdout, "    Subgoal trie nodes: %ld\n", TrStat_sg_nodes); |     fprintf(GLOBAL_stdout, "    Subgoal trie nodes: %ld\n", TrStat_sg_nodes); | ||||||
|     fprintf(Yap_stdout, "  Answer trie structure(s)\n"); |     fprintf(GLOBAL_stdout, "  Answer trie structure(s)\n"); | ||||||
| #ifdef TABLING_INNER_CUTS | #ifdef TABLING_INNER_CUTS | ||||||
|     fprintf(Yap_stdout, "    Answers: %ld (%ld pruned)\n", TrStat_answers, TrStat_answers_pruned); |     fprintf(GLOBAL_stdout, "    Answers: %ld (%ld pruned)\n", TrStat_answers, TrStat_answers_pruned); | ||||||
| #else | #else | ||||||
|     fprintf(Yap_stdout, "    Answers: %ld\n", TrStat_answers); |     fprintf(GLOBAL_stdout, "    Answers: %ld\n", TrStat_answers); | ||||||
| #endif /* TABLING_INNER_CUTS */ | #endif /* TABLING_INNER_CUTS */ | ||||||
|     fprintf(Yap_stdout, "    Answers 'TRUE': %ld\n", TrStat_answers_true); |     fprintf(GLOBAL_stdout, "    Answers 'TRUE': %ld\n", TrStat_answers_true); | ||||||
|     fprintf(Yap_stdout, "    Answers 'NO': %ld\n", TrStat_answers_no); |     fprintf(GLOBAL_stdout, "    Answers 'NO': %ld\n", TrStat_answers_no); | ||||||
|     fprintf(Yap_stdout, "    Answer trie nodes: %ld\n", TrStat_ans_nodes); |     fprintf(GLOBAL_stdout, "    Answer trie nodes: %ld\n", TrStat_ans_nodes); | ||||||
|     fprintf(Yap_stdout, "  Global trie references: %ld\n", TrStat_gt_refs); |     fprintf(GLOBAL_stdout, "  Global trie references: %ld\n", TrStat_gt_refs); | ||||||
|   } |   } | ||||||
|   fflush(Yap_stdout); |   fflush(GLOBAL_stdout); | ||||||
|   return; |   return; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1374,9 +1374,9 @@ void show_global_trie(int show_mode) { | |||||||
|     TrStat_gt_terms = 0; |     TrStat_gt_terms = 0; | ||||||
|     TrStat_gt_nodes = 1; |     TrStat_gt_nodes = 1; | ||||||
|     TrStat_gt_refs = 0; |     TrStat_gt_refs = 0; | ||||||
|     fprintf(Yap_stdout, "Global trie statistics\n"); |     fprintf(GLOBAL_stdout, "Global trie statistics\n"); | ||||||
|   } else {  /* SHOW_MODE_STRUCTURE */ |   } else {  /* SHOW_MODE_STRUCTURE */ | ||||||
|     fprintf(Yap_stdout, "Global trie structure\n"); |     fprintf(GLOBAL_stdout, "Global trie structure\n"); | ||||||
|   } |   } | ||||||
|   if (TrNode_child(GLOBAL_root_gt)) { |   if (TrNode_child(GLOBAL_root_gt)) { | ||||||
|     char *str = (char *) malloc(sizeof(char) * SHOW_TABLE_STR_ARRAY_SIZE); |     char *str = (char *) malloc(sizeof(char) * SHOW_TABLE_STR_ARRAY_SIZE); | ||||||
| @@ -1388,9 +1388,9 @@ void show_global_trie(int show_mode) { | |||||||
|   } else |   } else | ||||||
|     SHOW_TABLE_STRUCTURE("  EMPTY\n"); |     SHOW_TABLE_STRUCTURE("  EMPTY\n"); | ||||||
|   if (show_mode == SHOW_MODE_STATISTICS) { |   if (show_mode == SHOW_MODE_STATISTICS) { | ||||||
|     fprintf(Yap_stdout, "  Terms: %ld\n", TrStat_gt_terms); |     fprintf(GLOBAL_stdout, "  Terms: %ld\n", TrStat_gt_terms); | ||||||
|     fprintf(Yap_stdout, "  Global trie nodes: %ld\n", TrStat_gt_nodes); |     fprintf(GLOBAL_stdout, "  Global trie nodes: %ld\n", TrStat_gt_nodes); | ||||||
|     fprintf(Yap_stdout, "  Global trie auto references: %ld\n", TrStat_gt_refs); |     fprintf(GLOBAL_stdout, "  Global trie auto references: %ld\n", TrStat_gt_refs); | ||||||
|   } |   } | ||||||
|   return; |   return; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -259,28 +259,6 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) | |||||||
| 	    if (!strcmp("dump-runtime-variables",p)) | 	    if (!strcmp("dump-runtime-variables",p)) | ||||||
| 		return dump_runtime_variables(); | 		return dump_runtime_variables(); | ||||||
| #endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */ | #endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */ | ||||||
| #ifdef USE_SOCKET |  | ||||||
|           case 'c':          /* running as client */ |  | ||||||
| 	    { |  | ||||||
| 	      char *host, *p1; |  | ||||||
| 	      long port; |  | ||||||
| 	      char *ptr; |  | ||||||
|  |  | ||||||
| 	      host = *++argv; |  | ||||||
| 	      argc--; |  | ||||||
| 	      if (host == NULL || host[0] == '-') |  | ||||||
| 		YAP_Error(0,0L,"sockets must receive host to connect to"); |  | ||||||
| 	      p1 = *++argv; |  | ||||||
| 	      argc--; |  | ||||||
| 	      if (p1 == NULL || p1[0] == '-') |  | ||||||
| 		YAP_Error(0,0L,"sockets must receive port to connect to"); |  | ||||||
| 	      port = strtol(p1, &ptr, 10); |  | ||||||
| 	      if (ptr == NULL || ptr[0] != '\0') |  | ||||||
| 		YAP_Error(0,0L,"port argument to socket must be a number"); |  | ||||||
| 	      YAP_InitSocks(host,port); |  | ||||||
| 	    } |  | ||||||
| 	    break; |  | ||||||
| #endif |  | ||||||
| 	  case 'F': | 	  case 'F': | ||||||
| 	    /* just ignore for now */ | 	    /* just ignore for now */ | ||||||
| 	      argc--; | 	      argc--; | ||||||
|   | |||||||
| @@ -2741,9 +2741,9 @@ PL_query(int query) | |||||||
| { | { | ||||||
|   switch(query) { |   switch(query) { | ||||||
|   case PL_QUERY_ARGC: |   case PL_QUERY_ARGC: | ||||||
|     return (intptr_t)Yap_argc; |     return (intptr_t)GLOBAL_argc; | ||||||
|   case PL_QUERY_ARGV: |   case PL_QUERY_ARGV: | ||||||
|     return (intptr_t)Yap_argv; |     return (intptr_t)GLOBAL_argv; | ||||||
|   case PL_QUERY_USER_CPU: |   case PL_QUERY_USER_CPU: | ||||||
|     return (intptr_t)Yap_cputime(); |     return (intptr_t)Yap_cputime(); | ||||||
|   case PL_QUERY_VERSION: |   case PL_QUERY_VERSION: | ||||||
|   | |||||||
| @@ -75,8 +75,7 @@ typedef struct broadcast_req BroadcastRequest; | |||||||
|  * Auxiliary data |  * Auxiliary data | ||||||
|  ********************************************************************/ |  ********************************************************************/ | ||||||
| static int mpi_status; | static int mpi_status; | ||||||
| extern char **Yap_argv; | extern int GLOBAL_argc; | ||||||
| extern int Yap_argc; |  | ||||||
|  |  | ||||||
| #define HASHSIZE 1777 | #define HASHSIZE 1777 | ||||||
| static hashtable requests=NULL; | static hashtable requests=NULL; | ||||||
| @@ -261,8 +260,8 @@ static int mpi_error(int errcode){ | |||||||
| static int  | static int  | ||||||
| mpi_init(void){ | mpi_init(void){ | ||||||
|   int thread_level; |   int thread_level; | ||||||
|   //  MPI_Init(&Yap_argc, &Yap_argv); |   //  MPI_Init(&GLOBAL_argc, &GLOBAL_argv); | ||||||
|   MPI_Init_thread(&Yap_argc, &Yap_argv,MPI_THREAD_SINGLE,&thread_level); |   MPI_Init_thread(&GLOBAL_argc, &GLOBAL_argv,MPI_THREAD_SINGLE,&thread_level); | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   write_msg(__FUNCTION__,__FILE__,__LINE__,"Thread level: %d\n",thread_level); |   write_msg(__FUNCTION__,__FILE__,__LINE__,"Thread level: %d\n",thread_level); | ||||||
| #endif | #endif | ||||||
| @@ -300,11 +299,11 @@ rcv_msg_thread(char *handle_pred) { | |||||||
| static int  | static int  | ||||||
| mpi_init_rcv_thread(void){ | mpi_init_rcv_thread(void){ | ||||||
|   int thread_level; |   int thread_level; | ||||||
|   //  MPI_Init(&Yap_argc, &Yap_argv); |   //  MPI_Init(&GLOBAL_argc, &GLOBAL_argv); | ||||||
|   pthread_t  thread; |   pthread_t  thread; | ||||||
|   char *arg="handle_msg"; |   char *arg="handle_msg"; | ||||||
|  |  | ||||||
|   MPI_Init_thread(&Yap_argc, &Yap_argv,MPI_THREAD_SINGLE,&thread_level); |   MPI_Init_thread(&GLOBAL_argc, &GLOBAL_argv,MPI_THREAD_SINGLE,&thread_level); | ||||||
|   if(pthread_create(&thread,NULL,(void*)&rcv_msg_thread,arg)) { |   if(pthread_create(&thread,NULL,(void*)&rcv_msg_thread,arg)) { | ||||||
|     return (FALSE); |     return (FALSE); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -491,21 +491,21 @@ Yap_InitMPI(void) | |||||||
| { | { | ||||||
|   int i,j; |   int i,j; | ||||||
|  |  | ||||||
|   mpi_argv = malloc( Yap_argc * sizeof(char *) ); |   mpi_argv = malloc( GLOBAL_argc * sizeof(char *) ); | ||||||
|   mpi_argv[0] = strdup( Yap_argv[0] ); |   mpi_argv[0] = strdup( GLOBAL_argv[0] ); | ||||||
|  |  | ||||||
|   bufsize = RECV_BUF_SIZE; |   bufsize = RECV_BUF_SIZE; | ||||||
|   buf = malloc(bufsize * sizeof(char)); |   buf = malloc(bufsize * sizeof(char)); | ||||||
|  |  | ||||||
|   for( i=1; i<Yap_argc; ++i ) { |   for( i=1; i<GLOBAL_argc; ++i ) { | ||||||
|     if( !strcmp(Yap_argv[i], "--") ) { ++i; break; } |     if( !strcmp(GLOBAL_argv[i], "--") ) { ++i; break; } | ||||||
|   } |   } | ||||||
|   for( j=1; i<Yap_argc; ++i, ++j ) { |   for( j=1; i<GLOBAL_argc; ++i, ++j ) { | ||||||
|     mpi_argv[j] = strdup( Yap_argv[i] ); |     mpi_argv[j] = strdup( GLOBAL_argv[i] ); | ||||||
|   } |   } | ||||||
|   mpi_argc = j; |   mpi_argc = j; | ||||||
|  |  | ||||||
|   mpi_argv[0] = strdup( Yap_argv[0] ); |   mpi_argv[0] = strdup( GLOBAL_argv[0] ); | ||||||
|  |  | ||||||
|   Yap_InitCPred( "mpi_open", 3, p_mpi_open, SafePredFlag|SyncPredFlag ); |   Yap_InitCPred( "mpi_open", 3, p_mpi_open, SafePredFlag|SyncPredFlag ); | ||||||
|   Yap_InitCPred( "mpi_close", 0, p_mpi_close, SafePredFlag|SyncPredFlag ); |   Yap_InitCPred( "mpi_close", 0, p_mpi_close, SafePredFlag|SyncPredFlag ); | ||||||
|   | |||||||
							
								
								
									
										108
									
								
								misc/GLOBALS
									
									
									
									
									
								
							
							
						
						
									
										108
									
								
								misc/GLOBALS
									
									
									
									
									
								
							| @@ -18,45 +18,117 @@ | |||||||
| START_GLOBAL_DATA | START_GLOBAL_DATA | ||||||
|  |  | ||||||
| // initialization: tell whether the system has been initialised and by whom. | // initialization: tell whether the system has been initialised and by whom. | ||||||
| int		Initialised			=FALSE | int				Initialised				=FALSE | ||||||
| int		InitialisedFromPL		=FALSE | int				InitialisedFromPL			=FALSE | ||||||
| int		PL_Argc				=0 | int				PL_Argc					=0 | ||||||
| char**		PL_Argv				=NULL | char**				PL_Argv					=NULL | ||||||
|  |  | ||||||
| // halt hooks | // halt hooks | ||||||
| struct halt_hook*	HaltHooks		=NULL | struct halt_hook*		HaltHooks				=NULL | ||||||
|  |  | ||||||
| // stack overflow expansion/gc control | // stack overflow expansion/gc control | ||||||
| int		AllowLocalExpansion 		=TRUE | int				AllowLocalExpansion 			=TRUE | ||||||
| int		AllowGlobalExpansion 		=TRUE | int				AllowGlobalExpansion 			=TRUE | ||||||
| int		AllowTrailExpansion 		=TRUE | int				AllowTrailExpansion 			=TRUE | ||||||
| UInt		SizeOfOverflow			=0 | UInt				SizeOfOverflow				=0 | ||||||
|  |  | ||||||
| // amount of space recovered in all garbage collections | // amount of space recovered in all garbage collections | ||||||
| UInt		AGcThreshold			=10000 | UInt				AGcThreshold				=10000 | ||||||
| Agc_hook	AGCHook				=NULL | Agc_hook			AGCHook					=NULL | ||||||
|  |  | ||||||
|  |  | ||||||
| /* multi-thread support */ | /* multi-thread support */ | ||||||
| #if THREADS | #if THREADS | ||||||
| /* number of threads and processes in system */ | /* number of threads and processes in system */ | ||||||
| UInt		NOfThreads			=1 | UInt				NOfThreads				=1 | ||||||
| /* number of threads created since start */ | /* number of threads created since start */ | ||||||
| UInt		NOfThreadsCreated 		=1 | UInt				NOfThreadsCreated 			=1 | ||||||
| /* total run time for dead threads */ | /* total run time for dead threads */ | ||||||
| UInt  		ThreadsTotalTime 		=0L | UInt  				ThreadsTotalTime 			=0L | ||||||
| // Threads Array | // Threads Array | ||||||
| lockvar		ThreadHandlesLock		MkLock | lockvar				ThreadHandlesLock			MkLock | ||||||
| #endif | #endif	 | ||||||
|  |  | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
| // protect long critical regions | // protect long critical regions | ||||||
| lockvar		BGL				MkLock | lockvar				BGL					MkLock | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
| struct global_optyap_data	optyap_data	void	 | struct global_optyap_data	optyap_data				void	 | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
|  | // whether Yap is responsible for signal handling | ||||||
|  |  | ||||||
|  | int             		PrologShouldHandleInterrupts		void | ||||||
|  |  | ||||||
|  | /* This is the guy who actually started the system, and who has the correct registers */ | ||||||
|  | #if defined(THREADS) | ||||||
|  | pthread_t 			master_thread				void | ||||||
|  | #endif /* THREADS */ | ||||||
|  |  | ||||||
|  | // streams  | ||||||
|  | YP_FILE*			stdout					=stdout | ||||||
|  | YP_FILE*			stderr					=stderr	 | ||||||
|  |  | ||||||
|  | // access to yap initial arguments  | ||||||
|  | char**				argv					void | ||||||
|  | int           		 	argc					void | ||||||
|  |  | ||||||
|  | // extensions to Terms | ||||||
|  | #ifdef COROUTINING | ||||||
|  | /* array with the ops for your favourite extensions */ | ||||||
|  | ext_op 				attas[attvars_ext+1]			void | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | // agc.c | ||||||
|  | int 				agc_calls				void | ||||||
|  | YAP_ULONG_LONG 			agc_collected				void | ||||||
|  | /* total time spent in GC */ | ||||||
|  | Int 				tot_agc_time 				=0 | ||||||
|  | /* number of heap objects in all garbage collections */ | ||||||
|  | Int 				tot_agc_recovered 			=0  | ||||||
|  |  | ||||||
|  | //arrays.c | ||||||
|  | #if HAVE_MMAP | ||||||
|  | struct MMAP_ARRAY_BLOCK* 	mmap_arrays 				=NULL | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef DEBUG | ||||||
|  | //computils.c | ||||||
|  | char            		Option[20]				void | ||||||
|  | YP_FILE*			logfile					void | ||||||
|  | //init.c | ||||||
|  | int  				output_msg 				=FALSE | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //gprof.c | ||||||
|  | Int 				ProfCalls				void  | ||||||
|  | Int				ProfGCs 				void | ||||||
|  | Int				ProfHGrows 				void | ||||||
|  | Int				ProfSGrows 				void | ||||||
|  | Int				ProfMallocs 				void | ||||||
|  | Int				ProfOn 					void | ||||||
|  | Int				ProfOns					void | ||||||
|  | struct RB_red_blk_node* 	ProfilerRoot				void | ||||||
|  | struct RB_red_blk_node* 	ProfilerNil				void | ||||||
|  | char*				DIRNAME					=NULL | ||||||
|  |  | ||||||
|  | #if defined(COFF)  || defined(A_OUT) | ||||||
|  | // loada_coff.c && load_aout.c | ||||||
|  | char 				Executable[YAP_FILENAME_MAX]		void | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if  __simplescalar__ | ||||||
|  | char				pwd[YAP_FILENAME_MAX]			void | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //udi.c | ||||||
|  | //struct udi_control_block 	RtreeCmd				void	 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| END_GLOBAL_DATA | END_GLOBAL_DATA | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										275
									
								
								misc/LOCALS
									
									
									
									
									
								
							
							
						
						
									
										275
									
								
								misc/LOCALS
									
									
									
									
									
								
							| @@ -2,172 +2,213 @@ | |||||||
| START_WORKER_LOCAL | START_WORKER_LOCAL | ||||||
|  |  | ||||||
| // Streams | // Streams | ||||||
| int			c_input_stream		=0 | int				c_input_stream				=0 | ||||||
| int			c_output_stream		=1 | int				c_output_stream				=1 | ||||||
| int			c_error_stream		=2 | int				c_error_stream				=2 | ||||||
|  |  | ||||||
| // Restore info | // Restore info | ||||||
| CELL*			OldASP			=NULL | CELL*				OldASP					=NULL | ||||||
| CELL*			OldLCL0			=NULL | CELL*				OldLCL0					=NULL | ||||||
| tr_fr_ptr		OldTR			=NULL | tr_fr_ptr			OldTR					=NULL | ||||||
| CELL*			OldGlobalBase		=NULL | CELL*				OldGlobalBase				=NULL | ||||||
| CELL*			OldH			=NULL | CELL*				OldH					=NULL | ||||||
| CELL*			OldH0			=NULL | CELL*				OldH0					=NULL | ||||||
| ADDR			OldTrailBase		=NULL | ADDR				OldTrailBase				=NULL | ||||||
| ADDR			OldTrailTop		=NULL | ADDR				OldTrailTop				=NULL | ||||||
| ADDR			OldHeapBase		=NULL | ADDR				OldHeapBase				=NULL | ||||||
| ADDR			OldHeapTop		=NULL | ADDR				OldHeapTop				=NULL | ||||||
| Int			ClDiff			=0L | Int				ClDiff					=0L | ||||||
| Int			GDiff			=0L | Int				GDiff					=0L | ||||||
| Int			HDiff			=0L | Int				HDiff					=0L | ||||||
| Int			GDiff0			=0L | Int				GDiff0					=0L | ||||||
| CELL*			GSplit			=NULL | CELL*				GSplit					=NULL | ||||||
| Int			LDiff			=0L | Int				LDiff					=0L | ||||||
| Int			TrDiff			=0L | Int				TrDiff					=0L | ||||||
| Int			XDiff			=0L | Int				XDiff					=0L | ||||||
| Int			DelayDiff		=0L | Int				DelayDiff				=0L | ||||||
| Int			BaseDiff		=0L | Int				BaseDiff				=0L | ||||||
|  |  | ||||||
| // Reduction counters | // Reduction counters | ||||||
| YAP_ULONG_LONG		ReductionsCounter	=0L | YAP_ULONG_LONG			ReductionsCounter			=0L | ||||||
| YAP_ULONG_LONG		PredEntriesCounter	=0L | YAP_ULONG_LONG			PredEntriesCounter			=0L | ||||||
| YAP_ULONG_LONG		RetriesCounter		=0L | YAP_ULONG_LONG			RetriesCounter				=0L | ||||||
| int			ReductionsCounterOn	=0L | int				ReductionsCounterOn			=0L | ||||||
| int			PredEntriesCounterOn	=0L | int				PredEntriesCounterOn			=0L | ||||||
| int			RetriesCounterOn	=0L | int				RetriesCounterOn			=0L | ||||||
|  |  | ||||||
| // support for consulting files | // support for consulting files | ||||||
| /* current consult stack */ | /* current consult stack */ | ||||||
| union CONSULT_OBJ*	ConsultSp		=NULL | union CONSULT_OBJ*		ConsultSp				=NULL | ||||||
| /* current maximum number of cells in consult stack */ | /* current maximum number of cells in consult stack */ | ||||||
| UInt			ConsultCapacity		void | UInt				ConsultCapacity				void | ||||||
| /* top of consult stack  */ | /* top of consult stack  */ | ||||||
| union CONSULT_OBJ*	ConsultBase		=NULL | union CONSULT_OBJ*		ConsultBase				=NULL | ||||||
| /* low-water mark for consult  */ | /* low-water mark for consult  */ | ||||||
| union CONSULT_OBJ*	ConsultLow		=NULL | union CONSULT_OBJ*		ConsultLow				=NULL | ||||||
|  |  | ||||||
| //global variables | //global variables | ||||||
| Term			GlobalArena		=0L		TermToGlobalOrAtomAdjust | Term				GlobalArena				=0L		TermToGlobalOrAtomAdjust | ||||||
| UInt			GlobalArenaOverflows	=0L | UInt				GlobalArenaOverflows			=0L | ||||||
| Int			ArenaOverflows		=0L | Int				ArenaOverflows				=0L | ||||||
| Int			DepthArenas		=0 | Int				DepthArenas				=0 | ||||||
|  |  | ||||||
| int			ArithError		=FALSE | int				ArithError				=FALSE | ||||||
| struct pred_entry*	LastAssertedPred	=NULL | struct pred_entry*		LastAssertedPred			=NULL | ||||||
| int			DebugOn			=FALSE | int				DebugOn					=FALSE | ||||||
| char*			ScannerStack		=NULL | char*				ScannerStack				=NULL | ||||||
| struct scanner_extra_alloc* ScannerExtraBlocks	=NULL | struct scanner_extra_alloc*	 ScannerExtraBlocks			=NULL | ||||||
| struct DB_TERM*		BallTerm		=NULL 		RestoreBallTerm(wid) | struct DB_TERM*			BallTerm				=NULL 		RestoreBallTerm(wid) | ||||||
| UInt			ActiveSignals		=0L | UInt				ActiveSignals				=0L | ||||||
| UInt			IPredArity		=0L | UInt				IPredArity				=0L | ||||||
| yamop*			ProfEnd			=NULL | yamop*				ProfEnd					=NULL | ||||||
| int			UncaughtThrow		=FALSE | int				UncaughtThrow				=FALSE | ||||||
| int			DoingUndefp		=FALSE | int				DoingUndefp				=FALSE | ||||||
| Int			StartLine		=0L | Int				StartLine				=0L | ||||||
| scratch_block		ScratchPad		InitScratchPad(wid) | scratch_block			ScratchPad						InitScratchPad(wid) | ||||||
| #ifdef  COROUTINING | #ifdef  COROUTINING | ||||||
| Term			WokenGoals		=0L 		TermToGlobalAdjust | Term				WokenGoals				=0L 		TermToGlobalAdjust | ||||||
| Term			AttsMutableList		=0L 		TermToGlobalAdjust | Term				AttsMutableList				=0L 		TermToGlobalAdjust | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // gc_stuff | // gc_stuff | ||||||
| Term			GcGeneration		=0L 		TermToGlobalAdjust | Term				GcGeneration				=0L 		TermToGlobalAdjust | ||||||
| Term			GcPhase			=0L 		TermToGlobalAdjust | Term				GcPhase					=0L 		TermToGlobalAdjust | ||||||
| UInt			GcCurrentPhase		=0L | UInt				GcCurrentPhase				=0L | ||||||
| UInt			GcCalls			=0L | UInt				GcCalls					=0L | ||||||
| Int			TotGcTime		=0L | Int				TotGcTime				=0L | ||||||
| YAP_ULONG_LONG		TotGcRecovered		=0L | YAP_ULONG_LONG			TotGcRecovered				=0L | ||||||
| Int			LastGcTime		=0L | Int				LastGcTime				=0L | ||||||
| Int			LastSSTime		=0L | Int				LastSSTime				=0L | ||||||
|  |  | ||||||
| /* in a single gc */ | /* in a single gc */ | ||||||
| Int			total_marked		=0L | Int				total_marked				=0L | ||||||
| Int			total_oldies		=0L | Int				total_oldies				=0L | ||||||
| struct choicept*	current_B		=NULL | struct choicept*		current_B				=NULL | ||||||
| CELL*			prev_HB			=NULL | CELL*				prev_HB					=NULL | ||||||
| CELL*			HGEN			=NULL | CELL*				HGEN					=NULL | ||||||
| CELL**			iptop			=NULL | CELL**				iptop					=NULL | ||||||
|  |  | ||||||
| #if defined(GC_NO_TAGS) | #if defined(GC_NO_TAGS) | ||||||
| char*			bp			=NULL | char*				bp					=NULL | ||||||
| #endif | #endif | ||||||
| tr_fr_ptr		sTR			=NULL | tr_fr_ptr			sTR					=NULL | ||||||
| tr_fr_ptr		sTR0			=NULL | tr_fr_ptr			sTR0					=NULL | ||||||
| tr_fr_ptr		new_TR			=NULL | tr_fr_ptr			new_TR					=NULL | ||||||
| struct gc_mark_continuation*	cont_top0	=NULL | struct gc_mark_continuation*	cont_top0				=NULL | ||||||
| struct gc_mark_continuation*	cont_top	=NULL | struct gc_mark_continuation*	cont_top				=NULL | ||||||
| int			discard_trail_entries	=0 | int				discard_trail_entries			=0 | ||||||
| gc_ma_hash_entry	gc_ma_hash_table[GC_MAVARS_HASH_SIZE]	void | gc_ma_hash_entry		gc_ma_hash_table[GC_MAVARS_HASH_SIZE]	void | ||||||
| gc_ma_hash_entry*	gc_ma_h_top		=NULL | gc_ma_hash_entry*		gc_ma_h_top				=NULL | ||||||
| gc_ma_hash_entry*	gc_ma_h_list		=NULL | gc_ma_hash_entry*		gc_ma_h_list				=NULL | ||||||
| UInt			gc_timestamp		=0L | UInt				gc_timestamp				=0L | ||||||
| ADDR			db_vec			=NULL | ADDR				db_vec					=NULL | ||||||
| ADDR			db_vec0			=NULL | ADDR				db_vec0					=NULL | ||||||
| struct RB_red_blk_node*	db_root			=NULL | struct RB_red_blk_node*		db_root					=NULL | ||||||
| struct RB_red_blk_node*	db_nil			=NULL | struct RB_red_blk_node*		db_nil					=NULL | ||||||
|  |  | ||||||
| sigjmp_buf		gc_restore		void |  | ||||||
| struct array_entry*	DynamicArrays		=NULL 		PtoArrayEAdjust |  | ||||||
| struct static_array_entry* StaticArrays		=NULL 		PtoArraySAdjust |  | ||||||
| struct global_entry*	GlobalVariables		=NULL 		PtoGlobalEAdjust |  | ||||||
| int			AllowRestart		=FALSE |  | ||||||
|  |  | ||||||
|  | sigjmp_buf			gc_restore				void | ||||||
|  | struct array_entry*		DynamicArrays				=NULL 		PtoArrayEAdjust | ||||||
|  | struct static_array_entry*	StaticArrays				=NULL 		PtoArraySAdjust | ||||||
|  | struct global_entry*		GlobalVariables				=NULL 		PtoGlobalEAdjust | ||||||
|  | int				AllowRestart				=FALSE | ||||||
|  | 	 | ||||||
| // Thread Local Area for Fast Storage of Intermediate Compiled Code | // Thread Local Area for Fast Storage of Intermediate Compiled Code | ||||||
| struct mem_blk*		CMemFirstBlock		=NULL | struct mem_blk*			CMemFirstBlock				=NULL | ||||||
| UInt			CMemFirstBlockSz	=0L | UInt				CMemFirstBlockSz			=0L | ||||||
|  |  | ||||||
| // Thread Local Area for Labels | // Thread Local Area for Labels | ||||||
| Int*			LabelFirstArray		=NULL | Int*				LabelFirstArray				=NULL | ||||||
| UInt			LabelFirstArraySz	=0L | UInt				LabelFirstArraySz			=0L | ||||||
|  |  | ||||||
| // Thread Local Area for SWI-Prolog emulation routines. | // Thread Local Area for SWI-Prolog emulation routines. | ||||||
| struct PL_local_data*	PL_local_data_p		=Yap_InitThreadIO(wid) | struct PL_local_data*		PL_local_data_p				=Yap_InitThreadIO(wid) | ||||||
|  |  | ||||||
| #ifdef THREADS | #ifdef THREADS | ||||||
| struct thandle		ThreadHandle		InitThreadHandle(wid) | struct thandle			ThreadHandle				InitThreadHandle(wid) | ||||||
| #endif /* THREADS */ | #endif /* THREADS */ | ||||||
|  |  | ||||||
| #if defined(YAPOR) || defined(TABLING) | #if defined(YAPOR) || defined(TABLING) | ||||||
| struct local_optyap_data	optyap_data   	Yap_init_local_optyap_data(wid) | struct local_optyap_data	optyap_data   				Yap_init_local_optyap_data(wid) | ||||||
| #endif /* YAPOR || TABLING */ | #endif /* YAPOR || TABLING */ | ||||||
|  |  | ||||||
| int			InterruptsDisabled	=FALSE | int				InterruptsDisabled			=FALSE | ||||||
|  |  | ||||||
| struct open_query_struct* execution		=NULL | struct open_query_struct* 	execution				=NULL | ||||||
|  |  | ||||||
| #if LOW_LEVEL_TRACER | #if LOW_LEVEL_TRACER | ||||||
| Int			total_choicepoints	=0 | Int				total_choicepoints			=0 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int			consult_level		=0 | int				consult_level				=0 | ||||||
|  |  | ||||||
| #if defined(YAPOR) || defined(THREADS) | #if defined(YAPOR) || defined(THREADS) | ||||||
| lockvar			SignalLock		MkLock | lockvar				SignalLock				MkLock | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Variables related to memory allocation | // Variables related to memory allocation | ||||||
| ADDR			LocalBase		=REMOTE_LocalBase(0) | ADDR				LocalBase				=REMOTE_LocalBase(0) | ||||||
| ADDR			GlobalBase		=REMOTE_GlobalBase(0) | ADDR				GlobalBase				=REMOTE_GlobalBase(0) | ||||||
| ADDR			TrailBase		=REMOTE_TrailBase(0) | ADDR				TrailBase				=REMOTE_TrailBase(0) | ||||||
| ADDR			TrailTop		=REMOTE_TrailTop(0) | ADDR				TrailTop				=REMOTE_TrailTop(0) | ||||||
| char*			ErrorMessage		=REMOTE_ErrorMessage(0) | char*				ErrorMessage				=REMOTE_ErrorMessage(0) | ||||||
| Term			Error_Term		=REMOTE_Error_Term(0)	 | Term				Error_Term				=REMOTE_Error_Term(0)	 | ||||||
| #ifdef THREADS | #ifdef THREADS | ||||||
| Term			Error_TYPE		=REMOTE_Error_TYPE(0) | Term				Error_TYPE				=REMOTE_Error_TYPE(0) | ||||||
| #else | #else | ||||||
| yap_error_number	Error_TYPE		=REMOTE_Error_TYPE(0) | yap_error_number		Error_TYPE				=REMOTE_Error_TYPE(0) | ||||||
| #endif	 | #endif	 | ||||||
| UInt             	Error_Size		=REMOTE_Error_Size(0) | UInt             		Error_Size				=REMOTE_Error_Size(0) | ||||||
| char			ErrorSay[MAX_ERROR_MSG_SIZE]	void | char				ErrorSay[MAX_ERROR_MSG_SIZE]		void | ||||||
| jmp_buf 		IOBotch			void | jmp_buf 			IOBotch					void | ||||||
| TokEntry*		tokptr			=REMOTE_tokptr(0) | TokEntry*			tokptr					=REMOTE_tokptr(0) | ||||||
| TokEntry*		toktide			=REMOTE_toktide(0) | TokEntry*			toktide					=REMOTE_toktide(0) | ||||||
| VarEntry*		VarTable 		=REMOTE_VarTable(0) | VarEntry*			VarTable 				=REMOTE_VarTable(0) | ||||||
| VarEntry*		AnonVarTable		=REMOTE_AnonVarTable(0) | VarEntry*			AnonVarTable				=REMOTE_AnonVarTable(0) | ||||||
| sigjmp_buf         	RestartEnv		void | sigjmp_buf         		RestartEnv				void | ||||||
| char     		FileNameBuf[YAP_FILENAME_MAX]	void | char     			FileNameBuf[YAP_FILENAME_MAX]		void | ||||||
| char        		FileNameBuf2[YAP_FILENAME_MAX]	void | char        			FileNameBuf2[YAP_FILENAME_MAX]		void | ||||||
|  |  | ||||||
|  | // Prolog State | ||||||
|  |  | ||||||
|  | Int      			PrologMode 				=BootMode | ||||||
|  | int      			CritLocks 				=0 | ||||||
|  |  | ||||||
|  | //analyst.c | ||||||
|  | /* used to find out how many instructions of each kind are executed */ | ||||||
|  | #ifdef ANALYST | ||||||
|  | YAP_ULONG_LONG 			opcount[_std_top+1]			void | ||||||
|  | YAP_ULONG_LONG 			2opcount[_std_top+1][_std_top+1] 	void | ||||||
|  | #endif /* ANALYST */ | ||||||
| 		 | 		 | ||||||
|  | //dbase.c | ||||||
|  | struct db_globs*		s_dbg					void | ||||||
|  |  | ||||||
|  | //eval.c | ||||||
|  | yap_error_number 		matherror 				=YAP_NO_ERROR | ||||||
|  |  | ||||||
|  | //grow.c | ||||||
|  | int 				heap_overflows 				=0 | ||||||
|  | Int 				total_heap_overflow_time		=0 | ||||||
|  | int 				stack_overflows 			=0 | ||||||
|  | Int 				total_stack_overflow_time 		=0 | ||||||
|  | int 				delay_overflows 			=0	 | ||||||
|  | Int 				total_delay_overflow_time 		=0 | ||||||
|  | int 				trail_overflows 			=0 | ||||||
|  | Int 				total_trail_overflow_time 		=0 | ||||||
|  | int 				atom_table_overflows 			=0 | ||||||
|  | Int 				total_atom_table_overflow_time 		=0 | ||||||
|  |  | ||||||
|  | //load_dyld | ||||||
|  | #ifdef LOAD_DYLD | ||||||
|  | static 				dl_errno				=0 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //tracer.c | ||||||
|  | #ifdef LOW_LEVEL_TRACER | ||||||
|  | int 				do_trace_primitives 			=TRUE | ||||||
|  | #endif | ||||||
|  |  | ||||||
| END_WORKER_LOCAL | END_WORKER_LOCAL | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,6 +43,7 @@ do_startCritical(void) { | |||||||
| } | } | ||||||
| static inline int | static inline int | ||||||
| do_endCritical(void) { | do_endCritical(void) { | ||||||
|  |   CACHE_REGS | ||||||
|   YAPLeaveCriticalSection(); |   YAPLeaveCriticalSection(); | ||||||
|   return 1; |   return 1; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user