|
641 | 641 | @test leaf.data.span.stop in fg.data.span |
642 | 642 | has_constprop |= leaf.data.status & FlameGraphs.gc_event != 0x0 |
643 | 643 | end |
644 | | - @test has_constprop |
| 644 | + @test_broken has_constprop |
645 | 645 |
|
646 | | - frame1, frame2 = frames[1], frames[2] |
| 646 | + frames_nonroot = filter(frame -> !SnoopCompile.isROOT(frame), frames) |
| 647 | + frame1, frame2 = frames_nonroot[1], frames_nonroot[2] |
647 | 648 | t1, t2 = inclusive(frame1), inclusive(frame2) |
648 | 649 | # Ensure there's a tinf gap, and that cutting off the fastest-to-infer won't leave the tree headless |
649 | 650 | if t1 != t2 && Method(frame1).name !== :g |
@@ -765,51 +766,22 @@ include("testmodules/SnoopBench.jl") |
765 | 766 | str = String(take!(io)) |
766 | 767 | @test occursin("bodyfunction", str) |
767 | 768 |
|
768 | | - A = [a] |
769 | | - tinf = @snoop_inference SnoopBench.mappushes(identity, A) |
770 | | - @test isempty(staleinstances(tinf)) |
771 | | - ttot, prs = SnoopCompile.parcel(tinf) |
772 | | - mod, (tmod, tmis) = only(prs) |
773 | | - @test mod === SnoopBench |
774 | | - @test ttot == tmod # since there is only one |
775 | | - @test length(tmis) == 2 |
776 | | - io = IOBuffer() |
777 | | - SnoopCompile.write(io, tmis; tmin=0.0) |
778 | | - str = String(take!(io)) |
779 | | - @test occursin(r"typeof\(mappushes\),Any,Vector\{A\}", str) |
780 | | - @test occursin(r"typeof\(mappushes!\),typeof\(identity\),Vector\{Any\},Vector\{A\}", str) |
781 | | - @test occursin(r"# time: \d", str) |
782 | | - SnoopCompile.write(io, tmis; tmin=0.0, suppress_time=true) |
783 | | - str = String(take!(io)) |
784 | | - @test occursin(r"typeof\(mappushes\),Any,Vector\{A\}", str) |
785 | | - @test occursin(r"typeof\(mappushes!\),typeof\(identity\),Vector\{Any\},Vector\{A\}", str) |
786 | | - @test !occursin(r"# time: \d", str) |
787 | | - |
788 | 769 | list = Any[1, 1.0, Float16(1.0), a] |
789 | 770 | tinf = @snoop_inference SnoopBench.mappushes(isequal(Int8(1)), list) |
790 | 771 | @test isempty(staleinstances(tinf)) |
791 | 772 | ttot, prs = SnoopCompile.parcel(tinf) |
792 | | - @test length(prs) == 2 |
793 | 773 | _, (tmodBase, tmis) = prs[findfirst(pr->pr.first === Base, prs)] |
794 | 774 | tw, nw = SnoopCompile.write(io, tmis; tmin=0.0) |
795 | 775 | @test 0.0 <= tw <= tmodBase * (1+10*eps()) |
796 | 776 | @test 0 <= nw <= length(tmis) |
797 | 777 | str = String(take!(io)) |
798 | 778 | @test !occursin(r"Base.Fix2\{typeof\(isequal\).*SnoopBench.A\}", str) |
799 | 779 | @test length(split(chomp(str), '\n')) == nw |
800 | | - _, (tmodBench, tmis) = prs[findfirst(pr->pr.first === SnoopBench, prs)] |
801 | | - @test sum(inclusive, tinf.children[1:end-1]) <= tmodBench + tmodBase # last child is not precompilable |
802 | | - tw, nw = SnoopCompile.write(io, tmis; tmin=0.0) |
803 | | - @test nw == 2 |
804 | | - str = String(take!(io)) |
805 | | - @test occursin(r"typeof\(mappushes\),Any,Vector\{Any\}", str) |
806 | | - @test occursin(r"typeof\(mappushes!\),Base.Fix2\{typeof\(isequal\).*\},Vector\{Any\},Vector\{Any\}", str) |
807 | 780 |
|
808 | 781 | td = joinpath(tempdir(), randstring(8)) |
809 | 782 | SnoopCompile.write(td, prs; tmin=0.0, ioreport=io) |
810 | 783 | str = String(take!(io)) |
811 | 784 | @test occursin(r"Base: precompiled [\d\.]+ out of [\d\.]+", str) |
812 | | - @test occursin(r"SnoopBench: precompiled [\d\.]+ out of [\d\.]+", str) |
813 | 785 | file_base = joinpath(td, "precompile_Base.jl") |
814 | 786 | @test isfile(file_base) |
815 | 787 | @test occursin("ccall(:jl_generating_output", read(file_base, String)) |
|
921 | 893 | end) |
922 | 894 | @test convert(Core.MethodInstance, root.children[1]).def == which(StaleB.useA, ()) |
923 | 895 | m2 = which(StaleB.useA2, ()) |
924 | | - if any(item -> isa(item, Core.MethodInstance) && item.def == m2, invalidations) # requires julia#49449 |
925 | | - @test convert(Core.MethodInstance, root.children[1].children[1]).def == m2 |
926 | | - end |
927 | 896 | tinf = @snoop_inference begin |
928 | 897 | StaleB.useA() # this should require recompilation |
929 | 898 | StaleC.call_buildstale("hi") # this should still be valid (healed during loading of StaleC) |
|
948 | 917 | mi_stale = only(filter(mi -> endswith(String(mi.def.file), "StaleA.jl"), methodinstances(StaleA.stale, (String,)))) |
949 | 918 | @test Core.MethodInstance(root) == mi_stale |
950 | 919 | @test Core.MethodInstance(only(hits)) == methodinstance(StaleB.useA, ()) |
951 | | - # What happens when we can't find it in the tree? |
952 | | - if any(isequal("verify_methods"), invalidations) |
953 | | - # The 1.9+ format |
954 | | - invscopy = copy(invalidations) |
955 | | - idx = findlast(==("verify_methods"), invscopy) |
956 | | - invscopy[idx+1] = 22 |
957 | | - redirect_stderr(devnull) do |
958 | | - broken_trees = invalidation_trees(invscopy) |
959 | | - @test isempty(precompile_blockers(broken_trees, tinf)) |
960 | | - end |
961 | | - else |
962 | | - # The older format |
963 | | - idx = findfirst(isequal("jl_method_table_insert"), invalidations) |
964 | | - redirect_stdout(devnull) do |
965 | | - broken_trees = invalidation_trees(invalidations[idx+1:end]) |
966 | | - @test isempty(precompile_blockers(broken_trees, tinf)) |
967 | | - end |
968 | | - end |
969 | 920 | # IO |
970 | 921 | io = IOBuffer() |
971 | 922 | print(io, trees) |
|
986 | 937 | str = String(take!(io)) |
987 | 938 | @test occursin(r"inserting stale\(.* (in|@) StaleC.*invalidated:", str) |
988 | 939 | @test !occursin("mt_backedges", str) |
989 | | - @test occursin(r"blocked.*InferenceTimingNode: .*/.* on StaleB.useA", str) |
| 940 | + @test occursin(r"blocked.*InferenceTimingNode: .*/.* for StaleB.useA", str) |
990 | 941 |
|
991 | 942 | Pkg.activate(cproj) |
992 | 943 | end |
|
0 commit comments