@@ -422,42 +422,25 @@ void *jl_get_abi_converter(jl_task_t *ct, void *data)
422422 JL_UNLOCK (&cfun_lock);
423423 return f;
424424 };
425- jl_callptr_t invoke = nullptr ;
426425 bool is_opaque_closure = false ;
427426 jl_abi_t from_abi = { sigt, declrt, nargs, specsig, is_opaque_closure };
428- if (codeinst != NULL ) {
429- jl_value_t *astrt = codeinst->rettype ;
430- if (astrt != (jl_value_t *)jl_bottom_type &&
431- jl_type_intersection (astrt, declrt) == jl_bottom_type) {
432- // Do not warn if the function never returns since it is
433- // occasionally required by the C API (typically error callbacks)
434- // even though we're likely to encounter memory errors in that case
435- jl_printf (JL_STDERR, " WARNING: cfunction: return type of %s does not match\n " , name_from_method_instance (mi));
436- }
437- uint8_t specsigflags;
438- jl_read_codeinst_invoke (codeinst, &specsigflags, &invoke, &f, 1 );
439- if (invoke != nullptr ) {
440- if (invoke == jl_fptr_const_return_addr) {
441- return assign_fptr (jl_jit_abi_converter (ct, cfuncdata->unspecialized , from_abi, codeinst, invoke, nullptr , false ));
442- }
443- else if (invoke == jl_fptr_args_addr) {
444- assert (f);
445- if (!specsig && jl_subtype (astrt, declrt))
446- return assign_fptr (f);
447- return assign_fptr (jl_jit_abi_converter (ct, cfuncdata->unspecialized , from_abi, codeinst, invoke, f, false ));
448- }
449- else if (specsigflags & 0b1 ) {
450- assert (f);
451- if (specsig && jl_egal (mi->specTypes , sigt) && jl_egal (declrt, astrt))
452- return assign_fptr (f);
453- return assign_fptr (jl_jit_abi_converter (ct, cfuncdata->unspecialized , from_abi, codeinst, invoke, f, true ));
454- }
455- }
427+ if (codeinst == nullptr ) {
428+ // Generate an adapter to a dynamic dispatch
429+ if (cfuncdata->unspecialized == nullptr )
430+ cfuncdata->unspecialized = jl_jit_abi_converter (ct, from_abi, nullptr );
431+
432+ return assign_fptr (cfuncdata->unspecialized );
433+ }
434+
435+ jl_value_t *astrt = codeinst->rettype ;
436+ if (astrt != (jl_value_t *)jl_bottom_type &&
437+ jl_type_intersection (astrt, declrt) == jl_bottom_type) {
438+ // Do not warn if the function never returns since it is
439+ // occasionally required by the C API (typically error callbacks)
440+ // even though we're likely to encounter memory errors in that case
441+ jl_printf (JL_STDERR, " WARNING: cfunction: return type of %s does not match\n " , name_from_method_instance (mi));
456442 }
457- f = jl_jit_abi_converter (ct, cfuncdata->unspecialized , from_abi, codeinst, invoke, nullptr , false );
458- if (codeinst == nullptr )
459- cfuncdata->unspecialized = f;
460- return assign_fptr (f);
443+ return assign_fptr (jl_jit_abi_converter (ct, from_abi, codeinst));
461444}
462445
463446void jl_init_runtime_ccall (void )
0 commit comments