Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • utils/jsffi/dyld.mjs
    ... ... @@ -1105,6 +1105,20 @@ class DyLD {
    1105 1105
           if (/libHSghc-internal-\d+(\.\d+)*/i.test(soname)) {
    
    1106 1106
             this.rts_init();
    
    1107 1107
             delete this.rts_init;
    
    1108
    +
    
    1109
    +        // At this point the RTS symbols in linear memory are fixed
    
    1110
    +        // and constructors are run, especially the one in JSFFI.c
    
    1111
    +        // that does GHC RTS initialization for any code that links
    
    1112
    +        // JSFFI.o. Luckily no Haskell computation or gc has taken
    
    1113
    +        // place yet, so we must set keepCAFs=1 right now! Otherwise,
    
    1114
    +        // any BCO created by later TH splice or ghci expression may
    
    1115
    +        // refer to any CAF that's not reachable from GC roots (here
    
    1116
    +        // our only entry point is defaultServer) and the CAF could
    
    1117
    +        // have been GC'ed! (#26106)
    
    1118
    +        //
    
    1119
    +        // We call it here instead of in RTS C code, since we only
    
    1120
    +        // want keepCAFs=1 for ghci, not user code.
    
    1121
    +        this.exportFuncs.setKeepCAFs();
    
    1108 1122
           }
    
    1109 1123
           init();
    
    1110 1124
         }