fixes to garbage collector
fixes to debugger git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1558 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
ae98f71fd9
commit
cf669ee72b
158
C/cdmgr.c
158
C/cdmgr.c
@ -11,8 +11,11 @@
|
||||
* File: cdmgr.c *
|
||||
* comments: Code manager *
|
||||
* *
|
||||
* Last rev: $Date: 2006-02-01 13:28:56 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-03-06 14:04:56 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.176 2006/02/01 13:28:56 vsc
|
||||
* bignum support fixes
|
||||
*
|
||||
* Revision 1.175 2006/01/08 03:12:00 vsc
|
||||
* fix small bug in attvar handling.
|
||||
*
|
||||
@ -3207,7 +3210,7 @@ all_cps(choiceptr b_ptr)
|
||||
bp = H;
|
||||
H += 2;
|
||||
/* notice that MkIntegerTerm may increase the Heap */
|
||||
bp[0] = MkIntegerTerm((Int)b_ptr->cp_ap);
|
||||
bp[0] = MkIntegerTerm((Int)(LCL0-(CELL *)b_ptr));
|
||||
if (H >= ASP) {
|
||||
bp[1] = TermNil;
|
||||
return tf;
|
||||
@ -3243,6 +3246,12 @@ Yap_all_calls(void)
|
||||
return all_calls();
|
||||
}
|
||||
|
||||
static Int
|
||||
p_all_choicepoints(void)
|
||||
{
|
||||
return Yap_unify(ARG1,all_cps(B));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_current_stack(void)
|
||||
{
|
||||
@ -5311,6 +5320,149 @@ p_program_continuation(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Term
|
||||
BuildActivePred(PredEntry *ap, CELL *vect)
|
||||
{
|
||||
if (!ap->ArityOfPE) {
|
||||
return MkVarTerm();
|
||||
}
|
||||
return Yap_MkApplTerm(ap->FunctorOfPred, ap->ArityOfPE, vect);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_choicepoint_info(void)
|
||||
{
|
||||
choiceptr cptr = (choiceptr)(LCL0-IntegerOfTerm(Deref(ARG1)));
|
||||
PredEntry *pe;
|
||||
int go_on = TRUE;
|
||||
yamop *ipc = cptr->cp_ap;
|
||||
Term t, tname, tmod;
|
||||
UInt arity;
|
||||
|
||||
while (go_on) {
|
||||
op_numbers opnum = Yap_op_from_opcode(ipc->opc);
|
||||
|
||||
go_on = FALSE;
|
||||
switch (opnum) {
|
||||
#ifdef TABLING
|
||||
case _table_load_answer:
|
||||
pe = LOAD_CP(cptr)->cp_pred_entry;
|
||||
t = MkVarTerm();
|
||||
break;
|
||||
case _table_try_answer:
|
||||
case _table_retry_me:
|
||||
case _table_trust_me:
|
||||
case _table_retry:
|
||||
case _table_trust:
|
||||
case _table_completion:
|
||||
pe = GEN_CP(cptr)->cp_pred_entry;
|
||||
t = BuildActivePred(pe, (CELL *)(GEN_CP(B) + 1));
|
||||
break;
|
||||
case _table_answer_resolution:
|
||||
pe = CONS_CP(cptr)->cp_pred_entry;
|
||||
t = MkVarTerm();
|
||||
break;
|
||||
case _trie_retry_null:
|
||||
case _trie_trust_null:
|
||||
case _trie_retry_var:
|
||||
case _trie_trust_var:
|
||||
case _trie_retry_val:
|
||||
case _trie_trust_val:
|
||||
case _trie_retry_atom:
|
||||
case _trie_trust_atom:
|
||||
case _trie_retry_list:
|
||||
case _trie_trust_list:
|
||||
case _trie_retry_struct:
|
||||
case _trie_trust_struct:
|
||||
case _trie_retry_extension:
|
||||
case _trie_trust_extension:
|
||||
case _trie_retry_float:
|
||||
case _trie_trust_float:
|
||||
case _trie_retry_long:
|
||||
case _trie_trust_long:
|
||||
pe = UndefCode;
|
||||
t = MkVarTerm();
|
||||
break;
|
||||
#endif /* TABLING */
|
||||
case _or_else:
|
||||
pe = ipc->u.sla.p0;
|
||||
t = Yap_MkNewApplTerm(FunctorOr, 2);
|
||||
break;
|
||||
case _or_last:
|
||||
pe = ipc->u.p.p;
|
||||
t = Yap_MkNewApplTerm(FunctorOr, 2);
|
||||
break;
|
||||
case _retry2:
|
||||
case _retry3:
|
||||
case _retry4:
|
||||
case _trust_logical_pred:
|
||||
ipc = NEXTOP(ipc,l);
|
||||
go_on = TRUE;
|
||||
break;
|
||||
case _jump:
|
||||
ipc = ipc->u.l.l;
|
||||
go_on = TRUE;
|
||||
break;
|
||||
case _retry_c:
|
||||
case _retry_userc:
|
||||
pe = ipc->u.lds.p;
|
||||
t = BuildActivePred(pe, cptr->cp_args);
|
||||
break;
|
||||
case _retry_profiled:
|
||||
case _count_retry:
|
||||
ipc = NEXTOP(ipc,p);
|
||||
go_on = TRUE;
|
||||
break;
|
||||
case _retry_me:
|
||||
case _trust_me:
|
||||
case _count_retry_me:
|
||||
case _count_trust_me:
|
||||
case _profiled_retry_me:
|
||||
case _profiled_trust_me:
|
||||
case _retry_and_mark:
|
||||
case _profiled_retry_and_mark:
|
||||
case _retry:
|
||||
case _trust:
|
||||
pe = ipc->u.ld.p;
|
||||
t = BuildActivePred(pe, cptr->cp_args);
|
||||
break;
|
||||
case _Nstop:
|
||||
case _Ystop:
|
||||
default:
|
||||
pe = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
arity = pe->ArityOfPE;
|
||||
if (pe->ModuleOfPred != IDB_MODULE) {
|
||||
if (pe->ModuleOfPred == PROLOG_MODULE) {
|
||||
tmod = TermProlog;
|
||||
} else {
|
||||
tmod = pe->ModuleOfPred;
|
||||
}
|
||||
if (pe->ArityOfPE == 0) {
|
||||
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
|
||||
} else {
|
||||
Functor f = pe->FunctorOfPred;
|
||||
tname = MkAtomTerm(NameOfFunctor(f));
|
||||
}
|
||||
} else {
|
||||
tmod = pe->ModuleOfPred;
|
||||
if (pe->PredFlags & NumberDBPredFlag) {
|
||||
tname = MkIntegerTerm(pe->src.IndxId);
|
||||
} else if (pe->PredFlags & AtomDBPredFlag) {
|
||||
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
|
||||
} else {
|
||||
Functor f = pe->FunctorOfPred;
|
||||
tname = MkAtomTerm(NameOfFunctor(f));
|
||||
}
|
||||
}
|
||||
return Yap_unify(ARG2, tmod) &&
|
||||
Yap_unify(ARG3,tname) &&
|
||||
Yap_unify(ARG4,MkIntegerTerm(arity)) &&
|
||||
Yap_unify(ARG5,t);
|
||||
}
|
||||
|
||||
void
|
||||
Yap_InitCdMgr(void)
|
||||
{
|
||||
@ -5367,6 +5519,8 @@ Yap_InitCdMgr(void)
|
||||
Yap_InitCPred("$static_pred_statistics", 5, p_static_pred_statistics, SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$p_nth_clause", 4, p_nth_clause, SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$program_continuation", 3, p_program_continuation, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$all_choicepoints", 1, p_all_choicepoints, HiddenPredFlag);
|
||||
Yap_InitCPred("$choicepoint_info", 5, p_choicepoint_info, HiddenPredFlag);
|
||||
#ifdef DEBUG
|
||||
Yap_InitCPred("predicate_erased_statistics", 5, p_predicate_erased_statistics, SyncPredFlag);
|
||||
#endif
|
||||
|
2
C/exec.c
2
C/exec.c
@ -1796,6 +1796,8 @@ Yap_InitYaamRegs(void)
|
||||
AttsMutableList = Yap_NewTimedVar(MkIntTerm(0));
|
||||
#endif
|
||||
GcGeneration = Yap_NewTimedVar(MkIntTerm(0));
|
||||
GcCurrentPhase = 0L;
|
||||
GcPhase = Yap_NewTimedVar(MkIntTerm(GcCurrentPhase));
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
PP = NULL;
|
||||
WPP = NULL;
|
||||
|
2
C/grow.c
2
C/grow.c
@ -165,6 +165,7 @@ SetHeapRegs(void)
|
||||
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
||||
#endif
|
||||
GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(GcGeneration)));
|
||||
GcPhase = AbsAppl(PtoGloAdjust(RepAppl(GcPhase)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -218,6 +219,7 @@ SetStackRegs(void)
|
||||
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
||||
#endif
|
||||
GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(GcGeneration)));
|
||||
GcPhase = AbsAppl(PtoGloAdjust(RepAppl(GcPhase)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
25
C/heapgc.c
25
C/heapgc.c
@ -433,6 +433,8 @@ push_registers(Int num_regs, yamop *nextop)
|
||||
}
|
||||
TrailTerm(TR) = GcGeneration;
|
||||
TR++;
|
||||
TrailTerm(TR) = GcPhase;
|
||||
TR++;
|
||||
#ifdef COROUTINING
|
||||
TrailTerm(TR) = WokenGoals;
|
||||
TrailTerm(TR+1) = AttsMutableList;
|
||||
@ -495,6 +497,7 @@ pop_registers(Int num_regs, yamop *nextop)
|
||||
sal = sal->NextAE;
|
||||
}
|
||||
GcGeneration = TrailTerm(ptr++);
|
||||
GcPhase = TrailTerm(ptr++);
|
||||
#ifdef COROUTINING
|
||||
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
||||
WokenGoals = TrailTerm(ptr++);
|
||||
@ -3495,6 +3498,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
CELL *max;
|
||||
Int effectiveness, tot;
|
||||
int gc_trace;
|
||||
UInt gc_phase;
|
||||
|
||||
heap_cells = H-H0;
|
||||
gc_verbose = is_gc_verbose();
|
||||
@ -3632,19 +3636,10 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
#endif
|
||||
/* get the number of active registers */
|
||||
HGEN = H0+IntegerOfTerm(Yap_ReadTimedVar(GcGeneration));
|
||||
gc_phase = (UInt)IntegerOfTerm(Yap_ReadTimedVar(GcPhase));
|
||||
/* old HGEN are not very reliable, but still may have data to recover */
|
||||
if (HGEN < HB) {
|
||||
choiceptr b_ptr = B;
|
||||
/* cannot trust the data between HGEN and its current choice-point */
|
||||
while (b_ptr) {
|
||||
if (b_ptr->cp_h <= HGEN) {
|
||||
HGEN = b_ptr->cp_h;
|
||||
break;
|
||||
} else {
|
||||
b_ptr = b_ptr->cp_b;
|
||||
}
|
||||
}
|
||||
if (!b_ptr) HGEN = H0;
|
||||
if (gc_phase != GcCurrentPhase) {
|
||||
HGEN = H0;
|
||||
}
|
||||
/* fprintf(stderr,"HGEN is %ld, %p, %p/%p\n", IntegerOfTerm(Yap_ReadTimedVar(GcGeneration)), HGEN, H,H0);*/
|
||||
#if !GC_TAGS
|
||||
@ -3657,7 +3652,10 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
total_marked -= total_oldies;
|
||||
tot = total_marked+(HGEN-H0);
|
||||
} else {
|
||||
HGEN = H0;
|
||||
if (HGEN != H0) {
|
||||
HGEN = H0;
|
||||
GcCurrentPhase++;
|
||||
}
|
||||
tot = total_marked;
|
||||
}
|
||||
m_time = Yap_cputime();
|
||||
@ -3698,6 +3696,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
#endif
|
||||
/* fprintf(Yap_stderr,"NEW HGEN %ld (%ld)\n", H-H0, HGEN-H0);*/
|
||||
Yap_UpdateTimedVar(GcGeneration, MkIntegerTerm(H-H0));
|
||||
Yap_UpdateTimedVar(GcPhase, MkIntegerTerm(GcCurrentPhase));
|
||||
c_time = Yap_cputime();
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "%% Compress: took %g sec\n", (double)(c_time-time_start)/1000);
|
||||
|
8
C/save.c
8
C/save.c
@ -423,6 +423,8 @@ save_regs(int mode)
|
||||
putout(DEPTH);
|
||||
#endif
|
||||
putout(GcGeneration);
|
||||
putout(GcPhase);
|
||||
putout(GcCurrentPhase);
|
||||
}
|
||||
/* The operand base */
|
||||
putcellptr(CellPtr(XREGS));
|
||||
@ -832,6 +834,12 @@ get_regs(int flag)
|
||||
GcGeneration = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
GcPhase = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
GcCurrentPhase = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
}
|
||||
/* Get the old bases */
|
||||
OldXREGS = get_cellptr();
|
||||
|
9
H/Heap.h
9
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.91 2006-02-24 14:03:42 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.92 2006-03-06 14:04:56 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -98,6 +98,8 @@ typedef struct worker_local_struct {
|
||||
#endif
|
||||
/* gc_stuff */
|
||||
Term gc_generation; /* global stack limit at last generation */
|
||||
Term gc_phase; /* gc phase to be sure we are on a valid compression */
|
||||
UInt gc_current_phase; /* gc currrent phase */
|
||||
unsigned int gc_calls; /* number of times GC has been called */
|
||||
Int tot_gc_time; /* total time spent in GC */
|
||||
YAP_ULONG_LONG tot_gc_recovered; /* number of heap objects in all garbage collections */
|
||||
@ -785,7 +787,10 @@ struct various_codes *Yap_heap_regs;
|
||||
#define WokenGoals Yap_heap_regs->wl[worker_id].woken_goals
|
||||
#define AttsMutableList Yap_heap_regs->wl[worker_id].atts_mutable_list
|
||||
#endif
|
||||
/* support for generations with backtracking */
|
||||
#define GcGeneration Yap_heap_regs->wl[worker_id].gc_generation
|
||||
#define GcPhase Yap_heap_regs->wl[worker_id].gc_phase
|
||||
#define GcCurrentPhase Yap_heap_regs->wl[worker_id].gc_current_phase
|
||||
#define GcCalls Yap_heap_regs->wl[worker_id].gc_calls
|
||||
#define TotGcTime Yap_heap_regs->wl[worker_id].tot_gc_time
|
||||
#define TotGcRecovered Yap_heap_regs->wl[worker_id].tot_gc_recovered
|
||||
@ -854,6 +859,8 @@ struct various_codes *Yap_heap_regs;
|
||||
#define AttsMutableList Yap_heap_regs->wl.atts_mutable_list
|
||||
#endif
|
||||
#define GcGeneration Yap_heap_regs->wl.gc_generation
|
||||
#define GcPhase Yap_heap_regs->wl.gc_phase
|
||||
#define GcCurrentPhase Yap_heap_regs->wl.gc_current_phase
|
||||
#define GcCalls Yap_heap_regs->wl.gc_calls
|
||||
#define TotGcTime Yap_heap_regs->wl.tot_gc_time
|
||||
#define TotGcRecovered Yap_heap_regs->wl.tot_gc_recovered
|
||||
|
10
H/rheap.h
10
H/rheap.h
@ -11,8 +11,11 @@
|
||||
* File: rheap.h *
|
||||
* comments: walk through heap code *
|
||||
* *
|
||||
* Last rev: $Date: 2006-02-24 14:03:42 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-03-06 14:04:56 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.62 2006/02/24 14:03:42 vsc
|
||||
* fix refs to old LogUpd implementation (pre 5).
|
||||
*
|
||||
* Revision 1.61 2006/01/02 02:16:18 vsc
|
||||
* support new interface between YAP and GMP, so that we don't rely on our own
|
||||
* allocation routines.
|
||||
@ -493,6 +496,11 @@ restore_codes(void)
|
||||
Yap_heap_regs->wl.scratchpad.ptr =
|
||||
(char *)AddrAdjust((ADDR)Yap_heap_regs->wl.scratchpad.ptr);
|
||||
}
|
||||
Yap_heap_regs->wl.gc_generation =
|
||||
AbsAppl(PtoGloAdjust(RepAppl(Yap_heap_regs->wl.gc_generation)));
|
||||
Yap_heap_regs->wl.gc_phase =
|
||||
AbsAppl(PtoGloAdjust(RepAppl(Yap_heap_regs->wl.gc_phase)));
|
||||
/* current phase is an integer */
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
if (Yap_heap_regs->wake_up_code != NULL)
|
||||
|
@ -16,41 +16,49 @@
|
||||
|
||||
<h2>Yap-5.1.0:</h2>
|
||||
<ul>
|
||||
<li> NEW: debugger will not backtrack over complete deterministic computations.</li>
|
||||
<li> NEW: debugger can show CP stack.</li>
|
||||
<li> NEW: internal procedure to show choice-point stack.</li>
|
||||
<li> FIXED: Incremental GC could still get confused after backtracking
|
||||
over GEN marker. Associate GEN marker with timestamp and make sure
|
||||
we only use current GEN markers (obs Mark Goadrich).</li>
|
||||
<li> FIXED: Yap on OSX should not make CreepFlag a register, as this
|
||||
breaks Interrupt Handling. Also, it seems that if I do not reserve
|
||||
r13, GCC will use r14 for its own evil purposes.</li>
|
||||
<li> FIXED: make Yap files usable again as a script (Ales Kozumplik).</li>
|
||||
<li> FIXED: informational_messages was being ignored (Nicos Angelopoulos).</li>
|
||||
<li> FIXED: make Yap files usable again as a script (obs Ales Kozumplik).</li>
|
||||
<li> FIXED: silent informational_messages was being ignored (obs Nicos Angelopoulos).</li>
|
||||
<li> FIXED: initialization should only be performed after all
|
||||
consulted files are done.</li>
|
||||
<li> FIXED: garbage collector now makes refs to erased LU clauses point
|
||||
to LogUpdErasedMarker.</li>
|
||||
<li> FIXED: get rid of old code referring to LogUpds from within ImmediateSemantics.</li>
|
||||
<li> FIXED: indexing code would get confused about size of inlined
|
||||
float/1 (Paulo Moura).</li>
|
||||
float/1 (obs Paulo Moura).</li>
|
||||
<li> FIXED: broken SIGINT with tkyap (Keri Harris).</li>
|
||||
<li> FIXED: indexing of bignums was broken, just disable it for now.</li>
|
||||
<li> FIXED: pipe open was returning the same descriptor twice (Christian Thaeter).</li>
|
||||
<li> FIXED: pipe open was returning the same descriptor twice (obs Christian Thaeter).</li>
|
||||
<li> FIXED: style check should compare with true file name.</li>
|
||||
<li> FIXED: ^c should take care about TR and B.</li>
|
||||
<li> FIXED: don't pass a pointer to a mpz_t. (Nuno Fonseca)</li>
|
||||
<li> FIXED: handle heap overflow from huge atoms in Yap_LookupAtom/scanner (Nuno Fonseca).</li>
|
||||
<li> FIXED: bignum was using int where should be long int (Roberto Bagnara).</li>
|
||||
<li> FIXED: don't pass a pointer to a mpz_t. (obs Nuno Fonseca)</li>
|
||||
<li> FIXED: handle heap overflow from huge atoms in
|
||||
Yap_LookupAtom/scanner (obs Nuno Fonseca).</li>
|
||||
<li> FIXED: bignum was using int where should be long int (obs Roberto Bagnara).</li>
|
||||
<li> NEW: x86_64 should have registers, right? First cut at using them.</li>
|
||||
<li> FIXED: call_n would break under 64 bits, an int problem.</li>
|
||||
<li> FIXED: more compilation problems if GMP not there (Remko Troncon).</li>
|
||||
<li> FIXED: make syntax error report the line where the bug was (Jude Shavlik).</li>
|
||||
<li> FIXED: more compilation problems if GMP not there (obs Remko Troncon).</li>
|
||||
<li> FIXED: make syntax error report the line where the bug was (obs Jude Shavlik).</li>
|
||||
<li> FIXED: ok, MkBigInt shouldn't free the bigint.</li>
|
||||
<li> FIXED: MkBigInt already frees bigint.</li>
|
||||
<li> FIXED: don't pass a pointer to a mpz_t. (Nuno Fonseca)</li>
|
||||
<li> FIXED: YENV may be an HW register (could break some tabling code) (Remko Troncon) </li>
|
||||
<li> FIXED: don't pass a pointer to a mpz_t. (obs Nuno Fonseca)</li>
|
||||
<li> FIXED: YENV may be an HW register (could break some tabling code)
|
||||
(obs Remko Troncon) </li>
|
||||
<li> FIXED: All YAAM instructions are now brackedted, so Op introduced an { and EndOp intr
|
||||
oduces an }. This is because Ricardo assumes that. </li>
|
||||
<li> FIXED: compile attvars when COROUTING is undefined. </li>
|
||||
<li> FIXED: compiler warnings due to c-interface changes</li>.
|
||||
<li> FIXED: scanner would convert LONG_MIN to bigint, but it can be
|
||||
represent as a LONG; fixed by using mpz_fits_slong_p (Roberto Bagnara). </li>
|
||||
<li> FIXED: indexing cut should stop looking after a cut!!!! (Paulo Moura).
|
||||
represent as a LONG; fixed by using mpz_fits_slong_p (obs Roberto Bagnara). </li>
|
||||
<li> FIXED: indexing cut should stop looking after a cut!!!! (obs Paulo Moura).
|
||||
<li> FIXED: mktime was broken in WIN32. </li>
|
||||
<li> FIXED: don't assume a fixed point for WIN32 memory allocation. </li>
|
||||
<li> FIXED: don't call goal_expand when looking for handlers of undefined procedures. </li>
|
||||
@ -151,7 +159,7 @@ discontiguous. </li>
|
||||
<li> FIXED: save/restore FZ regs. </li>
|
||||
<li> FIXED: $loop_stream could be defined early in boot process. </li>
|
||||
<li> NEW: make rational trees default. </li>
|
||||
<li> NEW: make enable-max-memory default. </li>
|
||||
v<li> NEW: make enable-max-memory default. </li>
|
||||
<li> FIXED: allow people to disable indexing (obs Ricardo Lopes). </li>
|
||||
<li> FIXED: make undefined exception more ISO like (obs Paulo Moura). </li>
|
||||
<li> FIXED: add missing dependency in chr's Makefile.in. </li>
|
||||
|
@ -10258,9 +10258,10 @@ and it includes four or five fields:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The first two characters are used to point out special states of the
|
||||
debugger. If the first character is a @code{*}, execution is at a
|
||||
spy-point. If the second character is a @code{>}, execution has returned
|
||||
The first three characters are used to point out special states of the
|
||||
debugger. If the port is exit and the first character is '?', the
|
||||
current call still has alternatives to be tried. If the second character is a @code{*}, execution is at a
|
||||
spy-point. If the third character is a @code{>}, execution has returned
|
||||
either from a skip, a fail or a redo command.
|
||||
@item
|
||||
The second field is the activation number, and uniquely identifies the
|
||||
@ -10343,6 +10344,8 @@ information about @code{write_depth/2} (@pxref{I/O Control}).
|
||||
@item < - full term
|
||||
resets to the default of ten the debugger's maximum write depth. For
|
||||
more information about @code{write_depth/2} (@pxref{I/O Control}).
|
||||
@item A - alternatives
|
||||
show the list of backtrack points in the current execution.
|
||||
@end table
|
||||
|
||||
The debugging information, when fast-skip @code{quasi-leap} is used, will
|
||||
|
71
pl/debug.yap
71
pl/debug.yap
@ -318,7 +318,8 @@ debugging :-
|
||||
% we are skipping, so we can just call the goal,
|
||||
% while leaving the minimal structure in place.
|
||||
'$loop_spy'(GoalNumber, G, Module, InControl) :-
|
||||
'$system_catch'('$loop_spy2'(GoalNumber, G, Module, InControl),
|
||||
CP is '$last_choice_pt',
|
||||
'$system_catch'('$loop_spy2'(GoalNumber, CP, G, Module, InControl),
|
||||
Module, Event,
|
||||
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl)).
|
||||
|
||||
@ -357,7 +358,7 @@ debugging :-
|
||||
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl)).
|
||||
|
||||
% if we are in
|
||||
'$loop_spy2'(GoalNumber, G, Module, InControl) :-
|
||||
'$loop_spy2'(GoalNumber, CP, G, Module, InControl) :-
|
||||
/* the following choice point is where the predicate is called */
|
||||
(
|
||||
/* call port */
|
||||
@ -366,9 +367,10 @@ debugging :-
|
||||
/* go execute the predicate */
|
||||
(
|
||||
'$do_not_creep',
|
||||
'$show_trace'(exit,G,Module,GoalNumber), /* output
|
||||
message at exit */
|
||||
'$show_trace'(exit,G,Module,GoalNumber), /* output message at exit */
|
||||
/* exit port */
|
||||
/* get rid of deterministic computations */
|
||||
('$debugger_deterministic_goal'(G) -> '$cut_by'(CP) ; true),
|
||||
'$continue_debugging'
|
||||
;
|
||||
/* backtracking from exit */
|
||||
@ -448,14 +450,15 @@ debugging :-
|
||||
flush_output(user_error),
|
||||
recorded('$debug',on,R0), erase(R0),
|
||||
repeat,
|
||||
(P = exit, \+ '$debugger_deterministic_goal'(G) -> Det = '?' ; Det = ''),
|
||||
('$pred_being_spied'(G,Module) -> CSPY = '*' ; CSPY = ' '),
|
||||
( SL = L -> SLL = '>' ; SLL = ' '),
|
||||
( recorded('$debug',on, R), erase(R), fail ; true),
|
||||
( Module\=prolog,
|
||||
Module\=user ->
|
||||
format(user_error,"~a~a (~d) ~q: ~a:",[CSPY,SLL,L,P,Module])
|
||||
format(user_error,"~a~a~a (~d) ~q: ~a:",[Det,CSPY,SLL,L,P,Module])
|
||||
;
|
||||
format(user_error,"~a~a (~d) ~q:",[CSPY,SLL,L,P])
|
||||
format(user_error,"~a~a~a (~d) ~q:",[Det,CSPY,SLL,L,P])
|
||||
),
|
||||
'$debugger_write'(user_error,G),
|
||||
( nonvar(R0), recordaifnot('$debug',on,_), fail ; true),
|
||||
@ -503,12 +506,16 @@ debugging :-
|
||||
'$skipeol'(0'^),
|
||||
fail.
|
||||
'$action'(0'a,_,_,_,_) :- !, % a abort
|
||||
'$skipeol'(0'^),
|
||||
'$skipeol'(0'a),
|
||||
abort.
|
||||
'$action'(0'b,_,_,_,_) :- !, % b break
|
||||
'$skipeol'(0'b),
|
||||
break,
|
||||
fail.
|
||||
'$action'(0'A,_,_,_,_) :- !, % b break
|
||||
'$skipeol'(0'A),
|
||||
'$show_choicepoint_stack',
|
||||
fail.
|
||||
'$action'(0'c,_,_,_,_) :- !, % c creep
|
||||
'$set_yap_flags'(10,1),
|
||||
'$skipeol'(0'c).
|
||||
@ -618,6 +625,7 @@ debugging :-
|
||||
format(user_error,"<D depth D < full term~n", []),
|
||||
format(user_error,"+ spy this - nospy this~n", []),
|
||||
format(user_error,"^ view subg ^^ view using~n", []),
|
||||
format(user_error,"A alternatives~n", []),
|
||||
format(user_error,"! g execute goal~n", []).
|
||||
|
||||
'$ilgl'(C) :-
|
||||
@ -712,3 +720,52 @@ debugging :-
|
||||
'$delete_if_there'([Q|L], T, [Q|LN]) :-
|
||||
'$delete_if_there'(L, T, LN).
|
||||
|
||||
'$show_choicepoint_stack' :-
|
||||
'$all_choicepoints'(Cps),
|
||||
length(Cps,Level),
|
||||
'$debug_show_cps'(Cps,Level).
|
||||
|
||||
'$debug_show_cps'([],_).
|
||||
'$debug_show_cps'([C|Cps],Level) :-
|
||||
'$debug_show_cp'(C, Level),
|
||||
Level1 is Level-1,
|
||||
'$debug_show_cps'(Cps, Level1).
|
||||
|
||||
'$debug_show_cp'(C, Level) :-
|
||||
'$choicepoint_info'(C,Module,Name,Arity,Goal),
|
||||
'$continue_debug_show_cp'(Module,Name,Arity,Goal,Level).
|
||||
|
||||
'$continue_debug_show_cp'(prolog,'$do_live',0,(_;_),Level) :- !,
|
||||
format(user_error,' [~d] \'$toplevel\'',[Level]).
|
||||
'$continue_debug_show_cp'(prolog,'$do_log_upd_clause',4,'$do_log_upd_clause'(_,_,Goal,_),Level) :- !,
|
||||
format(user_error,' [~d] ~q~n',[Level,Goal]).
|
||||
'$continue_debug_show_cp'(prolog,'$do_static_clause',5,'$do_static_clause'(_,_,Goal,_,_),Level) :- !,
|
||||
format(user_error,' [~d] ~q~n',[Level,Goal]).
|
||||
'$continue_debug_show_cp'(Module,Name,Arity,Goal,_) :-
|
||||
functor(G0, Name, Arity), fail,
|
||||
'$hidden_predicate'(G0,Module),
|
||||
!.
|
||||
'$continue_debug_show_cp'(Module,Name,Arity,Goal,Level) :-
|
||||
var(Goal), !,
|
||||
format(user_error,' [~d] ~q:~q/~d~n',[Level,Module,Name,Arity]).
|
||||
'$continue_debug_show_cp'(Module,Name,Arity,(V1;V2),Level) :-
|
||||
var(V1), var(V2), !,
|
||||
format(user_error,' [~d] ~q:~q/~d: ;/2~n',[Level,Module,Name,Arity]).
|
||||
'$continue_debug_show_cp'(Module,Name,Arity,G,Level) :-
|
||||
format(user_error,' [~d] ~q~n',[Level,G]).
|
||||
|
||||
'$debugger_deterministic_goal'(G) :-
|
||||
'$all_choicepoints'(CPs),
|
||||
'$debugger_check_traces'(CPs,CPs1),
|
||||
'$debugger_check_loop_spy2'(CPs1,[Catch|_]),
|
||||
'$choicepoint_info'(Catch,prolog,'$catch',3,'$catch'(_,'$loop_spy_event'(_,_,G,_,_),_)).
|
||||
|
||||
'$debugger_check_traces'([CP|CPs],CPs1) :-
|
||||
'$choicepoint_info'(CP,prolog,'$trace',4,(_;_)), !,
|
||||
'$debugger_check_traces'(CPs,CPs1).
|
||||
'$debugger_check_traces'(CPs,CPs).
|
||||
|
||||
'$debugger_check_loop_spy2'([CP|CPs],CPs1) :-
|
||||
'$choicepoint_info'(CP,prolog,'$loop_spy2',5,(_;_)), !,
|
||||
'$debugger_check_loop_spy2'(CPs,CPs1).
|
||||
'$debugger_check_loop_spy2'(CPs,CPs).
|
||||
|
Reference in New Issue
Block a user