Merge branch 'udi_new' of github.com:davidvaz/yap-udi into udi_new

This commit is contained in:
David Vaz 2013-01-07 16:33:21 +00:00
commit 38fcc19d55
19 changed files with 113 additions and 54 deletions

8
C/adtdefs.c Normal file → Executable file
View File

@ -771,7 +771,6 @@ ExpandPredHash(void)
Prop Prop
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
{ {
CACHE_REGS
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p)); PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
if (p == NULL) { if (p == NULL) {
@ -852,10 +851,13 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
} }
p->FunctorOfPred = fe; p->FunctorOfPred = fe;
WRITE_UNLOCK(fe->FRWLock); WRITE_UNLOCK(fe->FRWLock);
{
CACHE_REGS
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC); Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC);
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_FUNC); Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_FUNC);
} }
}
return AbsPredProp(p); return AbsPredProp(p);
} }
@ -907,7 +909,6 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
Prop Prop
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
{ {
CACHE_REGS
Prop p0; Prop p0;
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p)); PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
@ -964,10 +965,13 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
p0 = AbsPredProp(p); p0 = AbsPredProp(p);
p->FunctorOfPred = (Functor)AbsAtom(ae); p->FunctorOfPred = (Functor)AbsAtom(ae);
WRITE_UNLOCK(ae->ARWLock); WRITE_UNLOCK(ae->ARWLock);
{
CACHE_REGS
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM); Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM);
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_ATOM); Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_ATOM);
} }
}
return p0; return p0;
} }

4
C/amasm.c Normal file → Executable file
View File

@ -2050,14 +2050,16 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
yamop *newcp; yamop *newcp;
/* emit a special instruction and then a label for backpatching */ /* emit a special instruction and then a label for backpatching */
if (pass_no) { if (pass_no) {
CACHE_REGS
UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl); UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl);
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) { if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
/* OOOPS, got in trouble, must do a longjmp and recover space */ /* OOOPS, got in trouble, must do a longjmp and recover space */
save_machine_regs(); save_machine_regs();
siglongjmp(cip->CompilerBotch,2); siglongjmp(cip->CompilerBotch,2);
} }
{
CACHE_REGS
Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX); Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX);
}
Yap_LUIndexSpace_CP += size; Yap_LUIndexSpace_CP += size;
#ifdef DEBUG #ifdef DEBUG
Yap_NewCps++; Yap_NewCps++;

View File

@ -3190,7 +3190,7 @@ YAP_Init(YAP_init_args *yap_init)
/* first, initialise the saved state */ /* first, initialise the saved state */
Term t_goal = MkAtomTerm(AtomInitProlog); Term t_goal = MkAtomTerm(AtomInitProlog);
YAP_RunGoalOnce(t_goal); YAP_RunGoalOnce(t_goal);
Yap_InitYaamRegs( 0 ); // Yap_InitYaamRegs( 0 );
/* reset stacks */ /* reset stacks */
return YAP_BOOT_FROM_SAVED_CODE; return YAP_BOOT_FROM_SAVED_CODE;
} else { } else {
@ -3314,7 +3314,7 @@ YAP_Reset(void)
} }
} }
/* reinitialise the engine */ /* reinitialise the engine */
Yap_InitYaamRegs( worker_id ); // Yap_InitYaamRegs( worker_id );
GLOBAL_Initialised = TRUE; GLOBAL_Initialised = TRUE;
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();

10
C/dbase.c Normal file → Executable file
View File

