Skip to content

Commit

Permalink
Cleanups for tagged code instance (#53336)
Browse files Browse the repository at this point in the history
Two small cleanups to #52233
- Don't use foreign code-instances for native code caching decision
making
- don't return a non-native codeinst for jl_method_compiled

---------

Co-authored-by: Keno Fischer <keno@juliahub.com>
  • Loading branch information
vchuravy and Keno authored Feb 15, 2024
1 parent 4c2633c commit 2c0098e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2368,12 +2368,13 @@ jl_method_instance_t *jl_get_unspecialized(jl_method_t *def JL_PROPAGATES_ROOT)
jl_code_instance_t *jl_method_compiled(jl_method_instance_t *mi, size_t world)
{
jl_code_instance_t *codeinst = jl_atomic_load_relaxed(&mi->cache);
while (codeinst) {
for (; codeinst; codeinst = jl_atomic_load_relaxed(&codeinst->next)) {
if (codeinst->owner != jl_nothing)
continue;
if (jl_atomic_load_relaxed(&codeinst->min_world) <= world && world <= jl_atomic_load_relaxed(&codeinst->max_world)) {
if (jl_atomic_load_relaxed(&codeinst->invoke) != NULL)
return codeinst;
}
codeinst = jl_atomic_load_relaxed(&codeinst->next);
}
return NULL;
}
Expand Down
5 changes: 4 additions & 1 deletion src/precompile_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ static int precompile_enq_specialization_(jl_method_instance_t *mi, void *closur
jl_code_instance_t *codeinst = jl_atomic_load_relaxed(&mi->cache);
while (codeinst) {
int do_compile = 0;
if (jl_atomic_load_relaxed(&codeinst->invoke) != jl_fptr_const_return) {
if (codeinst->owner != jl_nothing) {
// TODO(vchuravy) native code caching for foreign interpreters
}
else if (jl_atomic_load_relaxed(&codeinst->invoke) != jl_fptr_const_return) {
jl_value_t *inferred = jl_atomic_load_relaxed(&codeinst->inferred);
if (inferred &&
inferred != jl_nothing &&
Expand Down

0 comments on commit 2c0098e

Please sign in to comment.