Skip to content

Commit

Permalink
Restore backdating
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jan 21, 2025
1 parent 1c34623 commit 388910d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Compiler/test/invalidation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let mi = Base.method_instance(basic_caller, (Float64,))
end

# this redefinition below should invalidate the cache
const BASIC_CALLER_WORLD = Base.get_world_counter()+1
const BASIC_CALLER_WORLD = Base.get_world_counter()
basic_callee(x) = x, x
@test !isdefined(Base.method_instance(basic_callee, (Float64,)), :cache)
let mi = Base.method_instance(basic_caller, (Float64,))
Expand Down
5 changes: 4 additions & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,10 @@ JL_DLLEXPORT jl_binding_partition_t *jl_declare_constant_val3(
break;
}
}
bpart->min_world = new_world;
// N.B.: This backdates the first definition of the constant to world age 0 for backwards compatibility
// TODO: Mark this specially with a separate partition.
if (bpart->min_world != 0)
bpart->min_world = new_world;
JL_GC_POP();
return bpart;
}
Expand Down
8 changes: 4 additions & 4 deletions test/worlds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ wc265_41332a = Task(tls_world_age)
global wc265_41332d = Task(tls_world_age)
nothing
end)()
@test wc265 + 4 == get_world_counter() == tls_world_age()
@test wc265 + 3 == get_world_counter() == tls_world_age()
schedule(wc265_41332a)
schedule(wc265_41332b)
schedule(wc265_41332c)
schedule(wc265_41332d)
@test wc265 == fetch(wc265_41332a)
@test wc265 + 2 == fetch(wc265_41332b)
@test wc265 + 4 == fetch(wc265_41332c)
@test wc265 + 2 == fetch(wc265_41332d)
@test wc265 + 1 == fetch(wc265_41332b)
@test wc265 + 3 == fetch(wc265_41332c)
@test wc265 + 1 == fetch(wc265_41332d)
chnls, tasks = Base.channeled_tasks(2, wfunc)
t265 = tasks[1]

Expand Down

0 comments on commit 388910d

Please sign in to comment.