@ -1887,13 +1887,15 @@ Yap_new_ludbe(Term t, PredEntry *pe, UInt nargs)
static LogUpdClause * static LogUpdClause *
record_lu(PredEntry *pe, Term t, int position) record_lu(PredEntry *pe, Term t, int position)
{ {
CACHE_REGS
LogUpdClause *cl; LogUpdClause *cl;
if ((cl = new_lu_db_entry(t, pe)) == NULL) { if ((cl = new_lu_db_entry(t, pe)) == NULL) {
return NULL; return NULL;
} }
{
CACHE_REGS
Yap_inform_profiler_of_clause(cl, (char *)cl+cl->ClSize, pe, GPROF_NEW_LU_CLAUSE); Yap_inform_profiler_of_clause(cl, (char *)cl+cl->ClSize, pe, GPROF_NEW_LU_CLAUSE);
}
Yap_add_logupd_clause(pe, cl, (position == MkFirst ? 2 : 0)); Yap_add_logupd_clause(pe, cl, (position == MkFirst ? 2 : 0));
return cl; return cl;
} }
@ -4430,7 +4432,7 @@ p_increase_reference_counter( USES_REGS1 )
cl = (LogUpdClause *)DBRefOfTerm(t1); cl = (LogUpdClause *)DBRefOfTerm(t1);
PELOCK(67,cl->ClPred); PELOCK(67,cl->ClPred);
cl->ClRefCount++; cl->ClRefCount++;
UNLOCK(cl->ClPred); UNLOCK(cl->ClPred->PELock);
return TRUE; return TRUE;
} }
@ -4453,10 +4455,10 @@ p_decrease_reference_counter( USES_REGS1 )
PELOCK(67,cl->ClPred); PELOCK(67,cl->ClPred);
if (cl->ClRefCount) { if (cl->ClRefCount) {
cl->ClRefCount--; cl->ClRefCount--;
UNLOCK(cl->ClPred); UNLOCK(cl->ClPred->PELock);
return TRUE; return TRUE;
} }
UNLOCK(cl->ClPred); UNLOCK(cl->ClPred->PELock);
return FALSE; return FALSE;
} }

View File

