Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some duplicates from emitted compilation traces #53774

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/codegen-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ JL_DLLEXPORT void jl_generate_fptr_for_unspecialized_fallback(jl_code_instance_t
jl_atomic_store_release(&unspec->invoke, &jl_fptr_interpret_call);
}

JL_DLLEXPORT void jl_compile_codeinst_fallback(jl_code_instance_t *unspec)
JL_DLLEXPORT int jl_compile_codeinst_fallback(jl_code_instance_t *unspec)
{
// Do nothing. The caller will notice that we failed to provide a an ->invoke and trigger
// appropriate fallbacks.
return 0;
}

JL_DLLEXPORT uint32_t jl_get_LLVM_VERSION_fallback(void)
Expand Down
4 changes: 2 additions & 2 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2568,12 +2568,12 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
}

JL_GC_PUSH1(&codeinst);
jl_compile_codeinst(codeinst);
int did_compile = jl_compile_codeinst(codeinst);

if (jl_atomic_load_relaxed(&codeinst->invoke) == NULL) {
// Something went wrong. Bail to the fallback path.
codeinst = NULL;
} else {
} else if (did_compile) {
record_precompile_statement(mi);
}
JL_GC_POP();
Expand Down
7 changes: 5 additions & 2 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,19 +461,22 @@ void jl_extern_c_impl(jl_value_t *declrt, jl_tupletype_t *sigt)
}

extern "C" JL_DLLEXPORT_CODEGEN
void jl_compile_codeinst_impl(jl_code_instance_t *ci)
int jl_compile_codeinst_impl(jl_code_instance_t *ci)
{
int newly_compiled = 0;
if (jl_atomic_load_relaxed(&ci->invoke) != NULL) {
return;
return newly_compiled;
}
JL_LOCK(&jl_codegen_lock);
if (jl_atomic_load_relaxed(&ci->invoke) == NULL) {
++SpecFPtrCount;
uint64_t start = jl_typeinf_timing_begin();
_jl_compile_codeinst(ci, NULL, *jl_ExecutionEngine->getContext());
jl_typeinf_timing_end(start, 0);
newly_compiled = 1;
}
JL_UNLOCK(&jl_codegen_lock); // Might GC
return newly_compiled;
}

extern "C" JL_DLLEXPORT_CODEGEN
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ JL_DLLEXPORT uint32_t jl_crc32c(uint32_t crc, const char *buf, size_t len);
#define IR_FLAG_INBOUNDS 0x01

JL_DLLIMPORT void jl_generate_fptr_for_unspecialized(jl_code_instance_t *unspec);
JL_DLLIMPORT void jl_compile_codeinst(jl_code_instance_t *unspec);
JL_DLLIMPORT int jl_compile_codeinst(jl_code_instance_t *unspec);
JL_DLLIMPORT int jl_compile_extern_c(LLVMOrcThreadSafeModuleRef llvmmod, void *params, void *sysimg, jl_value_t *declrt, jl_value_t *sigt);

typedef struct {
Expand Down