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
@@ -538,7 +536,6 @@ typedef struct {
538536 arraylist_t uniquing_objs ; // a list of locations that reference non-types that must be de-duplicated
539537 arraylist_t fixup_types ; // a list of locations of types requiring (re)caching
540538 arraylist_t fixup_objs ; // a list of locations of objects requiring (re)caching
541- arraylist_t ccallable_list ; // @ccallable entry points to install
542539 // mapping from a buildid_idx to a depmods_idx
543540 jl_array_t * buildid_depmods_idxs ;
544541 // record of build_ids for all external linkages, in order of serialization for the current sysimg/pkgimg
@@ -1772,8 +1769,6 @@ static void jl_write_values(jl_serializer_state *s) JL_GC_DISABLED
17721769 else {
17731770 newm -> nroots_sysimg = m -> roots ? jl_array_len (m -> roots ) : 0 ;
17741771 }
1775- if (m -> ccallable )
1776- arraylist_push (& s -> ccallable_list , (void * )reloc_offset );
17771772 }
17781773 else if (jl_is_method_instance (v )) {
17791774 assert (f == s -> s );
@@ -2451,29 +2446,6 @@ static void jl_root_new_gvars(jl_serializer_state *s, jl_image_t *image, uint32_
24512446 }
24522447}
24532448
2454-
2455- static void jl_compile_extern (jl_method_t * m , void * sysimg_handle ) JL_GC_DISABLED
2456- {
2457- // install ccallable entry point in JIT
2458- assert (m ); // makes clang-sa happy
2459- jl_svec_t * sv = m -> ccallable ;
2460- int success = jl_compile_extern_c (NULL , NULL , sysimg_handle , jl_svecref (sv , 0 ), jl_svecref (sv , 1 ));
2461- if (!success )
2462- jl_safe_printf ("WARNING: @ccallable was already defined for this method name\n" ); // enjoy a very bad time
2463- assert (success || !sysimg_handle );
2464- }
2465-
2466-
2467- static void jl_reinit_ccallable (arraylist_t * ccallable_list , char * base , void * sysimg_handle )
2468- {
2469- for (size_t i = 0 ; i < ccallable_list -> len ; i ++ ) {
2470- uintptr_t item = (uintptr_t )ccallable_list -> items [i ];
2471- jl_method_t * m = (jl_method_t * )(base + item );
2472- jl_compile_extern (m , sysimg_handle );
2473- }
2474- }
2475-
2476-
24772449// Code below helps slim down the images by
24782450// removing cached types not referenced in the stream
24792451static jl_svec_t * jl_prune_type_cache_hash (jl_svec_t * cache ) JL_GC_DISABLED
@@ -3002,7 +2974,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
30022974 arraylist_new (& s .uniquing_objs , 0 );
30032975 arraylist_new (& s .fixup_types , 0 );
30042976 arraylist_new (& s .fixup_objs , 0 );
3005- arraylist_new (& s .ccallable_list , 0 );
30062977 s .buildid_depmods_idxs = image_to_depmodidx (mod_array );
30072978 s .link_ids_relocs = jl_alloc_array_1d (jl_array_int32_type , 0 );
30082979 s .link_ids_gctags = jl_alloc_array_1d (jl_array_int32_type , 0 );
@@ -3247,7 +3218,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
32473218 write_uint32 (f , jl_array_len (s .link_ids_external_fnvars ));
32483219 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 ));
32493220 write_uint32 (f , external_fns_begin );
3250- jl_write_arraylist (s .s , & s .ccallable_list );
32513221 }
32523222
32533223 assert (object_worklist .len == 0 );
@@ -3259,7 +3229,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
32593229 arraylist_free (& s .uniquing_objs );
32603230 arraylist_free (& s .fixup_types );
32613231 arraylist_free (& s .fixup_objs );
3262- arraylist_free (& s .ccallable_list );
32633232 arraylist_free (& s .memowner_list );
32643233 arraylist_free (& s .memref_list );
32653234 arraylist_free (& s .relocs_list );
@@ -3473,7 +3442,7 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
34733442 jl_array_t * * extext_methods , jl_array_t * * internal_methods ,
34743443 jl_array_t * * new_ext_cis , jl_array_t * * method_roots_list ,
34753444 jl_array_t * * edges ,
3476- char * * base , arraylist_t * ccallable_list , pkgcachesizes * cachesizes ) JL_GC_DISABLED
3445+ pkgcachesizes * cachesizes ) JL_GC_DISABLED
34773446{
34783447 jl_task_t * ct = jl_current_task ;
34793448 int en = jl_gc_enable (0 );
@@ -3600,7 +3569,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
36003569 ios_read (f , (char * )jl_array_data (s .link_ids_external_fnvars , uint32_t ), nlinks_external_fnvars * sizeof (uint32_t ));
36013570 }
36023571 uint32_t external_fns_begin = read_uint32 (f );
3603- jl_read_arraylist (s .s , ccallable_list ? ccallable_list : & s .ccallable_list );
36043572 if (s .incremental ) {
36053573 assert (restored && init_order && extext_methods && internal_methods && new_ext_cis && method_roots_list && edges );
36063574 * restored = (jl_array_t * )jl_delayed_reloc (& s , offset_restored );
@@ -3620,8 +3588,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
36203588
36213589 char * image_base = (char * )& sysimg .buf [0 ];
36223590 reloc_t * relocs_base = (reloc_t * )& relocs .buf [0 ];
3623- if (base )
3624- * base = image_base ;
36253591
36263592 s .s = & sysimg ;
36273593 jl_read_reloclist (& s , s .link_ids_gctags , GC_OLD | GC_IN_IMAGE ); // gctags
@@ -3965,11 +3931,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
39653931
39663932 s .s = & sysimg ;
39673933 jl_update_all_fptrs (& s , image ); // fptr relocs and registration
3968- if (!ccallable_list ) {
3969- // TODO: jl_sysimg_handle or img_handle?
3970- jl_reinit_ccallable (& s .ccallable_list , image_base , jl_sysimg_handle );
3971- arraylist_free (& s .ccallable_list );
3972- }
39733934 s .s = NULL ;
39743935
39753936 ios_close (& fptr_record );
@@ -4047,8 +4008,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
40474008
40484009 assert (datastartpos > 0 && datastartpos < dataendpos );
40494010 needs_permalloc = jl_options .permalloc_pkgimg || needs_permalloc ;
4050- char * base ;
4051- arraylist_t ccallable_list ;
40524011
40534012 jl_value_t * restored = NULL ;
40544013 jl_array_t * init_order = NULL , * extext_methods = NULL , * internal_methods = NULL , * new_ext_cis = NULL , * method_roots_list = NULL , * edges = NULL ;
@@ -4078,7 +4037,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
40784037 ios_static_buffer (f , sysimg , len );
40794038 pkgcachesizes cachesizes ;
40804039 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 ,
4081- & edges , & base , & ccallable_list , & cachesizes );
4040+ & edges , & cachesizes );
40824041 JL_SIGATOMIC_END ();
40834042
40844043 // No special processing of `new_ext_cis` is required because recaching handled it
@@ -4110,9 +4069,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
41104069 JL_UNLOCK (& world_counter_lock );
41114070 // but one of those immediate users is going to be our cache insertions
41124071 jl_insert_backedges ((jl_array_t * )edges , (jl_array_t * )new_ext_cis ); // restore existing caches (needs to be last)
4113- // reinit ccallables
4114- jl_reinit_ccallable (& ccallable_list , base , pkgimage_handle );
4115- arraylist_free (& ccallable_list );
41164072
41174073 if (completeinfo ) {
41184074 cachesizes_sv = jl_alloc_svec (7 );
@@ -4140,7 +4096,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
41404096static void jl_restore_system_image_from_stream (ios_t * f , jl_image_t * image , uint32_t checksum )
41414097{
41424098 JL_TIMING (LOAD_IMAGE , LOAD_Sysimg );
4143- jl_restore_system_image_from_stream_ (f , image , NULL , checksum | ((uint64_t )0xfdfcfbfa << 32 ), NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL );
4099+ jl_restore_system_image_from_stream_ (f , image , NULL , checksum | ((uint64_t )0xfdfcfbfa << 32 ), NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL );
41444100}
41454101
41464102JL_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