Skip to content

Commit

Permalink
Merge pull request #18276 from JuliaLang/tk/backports-0.5.0-rc4
Browse files Browse the repository at this point in the history
[release-0.5] Backports for 0.5.0-rc4
  • Loading branch information
tkelman authored Sep 8, 2016
2 parents e6f843b + 67e398b commit e1d2965
Show file tree
Hide file tree
Showing 66 changed files with 1,335 additions and 691 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ before_install:
brew rm --force $(brew deps --HEAD julia);
brew install -v staticfloat/juliadeps/libgfortran;
brew install -v --only-dependencies --HEAD julia;
BUILDOPTS="-j3 USECLANG=1 LLVM_CONFIG=$(brew --prefix llvm37-julia)/bin/llvm-config-3.7.1 LLVM_SIZE=$(brew --prefix llvm37-julia)/bin/llvm-size-3.7.1";
BUILDOPTS="-j3 USECLANG=1 LLVM_CONFIG=$(brew --prefix llvm37-julia)/bin/llvm-config-3.7 LLVM_SIZE=$(brew --prefix llvm37-julia)/bin/llvm-size-3.7";
BUILDOPTS="$BUILDOPTS VERBOSE=1 USE_BLAS64=0 SUITESPARSE_INC=-I$(brew --prefix suite-sparse-julia)/include FORCE_ASSERTIONS=1";
BUILDOPTS="$BUILDOPTS LIBBLAS=-lopenblas LIBBLASNAME=libopenblas LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas";
for lib in LLVM SUITESPARSE ARPACK BLAS FFTW LAPACK GMP MPFR PCRE LIBUNWIND; do
Expand Down
79 changes: 47 additions & 32 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
## It is generally preferable to change these options, for
## your local machine, in a file named `Make.user` in the toplevel
## and build directories
##
## For developers, take care to not insert comments on the same line as
## variable declarations. The spaces between the variable value and the
## comment will be included in the value.

# OPENBLAS build options
OPENBLAS_TARGET_ARCH:=
Expand Down Expand Up @@ -58,7 +62,8 @@ USE_INTEL_JITEVENTS ?= 0
USEICC ?= 0
USEIFC ?= 0

JULIA_THREADS := 1 # Enable threading with one thread
# Enable threading with one thread
JULIA_THREADS := 1

ifeq ($(USE_MKL), 1)
$(warning "The julia make variable USE_MKL has been renamed to USE_INTEL_MKL")
Expand Down Expand Up @@ -427,12 +432,16 @@ endif

ifeq ($(USECCACHE), 1)
# expand CC and CXX at declaration time because we will redefine them
CC_ARG := $(CC) # Expand CC and CXX here already because we want
CXX_ARG := $(CXX) # the original definition and not the ccache version.
CC_FULL := ccache $(CC) # Expand CC and CXX here already to avoid recursive
CXX_FULL := ccache $(CXX) # referencing.
CC := $(CC_FULL) # Add an extra indirection to make CC/CXX non-simple
CXX := $(CXX_FULL) # vars (because of how -m$(BINARY) is added later on).
# Expand CC and CXX here already because we want the original definition and not the ccache version.
CC_ARG := $(CC)
CXX_ARG := $(CXX)
# Expand CC and CXX here already to avoid recursive referencing.
CC_FULL := ccache $(CC)
CXX_FULL := ccache $(CXX)
# Add an extra indirection to make CC/CXX non-simple vars
# (because of how -m$(BINARY) is added later on).
CC := $(CC_FULL)
CXX := $(CXX_FULL)
CC_BASE := ccache
CXX_BASE := ccache
ifeq ($(USECLANG),1)
Expand Down Expand Up @@ -598,29 +607,6 @@ $(error Pre-SSE2 CPU targets not supported. To create a generic 32-bit x86 binar
pass 'MARCH=pentium4'.)
endif

ifneq ($(MARCH),)
CC += -march=$(MARCH)
CXX += -march=$(MARCH)
FC += -march=$(MARCH)
JULIA_CPU_TARGET ?= $(MARCH)
ifeq ($(OS),Darwin)
# on Darwin, the standalone `as` program doesn't know
# how to handle AVX instructions, but it does know how
# to dispatch to the clang assembler (if we ask it to)
ifeq ($(USECLANG),1)
CC += -integrated-as
CXX += -integrated-as
else
CC += -Wa,-q
CXX += -Wa,-q
endif
FC += -Wa,-q
AS += -q
endif
endif

