@@ -1925,6 +1925,7 @@ end
1925
1925
function occurs_more (e:: ANY , pred, n)
1926
1926
if isa (e,Expr)
1927
1927
e = e:: Expr
1928
+ e. head === :line && return 0
1928
1929
c = 0
1929
1930
for a = e. args
1930
1931
c += occurs_more (a, pred, n)
@@ -2612,10 +2613,17 @@ function inline_worthy(body::Expr, cost::Integer=1000) # precondition: 0 < cost;
2612
2613
return false
2613
2614
end
2614
2615
symlim = 1000 + 5_000_000 ÷ cost
2615
- if length (body. args) < (symlim + 500 ) ÷ 1000
2616
+ nargs = 0
2617
+ for arg in body. args
2618
+ if (! isa (arg, LineNumberNode) &&
2619
+ ! (isa (arg, Expr) && (arg:: Expr ). head === :line ))
2620
+ nargs += 1
2621
+ end
2622
+ end
2623
+ if nargs < (symlim + 500 ) ÷ 1000
2616
2624
symlim *= 16
2617
2625
symlim ÷= 1000
2618
- if occurs_more (body, e-> true , symlim) < symlim
2626
+ if occurs_more (body, e-> ( ! isa (e, LineNumberNode)) , symlim) < symlim
2619
2627
return true
2620
2628
end
2621
2629
end
@@ -2653,7 +2661,7 @@ end
2653
2661
const corenumtype = Union{Int32,Int64,Float32,Float64}
2654
2662
2655
2663
function inlining_pass (e:: Expr , sv, ast)
2656
- if e. head == :method
2664
+ if e. head === :method
2657
2665
# avoid running the inlining pass on function definitions
2658
2666
return (e,())
2659
2667
end
0 commit comments