@ -1736,7 +1736,7 @@ Yap_InitYaamRegs( int myworker_id )
Yap_ResetExceptionTerm ( myworker_id ); Yap_ResetExceptionTerm ( myworker_id );
Yap_PutValue (AtomBreak, MkIntTerm (0)); Yap_PutValue (AtomBreak, MkIntTerm (0));
TR = (tr_fr_ptr)REMOTE_TrailBase(myworker_id); TR = (tr_fr_ptr)REMOTE_TrailBase(myworker_id);
H = H0 = ((CELL *) REMOTE_GlobalBase(myworker_id))+1; H = H0 = ((CELL *) REMOTE_GlobalBase(myworker_id))+1; // +1: hack to ensure the gc does not try to mark mistakenly
LCL0 = ASP = (CELL *) REMOTE_LocalBase(myworker_id); LCL0 = ASP = (CELL *) REMOTE_LocalBase(myworker_id);
CurrentTrailTop = (tr_fr_ptr)(REMOTE_TrailTop(myworker_id)-MinTrailGap); CurrentTrailTop = (tr_fr_ptr)(REMOTE_TrailTop(myworker_id)-MinTrailGap);
/* notice that an initial choice-point and environment /* notice that an initial choice-point and environment

2
C/gprof.c Normal file → Executable file
View File

@ -1177,8 +1177,8 @@ static Int profres0( USES_REGS1 ) {
void void
Yap_InitLowProf(void) Yap_InitLowProf(void)
{ {
CACHE_REGS
#if LOW_PROF #if LOW_PROF
CACHE_REGS
LOCAL_ProfCalls = 0; LOCAL_ProfCalls = 0;
LOCAL_ProfilerOn = FALSE; LOCAL_ProfilerOn = FALSE;

View File

@ -410,8 +410,15 @@ push_registers(Int num_regs, yamop *nextop USES_REGS)
al = al->NextAE; al = al->NextAE;
} }
while (gl) { while (gl) {
Term t = gl->global;
if (!IsUnboundVar(&gl->global) &&
!IsAtomTerm(t) &&
!IsIntTerm(t)
) {
check_pr_trail(TR PASS_REGS); check_pr_trail(TR PASS_REGS);
TrailTerm(TR++) = gl->global; //fprintf(stderr,"in=%s %p\n", gl->AtomOfGE->StrOfAE, gl->global);
TrailTerm(TR++) = t;
}
gl = gl->NextGE; gl = gl->NextGE;
} }
while (sal) { while (sal) {
@ -504,7 +511,14 @@ pop_registers(Int num_regs, yamop *nextop USES_REGS)
al = al->NextAE; al = al->NextAE;
} }
while (gl) { while (gl) {
Term t = gl->global;
if (!IsUnboundVar(&gl->global) &&
!IsAtomTerm(t) &&
!IsIntTerm(t)
) {
//fprintf(stderr,"out=%s %p\n", gl->AtomOfGE->StrOfAE, gl->global);
gl->global = TrailTerm(ptr++); gl->global = TrailTerm(ptr++);
}
gl = gl->NextGE; gl = gl->NextGE;
} }
sal = LOCAL_StaticArrays; sal = LOCAL_StaticArrays;
@ -1150,6 +1164,7 @@ mark_variable(CELL_PTR current USES_REGS)
POP_CONTINUATION(); POP_CONTINUATION();
} }
if (current >= H0 && current < H) { if (current >= H0 && current < H) {
//fprintf(stderr,"%p M\n", current);
LOCAL_total_marked++; LOCAL_total_marked++;
if (current < LOCAL_HGEN) { if (current < LOCAL_HGEN) {
LOCAL_total_oldies++; LOCAL_total_oldies++;
@ -1165,6 +1180,7 @@ mark_variable(CELL_PTR current USES_REGS)
if (IN_BETWEEN(LOCAL_GlobalBase,current,H) && GlobalIsAttVar(current) && current==next) { if (IN_BETWEEN(LOCAL_GlobalBase,current,H) && GlobalIsAttVar(current) && current==next) {
if (next < H0) POP_CONTINUATION(); if (next < H0) POP_CONTINUATION();
if (!UNMARKED_MARK(next-1,local_bp)) { if (!UNMARKED_MARK(next-1,local_bp)) {
//fprintf(stderr,"%p M\n", next-1);
LOCAL_total_marked++; LOCAL_total_marked++;
if (next-1 < LOCAL_HGEN) { if (next-1 < LOCAL_HGEN) {
LOCAL_total_oldies++; LOCAL_total_oldies++;
@ -1207,6 +1223,7 @@ mark_variable(CELL_PTR current USES_REGS)
UNMARK(current); UNMARK(current);
*current = cnext; *current = cnext;
if (current >= H0 && current < H) { if (current >= H0 && current < H) {
//fprintf(stderr,"%p M\n", current-1);
LOCAL_total_marked--; LOCAL_total_marked--;
if (current < LOCAL_HGEN) { if (current < LOCAL_HGEN) {
LOCAL_total_oldies--; LOCAL_total_oldies--;
@ -1231,6 +1248,7 @@ mark_variable(CELL_PTR current USES_REGS)
*current = UNMARK_CELL(cnext); *current = UNMARK_CELL(cnext);
UNMARK(current); UNMARK(current);
if (current >= H0 && current < H ) { if (current >= H0 && current < H ) {
//fprintf(stderr,"%p M\n", current);
LOCAL_total_marked--; LOCAL_total_marked--;
if (current < LOCAL_HGEN) { if (current < LOCAL_HGEN) {
LOCAL_total_oldies--; LOCAL_total_oldies--;
@ -1278,6 +1296,7 @@ mark_variable(CELL_PTR current USES_REGS)
/* speedup for strings */ /* speedup for strings */
if (IsAtomOrIntTerm(*next)) { if (IsAtomOrIntTerm(*next)) {
if (!UNMARKED_MARK(next,local_bp)) { if (!UNMARKED_MARK(next,local_bp)) {
//fprintf(stderr,"%p M\n", next);
LOCAL_total_marked++; LOCAL_total_marked++;
if (next < LOCAL_HGEN) { if (next < LOCAL_HGEN) {
LOCAL_total_oldies++; LOCAL_total_oldies++;
@ -1337,6 +1356,7 @@ mark_variable(CELL_PTR current USES_REGS)
DEBUG_printf0("%p 1\n", next); DEBUG_printf0("%p 1\n", next);
DEBUG_printf0("%p 3\n", next); DEBUG_printf0("%p 3\n", next);
} }
//fprintf(stderr,"%p M 3\n", next);
LOCAL_total_marked += 3; LOCAL_total_marked += 3;
PUSH_POINTER(next PASS_REGS); PUSH_POINTER(next PASS_REGS);
PUSH_POINTER(next+2 PASS_REGS); PUSH_POINTER(next+2 PASS_REGS);
@ -1352,6 +1372,7 @@ mark_variable(CELL_PTR current USES_REGS)
DEBUG_printf0("%p 1\n", next); DEBUG_printf0("%p 1\n", next);
DEBUG_printf1("%p %ld\n", next, (long int)(sz+1)); DEBUG_printf1("%p %ld\n", next, (long int)(sz+1));
} }
//fprintf(stderr,"%p M %d\n", next,1+sz);
LOCAL_total_marked += 1+sz; LOCAL_total_marked += 1+sz;
PUSH_POINTER(next+sz PASS_REGS); PUSH_POINTER(next+sz PASS_REGS);
MARK(next+sz); MARK(next+sz);
@ -1390,6 +1411,7 @@ mark_variable(CELL_PTR current USES_REGS)
DEBUG_printf0("%p 1\n", next); DEBUG_printf0("%p 1\n", next);
DEBUG_printf1("%p %ld\n", next, (long int)(sz+2)); DEBUG_printf1("%p %ld\n", next, (long int)(sz+2));
} }
//fprintf(stderr,"%p M %d\n", next,2+sz);
LOCAL_total_marked += 2+sz; LOCAL_total_marked += 2+sz;
PUSH_POINTER(next PASS_REGS); PUSH_POINTER(next PASS_REGS);
sz++; sz++;
@ -1411,6 +1433,7 @@ mark_variable(CELL_PTR current USES_REGS)
#endif #endif
arity = ArityOfFunctor((Functor)(cnext)); arity = ArityOfFunctor((Functor)(cnext));
MARK(next); MARK(next);
//fprintf(stderr,"%p M\n", next);
++LOCAL_total_marked; ++LOCAL_total_marked;
if (next < LOCAL_HGEN) { if (next < LOCAL_HGEN) {
++LOCAL_total_oldies; ++LOCAL_total_oldies;
@ -1422,6 +1445,7 @@ mark_variable(CELL_PTR current USES_REGS)
/* speedup for leaves */ /* speedup for leaves */
while (arity && IsAtomOrIntTerm(*next)) { while (arity && IsAtomOrIntTerm(*next)) {
if (!UNMARKED_MARK(next,local_bp)) { if (!UNMARKED_MARK(next,local_bp)) {
//fprintf(stderr,"%p M\n", next);
LOCAL_total_marked++; LOCAL_total_marked++;
if (next < LOCAL_HGEN) { if (next < LOCAL_HGEN) {
LOCAL_total_oldies++; LOCAL_total_oldies++;
@ -1695,6 +1719,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
The ideal solution would be to unbind all variables. The current solution is to The ideal solution would be to unbind all variables. The current solution is to
remark it as an attributed variable */ remark it as an attributed variable */
if (IN_BETWEEN(LOCAL_GlobalBase,hp,H) && GlobalIsAttVar(hp) && !UNMARKED_MARK(hp-1,LOCAL_bp)) { if (IN_BETWEEN(LOCAL_GlobalBase,hp,H) && GlobalIsAttVar(hp) && !UNMARKED_MARK(hp-1,LOCAL_bp)) {
//fprintf(stderr,"%p M\n", hp);
LOCAL_total_marked++; LOCAL_total_marked++;
PUSH_POINTER(hp-1 PASS_REGS); PUSH_POINTER(hp-1 PASS_REGS);
if (hp-1 < LOCAL_HGEN) { if (hp-1 < LOCAL_HGEN) {
@ -3367,6 +3392,7 @@ compact_heap( USES_REGS1 )
ptr++; ptr++;
MARK(ptr); MARK(ptr);
#ifdef DEBUG #ifdef DEBUG
//fprintf(stderr,"%p U %d\n", ptr, nofcells);
found_marked+=nofcells; found_marked+=nofcells;
#endif #endif
/* first swap the tag so that it will be seen by the next step */ /* first swap the tag so that it will be seen by the next step */
@ -3381,6 +3407,7 @@ compact_heap( USES_REGS1 )
DEBUG_printf20("%p 1\n", current); DEBUG_printf20("%p 1\n", current);
} }
#ifdef DEBUG #ifdef DEBUG
// fprintf(stderr,"%p U\n", current);
found_marked++; found_marked++;
#endif /* DEBUG */ #endif /* DEBUG */
update_relocation_chain(current, dest PASS_REGS); update_relocation_chain(current, dest PASS_REGS);

4
C/index.c Normal file → Executable file
View File

@ -1888,7 +1888,6 @@ emit_single_switch_case(ClauseDef *min, struct intermediates *cint, int first, i
static UInt static UInt
suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint) suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint)
{ {
CACHE_REGS
UInt tcls = ap->cs.p_code.NOfClauses; UInt tcls = ap->cs.p_code.NOfClauses;
UInt cls = (max-min)+1; UInt cls = (max-min)+1;
@ -1924,7 +1923,10 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi
} else { } else {
Yap_IndexSpace_EXT += sz; Yap_IndexSpace_EXT += sz;
} }
{
CACHE_REGS
Yap_inform_profiler_of_clause(ncode, (CODEADDR)ncode+sz, ap, GPROF_NEW_EXPAND_BLOCK); Yap_inform_profiler_of_clause(ncode, (CODEADDR)ncode+sz, ap, GPROF_NEW_EXPAND_BLOCK);
}
/* create an expand_block */ /* create an expand_block */
ncode->opc = Yap_opcode(_expand_clauses); ncode->opc = Yap_opcode(_expand_clauses);
ncode->u.sssllp.p = ap; ncode->u.sssllp.p = ap;

2
C/qlyr.c Normal file → Executable file
View File

@ -961,7 +961,6 @@ read_ops(IOSTREAM *stream) {
static void static void
read_module(IOSTREAM *stream) { read_module(IOSTREAM *stream) {
CACHE_REGS
qlf_tag_t x; qlf_tag_t x;
InitHash(); InitHash();
@ -1045,7 +1044,6 @@ p_read_program( USES_REGS1 )
int int
Yap_Restore(char *s, char *lib_dir) Yap_Restore(char *s, char *lib_dir)
{ {
CACHE_REGS
IOSTREAM *stream = Yap_OpenRestore(s, lib_dir); IOSTREAM *stream = Yap_OpenRestore(s, lib_dir);
if (!stream) if (!stream)
return -1; return -1;

2
C/qlyw.c Normal file → Executable file
View File

@ -765,7 +765,6 @@ save_ops(IOSTREAM *stream, Term mod) {
static size_t static size_t
save_module(IOSTREAM *stream, Term mod) { save_module(IOSTREAM *stream, Term mod) {
CACHE_REGS
PredEntry *ap = Yap_ModulePred(mod); PredEntry *ap = Yap_ModulePred(mod);
InitHash(); InitHash();
ModuleAdjust(mod); ModuleAdjust(mod);
@ -803,7 +802,6 @@ save_header(IOSTREAM *stream)
static size_t static size_t
save_program(IOSTREAM *stream) { save_program(IOSTREAM *stream) {
CACHE_REGS
ModEntry *me = CurrentModules; ModEntry *me = CurrentModules;
InitHash(); InitHash();

View File

@ -466,7 +466,7 @@ static clock_t TimesStartOfTimes, Times_last_time;
/* store user time in this variable */ /* store user time in this variable */
static void static void
InitTime (int) InitTime (int wid)
{ {
HANDLE hProcess = GetCurrentProcess(); HANDLE hProcess = GetCurrentProcess();
FILETIME CreationTime, ExitTime, KernelTime, UserTime; FILETIME CreationTime, ExitTime, KernelTime, UserTime;
@ -476,6 +476,11 @@ InitTime (int)
t = clock (); t = clock ();
Times_last_time = TimesStartOfTimes = t; Times_last_time = TimesStartOfTimes = t;
} else { } else {
#if THREADS
REMOTE_ThreadHandle(wid).start_of_timesp = (struct _FILETIME *)malloc(sizeof(FILETIME));
REMOTE_ThreadHandle(wid).last_timep = (struct _FILETIME *)malloc(sizeof(FILETIME));
REMOTE_ThreadHandle(wid).start_of_times_sysp = (struct _FILETIME *)malloc(sizeof(FILETIME));
REMOTE_ThreadHandle(wid).last_time_sysp = (struct _FILETIME *)malloc(sizeof(FILETIME));
(*REMOTE_ThreadHandle(wid).last_timep).dwLowDateTime = (*REMOTE_ThreadHandle(wid).last_timep).dwLowDateTime =
UserTime.dwLowDateTime; UserTime.dwLowDateTime;
(*REMOTE_ThreadHandle(wid).last_timep).dwHighDateTime = (*REMOTE_ThreadHandle(wid).last_timep).dwHighDateTime =
@ -488,10 +493,28 @@ InitTime (int)
KernelTime.dwLowDateTime; KernelTime.dwLowDateTime;
(*REMOTE_ThreadHandle(wid).last_time_sysp).dwHighDateTime = (*REMOTE_ThreadHandle(wid).last_time_sysp).dwHighDateTime =
KernelTime.dwHighDateTime; KernelTime.dwHighDateTime;
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwLowDateTime = (*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwLowDateTime =
KernelTime.dwLowDateTime; KernelTime.dwLowDateTime;
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwHighDateTime = (*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwHighDateTime =
KernelTime.dwHighDateTime; KernelTime.dwHighDateTime;
#else
last_time.dwLowDateTime =
UserTime.dwLowDateTime;
last_time.dwHighDateTime =
UserTime.dwHighDateTime;
StartOfTimes.dwLowDateTime =
UserTime.dwLowDateTime;
StartOfTimes.dwHighDateTime =
UserTime.dwHighDateTime;
last_time_sys.dwLowDateTime =
KernelTime.dwLowDateTime;
last_time_sys.dwHighDateTime =
KernelTime.dwHighDateTime;
StartOfTimes_sys.dwLowDateTime =
KernelTime.dwLowDateTime;
StartOfTimes_sys.dwHighDateTime =
KernelTime.dwHighDateTime;
#endif
} }
} }
@ -1475,8 +1498,8 @@ STATIC_PROTO (void my_signal, (int, void (*)(int)));
static RETSIGTYPE static RETSIGTYPE
HandleMatherr(int sig) HandleMatherr(int sig)
{ {
#if HAVE_FETESTEXCEPT
CACHE_REGS CACHE_REGS
#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. */
int raised = fetestexcept(FE_ALL_EXCEPT); int raised = fetestexcept(FE_ALL_EXCEPT);

View File

@ -746,11 +746,16 @@ typedef struct thandle {
#endif #endif
pthread_mutex_t tlock; pthread_mutex_t tlock;
pthread_mutex_t tlock_status; pthread_mutex_t tlock_status;
#if HAVE_GETRUSAGE||defined(_WIN32) #if HAVE_GETRUSAGE
struct timeval *start_of_timesp; struct timeval *start_of_timesp;
struct timeval *last_timep; struct timeval *last_timep;
struct timeval *start_of_times_sysp; struct timeval *start_of_times_sysp;
struct timeval *last_time_sysp; struct timeval *last_time_sysp;
#elif _WIN32
struct _FILETIME *start_of_timesp;
struct _FILETIME *last_timep;
struct _FILETIME *start_of_times_sysp;
struct _FILETIME *last_time_sysp;
#endif #endif
} yap_thandle; } yap_thandle;
#endif /* THREADS */ #endif /* THREADS */

View File

@ -111,7 +111,9 @@ UNMARKED_MARK__(CELL* ptr, char *bp USES_REGS)
static inline void static inline void
MARK__(CELL* ptr USES_REGS) MARK__(CELL* ptr USES_REGS)
{ {
mcell(ptr) = mcell(ptr) | MARK_BIT; Int pos = ptr - (CELL *)LOCAL_GlobalBase;
char t = LOCAL_bp[pos];
LOCAL_bp[pos] = t | MARK_BIT;
} }
static inline void static inline void

13
configure vendored
View File

@ -637,6 +637,7 @@ ZLIB_TARGETS
ZLIBS ZLIBS
MAILDROP_CFLAGS MAILDROP_CFLAGS
RFC2045CHARSET RFC2045CHARSET
EXTRA_LIBS_FOR_SWIDLLS
CLIB_CRYPTLIBS CLIB_CRYPTLIBS
CLIB_NETLIBS CLIB_NETLIBS
CLIB_PLTARGETS CLIB_PLTARGETS
@ -706,7 +707,6 @@ YAP_EXTRAS
SONAMEFLAG SONAMEFLAG
DYNYAPLIB DYNYAPLIB
YAPLIB YAPLIB
EXTRA_LIBS_FOR_SWIDLLS
EXTRA_LIBS_FOR_DLLS EXTRA_LIBS_FOR_DLLS
YAPLIB_CFLAGS YAPLIB_CFLAGS
YAPLIB_LD YAPLIB_LD
@ -6921,7 +6921,6 @@ test -n "$PYTHON" || PYTHON=""none""
PYTHONHOME=`$PYTHON -c'import sys; print sys.prefix'` PYTHONHOME=`$PYTHON -c'import sys; print sys.prefix'`
PYTHONVERSION=`"$PYTHON" -c "import sys; print sys.version[:3]"` PYTHONVERSION=`"$PYTHON" -c "import sys; print sys.version[:3]"`
PYTHON_LIBS="-L $PYTHONHOME/lib -lpython$PYTHONVERSION" PYTHON_LIBS="-L $PYTHONHOME/lib -lpython$PYTHONVERSION"
LIBS="$LIBS $PYTHON_LIBS"
PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"
else else
PYTHON_TARGET="dummy" PYTHON_TARGET="dummy"
@ -7747,11 +7746,7 @@ elif test -e "$srcdir"/packages/jpl/Makefile.in; then
JAVA_HOME="$yap_cv_java" JAVA_HOME="$yap_cv_java"
case "$target_os" in case "$target_os" in
*cygwin*|*mingw*) *cygwin*|*mingw*)
if test $threads = yes; then
JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib -lpthread"
else
JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib" JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib"
fi
JPLCFLAGS="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/win32" JPLCFLAGS="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/win32"
;; ;;
*darwin*) *darwin*)
@ -8514,8 +8509,6 @@ fi
;; ;;
esac esac
EXTRA_LIBS_FOR_SWIDLLS="$EXTRA_LIBS_FOR_DLLS"
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
YAPLIB_CFLAGS="$SHLIB_CFLAGS" YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -9805,7 +9798,6 @@ CMDEXT=sh
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc threaded code" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc threaded code" >&5
@ -10909,6 +10901,9 @@ _ACEOF
fi fi
EXTRA_LIBS_FOR_SWIDLLS="$EXTRA_LIBS_FOR_DLLS $CLIB_PTHREADS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking \"variable timezone in tzset\"" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"variable timezone in tzset\"" >&5
$as_echo_n "checking \"variable timezone in tzset\"... " >&6; } $as_echo_n "checking \"variable timezone in tzset\"... " >&6; }

View File

@ -873,7 +873,6 @@ elif test -e "$srcdir"/packages/python/Makefile.in ; then
PYTHONHOME=`$PYTHON -c'import sys; print sys.prefix'` PYTHONHOME=`$PYTHON -c'import sys; print sys.prefix'`
PYTHONVERSION=`"$PYTHON" -c "import sys; print sys.version[[:3]]"` PYTHONVERSION=`"$PYTHON" -c "import sys; print sys.version[[:3]]"`
PYTHON_LIBS="-L $PYTHONHOME/lib -lpython$PYTHONVERSION" PYTHON_LIBS="-L $PYTHONHOME/lib -lpython$PYTHONVERSION"
LIBS="$LIBS $PYTHON_LIBS"
PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"
else else
PYTHON_TARGET="dummy" PYTHON_TARGET="dummy"
@ -1124,11 +1123,7 @@ elif test -e "$srcdir"/packages/jpl/Makefile.in; then
JAVA_HOME="$yap_cv_java" JAVA_HOME="$yap_cv_java"
case "$target_os" in case "$target_os" in
*cygwin*|*mingw*) *cygwin*|*mingw*)
if test $threads = yes; then
JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib -lpthread"
else
JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib" JAVALIBS="\"$JAVA_HOME\"/lib/jvm.lib"
fi
JPLCFLAGS="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/win32" JPLCFLAGS="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/win32"
;; ;;
*darwin*) *darwin*)
@ -1489,8 +1484,6 @@ dnl Linux has both elf and a.out, in this case we found elf
;; ;;
esac esac
EXTRA_LIBS_FOR_SWIDLLS="$EXTRA_LIBS_FOR_DLLS"
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
YAPLIB_CFLAGS="$SHLIB_CFLAGS" YAPLIB_CFLAGS="$SHLIB_CFLAGS"
@ -1830,7 +1823,6 @@ AC_SUBST(SHLIB_CXX_LD)
AC_SUBST(YAPLIB_LD) AC_SUBST(YAPLIB_LD)
AC_SUBST(YAPLIB_CFLAGS) AC_SUBST(YAPLIB_CFLAGS)
AC_SUBST(EXTRA_LIBS_FOR_DLLS) AC_SUBST(EXTRA_LIBS_FOR_DLLS)
AC_SUBST(EXTRA_LIBS_FOR_SWIDLLS)
dnl objects in YAP library dnl objects in YAP library
AC_SUBST(YAPLIB) AC_SUBST(YAPLIB)
AC_SUBST(DYNYAPLIB) AC_SUBST(DYNYAPLIB)
@ -2273,6 +2265,9 @@ AC_CHECK_TYPES(ssize_t, [], [],
#include <sys/socket.h> #include <sys/socket.h>
]) ])
EXTRA_LIBS_FOR_SWIDLLS="$EXTRA_LIBS_FOR_DLLS $CLIB_PTHREADS"
AC_SUBST(EXTRA_LIBS_FOR_SWIDLLS)
dnl tszet and timezone trouble dnl tszet and timezone trouble
AC_MSG_CHECKING("variable timezone in tzset") AC_MSG_CHECKING("variable timezone in tzset")

View File

@ -706,6 +706,7 @@ PL_EXPORT(int) PL_get_list_ex(term_t l, term_t h, term_t t);
PL_EXPORT(int) PL_get_nil_ex(term_t l); PL_EXPORT(int) PL_get_nil_ex(term_t l);
PL_EXPORT(int) PL_instantiation_error(term_t culprit); PL_EXPORT(int) PL_instantiation_error(term_t culprit);
PL_EXPORT(int) PL_uninstantiation_error(term_t culprit);
PL_EXPORT(int) PL_representation_error(const char *resource); PL_EXPORT(int) PL_representation_error(const char *resource);
PL_EXPORT(int) PL_type_error(const char *expected, term_t culprit); PL_EXPORT(int) PL_type_error(const char *expected, term_t culprit);
PL_EXPORT(int) PL_domain_error(const char *expected, term_t culprit); PL_EXPORT(int) PL_domain_error(const char *expected, term_t culprit);

5
os/pl-error.c Normal file → Executable file
View File

@ -204,6 +204,11 @@ PL_instantiation_error(term_t actual)
{ return PL_error(NULL, 0, NULL, ERR_INSTANTIATION); { return PL_error(NULL, 0, NULL, ERR_INSTANTIATION);
} }
int
PL_uninstantiation_error(term_t actual)
{ return PL_error(NULL, 0, NULL, ERR_UNINSTANTIATION, 0, actual);
}
int int
PL_representation_error(const char *resource) PL_representation_error(const char *resource)
{ atom_t r = PL_new_atom(resource); { atom_t r = PL_new_atom(resource);

2
packages/prism/src/c/Makefile.in Normal file → Executable file
View File

@ -71,7 +71,7 @@ mp/%.o: $(srcdir)/mp/%.c
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
@DO_SECOND_LD@prism.@SO@: $(OBJS) @DO_SECOND_LD@prism.@SO@: $(OBJS)
@DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o $@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@ @DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o $@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@ @CLIB_PTHREADS@
all: $(TARGETS) all: $(TARGETS)

@ -1 +1 @@
Subproject commit 29a8436d86886cf932a790a013cfcf10240c68c8 Subproject commit 4452ed66c995b13258d74144d64a9d9425f22e77