-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
effects: power-up effects analysis for array operations
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 ```
- Loading branch information
Showing
4 changed files
with
229 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
Oops, something went wrong.