Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix to previous fix to THUNK_SELECTOR machinery

It turns out I didn't get it quite right in the case of compacting
collection.  This should make it work again.
  • Loading branch information...
commit 6ff4beae14211e6078b2845f52b2220d72a52228 1 parent 390b7c4
Simon Marlow authored

Showing 1 changed file with 22 additions and 19 deletions. Show diff stats Hide diff stats

  1. +22 19 rts/sm/Evac.c
41 rts/sm/Evac.c
@@ -713,18 +713,29 @@ eval_thunk_selector (StgSelector * p, rtsBool evac)
713 713 info_ptr = p->header.info;
714 714 field = get_itbl(p)->layout.selector_offset;
715 715
716   - // If the THUNK_SELECTOR is in to-space or in a generation that we
717   - // are not collecting, then bail out early. We won't be able to
718   - // save any space in any case, and updating with an indirection is
719   - // trickier in an old gen.
720 716 bd = Bdescr((StgPtr)p);
721   - if (HEAP_ALLOCED(p) &&
722   - ((bd->gen_no > N)
723   - || (bd->flags & BF_EVACUATED)
724   - || ((bd->flags & BF_COMPACTED) &&
725   - is_marked((P_)p,bd)))) {
726   - unchain_thunk_selectors(prev_thunk_selector, (StgClosure *)p);
727   - return (StgClosure *)p;
  717 + if (HEAP_ALLOCED(p)) {
  718 + // If the THUNK_SELECTOR is in to-space or in a generation that we
  719 + // are not collecting, then bale out early. We won't be able to
  720 + // save any space in any case, and updating with an indirection is
  721 + // trickier in a non-collected gen: we would have to update the
  722 + // mutable list.
  723 + if ((bd->gen_no > N) || (bd->flags & BF_EVACUATED)) {
  724 + unchain_thunk_selectors(prev_thunk_selector, (StgClosure *)p);
  725 + return (StgClosure *)p;
  726 + }
  727 + // we don't update THUNK_SELECTORS in the compacted
  728 + // generation, because compaction does not remove the INDs
  729 + // that result, this causes confusion later
  730 + // (scavenge_mark_stack doesn't deal with IND). BEWARE! This
  731 + // bit is very tricky to get right. If you make changes
  732 + // around here, test by compiling stage 3 with +RTS -c -RTS.
  733 + if (bd->flags & BF_COMPACTED) {
  734 + // must call evacuate() to mark this closure if evac==rtsTrue
  735 + if (evac) p = (StgSelector *)evacuate((StgClosure *)p);
  736 + unchain_thunk_selectors(prev_thunk_selector, (StgClosure *)p);
  737 + return (StgClosure *)p;
  738 + }
728 739 }
729 740
730 741 // BLACKHOLE the selector thunk, since it is now under evaluation.
@@ -818,14 +829,6 @@ eval_thunk_selector (StgSelector * p, rtsBool evac)
818 829 {
819 830 StgClosure *val;
820 831
821   - // we don't update THUNK_SELECTORS in the compacted
822   - // generation, because compaction does not remove the INDs
823   - // that result, this causes confusion later
824   - // (scavenge_mark_stack doesn't deal with IND).
825   - if (Bdescr((P_)selectee)->flags && BF_COMPACTED) {
826   - goto bale_out;
827   - }
828   -
829 832 // recursively evaluate this selector. We don't want to
830 833 // recurse indefinitely, so we impose a depth bound.
831 834 if (thunk_selector_depth >= MAX_THUNK_SELECTOR_DEPTH) {

0 comments on commit 6ff4bea

Please sign in to comment.
Something went wrong with that request. Please try again.