-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Effects-tune PersitentDict #52954
Effects-tune PersitentDict #52954
Conversation
Looks like this has a legitimate test failure:
|
Yeah, that's an embarrassing copy-paste-typo in the |
To in particular allow elimination of dead PersistentDict constructions.
trie = dict.trie | ||
h = HAMT.HashState(key) | ||
found, present, trie, i, bi, top, hs = HAMT.path(trie, key, h, #=persistent=# true) | ||
HAMT.insert!(found, present, trie, i, bi, hs, val) | ||
return new{K, V}(top) | ||
end | ||
@noinline function KeyValue.set(dict::PersistentDict{K, V}, key) where {K, V} | ||
@noinline @Base.assume_effects :nothrow :effect_free function KeyValue.set(dict::PersistentDict{K, V}, key::K, val::V) where {K, V} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon further investigation, it appears that modifying this single line is enough to remove the call to the dead PersistentDict
constructor. But, this seems to stem from an inference bug, where we're deleting statements without actually proving terminates
.
julia> @noinline Base.@assume_effects :effect_free :nothrow function foo(n)
s = 0
while true
if n - rand(1:10) > 0
s += 1
else
break
end
end
return s
end^C
julia> code_typed((Int,)) do n
foo(n)
nothing
end
1-element Vector{Any}:
CodeInfo(
1 ─ return Main.nothing
) => Nothing
So, I'd like to address this bug first and then revisit this PR.
To in particular allow elimination of dead PersistentDict constructions.
To in particular allow elimination of dead PersistentDict constructions.