bootstrap and small cleanups
This commit is contained in:
parent
84afde2d56
commit
94092be293
@ -2301,7 +2301,7 @@ Yap_source_line_no( void )
|
|||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_source_file_name( void )
|
Yap_source_file_name( void )
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return LOCAL_SourceFileName;
|
return LOCAL_SourceFileName;
|
||||||
}
|
}
|
||||||
@ -3688,7 +3688,7 @@ do_toggle_static_predicates_in_use(int mask)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
|
|
||||||
/* check first environments that are younger than our latest choicepoint */
|
/* check first environments that are younger than our latest choicepoint */
|
||||||
while (b_ptr > (choiceptr)env_ptr) {
|
while (b_ptr > (choiceptr)env_ptr) {
|
||||||
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
|
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
|
||||||
@ -4094,8 +4094,7 @@ cl_code_in_pred(PredEntry *pp, yamop *codeptr, CODEADDR *startp, CODEADDR *endp)
|
|||||||
static Int
|
static Int
|
||||||
code_in_pred(PredEntry *pp, Atom *pat, arity_t *parity, yamop *codeptr) {
|
code_in_pred(PredEntry *pp, Atom *pat, arity_t *parity, yamop *codeptr) {
|
||||||
Int out;
|
Int out;
|
||||||
|
PELOCK(40,pp);
|
||||||
// PELOCK(40,pp); this is deadlocking...
|
|
||||||
/* check if the codeptr comes from the indexing code */
|
/* check if the codeptr comes from the indexing code */
|
||||||
if (pp->PredFlags & IndexedPredFlag) {
|
if (pp->PredFlags & IndexedPredFlag) {
|
||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
|
2
C/exo.c
2
C/exo.c
@ -732,7 +732,7 @@ bool
|
|||||||
YAP_AssertTuples( PredEntry *pe, const Term *ts, size_t offset, size_t m)
|
YAP_AssertTuples( PredEntry *pe, const Term *ts, size_t offset, size_t m)
|
||||||
{
|
{
|
||||||
MegaClause *mcl = ClauseCodeToMegaClause(pe->cs.p_code.FirstClause);
|
MegaClause *mcl = ClauseCodeToMegaClause(pe->cs.p_code.FirstClause);
|
||||||
size_t i, n = pe->cs.p_code.NOfClauses;
|
size_t i;
|
||||||
ADDR base = (ADDR)mcl->ClCode+2*sizeof(struct index_t *);
|
ADDR base = (ADDR)mcl->ClCode+2*sizeof(struct index_t *);
|
||||||
for (i=0; i<m; i++) {
|
for (i=0; i<m; i++) {
|
||||||
yamop *ptr = (yamop *)(base+offset*(mcl->ClItemSize));
|
yamop *ptr = (yamop *)(base+offset*(mcl->ClItemSize));
|
||||||
|
7
C/grow.c
7
C/grow.c
@ -751,9 +751,10 @@ AdjustScannerStacks(TokEntry **tksp, VarEntry **vep USES_REGS)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Var_tok:
|
case Var_tok:
|
||||||
case String_tok:
|
case String_tok:
|
||||||
case WString_tok:
|
case WString_tok:
|
||||||
case StringTerm_tok:
|
case BQString_tok:
|
||||||
|
case WBQString_tok:
|
||||||
if (IsOldTrail(tks->TokInfo))
|
if (IsOldTrail(tks->TokInfo))
|
||||||
tks->TokInfo = TrailAdjust(tks->TokInfo);
|
tks->TokInfo = TrailAdjust(tks->TokInfo);
|
||||||
break;
|
break;
|
||||||
|
4
C/init.c
4
C/init.c
@ -979,7 +979,6 @@ InitStdPreds(void)
|
|||||||
Yap_InitCPreds();
|
Yap_InitCPreds();
|
||||||
Yap_InitBackCPreds();
|
Yap_InitBackCPreds();
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
Yap_InitYaamRegs( 0 );
|
|
||||||
Yap_InitPlIO();
|
Yap_InitPlIO();
|
||||||
Yap_InitFlags(false);
|
Yap_InitFlags(false);
|
||||||
#if HAVE_MPE
|
#if HAVE_MPE
|
||||||
@ -1335,7 +1334,7 @@ InitCodes(void)
|
|||||||
modp->PredFlags |= MetaPredFlag;
|
modp->PredFlags |= MetaPredFlag;
|
||||||
}
|
}
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
Yap_heap_regs->getwork_code->y_u.Otapl.p = RepPredProp(PredPropByAtom(AtomGetwork, PROLOG_MODULE));
|
v Yap_heap_regs->getwork_code->y_u.Otapl.p = RepPredProp(PredPropByAtom(AtomGetwork, PROLOG_MODULE));
|
||||||
Yap_heap_regs->getwork_seq_code->y_u.Otapl.p = RepPredProp(PredPropByAtom(AtomGetworkSeq, PROLOG_MODULE));
|
Yap_heap_regs->getwork_seq_code->y_u.Otapl.p = RepPredProp(PredPropByAtom(AtomGetworkSeq, PROLOG_MODULE));
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
@ -1458,6 +1457,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
GLOBAL_AllowLocalExpansion = TRUE;
|
GLOBAL_AllowLocalExpansion = TRUE;
|
||||||
GLOBAL_AllowTrailExpansion = TRUE;
|
GLOBAL_AllowTrailExpansion = TRUE;
|
||||||
Yap_InitExStacks (0, Trail, Stack);
|
Yap_InitExStacks (0, Trail, Stack);
|
||||||
|
Yap_InitYaamRegs( 0 );
|
||||||
InitStdPreds();
|
InitStdPreds();
|
||||||
/* make sure tmp area is available */
|
/* make sure tmp area is available */
|
||||||
{
|
{
|
||||||
|
70
C/parser.c
70
C/parser.c
@ -718,36 +718,46 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case String_tok: /* build list on the heap */
|
case String_tok: /* build list on the heap */
|
||||||
{
|
{
|
||||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||||
t = Yap_CharsToTDQ(p, CurrentModule PASS_REGS);
|
t = Yap_CharsToTDQ(p, CurrentModule PASS_REGS);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
NextToken;
|
NextToken;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WString_tok: /* build list on the heap */
|
case WString_tok: /* build list on the heap */
|
||||||
{
|
{
|
||||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||||
t = Yap_WCharsToTDQ(p, CurrentModule PASS_REGS);
|
t = Yap_WCharsToTDQ(p, CurrentModule PASS_REGS);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
NextToken;
|
NextToken;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case StringTerm_tok: /* build list on the heap */
|
case BQString_tok: /* build list on the heap */
|
||||||
{
|
{
|
||||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||||
t = Yap_CharsToString(p PASS_REGS);
|
t = Yap_CharsToTBQ(p, CurrentModule PASS_REGS);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
NextToken;
|
NextToken;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case WBQString_tok: /* build list on the heap */
|
||||||
|
{
|
||||||
|
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||||
|
t = Yap_WCharsToTBQ(p, CurrentModule PASS_REGS);
|
||||||
|
if (!t) {
|
||||||
|
FAIL;
|
||||||
|
}
|
||||||
|
NextToken;
|
||||||
|
} break;
|
||||||
|
|
||||||
case Var_tok:
|
case Var_tok:
|
||||||
varinfo = (VarEntry *)(LOCAL_tokptr->TokInfo);
|
varinfo = (VarEntry *)(LOCAL_tokptr->TokInfo);
|
||||||
if ((t = varinfo->VarAdr) == TermNil) {
|
if ((t = varinfo->VarAdr) == TermNil) {
|
||||||
|
@ -236,8 +236,7 @@ p_creep_fail( USES_REGS1 )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int stop_creeping( USES_REGS1 )
|
||||||
p_stop_creeping( USES_REGS1 )
|
|
||||||
{
|
{
|
||||||
get_signal( YAP_CREEP_SIGNAL PASS_REGS );
|
get_signal( YAP_CREEP_SIGNAL PASS_REGS );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -452,7 +451,8 @@ Yap_InitSignalCPreds(void)
|
|||||||
/* Basic predicates for the debugger */
|
/* Basic predicates for the debugger */
|
||||||
Yap_InitCPred("$creep", 0, p_creep, SafePredFlag);
|
Yap_InitCPred("$creep", 0, p_creep, SafePredFlag);
|
||||||
Yap_InitCPred("$creep_fail", 0, p_creep_fail, SafePredFlag);
|
Yap_InitCPred("$creep_fail", 0, p_creep_fail, SafePredFlag);
|
||||||
Yap_InitCPred("$stop_creeping", 0, p_stop_creeping, SafePredFlag);
|
Yap_InitCPred("$stop_creeping", 0, stop_creeping, NoTracePredFlag|HiddenPredFlag|SafePredFlag);
|
||||||
|
Yap_InitCPred("$disable_debugging", 0, stop_creeping, NoTracePredFlag|HiddenPredFlag|SafePredFlag);
|
||||||
Yap_InitCPred ("$first_signal", 1, p_first_signal, SafePredFlag|SyncPredFlag);
|
Yap_InitCPred ("$first_signal", 1, p_first_signal, SafePredFlag|SyncPredFlag);
|
||||||
Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag);
|
Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag);
|
||||||
Yap_InitCPred("$creep_allowed", 0, p_creep_allowed, 0);
|
Yap_InitCPred("$creep_allowed", 0, p_creep_allowed, 0);
|
||||||
|
@ -94,6 +94,7 @@ check_trail_consistency(void) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
volatile int v;
|
||||||
|
|
||||||
CELL old_value = 0L, old_value2 = 0L;
|
CELL old_value = 0L, old_value2 = 0L;
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
Int arity;
|
Int arity;
|
||||||
/* extern int gc_calls; */
|
/* extern int gc_calls; */
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
|
if (vsc_count == 12534) jmp_deb( 2 );
|
||||||
#if __ANDROID__ && 0
|
#if __ANDROID__ && 0
|
||||||
PredEntry *ap = pred;
|
PredEntry *ap = pred;
|
||||||
if (pred && port == enter_pred) {
|
if (pred && port == enter_pred) {
|
||||||
@ -170,7 +172,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
sc = Yap_heap_regs;
|
sc = Yap_heap_regs;
|
||||||
//if (vsc_count == 161862) jmp_deb(1);
|
//if (vsc_count == 161862) jmp_deb(1);
|
||||||
// fprintf(stderr,"B=%p ", B);
|
fprintf(stderr,"B=%ld ", LCL0-(CELL*)B);
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
LOCAL_ThreadHandle.thread_inst_count++;
|
LOCAL_ThreadHandle.thread_inst_count++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,11 +83,12 @@ typedef struct write_globs {
|
|||||||
#define lastw wglb->lw
|
#define lastw wglb->lw
|
||||||
#define last_minus wglb->last_atom_minus
|
#define last_minus wglb->last_atom_minus
|
||||||
|
|
||||||
static bool callPortray(Term t, struct DB_TERM **old_EXp USES_REGS) {
|
static bool callPortray(Term t, struct DB_TERM **old_EXp, int sno USES_REGS) {
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
Int b0 = LCL0 - (CELL *)B;
|
Int b0 = LCL0 - (CELL *)B;
|
||||||
|
|
||||||
EX = NULL;
|
EX = NULL;
|
||||||
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorPortray, USER_MODULE))) &&
|
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorPortray, USER_MODULE))) &&
|
||||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||||
Yap_execute_pred(pe, &t, true PASS_REGS)) {
|
Yap_execute_pred(pe, &t, true PASS_REGS)) {
|
||||||
@ -95,8 +96,10 @@ static bool callPortray(Term t, struct DB_TERM **old_EXp USES_REGS) {
|
|||||||
if (EX && !*old_EXp)
|
if (EX && !*old_EXp)
|
||||||
*old_EXp = EX;
|
*old_EXp = EX;
|
||||||
Yap_fail_all(B0 PASS_REGS);
|
Yap_fail_all(B0 PASS_REGS);
|
||||||
|
LOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
LOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
if (EX && !*old_EXp)
|
if (EX && !*old_EXp)
|
||||||
*old_EXp = EX;
|
*old_EXp = EX;
|
||||||
return false;
|
return false;
|
||||||
@ -903,7 +906,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wglb->Use_portray)
|
if (wglb->Use_portray)
|
||||||
if (callPortray(t, &EX PASS_REGS)) {
|
if (callPortray(t, &EX, wglb->stream-GLOBAL_Stream PASS_REGS)) {
|
||||||
EX = oEX;
|
EX = oEX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -977,7 +980,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wglb->Use_portray) {
|
if (wglb->Use_portray) {
|
||||||
if (callPortray(t, &EX PASS_REGS)) {
|
if (callPortray(t, &EX, wglb->stream-GLOBAL_Stream PASS_REGS)) {
|
||||||
EX = oEX;
|
EX = oEX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user