Why not short out IND_STATICs in the GC?

Ömer Sinan Ağacan omeragacan at gmail.com
Sat Apr 27 06:44:20 UTC 2019


Hi Simon,

I'm wondering why in the GC we don't short out IND_STATICs like we do in INDs
and BLACKHOLEs. Is there a reason for that? In this code in evacuate():

      case IND_STATIC:
          evacuate_static_object(IND_STATIC_LINK((StgClosure *)q), q);
          return;

Why not do something like

      case IND_STATIC:
          q = ((StgIndStatic*)q)->indirectee;
          *p = q;
          goto loop;

I actually tried it and it broke a lot of things, but I don't understand why.
We basically turn this

    heap closure -> IND_STATIC -> heap closure

into

    heap closure -> heap closure

To me this should work, but for some reason it doesn't. Could you comment on why
this doesn't work?

Thanks,

Ömer


More information about the ghc-devs mailing list