44
44
45
45
- step 3 combines the different sections (fields of `jl_serializer_state`) into one
46
46
47
- - step 4 writes the values of the hard-coded tagged items and `ccallable_list`
48
-
49
47
Much of the "real work" during deserialization is done by `get_item_for_reloc`. But a few items require specific
50
48
attention:
51
49
- uniquing: during deserialization, the target item (an "external" type or MethodInstance) must be checked against
@@ -538,7 +536,6 @@ typedef struct {
538
536
arraylist_t uniquing_objs ; // a list of locations that reference non-types that must be de-duplicated
539
537
arraylist_t fixup_types ; // a list of locations of types requiring (re)caching
540
538
arraylist_t fixup_objs ; // a list of locations of objects requiring (re)caching
541
- arraylist_t ccallable_list ; // @ccallable entry points to install
542
539
// mapping from a buildid_idx to a depmods_idx
543
540
jl_array_t * buildid_depmods_idxs ;
544
541
// 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
1772
1769
else {
1773
1770
newm -> nroots_sysimg = m -> roots ? jl_array_len (m -> roots ) : 0 ;
1774
1771
}
1775
- if (m -> ccallable )
1776
- arraylist_push (& s -> ccallable_list , (void * )reloc_offset );
1777
1772
}
1778
1773
else if (jl_is_method_instance (v )) {
1779
1774
assert (f == s -> s );
@@ -2451,29 +2446,6 @@ static void jl_root_new_gvars(jl_serializer_state *s, jl_image_t *image, uint32_
2451
2446
}
2452
2447
}
2453
2448
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
-
2477
2449
// Code below helps slim down the images by
2478
2450
// removing cached types not referenced in the stream
2479
2451
static 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,
3002
2974
arraylist_new (& s .uniquing_objs , 0 );
3003
2975
arraylist_new (& s .fixup_types , 0 );
3004
2976
arraylist_new (& s .fixup_objs , 0 );
3005
- arraylist_new (& s .ccallable_list , 0 );
3006
2977
s .buildid_depmods_idxs = image_to_depmodidx (mod_array );
3007
2978
s .link_ids_relocs = jl_alloc_array_1d (jl_array_int32_type , 0 );
3008
2979
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,
3247
3218
write_uint32 (f , jl_array_len (s .link_ids_external_fnvars ));
3248
3219
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 ));
3249
3220
write_uint32 (f , external_fns_begin );
3250
- jl_write_arraylist (s .s , & s .ccallable_list );
3251
3221
}
3252
3222
3253
3223
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,
3259
3229
arraylist_free (& s .uniquing_objs );
3260
3230
arraylist_free (& s .fixup_types );
3261
3231
arraylist_free (& s .fixup_objs );
3262
- arraylist_free (& s .ccallable_list );
3263
3232
arraylist_free (& s .memowner_list );
3264
3233
arraylist_free (& s .memref_list );
3265
3234
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
3473
3442
jl_array_t * * extext_methods , jl_array_t * * internal_methods ,
3474
3443
jl_array_t * * new_ext_cis , jl_array_t * * method_roots_list ,
3475
3444
jl_array_t * * edges ,
3476
- char * * base , arraylist_t * ccallable_list , pkgcachesizes * cachesizes ) JL_GC_DISABLED
3445
+ pkgcachesizes * cachesizes ) JL_GC_DISABLED
3477
3446
{
3478
3447
jl_task_t * ct = jl_current_task ;
3479
3448
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
3600
3569
ios_read (f , (char * )jl_array_data (s .link_ids_external_fnvars , uint32_t ), nlinks_external_fnvars * sizeof (uint32_t ));
3601
3570
}
3602
3571
uint32_t external_fns_begin = read_uint32 (f );
3603
- jl_read_arraylist (s .s , ccallable_list ? ccallable_list : & s .ccallable_list );
3604
3572
if (s .incremental ) {
3605
3573
assert (restored && init_order && extext_methods && internal_methods && new_ext_cis && method_roots_list && edges );
3606
3574
* 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
3620
3588
3621
3589
char * image_base = (char * )& sysimg .buf [0 ];
3622
3590
reloc_t * relocs_base = (reloc_t * )& relocs .buf [0 ];
3623
- if (base )
3624
- * base = image_base ;
3625
3591
3626
3592
s .s = & sysimg ;
3627
3593
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
3965
3931
3966
3932
s .s = & sysimg ;
3967
3933
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
- }
3973
3934
s .s = NULL ;
3974
3935
3975
3936
ios_close (& fptr_record );
@@ -4047,8 +4008,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
4047
4008
4048
4009
assert (datastartpos > 0 && datastartpos < dataendpos );
4049
4010
needs_permalloc = jl_options .permalloc_pkgimg || needs_permalloc ;
4050
- char * base ;
4051
- arraylist_t ccallable_list ;
4052
4011
4053
4012
jl_value_t * restored = NULL ;
4054
4013
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
4078
4037
ios_static_buffer (f , sysimg , len );
4079
4038
pkgcachesizes cachesizes ;
4080
4039
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 );
4082
4041
JL_SIGATOMIC_END ();
4083
4042
4084
4043
// 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
4110
4069
JL_UNLOCK (& world_counter_lock );
4111
4070
// but one of those immediate users is going to be our cache insertions
4112
4071
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 );
4116
4072
4117
4073
if (completeinfo ) {
4118
4074
cachesizes_sv = jl_alloc_svec (7 );
@@ -4140,7 +4096,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
4140
4096
static void jl_restore_system_image_from_stream (ios_t * f , jl_image_t * image , uint32_t checksum )
4141
4097
{
4142
4098
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 );
4144
4100
}
4145
4101
4146
4102
JL_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