JULIA_CPU_TARGET ?= native

# We map amd64 to x86_64 for compatibility with systems that identify 64-bit systems as such
ifeq ($(ARCH),amd64)
override ARCH := x86_64
Expand Down Expand Up @@ -649,13 +635,19 @@ else
ISX86:=0
endif

# If we are running on powerpc64 or ppc64, set certain options automatically
ifneq (,$(filter $(ARCH), powerpc64 ppc64le))
# If we are running on powerpc64le or ppc64le, set certain options automatically
ifneq (,$(filter $(ARCH), powerpc64le ppc64le))
JCFLAGS += -fsigned-char
override LLVM_VER:=3.8.1
override OPENBLAS_DYNAMIC_ARCH:=0
override OPENBLAS_TARGET_ARCH:=POWER8
# GCC doesn't do -march= on ppc64le
override MARCH=
endif

# If we are running on powerpc64 or ppc64, fail out dramatically
ifneq (,$(filter $(ARCH), powerpc64 ppc64))
$(error Big-endian PPC64 is not supported, to ignore this error, set ARCH=ppc64le)
endif

# If we are running on ARM, set certain options automatically
Expand All @@ -667,8 +659,31 @@ override USE_BLAS64:=0
override OPENBLAS_DYNAMIC_ARCH:=0
override OPENBLAS_TARGET_ARCH:=ARMV7
override USE_SYSTEM_LIBM:=1
endif

# Set MARCH-specific flags
ifneq ($(MARCH),)
CC += -march=$(MARCH)
CXX += -march=$(MARCH)
FC += -march=$(MARCH)
JULIA_CPU_TARGET ?= $(MARCH)
ifeq ($(OS),Darwin)
# on Darwin, the standalone `as` program doesn't know
# how to handle AVX instructions, but it does know how
# to dispatch to the clang assembler (if we ask it to)
ifeq ($(USECLANG),1)
CC += -integrated-as
CXX += -integrated-as
else
CC += -Wa,-q
CXX += -Wa,-q
endif
FC += -Wa,-q
AS += -q
endif
endif

JULIA_CPU_TARGET ?= native

