@@ -2616,7 +2616,7 @@ JL_DLLEXPORT void jl_create_system_image(void **_native_data, jl_array_t *workli
26162616 if (worklist ) {
26172617 mod_array = jl_get_loaded_modules (); // __toplevel__ modules loaded in this session (from Base.loaded_modules_array)
26182618 // Generate _native_data`
2619- if (jl_options . outputo || jl_options . outputbc || jl_options . outputunoptbc || jl_options . outputasm ) {
2619+ if (_native_data != NULL ) {
26202620 jl_prepare_serialization_data (mod_array , newly_inferred , jl_worklist_key (worklist ),
26212621 & extext_methods , & new_specializations , NULL , NULL , NULL );
26222622 jl_precompile_toplevel_module = (jl_module_t * )jl_array_ptr_ref (worklist , jl_array_len (worklist )- 1 );
@@ -2635,7 +2635,7 @@ JL_DLLEXPORT void jl_create_system_image(void **_native_data, jl_array_t *workli
26352635 checksumpos_ff = checksumpos ;
26362636 }
26372637 }
2638- else {
2638+ else if ( _native_data != NULL ) {
26392639 * _native_data = jl_precompile (jl_options .compile_enabled == JL_OPTIONS_COMPILE_ALL );
26402640 }
26412641
@@ -2656,9 +2656,11 @@ JL_DLLEXPORT void jl_create_system_image(void **_native_data, jl_array_t *workli
26562656 }
26572657 datastartpos = ios_pos (ff );
26582658 }
2659- native_functions = * _native_data ;
2659+ if (_native_data != NULL )
2660+ native_functions = * _native_data ;
26602661 jl_save_system_image_to_stream (ff , worklist , extext_methods , new_specializations , method_roots_list , ext_targets , edges );
2661- native_functions = NULL ;
2662+ if (_native_data != NULL )
2663+ native_functions = NULL ;
26622664 // make sure we don't run any Julia code concurrently before this point
26632665 // Re-enable running julia code for postoutput hooks, atexit, etc.
26642666 jl_gc_enable_finalizers (ct , 1 );
0 commit comments