Ticket #1173: simpler-fix.patch

File simpler-fix.patch, 1.5 KB (added by sjamaan, 8 years ago)

A noninvasive patch that works with the current weak table code

  • runtime.c

    diff --git a/runtime.c b/runtime.c
    index cdaaa0e..01f26df 100644
    a b C_regparm void C_fcall really_mark(C_word *x) 
    32673267    if(is_fptr(h)) {
    32683268      val = fptr_to_ptr(h);
    32693269
     3270      /* When we marked the bucket, it may have already referred
     3271       * to the _moved_ symbol. Re-check:
     3272       */
     3273      if(C_enable_gcweak &&
     3274         (C_block_header(val) & C_HEADER_TYPE_BITS) == C_SYMBOL_TYPE &&
     3275         (wep = lookup_weak_table_entry(*x, 0)) != NULL) {
     3276        if((wep->container & WEAK_COUNTER_MAX) == 0) ++wep->container;
     3277      }
     3278
    32703279      if((C_uword)val >= (C_uword)tospace_start && (C_uword)val < (C_uword)tospace_top) {
    32713280        *x = val;
    32723281        return;
    C_regparm void C_fcall really_mark(C_word *x) 
    32803289        /* Link points into fromspace and into a link which points into from- or tospace: */
    32813290        val = fptr_to_ptr(h);
    32823291       
     3292        /* See above: might happen twice */
     3293        if(C_enable_gcweak &&
     3294           (C_block_header(val) & C_HEADER_TYPE_BITS) == C_SYMBOL_TYPE &&
     3295           ((wep = lookup_weak_table_entry((C_word)p, 0)) != NULL ||
     3296            /* Also check against original location if forwarded later.
     3297             * TODO: Can this even occur?
     3298             */
     3299            (wep = lookup_weak_table_entry(*x, 0)) != NULL)) {
     3300          if((wep->container & WEAK_COUNTER_MAX) == 0) ++wep->container;
     3301        }
     3302
    32833303        if((C_uword)val >= (C_uword)tospace_start && (C_uword)val < (C_uword)tospace_top) {
    32843304          *x = val;
    32853305          return;