upgrade JPL
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1936 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
21
C/globals.c
21
C/globals.c
@@ -91,7 +91,6 @@ CreateNewArena(CELL *ptr, UInt size)
|
||||
dst->_mp_size = 0L;
|
||||
dst->_mp_alloc = arena2big_sz(size);
|
||||
ptr[size-1] = EndSpecials;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -263,6 +262,16 @@ p_allocate_default_arena(void)
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
static void
|
||||
adjust_cps(UInt size)
|
||||
{
|
||||
/* adjust possible back pointers in choice-point stack */
|
||||
choiceptr b_ptr = B;
|
||||
while (b_ptr->cp_h == H) {
|
||||
b_ptr->cp_h += size;
|
||||
b_ptr = b_ptr->cp_b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
@@ -279,22 +288,16 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity)
|
||||
size = 4096;
|
||||
}
|
||||
if (pt == H) {
|
||||
choiceptr b_ptr;
|
||||
if (H+size > ASP-1024) {
|
||||
|
||||
XREGS[arity+1] = arena;
|
||||
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, P)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
arena = XREGS[arity+1];
|
||||
}
|
||||
/* adjust possible back pointers in choice-point stack */
|
||||
b_ptr = B;
|
||||
while (b_ptr->cp_h == H) {
|
||||
b_ptr->cp_h += size;
|
||||
b_ptr = b_ptr->cp_b;
|
||||
}
|
||||
adjust_cps(size);
|
||||
H += size;
|
||||
} else {
|
||||
XREGS[arity+1] = arena;
|
||||
|
18
C/heapgc.c
18
C/heapgc.c
@@ -3040,8 +3040,13 @@ compact_heap(void)
|
||||
}
|
||||
#endif
|
||||
next_hb = set_next_hb(gc_B);
|
||||
dest = (CELL_PTR) H0 + total_marked - 1;
|
||||
dest = H0 + total_marked - 1;
|
||||
|
||||
gc_B = update_B_H(gc_B, H, dest+1, dest+2
|
||||
#ifdef TABLING
|
||||
, &depfr
|
||||
#endif
|
||||
);
|
||||
for (current = H - 1; current >= start_from; current--) {
|
||||
if (MARKED_PTR(current)) {
|
||||
CELL ccell = UNMARK_CELL(*current);
|
||||
@@ -3219,6 +3224,11 @@ icompact_heap(void)
|
||||
#endif
|
||||
next_hb = set_next_hb(gc_B);
|
||||
dest = (CELL_PTR) H0 + total_marked - 1;
|
||||
gc_B = update_B_H(gc_B, H, dest+1, dest+2
|
||||
#ifdef TABLING
|
||||
, &depfr
|
||||
#endif
|
||||
);
|
||||
for (iptr = iptop - 1; iptr >= ibase; iptr--) {
|
||||
CELL ccell;
|
||||
CELL_PTR current;
|
||||
@@ -3658,9 +3668,13 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
|
||||
gc_phase = (UInt)IntegerOfTerm(Yap_ReadTimedVar(GcPhase));
|
||||
/* old HGEN are not very reliable, but still may have data to recover */
|
||||
#ifdef FIX
|
||||
if (gc_phase != GcCurrentPhase) {
|
||||
HGEN = H0;
|
||||
}
|
||||
#else
|
||||
HGEN = H0;
|
||||
#endif
|
||||
/* fprintf(stderr,"HGEN is %ld, %p, %p/%p\n", IntegerOfTerm(Yap_ReadTimedVar(GcGeneration)), HGEN, H,H0);*/
|
||||
OldTR = (tr_fr_ptr)(old_TR = TR);
|
||||
push_registers(predarity, nextop);
|
||||
@@ -3710,8 +3724,10 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
pop_registers(predarity, nextop);
|
||||
TR = new_TR;
|
||||
/* fprintf(Yap_stderr,"NEW HGEN %ld (%ld)\n", H-H0, HGEN-H0);*/
|
||||
#ifdef FIX
|
||||
Yap_UpdateTimedVar(GcGeneration, MkIntegerTerm(H-H0));
|
||||
Yap_UpdateTimedVar(GcPhase, MkIntegerTerm(GcCurrentPhase));
|
||||
#endif
|
||||
c_time = Yap_cputime();
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "%% Compress: took %g sec\n", (double)(c_time-time_start)/1000);
|
||||
|
20
C/iopreds.c
20
C/iopreds.c
@@ -2143,6 +2143,25 @@ check_bom(int sno, StreamDesc *st)
|
||||
}
|
||||
}
|
||||
|
||||
static Int
|
||||
p_access(char *file_name)
|
||||
{
|
||||
#if HAVE_STAT
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
struct _stat ss;
|
||||
if (_stat(file_name, &ss) != 0) {
|
||||
#else
|
||||
struct stat ss;
|
||||
if (stat(file_name, &ss) != 0) {
|
||||
#endif
|
||||
/* ignore errors while checking a file */
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static Int
|
||||
p_open (void)
|
||||
@@ -5885,6 +5904,7 @@ Yap_InitIOPreds(void)
|
||||
Yap_InitCPred ("$get0", 2, p_get0, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$get0_line_codes", 2, p_get0_line_codes, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$get_byte", 2, p_get_byte, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$access", 1, p_access, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$open", 5, p_open, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$file_expansion", 2, p_file_expansion, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("$open_null_stream", 1, p_open_null_stream, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
|
39
C/sysbits.c
39
C/sysbits.c
@@ -2598,6 +2598,42 @@ p_continue_signals(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_unix(void)
|
||||
{
|
||||
#ifdef unix
|
||||
return TRUE;
|
||||
#else
|
||||
#ifdef __unix__
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static Int
|
||||
p_win32(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return TRUE;
|
||||
#else
|
||||
#ifdef __CYGWIN__
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static Int
|
||||
p_ld_path(void)
|
||||
{
|
||||
return Yap_unify(ARG1,MkAtomTerm(Yap_LookupAtom("LD_LIBRARY_PATH")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Yap_InitSysPreds(void)
|
||||
{
|
||||
@@ -2624,6 +2660,9 @@ Yap_InitSysPreds(void)
|
||||
Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred ("file_directory_name", 2, p_file_directory_name, SafePredFlag);
|
||||
Yap_InitCPred ("$env_separator", 1, p_env_separator, SafePredFlag);
|
||||
Yap_InitCPred ("$unix", 0, p_unix, SafePredFlag);
|
||||
Yap_InitCPred ("$win32", 0, p_win32, SafePredFlag);
|
||||
Yap_InitCPred ("$ld_path", 1, p_ld_path, SafePredFlag);
|
||||
CurrentModule = SYSTEM_MODULE;
|
||||
Yap_InitCPred ("true_file_name", 2, p_true_file_name, SyncPredFlag);
|
||||
CurrentModule = cm;
|
||||
|
Reference in New Issue
Block a user