Zubin pushed to branch ghc-9.14 at Glasgow Haskell Compiler / GHC
Commits:
-
bcc68c56
by Luite Stegeman at 2025-11-25T18:23:46+05:30
-
85e8147d
by Zubin Duggal at 2025-11-28T14:00:24+05:30
2 changed files:
Changes:
| ... | ... | @@ -321,11 +321,12 @@ threadPaused(Capability *cap, StgTSO *tso) |
| 321 | 321 | if(frame_info == &stg_bh_upd_frame_info) {
|
| 322 | 322 | // eager black hole: we do nothing
|
| 323 | 323 | |
| 324 | - // it should be a black hole that we own
|
|
| 324 | + // it should be a black hole (but we may not own it, as another
|
|
| 325 | + // thread could have raced us to claim it)
|
|
| 325 | 326 | ASSERT(bh_info == &stg_BLACKHOLE_info ||
|
| 326 | 327 | bh_info == &__stg_EAGER_BLACKHOLE_info ||
|
| 327 | 328 | bh_info == &stg_CAF_BLACKHOLE_info);
|
| 328 | - ASSERT(blackHoleOwner(bh) == tso || blackHoleOwner(bh) == NULL);
|
|
| 329 | + |
|
| 329 | 330 | } else {
|
| 330 | 331 | // lazy black hole
|
| 331 | 332 | |
| ... | ... | @@ -368,13 +369,15 @@ threadPaused(Capability *cap, StgTSO *tso) |
| 368 | 369 | // The payload of the BLACKHOLE points to the TSO
|
| 369 | 370 | RELEASE_STORE(&((StgInd *)bh)->indirectee, (StgClosure *)tso);
|
| 370 | 371 | SET_INFO_RELEASE(bh,&stg_BLACKHOLE_info);
|
| 372 | + }
|
|
| 371 | 373 | |
| 372 | - // .. and we need a write barrier, since we just mutated the closure:
|
|
| 373 | - recordClosureMutated(cap,bh);
|
|
| 374 | + // We need a write barrier, since the closure was mutated (by
|
|
| 375 | + // threadPaused for lazy black holes, or the mutator for eager
|
|
| 376 | + // black holes).
|
|
| 377 | + recordClosureMutated(cap,bh);
|
|
| 374 | 378 | |
| 375 | - // We pretend that bh has just been created.
|
|
| 376 | - LDV_RECORD_CREATE(bh);
|
|
| 377 | - }
|
|
| 379 | + // We pretend that bh has just been created.
|
|
| 380 | + LDV_RECORD_CREATE(bh);
|
|
| 378 | 381 | |
| 379 | 382 | frame = (StgClosure *) ((StgUpdateFrame *)frame + 1);
|
| 380 | 383 | if (prev_was_update_frame) {
|
| ... | ... | @@ -552,7 +552,12 @@ static int compare_path(StgWord key1, StgWord key2) |
| 552 | 552 | |
| 553 | 553 | static void addLoadedDll(LoadedDllCache *cache, const pathchar *dll_name, HINSTANCE instance)
|
| 554 | 554 | {
|
| 555 | - insertHashTable_(cache->hash, (StgWord) dll_name, instance, hash_path);
|
|
| 555 | + // dll_name might be deallocated, we need to copy it to have a stable reference to the contents
|
|
| 556 | + // See #26613
|
|
| 557 | + size_t size = wcslen(dll_name) + 1;
|
|
| 558 | + pathchar* dll_name_copy = stgMallocBytes(size * sizeof(pathchar), "addLoadedDll");
|
|
| 559 | + wcsncpy(dll_name_copy, dll_name, size);
|
|
| 560 | + insertHashTable_(cache->hash, (StgWord) dll_name_copy, instance, hash_path);
|
|
| 556 | 561 | }
|
| 557 | 562 | |
| 558 | 563 | static HINSTANCE isDllLoaded(const LoadedDllCache *cache, const pathchar *dll_name)
|