diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index 29d989a80..ea823a76c 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -5,12 +5,22 @@ on: tags: [v*] pull_request: +defaults: + run: + shell: bash + jobs: Documenter: name: Documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: nightly + - run: julia --project -e 'using Pkg; Pkg.develop([PackageSpec(path="SnoopCompileCore"), + PackageSpec(path="SnoopCompileAnalysis"), + PackageSpec(path="SnoopCompileBot")])' - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-docdeploy@releases/v1 env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 810b43b20..69c730b2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,9 @@ name: CI on: - push - pull_request +defaults: + run: + shell: bash jobs: test: if: "!contains(github.event.head_commit.message, '[skip ci]')" @@ -27,6 +30,9 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} + - run: julia --project -e 'using Pkg; Pkg.develop([PackageSpec(path="SnoopCompileCore"), + PackageSpec(path="SnoopCompileAnalysis"), + PackageSpec(path="SnoopCompileBot")])' - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-runtest@latest diff --git a/Project.toml b/Project.toml index ac1946d39..f0c8c4f6f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SnoopCompile" uuid = "aa65fe97-06da-5843-b5b1-d5d13cad87d2" author = ["Tim Holy "] -version = "1.6.0" +version = "1.6.1" [deps] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" @@ -11,9 +11,9 @@ SnoopCompileBot = "1d5e0e55-7d74-4714-b8d8-efa80e938cf7" SnoopCompileCore = "e2b509da-e806-4183-be48-004708413034" [compat] -SnoopCompileAnalysis = "1" -SnoopCompileBot = "1" -SnoopCompileCore = "1" +SnoopCompileAnalysis = "~1.6.1" +SnoopCompileBot = "~1.6.1" +SnoopCompileCore = "~1.6.1" julia = "1" [extras] diff --git a/SnoopCompileAnalysis/LICENSE.md b/SnoopCompileAnalysis/LICENSE.md new file mode 100644 index 000000000..3722d9aaa --- /dev/null +++ b/SnoopCompileAnalysis/LICENSE.md @@ -0,0 +1,22 @@ +The SnoopCompile.jl package is licensed under the MIT "Expat" License: + +> Copyright (c) 2015: Tim Holy. +> +> Permission is hereby granted, free of charge, to any person obtaining +> a copy of this software and associated documentation files (the +> "Software"), to deal in the Software without restriction, including +> without limitation the rights to use, copy, modify, merge, publish, +> distribute, sublicense, and/or sell copies of the Software, and to +> permit persons to whom the Software is furnished to do so, subject to +> the following conditions: +> +> The above copyright notice and this permission notice shall be +> included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/SnoopCompileAnalysis/Project.toml b/SnoopCompileAnalysis/Project.toml index d5d24c289..be51fc1e9 100644 --- a/SnoopCompileAnalysis/Project.toml +++ b/SnoopCompileAnalysis/Project.toml @@ -1,7 +1,7 @@ name = "SnoopCompileAnalysis" uuid = "9ea4277c-da97-4c3a-afb0-537c066769de" author = ["Tim Holy "] -version = "1.6.0" +version = "1.6.1" [deps] OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" diff --git a/SnoopCompileAnalysis/README.md b/SnoopCompileAnalysis/README.md new file mode 100644 index 000000000..4da2bba11 --- /dev/null +++ b/SnoopCompileAnalysis/README.md @@ -0,0 +1,3 @@ +# SnoopCompileAnalysis + +SnoopCompileAnalysis is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl). diff --git a/SnoopCompileAnalysis/src/invalidations.jl b/SnoopCompileAnalysis/src/invalidations.jl index 45aeffd3e..2b4dd267e 100644 --- a/SnoopCompileAnalysis/src/invalidations.jl +++ b/SnoopCompileAnalysis/src/invalidations.jl @@ -188,7 +188,7 @@ end """ trees = invalidation_trees(list) -Parse `list`, as captured by [`@snoopr`](@ref), into a set of invalidation trees, where parents nodes +Parse `list`, as captured by [`SnoopCompileCore.@snoopr`](@ref), into a set of invalidation trees, where parents nodes were called by their children. # Example @@ -284,6 +284,7 @@ function invalidation_trees(list) push!(methodinvs, sort!(MethodInvalidations(method, reason, mt_backedges, backedges, mt_cache))) mt_backedges, backedges, mt_cache = methinv_storage() leaf = nothing + reason = nothing else error("unexpected item ", item, " at ", i) end @@ -292,6 +293,7 @@ function invalidation_trees(list) reason = checkreason(reason, item) push!(backedges, getroot(leaf)) leaf = nothing + reason = nothing elseif isa(item, Type) push!(mt_backedges, item=>getroot(leaf)) leaf = nothing diff --git a/SnoopCompileBot/LICENSE.md b/SnoopCompileBot/LICENSE.md new file mode 100644 index 000000000..bee3f3c25 --- /dev/null +++ b/SnoopCompileBot/LICENSE.md @@ -0,0 +1,22 @@ +The SnoopCompile.jl package is licensed under the MIT "Expat" License: + +> Copyright (c) 2020: Amin Yahyaabadi +> +> Permission is hereby granted, free of charge, to any person obtaining +> a copy of this software and associated documentation files (the +> "Software"), to deal in the Software without restriction, including +> without limitation the rights to use, copy, modify, merge, publish, +> distribute, sublicense, and/or sell copies of the Software, and to +> permit persons to whom the Software is furnished to do so, subject to +> the following conditions: +> +> The above copyright notice and this permission notice shall be +> included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/SnoopCompileBot/Project.toml b/SnoopCompileBot/Project.toml index 3f4a22fff..42030dd8d 100644 --- a/SnoopCompileBot/Project.toml +++ b/SnoopCompileBot/Project.toml @@ -1,7 +1,7 @@ name = "SnoopCompileBot" uuid = "1d5e0e55-7d74-4714-b8d8-efa80e938cf7" author = ["Amin Yahyaabadi "] -version = "1.6.0" +version = "1.6.1" [deps] FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f" @@ -12,8 +12,8 @@ SnoopCompileCore = "e2b509da-e806-4183-be48-004708413034" [compat] FilePathsBase = "0.9" -SnoopCompileAnalysis = "1" -SnoopCompileCore = "1" +SnoopCompileAnalysis = "~1.6.1" +SnoopCompileCore = "~1.6.1" YAML = "0.4" julia = "1" diff --git a/SnoopCompileBot/README.md b/SnoopCompileBot/README.md new file mode 100644 index 000000000..5ce705711 --- /dev/null +++ b/SnoopCompileBot/README.md @@ -0,0 +1,3 @@ +# SnoopCompileBot + +SnoopCompileBot is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl). diff --git a/SnoopCompileBot/src/botutils.jl b/SnoopCompileBot/src/botutils.jl index bc254e53d..04bc34a67 100644 --- a/SnoopCompileBot/src/botutils.jl +++ b/SnoopCompileBot/src/botutils.jl @@ -82,7 +82,7 @@ Standardize different names from Github actions, Travis, etc https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources # Examples -```jldoctest +```jldoctest; setup=:(using SnoopCompile) julia> SnoopCompile.standardize_osname("ubuntu-latest") "linux" @@ -281,13 +281,13 @@ returns the Julia version number by following the same specifications as Version `JuliaVersionNumber` will fetch the latest nightly version number if `"nightly"` or `"latest"` is given as the input. # Examples ```julia -julia> JuliaVersionNumber("nightly") +julia> SnoopCompile.JuliaVersionNumber("nightly") v"1.6.0-DEV" ``` -```jldoctest -julia> JuliaVersionNumber("1.2.3") +```jldoctest; setup=:(using SnoopCompile) +julia> SnoopCompile.JuliaVersionNumber("1.2.3") v"1.2.3" -julia> JuliaVersionNumber(v"1.2.3") +julia> SnoopCompile.JuliaVersionNumber(v"1.2.3") v"1.2.3" ``` """ diff --git a/SnoopCompileBot/src/snoop_bench.jl b/SnoopCompileBot/src/snoop_bench.jl index 6be3aef26..3c680b79b 100644 --- a/SnoopCompileBot/src/snoop_bench.jl +++ b/SnoopCompileBot/src/snoop_bench.jl @@ -109,7 +109,7 @@ Benchmark the impact of precompile statements, by running a script with and with `config` can be generated by [`BotConfig`](@ref). `path_to_example_script` is preferred to be an absolute path. The example script will be run in the module specified by `test_modul`. -`snoop_mode` can be `:auto`, `:snoopi` (to test with [`@snoopi`](@ref)), +`snoop_mode` can be `:auto`, `:snoopi` (to test with [`SnoopCompileCore.@snoopi`](@ref)), or `:runtime` (to measure total script run time with `@timev`). `:auto` chooses `:snoopi` on supported versions of Julia. diff --git a/SnoopCompileBot/src/snoop_bot.jl b/SnoopCompileBot/src/snoop_bot.jl index 902cd2bbe..d944262b7 100644 --- a/SnoopCompileBot/src/snoop_bot.jl +++ b/SnoopCompileBot/src/snoop_bot.jl @@ -152,8 +152,8 @@ Generate precompile statements using a precompile script. `config` can be generated by [`BotConfig`](@ref). `path_to_example_script` is preferred to be an absolute path. The example script will be run in the module specified by `test_modul`. -`snoop_mode` can be `:auto`, `:snoopi` (to run [`@snoopi`](@ref)), -or `:snoopc` (to run [`@snoopc`](@ref)), +`snoop_mode` can be `:auto`, `:snoopi` (to run [`SnoopCompileCore.@snoopi`](@ref)), +or `:snoopc` (to run [`SnoopCompileCore.@snoopc`](@ref)), where `:auto` chooses `:snoopi` on supported versions of Julia. See the [online documentation](https://timholy.github.io/SnoopCompile.jl/stable/bot/) diff --git a/SnoopCompileCore/LICENSE.md b/SnoopCompileCore/LICENSE.md new file mode 100644 index 000000000..3722d9aaa --- /dev/null +++ b/SnoopCompileCore/LICENSE.md @@ -0,0 +1,22 @@ +The SnoopCompile.jl package is licensed under the MIT "Expat" License: + +> Copyright (c) 2015: Tim Holy. +> +> Permission is hereby granted, free of charge, to any person obtaining +> a copy of this software and associated documentation files (the +> "Software"), to deal in the Software without restriction, including +> without limitation the rights to use, copy, modify, merge, publish, +> distribute, sublicense, and/or sell copies of the Software, and to +> permit persons to whom the Software is furnished to do so, subject to +> the following conditions: +> +> The above copyright notice and this permission notice shall be +> included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/SnoopCompileCore/Project.toml b/SnoopCompileCore/Project.toml index b92e93a30..27f4bc31b 100644 --- a/SnoopCompileCore/Project.toml +++ b/SnoopCompileCore/Project.toml @@ -1,7 +1,7 @@ name = "SnoopCompileCore" uuid = "e2b509da-e806-4183-be48-004708413034" author = ["Tim Holy "] -version = "1.6.0" +version = "1.6.1" [deps] Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" diff --git a/SnoopCompileCore/README.md b/SnoopCompileCore/README.md new file mode 100644 index 000000000..e7ca60b5c --- /dev/null +++ b/SnoopCompileCore/README.md @@ -0,0 +1,3 @@ +# SnoopCompileCore + +SnoopCompileCore is a component of [SnoopCompile](https://github.com/timholy/SnoopCompile.jl). diff --git a/SnoopCompileCore/src/snoopr.jl b/SnoopCompileCore/src/snoopr.jl index bd1e5866f..6b728c569 100644 --- a/SnoopCompileCore/src/snoopr.jl +++ b/SnoopCompileCore/src/snoopr.jl @@ -8,7 +8,7 @@ Capture method cache invalidations triggered by evaluating `expr`. of integers (encoding depth) and strings (documenting the source of an invalidation). Unless you are working at a low level, you essentially always want to pass `list` -directly to [`invalidation_trees`](@ref). +directly to [`SnoopCompileAnalysis.invalidation_trees`](@ref). # Extended help diff --git a/docs/make.jl b/docs/make.jl index 6d0252a9a..fcd8b6105 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,7 +6,7 @@ makedocs( format = Documenter.HTML( prettyurls = get(ENV, "CI", nothing) == "true" ), - modules = [SnoopCompile], + modules = [SnoopCompile.SnoopCompileCore, SnoopCompile.SnoopCompileAnalysis, SnoopCompile.SnoopCompileBot, SnoopCompile], pages = ["index.md", "snoopi.md", "snoopc.md", "userimg.md", "bot.md", "snoopr.md", "reference.md"] ) diff --git a/docs/src/snoopr.md b/docs/src/snoopr.md index d7f4830c9..0fe3119a3 100644 --- a/docs/src/snoopr.md +++ b/docs/src/snoopr.md @@ -44,10 +44,11 @@ So we can see the consequences for the compiled code, we'll make this definition ```jldoctest invalidations julia> trees = invalidation_trees(@snoopr f(::Float64) = 2) -1-element Array{SnoopCompile.MethodInvalidations,1}: +1-element Array{SnoopCompileAnalysis.MethodInvalidations,1}: inserting f(::Float64) in Main at REPL[9]:1 invalidated: backedges: 1: superseding f(::Real) in Main at REPL[2]:1 with MethodInstance for f(::Float64) (2 children) more specific 2: superseding f(::Real) in Main at REPL[2]:1 with MethodInstance for f(::AbstractFloat) (2 children) more specific + 2 mt_cache ``` The list of `MethodInvalidations` indicates that some previously-compiled code got invalidated. @@ -85,7 +86,7 @@ This is often seen with more complex, real-world tests: ```julia julia> trees = invalidation_trees(@snoopr using SIMD) -4-element Array{SnoopCompile.MethodInvalidations,1}: +4-element Array{SnoopCompileAnalysis.MethodInvalidations,1}: inserting convert(::Type{Tuple{Vararg{R,N}}}, v::Vec{N,T}) where {N, R, T} in SIMD at /home/tim/.julia/packages/SIMD/Am38N/src/SIMD.jl:182 invalidated: mt_backedges: 1: signature Tuple{typeof(convert),Type{Tuple{DataType,DataType,DataType}},Any} triggered MethodInstance for Pair{DataType,Tuple{DataType,DataType,DataType}}(::Any, ::Any) (0 children) ambiguous 2: signature Tuple{typeof(convert),Type{NTuple{8,DataType}},Any} triggered MethodInstance for Pair{DataType,NTuple{8,DataType}}(::Any, ::Any) (0 children) ambiguous @@ -159,6 +160,11 @@ MethodInstance for pointer(::String, ::Integer) (1027 children) Many nodes in this tree have multiple "child" branches. +!!! note + These `trees` are sorted so that the last items have the largest number of children. + It works this way so that long printouts don't have the most important information scroll off the + top of the screen. + ## Filtering invalidations Some methods trigger widespread invalidation. diff --git a/src/SnoopCompile.jl b/src/SnoopCompile.jl index d8e01e14f..5a10d2ae4 100644 --- a/src/SnoopCompile.jl +++ b/src/SnoopCompile.jl @@ -5,7 +5,7 @@ export @snoopc using SnoopCompileAnalysis -# needed for snoopc +# needed for processing the output of snoopc (avoids a breaking change in scoping) using SnoopCompileAnalysis: parcel, read, write, parse_call, format_userimg if isdefined(SnoopCompileCore, Symbol("@snoopi")) @@ -14,8 +14,8 @@ if isdefined(SnoopCompileCore, Symbol("@snoopi")) end if isdefined(SnoopCompileCore, Symbol("@snoopr")) - export @snoopr, invalidation_trees, filtermod, findcaller - using SnoopCompileAnalysis: getroot + export @snoopr, invalidation_trees, filtermod, findcaller, ascend + using SnoopCompileAnalysis: getroot, remove_if_not_eval! end using SnoopCompileBot @@ -25,7 +25,6 @@ if isdefined(SnoopCompileBot, Symbol("@snoopiBench")) # deprecated names export @snoopiBench, @snoopiBot, @snoopi_bench, @snoopi_bot end - -export SnoopCompileCore, SnoopCompileAnalysis, SnoopCompileBot +using SnoopCompileBot: standardize_osname, JuliaVersionNumber, addtestdep end # module diff --git a/test/snoopi.jl b/test/snoopi.jl index 18753811a..fba630e36 100644 --- a/test/snoopi.jl +++ b/test/snoopi.jl @@ -199,8 +199,8 @@ end @testset "@snoopi docs" begin # docstring is present (weird Docs bug) - dct = Docs.meta(SnoopCompileCore) - @test haskey(dct, Docs.Binding(SnoopCompileCore, Symbol("@snoopi"))) + dct = Docs.meta(SnoopCompile.SnoopCompileCore) + @test haskey(dct, Docs.Binding(SnoopCompile.SnoopCompileCore, Symbol("@snoopi"))) end @testset "Duplicates (#70)" begin