# Set some ARCH-specific flags
ifneq ($(USEICC),1)
Expand Down
17 changes: 17 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ This section lists changes that do not have deprecation warnings.
* `map` on a dictionary now expects a function that expects and returns a `Pair`.
The result is now another dictionary instead of an array ([#16622]).

* Bit shift operations (i.e. `<<`, `>>`, and `>>>`) now handle
negative shift counts differently: Negative counts are interpreted
as shifts in the opposite direction. For example, `4 >> -1 == 4 <<
+1 == 8`. Previously, negative counts would implicitly overflow to
large positive counts, always yielding either `0` or `-1`.

Library improvements
--------------------

Expand Down Expand Up @@ -437,6 +443,17 @@ Deprecated or removed
* The no-op `transpose` fallback has been deprecated. Consider introducing suitable
`transpose` methods or calling `permutedims(x, [2,1])` ([#13171], [#17075], [#17374]).
* The following macros have been deprecated ([#16219]):
* `@windows` is deprecated in favor of `is_windows()`
* `@unix` is deprecated in favor of `is_unix()`
* `@osx` is deprecated in favor of `is_apple()`
* `@linux` is deprecated in favor of `is_linux()`
* `@windows_only` is deprecated in favor of `if is_windows()`
* `@unix_only` is deprecated in favor of `if is_unix()`
* `@osx_only` is deprecated in favor of `if is_apple()`
* `@linux_only` is deprecated in favor of `if is_linux()`
* NOTE: Using `@static` could be useful/necessary when used in a function's local scope. See details at the section entitled [Handling Operating System Variation](http://docs.julialang.org/en/latest/manual/handling-operating-system-variation/#man-handling-operating-system-variation) in the manual.
Command-line option changes
---------------------------
Expand Down
7 changes: 1 addition & 6 deletions README.arm.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# Julia binaries for ARM

[Nightly builds](https://status.julialang.org/download/linux-arm) are
available for ARMv7-A.

# Hardware requirements

Julia requires at least `armv6` and `vfpv2` instruction sets. It's recommended
to use at least `armv7-a`. `armv5` or soft float are not supported.
available for ARM.

# Building Julia on ARM

Expand Down
3 changes: 2 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1656,12 +1656,13 @@ function mapslices(f, A::AbstractArray, dims::AbstractVector)
end

# These are needed because map(eltype, As) is not inferrable
promote_eltype_op(::Any) = (@_pure_meta; Bottom)
promote_eltype_op(::Any) = (@_pure_meta; Any)
promote_eltype_op(op, A) = (@_pure_meta; promote_op(op, eltype(A)))
promote_eltype_op{T}(op, ::AbstractArray{T}) = (@_pure_meta; promote_op(op, T))
promote_eltype_op{T}(op, ::AbstractArray{T}, A) = (@_pure_meta; promote_op(op, T, eltype(A)))
promote_eltype_op{T}(op, A, ::AbstractArray{T}) = (@_pure_meta; promote_op(op, eltype(A), T))
promote_eltype_op{R,S}(op, ::AbstractArray{R}, ::AbstractArray{S}) = (@_pure_meta; promote_op(op, R, S))
promote_eltype_op(op, A, B) = (@_pure_meta; promote_op(op, eltype(A), eltype(B)))
promote_eltype_op(op, A, B, C, D...) = (@_pure_meta; promote_eltype_op(op, promote_eltype_op(op, A, B), C, D...))

## 1 argument
Expand Down
5 changes: 4 additions & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ end

## Conversions ##

convert{T}(::Type{Vector}, x::AbstractVector{T}) = convert(Vector{T}, x)
convert{T}(::Type{Matrix}, x::AbstractMatrix{T}) = convert(Matrix{T}, x)

convert{T,n}(::Type{Array{T}}, x::Array{T,n}) = x
convert{T,n}(::Type{Array{T,n}}, x::Array{T,n}) = x

Expand Down Expand Up @@ -594,7 +597,7 @@ julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5)
julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2))
ERROR: ArgumentError: indices must be unique and sorted
in deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:611
in deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:614
...
```
"""
Expand Down
2 changes: 1 addition & 1 deletion base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function broadcast_t(f, ::Type{Any}, As...)
shape = broadcast_shape(As...)
iter = CartesianRange(shape)
if isempty(iter)
return similar(Array{Union{}}, shape)
return similar(Array{Any}, shape)
end
nargs = length(As)
keeps, Idefaults = map_newindexer(shape, As)
Expand Down
5 changes: 2 additions & 3 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,11 @@ end

@deprecate ==(x::Char, y::Integer) UInt32(x) == y
@deprecate ==(x::Integer, y::Char) x == UInt32(y)
# Note: when these deprecations are deleted, the specialized definitions isequal(x::Char, y::Integer)
# and isequal(x::Integer, y::Char) in operators.jl can be deleted, too
@deprecate isless(x::Char, y::Integer) UInt32(x) < y
@deprecate isless(x::Integer, y::Char) x < UInt32(y)

# delete these methods along with deprecations:
isequal(x::Char, y::Integer) = false
isequal(x::Integer, y::Char) = false

#6674 and #4233
macro windows(qm,ex)
Expand Down
3 changes: 3 additions & 0 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -848,3 +848,6 @@ function similar(t::ImmutableDict)
end
return t
end

_similar_for{P<:Pair}(c::Dict, ::Type{P}, itr, isz) = similar(c, P)
_similar_for(c::Associative, T, itr, isz) = throw(ArgumentError("for Associatives, similar requires an element type of Pair;\n if calling map, consider a comprehension instead"))
13 changes: 9 additions & 4 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4245,12 +4245,17 @@ eta
"""
isdefined([m::Module,] s::Symbol)
isdefined(object, s::Symbol)
isdefined(a::AbstractArray, index::Int)
isdefined(object, index::Int)
isdefined(a::Array, index::Int)
Tests whether an assignable location is defined. The arguments can be a module and a symbol,
a composite object and field name (as a symbol), or an array and index. With a single
symbol argument, tests whether a global variable with that name is defined in
a composite object and field name (as a symbol) or index, or an `Array` and index.
With a single symbol argument, tests whether a global variable with that name is defined in
`current_module()`.
Note: For `AbstractArray`s other than `Array`, `isdefined` tests whether the given field
index is defined, not the given array index. To test whether an array index is defined, use
[`isassigned`](:func:`isassigned`).
"""
isdefined

Expand Down Expand Up @@ -4961,7 +4966,7 @@ Sys.get_process_title
"""
readcsv(source, [T::Type]; options...)
Equivalent to `readdlm` with `delim` set to comma.
Equivalent to `readdlm` with `delim` set to comma, and type optionally defined by `T`.
"""
readcsv

Expand Down
66 changes: 31 additions & 35 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2042,15 +2042,9 @@ function eval_annotate(e::ANY, vtypes::ANY, sv::InferenceState, undefs, pass)
end

function expr_cannot_delete(ex::Expr)
# This alone should be enough for any sane use of
# `Expr(:inbounds)` and `Expr(:boundscheck)`. However, it is still possible
# to have these embeded in other expressions (e.g. `return @inbounds ...`)
# so we check recursively if there's a matching expression
(ex.head === :inbounds || ex.head === :boundscheck) && return true
for arg in ex.args
isa(arg, Expr) && expr_cannot_delete(arg::Expr) && return true
end
return false
head = ex.head
return (head === :inbounds || head === :boundscheck || head === :meta ||
head === :line)
end

# annotate types of all symbols in AST
Expand Down Expand Up @@ -2081,7 +2075,8 @@ function type_annotate!(linfo::LambdaInfo, states::Array{Any,1}, sv::ANY, nargs)
record_slot_type!(id, widenconst(states[i+1][id].typ), linfo.slottypes)
end
elseif optimize
if isa(expr, Expr) && expr_cannot_delete(expr::Expr)
if ((isa(expr, Expr) && expr_cannot_delete(expr::Expr)) ||
isa(expr, LineNumberNode))
i += 1
continue
end
Expand Down Expand Up @@ -2524,26 +2519,10 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
return invoke_NF()
end

(linfo, ty, inferred) = typeinf(method, metharg, methsp, false)
if linfo === nothing || !inferred
return invoke_NF()
end
if linfo !== nothing && linfo.jlcall_api == 2
# in this case function can be inlined to a constant
return inline_as_constant(linfo.constval, argexprs, enclosing)
elseif linfo !== nothing && !linfo.inlineable
return invoke_NF()
elseif linfo === nothing || linfo.code === nothing
(linfo, ty, inferred) = typeinf(method, metharg, methsp, true)
end
if linfo === nothing || !inferred || !linfo.inlineable || (ast = linfo.code) === nothing
return invoke_NF()
end

na = linfo.nargs
na = method.lambda_template.nargs
# check for vararg function
isva = false
if na > 0 && linfo.isva
if na > 0 && method.lambda_template.isva
@assert length(argexprs) >= na-1
# construct tuple-forming expression for argument tail
vararg = mk_tuplecall(argexprs[na:end], sv)
Expand All @@ -2559,17 +2538,34 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference

@assert na == length(argexprs)

spvals = Any[]
for i = 1:length(methsp)
si = methsp[i]
if isa(si, TypeVar)
return NF
end
push!(spvals, si)
isa(si, TypeVar) && return NF
end

(linfo, ty, inferred) = typeinf(method, metharg, methsp, false)
if linfo === nothing || !inferred
return invoke_NF()
end
if linfo !== nothing && linfo.jlcall_api == 2
# in this case function can be inlined to a constant
return inline_as_constant(linfo.constval, argexprs, enclosing)
elseif linfo !== nothing && !linfo.inlineable
return invoke_NF()
elseif linfo === nothing || linfo.code === nothing
(linfo, ty, inferred) = typeinf(method, metharg, methsp, true)
end
if linfo === nothing || !inferred || !linfo.inlineable || (ast = linfo.code) === nothing
return invoke_NF()
end

spvals = Any[]
for i = 1:length(methsp)
push!(spvals, methsp[i])
end
for i=1:length(spvals)
for i = 1:length(spvals)
si = spvals[i]
if isa(si,Symbol) || isa(si,SSAValue) || isa(si,Slot)
if isa(si, Symbol) || isa(si, SSAValue) || isa(si, Slot)
spvals[i] = QuoteNode(si)
end
end
Expand Down
Loading

0 comments on commit e1d2965

Please sign in to comment.