make sure we track both producers and consumers (I am not sure we need to track
producers, though) Always mark choicepoint, even if cp_ap==NULL (fixes wine).
This commit is contained in:
parent
22ac3ee80b
commit
11fb9183e1
63
C/heapgc.c
63
C/heapgc.c
@ -1859,6 +1859,33 @@ mark_delays(attvar_record *top, attvar_record *bottom)
|
|||||||
#define mark_delays(T,B)
|
#define mark_delays(T,B)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TABLING
|
||||||
|
static choiceptr
|
||||||
|
youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp, sg_fr_ptr *aux_sg_frp)
|
||||||
|
{
|
||||||
|
dep_fr_ptr depfr = *depfrp;
|
||||||
|
sg_fr_ptr aux_sg_fr = *aux_sg_frp;
|
||||||
|
choiceptr min = gc_B;
|
||||||
|
|
||||||
|
if (!gc_B) {
|
||||||
|
return gc_B;
|
||||||
|
}
|
||||||
|
if (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)) {
|
||||||
|
*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;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||||
@ -1874,13 +1901,11 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,Otapl);
|
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,Otapl);
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
dep_fr_ptr depfr = LOCAL_top_dep_fr;
|
dep_fr_ptr depfr = LOCAL_top_dep_fr;
|
||||||
|
sg_fr_ptr aux_sg_fr = LOCAL_top_sg_fr;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
gc_B = youngest_cp(gc_B, &depfr, &aux_sg_fr);
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
|
||||||
depfr = DepFr_next(depfr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
while (gc_B != NULL) {
|
while (gc_B != NULL) {
|
||||||
op_numbers opnum;
|
op_numbers opnum;
|
||||||
@ -1898,12 +1923,6 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
num_bs++;
|
num_bs++;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* include consumers */
|
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
|
||||||
depfr = DepFr_next(depfr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rtp == NULL) {
|
if (rtp == NULL) {
|
||||||
opnum = _table_completion;
|
opnum = _table_completion;
|
||||||
} else
|
} else
|
||||||
@ -2040,7 +2059,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
nargs = 0;
|
nargs = 0;
|
||||||
break;
|
break;
|
||||||
case _table_completion:
|
case _table_completion:
|
||||||
if (rtp) {
|
{
|
||||||
CELL *vars_ptr, vars;
|
CELL *vars_ptr, vars;
|
||||||
vars_ptr = (CELL *)(GEN_CP(gc_B) + 1);
|
vars_ptr = (CELL *)(GEN_CP(gc_B) + 1);
|
||||||
nargs = SgFr_arity(GEN_CP(gc_B)->cp_sg_fr);
|
nargs = SgFr_arity(GEN_CP(gc_B)->cp_sg_fr);
|
||||||
@ -2247,7 +2266,11 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
mark_external_reference(saved_reg);
|
mark_external_reference(saved_reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if TABLING
|
||||||
|
gc_B = youngest_cp(gc_B->cp_b, &depfr, &aux_sg_fr);
|
||||||
|
#else
|
||||||
gc_B = gc_B->cp_b;
|
gc_B = gc_B->cp_b;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2792,13 +2815,11 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
{
|
{
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
dep_fr_ptr depfr = LOCAL_top_dep_fr;
|
dep_fr_ptr depfr = LOCAL_top_dep_fr;
|
||||||
|
sg_fr_ptr aux_sg_fr = LOCAL_top_sg_fr;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
gc_B = youngest_cp(gc_B, &depfr, &aux_sg_fr);
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
|
||||||
depfr = DepFr_next(depfr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
while (gc_B != NULL) {
|
while (gc_B != NULL) {
|
||||||
yamop *rtp = gc_B->cp_ap;
|
yamop *rtp = gc_B->cp_ap;
|
||||||
@ -2806,12 +2827,6 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
op_numbers opnum;
|
op_numbers opnum;
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* include consumers */
|
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
|
||||||
depfr = DepFr_next(depfr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rtp == NULL) {
|
if (rtp == NULL) {
|
||||||
opnum = _table_completion;
|
opnum = _table_completion;
|
||||||
} else
|
} else
|
||||||
@ -2916,7 +2931,7 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _table_completion:
|
case _table_completion:
|
||||||
if (rtp) {
|
{
|
||||||
int nargs;
|
int nargs;
|
||||||
CELL *vars_ptr, vars;
|
CELL *vars_ptr, vars;
|
||||||
sweep_environments(gc_B->cp_env, EnvSize(gc_B->cp_cp), EnvBMap(gc_B->cp_cp));
|
sweep_environments(gc_B->cp_env, EnvSize(gc_B->cp_cp), EnvBMap(gc_B->cp_cp));
|
||||||
@ -3087,7 +3102,11 @@ sweep_choicepoints(choiceptr gc_B)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* link to prev choicepoint */
|
/* link to prev choicepoint */
|
||||||
|
#if TABLING
|
||||||
|
gc_B = youngest_cp(gc_B->cp_b, &depfr, &aux_sg_fr);
|
||||||
|
#else
|
||||||
gc_B = gc_B->cp_b;
|
gc_B = gc_B->cp_b;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user