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
@@ -556,7 +554,6 @@ typedef struct {
556
554
arraylist_t uniquing_objs ; // a list of locations that reference non-types that must be de-duplicated
557
555
arraylist_t fixup_types ; // a list of locations of types requiring (re)caching
558
556
arraylist_t fixup_objs ; // a list of locations of objects requiring (re)caching
559
- arraylist_t ccallable_list ; // @ccallable entry points to install
560
557
// mapping from a buildid_idx to a depmods_idx
561
558
jl_array_t * buildid_depmods_idxs ;
562
559
// 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
1875
1872
else {
1876
1873
newm -> nroots_sysimg = m -> roots ? jl_array_len (m -> roots ) : 0 ;
1877
1874
}
1878
- if (m -> ccallable )
1879
- arraylist_push (& s -> ccallable_list , (void * )reloc_offset );
1880
1875
}
1881
1876
else if (jl_is_method_instance (v )) {
1882
1877
assert (f == s -> s );
@@ -2557,29 +2552,6 @@ static void jl_root_new_gvars(jl_serializer_state *s, jl_image_t *image, uint32_
2557
2552
}
2558
2553
}
2559
2554
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
-
2583
2555
// Code below helps slim down the images by
2584
2556
// removing cached types not referenced in the stream
2585
2557
static 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,
3106
3078
arraylist_new (& s .uniquing_objs , 0 );
3107
3079
arraylist_new (& s .fixup_types , 0 );
3108
3080
arraylist_new (& s .fixup_objs , 0 );
3109
- arraylist_new (& s .ccallable_list , 0 );
3110
3081
s .buildid_depmods_idxs = image_to_depmodidx (mod_array );
3111
3082
s .link_ids_relocs = jl_alloc_array_1d (jl_array_int32_type , 0 );
3112
3083
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,
3363
3334
write_uint32 (f , jl_array_len (s .link_ids_external_fnvars ));
3364
3335
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 ));
3365
3336
write_uint32 (f , external_fns_begin );
3366
- jl_write_arraylist (s .s , & s .ccallable_list );
3367
3337
}
3368
3338
3369
3339
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,
3375
3345
arraylist_free (& s .uniquing_objs );
3376
3346
arraylist_free (& s .fixup_types );
3377
3347
arraylist_free (& s .fixup_objs );
3378
- arraylist_free (& s .ccallable_list );
3379
3348
arraylist_free (& s .memowner_list );
3380
3349
arraylist_free (& s .memref_list );
3381
3350
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
3677
3646
jl_array_t * * extext_methods , jl_array_t * * internal_methods ,
3678
3647
jl_array_t * * new_ext_cis , jl_array_t * * method_roots_list ,
3679
3648
jl_array_t * * edges ,
3680
- char * * base , arraylist_t * ccallable_list , pkgcachesizes * cachesizes ) JL_GC_DISABLED
3649
+ pkgcachesizes * cachesizes ) JL_GC_DISABLED
3681
3650
{
3682
3651
jl_task_t * ct = jl_current_task ;
3683
3652
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
3804
3773
ios_read (f , (char * )jl_array_data (s .link_ids_external_fnvars , uint32_t ), nlinks_external_fnvars * sizeof (uint32_t ));
3805
3774
}
3806
3775
uint32_t external_fns_begin = read_uint32 (f );
3807
- jl_read_arraylist (s .s , ccallable_list ? ccallable_list : & s .ccallable_list );
3808
3776
if (s .incremental ) {
3809
3777
assert (restored && init_order && extext_methods && internal_methods && new_ext_cis && method_roots_list && edges );
3810
3778
* 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
3824
3792
3825
3793
char * image_base = (char * )& sysimg .buf [0 ];
3826
3794
reloc_t * relocs_base = (reloc_t * )& relocs .buf [0 ];
3827
- if (base )
3828
- * base = image_base ;
3829
3795
3830
3796
s .s = & sysimg ;
3831
3797
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
4185
4151
4186
4152
s .s = & sysimg ;
4187
4153
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
- }
4193
4154
s .s = NULL ;
4194
4155
4195
4156
ios_close (& fptr_record );
@@ -4267,8 +4228,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
4267
4228
4268
4229
assert (datastartpos > 0 && datastartpos < dataendpos );
4269
4230
needs_permalloc = jl_options .permalloc_pkgimg || needs_permalloc ;
4270
- char * base ;
4271
- arraylist_t ccallable_list ;
4272
4231
4273
4232
jl_value_t * restored = NULL ;
4274
4233
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
4298
4257
ios_static_buffer (f , sysimg , len );
4299
4258
pkgcachesizes cachesizes ;
4300
4259
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 );
4302
4261
JL_SIGATOMIC_END ();
4303
4262
4304
4263
// Add roots to methods
@@ -4328,10 +4287,6 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
4328
4287
// now permit more methods to be added again
4329
4288
JL_UNLOCK (& world_counter_lock );
4330
4289
4331
- // reinit ccallables
4332
- jl_reinit_ccallable (& ccallable_list , base , pkgimage_handle );
4333
- arraylist_free (& ccallable_list );
4334
-
4335
4290
jl_value_t * ext_edges = new_ext_cis ? (jl_value_t * )new_ext_cis : jl_nothing ;
4336
4291
4337
4292
if (completeinfo ) {
@@ -4359,7 +4314,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i
4359
4314
static void jl_restore_system_image_from_stream (ios_t * f , jl_image_t * image , uint32_t checksum )
4360
4315
{
4361
4316
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 );
4363
4318
}
4364
4319
4365
4320
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