4444
4545 - step 3 combines the different sections (fields of `jl_serializer_state`) into one
4646
47- - step 4 writes the values of the hard-coded tagged items and `ccallable_list`
48-
4947Much of the "real work" during deserialization is done by `get_item_for_reloc`. But a few items require specific
5048attention:
5149- uniquing: during deserialization, the target item (an "external" type or MethodInstance) must be checked against
@@ -556,7 +554,6 @@ typedef struct {
556554 arraylist_t uniquing_objs ; // a list of locations that reference non-types that must be de-duplicated
557555 arraylist_t fixup_types ; // a list of locations of types requiring (re)caching
558556 arraylist_t fixup_objs ; // a list of locations of objects requiring (re)caching
559- arraylist_t ccallable_list ; // @ccallable entry points to install
560557 // mapping from a buildid_idx to a depmods_idx
561558 jl_array_t * buildid_depmods_idxs ;
562559 // record of build_ids for all external linkages, in order of serialization for the current sysimg/pkgimg
@@ -1875,8 +1872,6 @@ static void jl_write_values(jl_serializer_state *s) JL_GC_DISABLED
18751872 else {
18761873 newm -> nroots_sysimg = m -> roots ? jl_array_len (m -> roots ) : 0 ;
18771874 }
1878- if (m -> ccallable )
1879- arraylist_push (& s -> ccallable_list , (void * )reloc_offset );
18801875 }
18811876 else if (jl_is_method_instance (v )) {
18821877 assert (f == s -> s );
@@ -2557,29 +2552,6 @@ static void jl_root_new_gvars(jl_serializer_state *s, jl_image_t *image, uint32_
25572552 }
25582553}
25592554
2560-
2561- static void jl_compile_extern (jl_method_t * m , void * sysimg_handle ) JL_GC_DISABLED
2562- {
2563- // install ccallable entry point in JIT
2564- assert (m ); // makes clang-sa happy
2565- jl_svec_t * sv = m -> ccallable ;
2566- int success = jl_compile_extern_c (NULL , NULL , sysimg_handle , jl_svecref (sv , 0 ), jl_svecref (sv , 1 ));
2567- if (!success )
2568- jl_safe_printf ("WARNING: @ccallable was already defined for this method name\n" ); // enjoy a very bad time
2569- assert (success || !sysimg_handle );
2570- }
2571-
2572-
2573- static void jl_reinit_ccallable (arraylist_t * ccallable_list , char * base , void * sysimg_handle )
2574- {
2575- for (size_t i = 0 ; i < ccallable_list -> len ; i ++ ) {
2576- uintptr_t item = (uintptr_t )ccallable_list -> items [i ];
2577- jl_method_t * m = (jl_method_t * )(base + item );
2578- jl_compile_extern (m , sysimg_handle );
2579- }
2580- }
2581-
2582-
25832555// Code below helps slim down the images by
25842556// removing cached types not referenced in the stream
25852557static jl_svec_t * jl_prune_type_cache_hash (jl_svec_t * cache ) JL_GC_DISABLED
@@ -3106,7 +3078,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
31063078 arraylist_new (& s .uniquing_objs , 0 );
31073079 arraylist_new (& s .fixup_types , 0 );
31083080 arraylist_new (& s .fixup_objs , 0 );
3109- arraylist_new (& s .ccallable_list , 0 );
31103081 s .buildid_depmods_idxs = image_to_depmodidx (mod_array );
31113082 s .link_ids_relocs = jl_alloc_array_1d (jl_array_int32_type , 0 );
31123083 s .link_ids_gctags = jl_alloc_array_1d (jl_array_int32_type , 0 );
@@ -3363,7 +3334,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
33633334 write_uint32 (f , jl_array_len (s .link_ids_external_fnvars ));
33643335 ios_write (f , (char * )jl_array_data (s .link_ids_external_fnvars , uint32_t ), jl_array_len (s .link_ids_external_fnvars ) * sizeof (uint32_t ));
33653336 write_uint32 (f , external_fns_begin );
3366- jl_write_arraylist (s .s , & s .ccallable_list );
33673337 }
33683338
33693339 assert (object_worklist .len == 0 );
@@ -3375,7 +3345,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
33753345 arraylist_free (& s .uniquing_objs );
33763346 arraylist_free (& s .fixup_types );
33773347 arraylist_free (& s .fixup_objs );
3378- arraylist_free (& s .ccallable_list );
33793348 arraylist_free (& s .memowner_list );
33803349 arraylist_free (& s .memref_list );
33813350 arraylist_free (& s .relocs_list );
@@ -3677,7 +3646,7 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
36773646 jl_array_t * * extext_methods , jl_array_t * * internal_methods ,
36783647 jl_array_t * * new_ext_cis , jl_array_t * * method_roots_list ,
36793648 jl_array_t * * edges ,
3680- char * * base , arraylist_t * ccallable_list , pkgcachesizes * cachesizes ) JL_GC_DISABLED
3649+ pkgcachesizes * cachesizes ) JL_GC_DISABLED
36813650{
36823651 jl_task_t * ct = jl_current_task ;
36833652 int en = jl_gc_enable (0 );
@@ -3804,7 +3773,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
38043773 ios_read (f , (char * )jl_array_data (s .link_ids_external_fnvars , uint32_t ), nlinks_external_fnvars * sizeof (uint32_t ));
38053774 }
38063775 uint32_t external_fns_begin = read_uint32 (f );
3807- jl_read_arraylist (s .s , ccallable_list ? ccallable_list : & s .ccallable_list );
38083776 if (s .incremental ) {
38093777 assert (restored && init_order && extext_methods && internal_methods && new_ext_cis && method_roots_list && edges );
38103778 * restored = (jl_array_t * )jl_delayed_reloc (& s , offset_restored );
@@ -3824,8 +3792,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
38243792
38253793 char * image_base = (char * )& sysimg .buf [0 ];
38263794 reloc_t * relocs_base = (reloc_t * )& relocs .buf [0 ];
3827- if (base )
3828- * base = image_base ;
38293795
38303796 s .s = & sysimg ;
38313797 jl_read_reloclist (& s , s .link_ids_gctags , GC_OLD | GC_IN_IMAGE ); // gctags
@@ -4185,11 +4151,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
41854151
41864152 s .s = & sysimg ;
41874153 jl_update_all_fptrs (& s , image ); // fptr relocs and registration
4188- if (!ccallable_list ) {
4189- // TODO: jl_sysimg_handle or img_handle?
4190- jl_reinit_ccallable (& s .ccallable_list , image_base , jl_sysimg_handle );
4191- arraylist_free (& s .ccallable_list );
4192- }
41934154 s .s = NULL ;
41944155
41954156 ios_close (& fptr_record );
@@ -4267,8 +4228,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
42674228
42684229 assert (datastartpos > 0 && datastartpos < dataendpos );
42694230 needs_permalloc = jl_options .permalloc_pkgimg || needs_permalloc ;
4270- char * base ;
4271- arraylist_t ccallable_list ;
42724231
42734232 jl_value_t * restored = NULL ;
42744233 jl_array_t * init_order = NULL , * extext_methods = NULL , * internal_methods = NULL , * new_ext_cis = NULL , * method_roots_list = NULL , * edges = NULL ;
@@ -4298,7 +4257,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
42984257 ios_static_buffer (f , sysimg , len );
42994258 pkgcachesizes cachesizes ;
43004259 jl_restore_system_image_from_stream_ (f , image , depmods , checksum , (jl_array_t * * )& restored , & init_order , & extext_methods , & internal_methods , & new_ext_cis , & method_roots_list ,
4301- & edges , & base , & ccallable_list , & cachesizes );
4260+ & edges , & cachesizes );
43024261 JL_SIGATOMIC_END ();
43034262
43044263 // Add roots to methods
@@ -4328,10 +4287,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
43284287 // now permit more methods to be added again
43294288 JL_UNLOCK (& world_counter_lock );
43304289
4331- // reinit ccallables
4332- jl_reinit_ccallable (& ccallable_list , base , pkgimage_handle );
4333- arraylist_free (& ccallable_list );
4334-
43354290 jl_value_t * ext_edges = new_ext_cis ? (jl_value_t * )new_ext_cis : jl_nothing ;
43364291
43374292 if (completeinfo ) {
@@ -4359,7 +4314,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
43594314static void jl_restore_system_image_from_stream (ios_t * f , jl_image_t * image , uint32_t checksum )
43604315{
43614316 JL_TIMING (LOAD_IMAGE , LOAD_Sysimg );
4362- jl_restore_system_image_from_stream_ (f , image , NULL , checksum | ((uint64_t )0xfdfcfbfa << 32 ), NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL );
4317+ jl_restore_system_image_from_stream_ (f , image , NULL , checksum | ((uint64_t )0xfdfcfbfa << 32 ), NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL );
43634318}
43644319
43654320JL_DLLEXPORT jl_value_t * jl_restore_incremental_from_buf (void * pkgimage_handle , const char * buf , jl_image_t * image , size_t sz , jl_array_t * depmods , int completeinfo , const char * pkgname , int needs_permalloc )
0 commit comments