@@ -1934,6 +1934,7 @@ end
1934
1934
function occurs_more (e:: ANY , pred, n)
1935
1935
if isa (e,Expr)
1936
1936
e = e:: Expr
1937
+ e. head === :line && return 0
1937
1938
c = 0
1938
1939
for a = e. args
1939
1940
c += occurs_more (a, pred, n)
@@ -2620,10 +2621,17 @@ function inline_worthy(body::Expr, cost::Integer=1000) # precondition: 0 < cost;
2620
2621
return false
2621
2622
end
2622
2623
symlim = 1000 + 5_000_000 ÷ cost
2623
- if length (body. args) < (symlim + 500 ) ÷ 1000
2624
+ nargs = 0
2625
+ for arg in body. args
2626
+ if (! isa (arg, LineNumberNode) &&
2627
+ ! (isa (arg, Expr) && (arg:: Expr ). head === :line ))
2628
+ nargs += 1
2629
+ end
2630
+ end
2631
+ if nargs < (symlim + 500 ) ÷ 1000
2624
2632
symlim *= 16
2625
2633
symlim ÷= 1000
2626
- if occurs_more (body, e-> true , symlim) < symlim
2634
+ if occurs_more (body, e-> ( ! isa (e, LineNumberNode)) , symlim) < symlim
2627
2635
return true
2628
2636
end
2629
2637
end
@@ -2661,7 +2669,7 @@ end
2661
2669
const corenumtype = Union{Int32,Int64,Float32,Float64}
2662
2670
2663
2671
function inlining_pass (e:: Expr , sv, ast)
2664
- if e. head == :method
2672
+ if e. head === :method
2665
2673
# avoid running the inlining pass on function definitions
2666
2674
return (e,())
2667
2675
end
0 commit comments