Ben Gamari pushed to branch wip/T26312 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • rts/IPE.c
    ... ... @@ -313,38 +313,41 @@ void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node) {
    313 313
             barf("An IPE buffer list node has been compressed, but the "
    
    314 314
                  "decompression library (zstd) is not available.");
    
    315 315
     #else
    
    316
    +        // Decompress string table
    
    316 317
             size_t compressed_sz = ZSTD_findFrameCompressedSize(
    
    317
    -            node->string_table,
    
    318
    +            node->string_table_block->string_table,
    
    318 319
                 node->string_table_size
    
    319 320
             );
    
    320
    -        char *decompressed_strings = stgMallocBytes(
    
    321
    -            node->string_table_size,
    
    321
    +        IpeStringTableBlock *decompressed_strings = stgMallocBytes(
    
    322
    +            sizeof(IpeStringTableBlock) + node->string_table_size,
    
    322 323
                 "updateIpeMap: decompressed_strings"
    
    323 324
             );
    
    325
    +        decompressed_strings->magic = IPE_MAGIC_WORD;
    
    324 326
             ZSTD_decompress(
    
    325
    -            decompressed_strings,
    
    327
    +            decompressed_strings->string_table,
    
    326 328
                 node->string_table_size,
    
    327
    -            node->string_table,
    
    329
    +            node->string_table_block->string_table,
    
    328 330
                 compressed_sz
    
    329 331
             );
    
    330
    -        node->string_table = (const char *) decompressed_strings;
    
    332
    +        node->string_table_block = decompressed_strings;
    
    331 333
     
    
    332 334
             // Decompress the IPE data
    
    333 335
             compressed_sz = ZSTD_findFrameCompressedSize(
    
    334
    -            node->entries,
    
    336
    +            node->entries_block->entries,
    
    335 337
                 node->entries_size
    
    336 338
             );
    
    337
    -        void *decompressed_entries = stgMallocBytes(
    
    338
    -            node->entries_size,
    
    339
    +        IpeBufferEntryBlock *decompressed_entries = stgMallocBytes(
    
    340
    +            sizeof(IpeBufferEntryBlock) + node->entries_size,
    
    339 341
                 "updateIpeMap: decompressed_entries"
    
    340 342
             );
    
    343
    +        decompressed_entries->magic = IPE_MAGIC_WORD;
    
    341 344
             ZSTD_decompress(
    
    342
    -            decompressed_entries,
    
    345
    +            decompressed_entries->entries,
    
    343 346
                 node->entries_size,
    
    344
    -            node->entries,
    
    347
    +            node->entries_block->entries,
    
    345 348
                 compressed_sz
    
    346 349
             );
    
    347
    -        node->entries = decompressed_entries;
    
    350
    +        node->entries_block = decompressed_entries;
    
    348 351
     #endif // HAVE_LIBZSTD == 0
    
    349 352
     
    
    350 353
         }