gc of tabling cps: now, if current cp is in gen chain, mark it as completion,
otherwise, mark it as trust_fail.
This commit is contained in:
parent
daa05caf86
commit
5327c8bfe7
61
C/heapgc.c
61
C/heapgc.c
@ -1861,10 +1861,9 @@ mark_delays(attvar_record *top, attvar_record *bottom)
|
|||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
static choiceptr
|
static choiceptr
|
||||||
youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp, sg_fr_ptr *aux_sg_frp)
|
youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp)
|
||||||
{
|
{
|
||||||
dep_fr_ptr depfr = *depfrp;
|
dep_fr_ptr depfr = *depfrp;
|
||||||
sg_fr_ptr aux_sg_fr = *aux_sg_frp;
|
|
||||||
choiceptr min = gc_B;
|
choiceptr min = gc_B;
|
||||||
|
|
||||||
if (!gc_B) {
|
if (!gc_B) {
|
||||||
@ -1873,15 +1872,9 @@ youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp, sg_fr_ptr *aux_sg_frp)
|
|||||||
if (depfr && min > DepFr_cons_cp(depfr)) {
|
if (depfr && min > DepFr_cons_cp(depfr)) {
|
||||||
min = DepFr_cons_cp(depfr);
|
min = DepFr_cons_cp(depfr);
|
||||||
}
|
}
|
||||||
if (aux_sg_fr && min > SgFr_gen_cp(aux_sg_fr)) {
|
|
||||||
min = SgFr_gen_cp(aux_sg_fr);
|
|
||||||
}
|
|
||||||
if (depfr && min == DepFr_cons_cp(depfr)) {
|
if (depfr && min == DepFr_cons_cp(depfr)) {
|
||||||
*depfrp = DepFr_next(depfr);
|
*depfrp = DepFr_next(depfr);
|
||||||
}
|
}
|
||||||
if (aux_sg_fr && min == SgFr_gen_cp(aux_sg_fr)) {
|
|
||||||
*aux_sg_frp = SgFr_next(aux_sg_fr);
|
|
||||||
}
|
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1905,7 +1898,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
gc_B = youngest_cp(gc_B, &depfr, &aux_sg_fr);
|
gc_B = youngest_cp(gc_B, &depfr);
|
||||||
#endif
|
#endif
|
||||||
while (gc_B != NULL) {
|
while (gc_B != NULL) {
|
||||||
op_numbers opnum;
|
op_numbers opnum;
|
||||||
@ -1924,13 +1917,23 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (rtp == NULL) {
|
if (rtp == NULL) {
|
||||||
opnum = _table_completion;
|
if (aux_sg_fr && gc_B == SgFr_gen_cp(aux_sg_fr)) {
|
||||||
} else
|
/* found generator */
|
||||||
#endif /* TABLING */
|
opnum = _table_completion;
|
||||||
{
|
} else {
|
||||||
op = rtp->opc;
|
/* found sld node is done */
|
||||||
opnum = Yap_op_from_opcode(op);
|
opnum = _trust_fail;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
#endif /* TABLING */
|
||||||
|
op = rtp->opc;
|
||||||
|
opnum = Yap_op_from_opcode(op);
|
||||||
|
#ifdef TABLING
|
||||||
|
}
|
||||||
|
if (aux_sg_fr && gc_B == SgFr_gen_cp(aux_sg_fr)) {
|
||||||
|
aux_sg_fr = SgFr_next(aux_sg_fr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (very_verbose) {
|
if (very_verbose) {
|
||||||
PredEntry *pe = Yap_PredForChoicePt(gc_B);
|
PredEntry *pe = Yap_PredForChoicePt(gc_B);
|
||||||
#if defined(ANALYST) || defined(DEBUG)
|
#if defined(ANALYST) || defined(DEBUG)
|
||||||
@ -2264,7 +2267,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if TABLING
|
#if TABLING
|
||||||
gc_B = youngest_cp(gc_B->cp_b, &depfr, &aux_sg_fr);
|
gc_B = youngest_cp(gc_B->cp_b, &depfr);
|
||||||
#else
|
#else
|
||||||
gc_B = gc_B->cp_b;
|
gc_B = gc_B->cp_b;
|
||||||
#endif
|
#endif
|
||||||
@ -2816,7 +2819,7 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
gc_B = youngest_cp(gc_B, &depfr, &aux_sg_fr);
|
gc_B = youngest_cp(gc_B, &depfr);
|
||||||
#endif
|
#endif
|
||||||
while (gc_B != NULL) {
|
while (gc_B != NULL) {
|
||||||
yamop *rtp = gc_B->cp_ap;
|
yamop *rtp = gc_B->cp_ap;
|
||||||
@ -2825,13 +2828,23 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (rtp == NULL) {
|
if (rtp == NULL) {
|
||||||
opnum = _table_completion;
|
if (aux_sg_fr && gc_B == SgFr_gen_cp(aux_sg_fr)) {
|
||||||
} else
|
/* found generator */
|
||||||
#endif /* TABLING */
|
opnum = _table_completion;
|
||||||
{
|
} else {
|
||||||
op = rtp->opc;
|
/* found sld node is done */
|
||||||
opnum = Yap_op_from_opcode(op);
|
opnum = _trust_fail;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
#endif /* TABLING */
|
||||||
|
op = rtp->opc;
|
||||||
|
opnum = Yap_op_from_opcode(op);
|
||||||
|
#ifdef TABLING
|
||||||
|
}
|
||||||
|
if (aux_sg_fr && gc_B == SgFr_gen_cp(aux_sg_fr)) {
|
||||||
|
aux_sg_fr = SgFr_next(aux_sg_fr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
restart_cp:
|
restart_cp:
|
||||||
/*
|
/*
|
||||||
@ -3097,7 +3110,7 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
|
|
||||||
/* link to prev choicepoint */
|
/* link to prev choicepoint */
|
||||||
#if TABLING
|
#if TABLING
|
||||||
gc_B = youngest_cp(gc_B->cp_b, &depfr, &aux_sg_fr);
|
gc_B = youngest_cp(gc_B->cp_b, &depfr);
|
||||||
#else
|
#else
|
||||||
gc_B = gc_B->cp_b;
|
gc_B = gc_B->cp_b;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user