@@ -1344,6 +1344,10 @@ static void jl_write_module(jl_serializer_state *s, uintptr_t item, jl_module_t
1344
1344
arraylist_push (& s -> relocs_list , (void * )(reloc_offset + offsetof(jl_module_t , usings_backedges )));
1345
1345
arraylist_push (& s -> relocs_list , (void * )backref_id (s , m -> usings_backedges , s -> link_ids_relocs ));
1346
1346
1347
+ // After reload, everything that has happened in this process happened semantically at
1348
+ // (for .incremental) or before jl_require_world, so reset this flag.
1349
+ jl_atomic_store_relaxed (& newm -> export_set_changed_since_require_world , 0 );
1350
+
1347
1351
// write out the usings list
1348
1352
memset (& newm -> usings ._space , 0 , sizeof (newm -> usings ._space ));
1349
1353
if (m -> usings .items == & m -> usings ._space [0 ]) {
@@ -1372,6 +1376,7 @@ static void jl_write_module(jl_serializer_state *s, uintptr_t item, jl_module_t
1372
1376
newm -> usings .items = (void * * )tot ;
1373
1377
arraylist_push (& s -> relocs_list , (void * )(reloc_offset + offsetof(jl_module_t , usings .items )));
1374
1378
arraylist_push (& s -> relocs_list , (void * )(((uintptr_t )DataRef << RELOC_TAG_OFFSET ) + item ));
1379
+ newm = NULL ; // `write_*(s->s)` below may invalidate `newm`, so defensively set it to NULL
1375
1380
size_t i ;
1376
1381
for (i = 0 ; i < module_usings_length (m ); i ++ ) {
1377
1382
struct _jl_module_using * data = module_usings_getidx (m , i );
@@ -1395,10 +1400,6 @@ static void jl_write_module(jl_serializer_state *s, uintptr_t item, jl_module_t
1395
1400
}
1396
1401
}
1397
1402
assert (ios_pos (s -> s ) - reloc_offset == tot );
1398
-
1399
- // After reload, everything that has happened in this process happened semantically at
1400
- // (for .incremental) or before jl_require_world, so reset this flag.
1401
- jl_atomic_store_relaxed (& newm -> export_set_changed_since_require_world , 0 );
1402
1403
}
1403
1404
1404
1405
static void record_memoryref (jl_serializer_state * s , size_t reloc_offset , jl_genericmemoryref_t ref ) {
0 commit comments