Skip to content

Commit

Permalink
DO NOT MERGE: temporarily disable forced-inline macros
Browse files Browse the repository at this point in the history
This is purely for the purposes of testing the performance of Inference's inliner, which we'd like to have stand on its own two feet rather than relying on programmer annotations.
  • Loading branch information
timholy committed Jun 6, 2017
1 parent 9a22471 commit 1a12668
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Base.@propagate_inbounds _broadcast_getindex(::Any, A, I) = A[I]
@generated function _broadcast!(f, B::AbstractArray, keeps::K, Idefaults::ID, A::AT, Bs::BT, ::Type{Val{N}}, iter) where {K,ID,AT,BT,N}
nargs = N + 1
quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
# destructure the keeps and As tuples
A_1 = A
@nexprs $N i->(A_{i+1} = Bs[i])
Expand All @@ -160,7 +160,7 @@ end
@generated function _broadcast!(f, B::BitArray, keeps::K, Idefaults::ID, A::AT, Bs::BT, ::Type{Val{N}}, iter) where {K,ID,AT,BT,N}
nargs = N + 1
quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
# destructure the keeps and As tuples
A_1 = A
@nexprs $N i->(A_{i+1} = Bs[i])
Expand Down
6 changes: 4 additions & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ abstract type Associative{K,V} end
# The real @inline macro is not available until after array.jl, so this
# internal macro splices the meta Expr directly into the function body.
macro _inline_meta()
Expr(:meta, :inline)
# Expr(:meta, :inline)
nothing
end
macro _noinline_meta()
Expr(:meta, :noinline)
Expand All @@ -22,7 +23,8 @@ macro _pure_meta()
end
# another version of inlining that propagates an inbounds context
macro _propagate_inbounds_meta()
Expr(:meta, :inline, :propagate_inbounds)
# Expr(:meta, :inline, :propagate_inbounds)
Expr(:meta, :propagate_inbounds)
end

convert(::Type{Any}, x::ANY) = x
Expand Down
5 changes: 3 additions & 2 deletions base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ end
```
"""
macro inline(ex)
esc(isa(ex, Expr) ? pushmeta!(ex, :inline) : ex)
# esc(isa(ex, Expr) ? pushmeta!(ex, :inline) : ex)
esc(ex)
end

"""
Expand Down Expand Up @@ -162,7 +163,7 @@ Tells the compiler to inline a function while retaining the caller's inbounds co
"""
macro propagate_inbounds(ex)
if isa(ex, Expr)
pushmeta!(ex, :inline)
# pushmeta!(ex, :inline)
pushmeta!(ex, :propagate_inbounds)
esc(ex)
else
Expand Down
6 changes: 3 additions & 3 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ end
@generated function _unsafe_getindex!(dest::AbstractArray, src::AbstractArray, I::Union{Real, AbstractArray}...)
N = length(I)
quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
@nexprs $N d->(J_d = I[d])
D = eachindex(dest)
Ds = start(D)
Expand Down Expand Up @@ -977,7 +977,7 @@ end
I0::Union{Slice,UnitRange{Int}}, I::Union{Int,UnitRange{Int},Slice}...)
N = length(I)
quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
@nexprs $N d->(I_d = I[d])

idxlens = @ncall $N index_lengths I0 I
Expand Down Expand Up @@ -1015,7 +1015,7 @@ end
@generated function _unsafe_getindex!(X::BitArray, B::BitArray, I::Union{Int,AbstractArray{Int}}...)
N = length(I)
quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
stride_1 = 1
@nexprs $N d->(stride_{d+1} = stride_d*size(B, d))
$(Symbol(:offset_, N)) = 1
Expand Down
4 changes: 2 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ importall .Broadcast
Core.typeassert(N, Int)
(N >= 0) || return :(throw($(ArgumentError(string("tuple length should be ≥0, got ", N)))))
return quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
@nexprs $N i -> t_i = f(i)
@ncall $N tuple t
end
Expand All @@ -208,7 +208,7 @@ end
M = length(t.parameters)
M > N && return :(throw($(ArgumentError("input tuple of length $M, requested $N"))))
return quote
$(Expr(:meta, :inline))
# $(Expr(:meta, :inline))
(t..., $(Any[ :val for i = (M + 1):N ]...))
end
end
Expand Down

0 comments on commit 1a12668

Please sign in to comment.