-
-
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: some improvements for type-based-effects-analysis #46329
Open
aviatesk
wants to merge
1,418
commits into
avi/typetypeinf
Choose a base branch
from
avi/moreeffects
base: avi/typetypeinf
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a1a6e2b
to
a26e76f
Compare
182729a
to
1c87730
Compare
7e48407
to
6683109
Compare
vtjnash
reviewed
Sep 12, 2022
@@ -983,6 +983,9 @@ function getfield_notundefined(@nospecialize(typ0), @nospecialize(name)) | |||
# tuples and named tuples can't be instantiated with undefined fields, | |||
# so we don't need to be conservative here | |||
return true | |||
elseif isType(typ) || typ === DataType | |||
# types have never undefined fields | |||
return true |
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.
They have .singleton
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.
(the rest of the commits look good)
…y` (#48854) Previously the `:inaccessiblememonly` effect bit may be wrongly refined when analyzing va-method, e.g.: ```julia julia> callgetfield1(xs...) = getfield(getfield(xs, 1), 1) callgetfield1 (generic function with 1 method) julia> Base.infer_effects(callgetfield1, (Base.RefValue{Symbol},)) (+c,+e,!n,+t,+s,+m,+i) # inaccessiblememonly is wrongly refined here ``` This leads to wrong concrete evaluation of `callgetfield1` and thus may result in a problem like below: ```julia julia> const GLOBAL_XS = Ref(:julia); julia> global_getfield() = callgetfield1(GLOBAL_XS); julia> @test let Base.Experimental.@force_compile global_getfield() end === :julia Test Passed julia> GLOBAL_XS[] = :julia2; julia> @test let Base.Experimental.@force_compile global_getfield() end === :julia2 # this fails Test Failed at REPL[8]:1 Expression: let #= REPL[8]:2 =# Base.Experimental.@force_compile global_getfield() end === :julia2 Evaluated: julia === julia2 ``` This commit fixes it up.
* Fix heapsize hint and use a line so that large machines utilize more of their ram
According to the Juno website, development focus has been shifted to VS Code.
…#48568) Co-authored-by: matthias314 <[email protected]>
There have been longstanding reasons to want an API for extracting all extant specializations of a method, but this is even more true after #49071. Co-authored-by: Shuhei Kadowaki <[email protected]> Co-authored-by: Jameson Nash <[email protected]>
For most applications the sample rate of 1/1000 is way too low. This will require manually setting a rate for production use, but IMO it's a lot better to make the default be taylored towards interactive/beginner use rather than deployment.
Fix LLVMPtr subtyping
Add bit to the GC tag to turn GC in image search O(1) and also increase gc interval when encountering many pointers
This helps us prove `:nothrow`-ness of `arrayset` when bounds checking is turned off manually.
This allows us to prove `:nothrow`-ness of `getfield` when bounds checking is turned off manually. It still taints `:nothrow` when a name of invalid type is given.
effects: assume `:nothrow`-ness more when bounds checking is manually turned off
Mostly by making use of newly added `:inaccessiblememonly` effect property. Now we can fold simple vector operations like: ```julia julia> function simple_vec_ops(T, op!, op, xs...) a = T[] op!(a, xs...) return op(a) end; simple_vec_ops (generic function with 1 method) julia> for T = Any[Int,Any], op! = Any[push!,pushfirst!], op = Any[length,size], xs = Any[(Int,), (Int,Int,)] let effects = Base.infer_effects(simple_vec_ops, (Type{T},typeof(op!),typeof(op),xs...)) @test Core.Compiler.is_foldable(effects) end end julia> code_typed() do simple_vec_ops(Any, push!, length, Any,nothing,Core.Const(1)) end 1-element Vector{Any}: CodeInfo( 1 ─ return 3 ) => Int64 ```
`Type`-object never has "undef" field and we should prove `getfield` access to `Type`-object is `:consistent`.
By allowing cases when `Type`-objects are returned, e.g.: ```julia @test Base.infer_effects((String,)) do a x = Ref(a) typeof(x) end |> Core.Compiler.is_consistent ```
When it's applied to non-immutable object, we can taint `:consistent`-cy by `CONSISTENT_IF_INACCESSIBLEMEMONLY` instead of `ALWAYS_FALSE`.
This reverts commit 1a29a83.
1c87730
to
b561998
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By allowing cases when
Type
-objects are returned, e.g.:When it's applied to non-immutable object, we can taint
:consistent
-cyby
CONSISTENT_IF_INACCESSIBLEMEMONLY
instead ofALWAYS_FALSE
.