From 705a187e6812a6176a3738311757215236f758fc Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 1 Jul 2017 04:49:25 -0500 Subject: [PATCH] More inlining prevention --- base/abstractarraymath.jl | 2 +- base/reduce.jl | 7 +++++-- base/sparse/sparsematrix.jl | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index 3815098bceeea..ab85a794a8a56 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -397,7 +397,7 @@ _rshps(shp, shp_i, sz, i, ::Tuple{}) = _reperr(s, n, N) = throw(ArgumentError("number of " * s * " repetitions " * "($n) cannot be less than number of dimensions of input ($N)")) -@propagate_inbounds function _repeat(A::AbstractArray, inner, outer) +@noinline function _repeat(A::AbstractArray, inner, outer) shape, inner_shape = rep_shapes(A, inner, outer) R = similar(A, shape) diff --git a/base/reduce.jl b/base/reduce.jl index a8b3e80d802be..1860541c43b68 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -33,7 +33,7 @@ r_promote(op, x::T) where {T} = convert(r_promote_type(op, T), x) ## foldl && mapfoldl -function mapfoldl_impl(f, op, v0, itr, i) +@noinline function mapfoldl_impl(f, op, v0, itr, i) # Unroll the while loop once; if v0 is known, the call to op may # be evaluated at compile time if done(itr, i) @@ -174,7 +174,7 @@ foldr(op, itr) = mapfoldr(identity, op, itr) # This is a generic implementation of `mapreduce_impl()`, # certain `op` (e.g. `min` and `max`) may have their own specialized versions. -function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer, blksize::Int=pairwise_blocksize(f, op)) +@noinline function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer, blksize::Int) if ifirst == ilast @inbounds a1 = A[ifirst] return r_promote(op, f(a1)) @@ -197,6 +197,9 @@ function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer end end +mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer) = + mapreduce_impl(f, op, A, ifirst, ilast, pairwise_blocksize(f, op)) + """ mapreduce(f, op, itr) diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index c640feb82f5c3..709016fa9678c 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -800,7 +800,7 @@ position forward in `X.colptr`, computes `map(f, transpose(A[:,q]))` by appropri distributing `A.rowval` and `f`-transformed `A.nzval` into `X.rowval` and `X.nzval` respectively. Simultaneously fixes the one-position-forward shift in `X.colptr`. """ -function _distributevals_halfperm!(X::SparseMatrixCSC{Tv,Ti}, +@noinline function _distributevals_halfperm!(X::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}, q::AbstractVector{<:Integer}, f::Function) where {Tv,Ti} @inbounds for Xi in 1:A.n Aj = q[Xi]