@@ -809,8 +809,14 @@ static void jl_queue_module_for_serialization(jl_serializer_state *s, jl_module_
809809 jl_queue_for_serialization (s , module_usings_getmod (m , i ));
810810 }
811811
812- jl_queue_for_serialization (s , m -> usings_backedges );
813- jl_queue_for_serialization (s , m -> scanned_methods );
812+ if (jl_options .trim || jl_options .strip_ir ) {
813+ record_field_change ((jl_value_t * * )& m -> usings_backedges , jl_nothing );
814+ record_field_change ((jl_value_t * * )& m -> scanned_methods , jl_nothing );
815+ }
816+ else {
817+ jl_queue_for_serialization (s , m -> usings_backedges );
818+ jl_queue_for_serialization (s , m -> scanned_methods );
819+ }
814820}
815821
816822// Anything that requires uniquing or fixing during deserialization needs to be "toplevel"
@@ -1322,10 +1328,10 @@ static void jl_write_module(jl_serializer_state *s, uintptr_t item, jl_module_t
13221328 newm -> line = 0 ;
13231329 newm -> usings_backedges = NULL ;
13241330 arraylist_push (& s -> relocs_list , (void * )(reloc_offset + offsetof(jl_module_t , usings_backedges )));
1325- arraylist_push (& s -> relocs_list , (void * )backref_id (s , m -> usings_backedges , s -> link_ids_relocs ));
1331+ arraylist_push (& s -> relocs_list , (void * )backref_id (s , get_replaceable_field ( & m -> usings_backedges , 1 ) , s -> link_ids_relocs ));
13261332 newm -> scanned_methods = NULL ;
13271333 arraylist_push (& s -> relocs_list , (void * )(reloc_offset + offsetof(jl_module_t , scanned_methods )));
1328- arraylist_push (& s -> relocs_list , (void * )backref_id (s , m -> scanned_methods , s -> link_ids_relocs ));
1334+ arraylist_push (& s -> relocs_list , (void * )backref_id (s , get_replaceable_field ( & m -> scanned_methods , 1 ) , s -> link_ids_relocs ));
13291335
13301336 // After reload, everything that has happened in this process happened semantically at
13311337 // (for .incremental) or before jl_require_world, so reset this flag.
@@ -3630,7 +3636,7 @@ static int jl_validate_binding_partition(jl_binding_t *b, jl_binding_partition_t
36303636 jl_sym_t * name = b -> globalref -> name ;
36313637 JL_LOCK (& mod -> lock );
36323638 jl_atomic_store_release (& mod -> export_set_changed_since_require_world , 1 );
3633- if (mod -> usings_backedges ) {
3639+ if (mod -> usings_backedges != jl_nothing ) {
36343640 for (size_t i = 0 ; i < jl_array_len (mod -> usings_backedges ); i ++ ) {
36353641 jl_module_t * edge = (jl_module_t * )jl_array_ptr_ref (mod -> usings_backedges , i );
36363642 jl_binding_t * importee = jl_get_module_binding (edge , name , 0 );
0 commit comments