Skip to content

Commit

Permalink
Merge pull request #13834 from JuliaLang/tk/backports-0.4.1
Browse files Browse the repository at this point in the history
[release-0.4, RFC] backports for 0.4.1
  • Loading branch information
tkelman committed Nov 8, 2015
2 parents 669222e + 385ec5a commit 3660d47
Show file tree
Hide file tree
Showing 120 changed files with 1,635 additions and 862 deletions.
1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ Julia's build process uses the following external tools:
Julia bundles the following external programs and libraries on some platforms:

- [7-Zip](http://www.7-zip.org/license.txt)
- [BUSYBOX](https://github.com/rmyorston/busybox-w32/blob/master/LICENSE)
- [GIT](http://git-scm.com/about/free-and-open-source)
- [ZLIB](http://zlib.net/zlib_license.html)
- [LIBEXPAT](http://expat.cvs.sourceforge.net/viewvc/expat/expat/README)
Expand Down
9 changes: 2 additions & 7 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,9 @@ ISX86=1
else ifeq ($(ARCH),x86_64)
BINARY=64
ISX86=1
else ifneq (,$(findstring arm,$(ARCH)))
ISX86=0
else ifneq (,$(findstring powerpc,$(ARCH)))
ISX86=0
else ifneq (,$(findstring ppc,$(ARCH)))
ISX86=0
else
$(error "unknown word-size for arch: $(ARCH)")
# For all other architectures (ARM, PPC, AArch64, etc.)
ISX86=0
endif

# If we are running on ARM, set certain options automatically
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ distclean dist-clean:
dist:
@echo \'dist\' target is deprecated: use \'binary-dist\' instead.

ifeq ($(ARCH),x86_64)
GITCONFIG := $(DESTDIR)$(prefix)/Git/mingw64/etc/gitconfig
else
GITCONFIG := $(DESTDIR)$(prefix)/Git/mingw32/etc/gitconfig
endif

binary-dist: distclean
ifeq ($(USE_SYSTEM_BLAS),0)
ifeq ($(ISX86),1)
Expand Down Expand Up @@ -429,10 +435,8 @@ ifeq ($(OS), WINNT)
cp 7z.exe 7z.dll libexpat-1.dll zlib1.dll libgfortran-3.dll libquadmath-0.dll libstdc++-6.dll libgcc_s_s*-1.dll libssp-0.dll $(bindir) && \
mkdir $(DESTDIR)$(prefix)/Git && \
7z x PortableGit.7z -o"$(DESTDIR)$(prefix)/Git" && \
echo "[core] eol = lf" >> "$(DESTDIR)$(prefix)/Git/etc/gitconfig" && \
sed -i "s/\bautocrlf = true$$/autocrlf = input/" "$(DESTDIR)$(prefix)/Git/etc/gitconfig" && \
cp busybox.exe $(DESTDIR)$(prefix)/Git/bin/echo.exe && \
cp busybox.exe $(DESTDIR)$(prefix)/Git/bin/printf.exe )
echo "[core] eol = lf" >> "$(GITCONFIG)" && \
sed -i "s/\bautocrlf = true$$/autocrlf = input/" "$(GITCONFIG)" )
cd $(DESTDIR)$(bindir) && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe

# create file listing for uninstall. note: must have Windows path separators and line endings.
Expand Down Expand Up @@ -571,9 +575,7 @@ endif
cd dist-extras && \
$(JLDOWNLOAD) http://downloads.sourceforge.net/sevenzip/7z920_extra.7z && \
$(JLDOWNLOAD) https://unsis.googlecode.com/files/nsis-2.46.5-Unicode-setup.exe && \
$(JLDOWNLOAD) busybox.exe http://frippery.org/files/busybox/busybox-w32-FRP-1-g9eb16cb.exe && \
chmod a+x 7z.exe && \
chmod a+x 7z.dll && \
$(call spawn,./7z.exe) x -y -onsis nsis-2.46.5-Unicode-setup.exe && \
chmod a+x ./nsis/makensis.exe && \
chmod a+x busybox.exe
chmod a+x ./nsis/makensis.exe
56 changes: 35 additions & 21 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ndims{T,n}(::Type{AbstractArray{T,n}}) = n
ndims{T<:AbstractArray}(::Type{T}) = ndims(super(T))
length(t::AbstractArray) = prod(size(t))::Int
endof(a::AbstractArray) = length(a)
first(a::AbstractArray) = a[1]
first(a::AbstractArray) = a[first(eachindex(a))]

function first(itr)
state = start(itr)
Expand Down Expand Up @@ -409,10 +409,10 @@ next(A::AbstractArray,i) = (@_inline_meta(); (idx, s) = next(i[1], i[2]); (A[idx
done(A::AbstractArray,i) = done(i[1], i[2])

iterstate(i) = i
iterstate(i::Tuple{UnitRange{Int},Int}) = i[2]

# eachindex iterates over all indices. LinearSlow definitions are later.
eachindex(A::AbstractArray) = (@_inline_meta(); eachindex(linearindexing(A), A))
eachindex(::LinearFast, A::AbstractArray) = 1:length(A)

function eachindex(A::AbstractArray, B::AbstractArray)
@_inline_meta
Expand All @@ -422,8 +422,16 @@ function eachindex(A::AbstractArray, B::AbstractArray...)
@_inline_meta
eachindex(linearindexing(A,B...), A, B...)
end
eachindex(::LinearFast, A::AbstractArray, B::AbstractArray) = 1:max(length(A),length(B))
eachindex(::LinearFast, A::AbstractArray, B::AbstractArray...) = 1:max(length(A), map(length, B)...)
eachindex(::LinearFast, A::AbstractArray) = 1:length(A)
function eachindex(::LinearFast, A::AbstractArray, B::AbstractArray...)
@_inline_meta
1:_maxlength(A, B...)
end
_maxlength(A) = length(A)
function _maxlength(A, B, C...)
@_inline_meta
max(length(A), _maxlength(B, C...))
end

isempty(a::AbstractArray) = (length(a) == 0)

Expand Down Expand Up @@ -720,29 +728,29 @@ cat(catdim::Integer) = Array(Any, 0)

vcat() = Array(Any, 0)
hcat() = Array(Any, 0)
typed_vcat(T::Type) = Array(T, 0)
typed_hcat(T::Type) = Array(T, 0)

## cat: special cases
hcat{T}(X::T...) = T[ X[j] for i=1, j=1:length(X) ]
hcat{T<:Number}(X::T...) = T[ X[j] for i=1, j=1:length(X) ]
vcat{T}(X::T...) = T[ X[i] for i=1:length(X) ]
vcat{T<:Number}(X::T...) = T[ X[i] for i=1:length(X) ]
hcat{T}(X::T...) = T[ X[j] for i=1, j=1:length(X) ]
hcat{T<:Number}(X::T...) = T[ X[j] for i=1, j=1:length(X) ]

function vcat(X::Number...)
T = promote_typeof(X...)
hvcat_fill(Array(T,length(X)), X)
end
vcat(X::Number...) = hvcat_fill(Array(promote_typeof(X...),length(X)), X)
hcat(X::Number...) = hvcat_fill(Array(promote_typeof(X...),1,length(X)), X)
typed_vcat(T::Type, X::Number...) = hvcat_fill(Array(T,length(X)), X)
typed_hcat(T::Type, X::Number...) = hvcat_fill(Array(T,1,length(X)), X)

function hcat(X::Number...)
T = promote_typeof(X...)
hvcat_fill(Array(T,1,length(X)), X)
end
vcat(V::AbstractVector...) = typed_vcat(promote_eltype(V...), V...)
vcat{T}(V::AbstractVector{T}...) = typed_vcat(T, V...)

function vcat{T}(V::AbstractVector{T}...)
n = 0
function typed_vcat(T::Type, V::AbstractVector...)
n::Int = 0
for Vk in V
n += length(Vk)
end
a = similar(full(V[1]), n)
a = similar(full(V[1]), T, n)
pos = 1
for k=1:length(V)
Vk = V[k]
Expand All @@ -753,7 +761,10 @@ function vcat{T}(V::AbstractVector{T}...)
a
end

function hcat{T}(A::AbstractVecOrMat{T}...)
hcat(A::AbstractVecOrMat...) = typed_hcat(promote_eltype(A...), A...)
hcat{T}(A::AbstractVecOrMat{T}...) = typed_hcat(T, A...)

function typed_hcat(T::Type, A::AbstractVecOrMat...)
nargs = length(A)
nrows = size(A[1], 1)
ncols = 0
Expand All @@ -767,7 +778,7 @@ function hcat{T}(A::AbstractVecOrMat{T}...)
nd = ndims(Aj)
ncols += (nd==2 ? size(Aj,2) : 1)
end
B = similar(full(A[1]), nrows, ncols)
B = similar(full(A[1]), T, nrows, ncols)
pos = 1
if dense
for k=1:nargs
Expand All @@ -787,7 +798,10 @@ function hcat{T}(A::AbstractVecOrMat{T}...)
return B
end

function vcat{T}(A::AbstractMatrix{T}...)
vcat(A::AbstractMatrix...) = typed_vcat(promote_eltype(A...), A...)
vcat{T}(A::AbstractMatrix{T}...) = typed_vcat(T, A...)

function typed_vcat(T::Type, A::AbstractMatrix...)
nargs = length(A)
nrows = sum(a->size(a, 1), A)::Int
ncols = size(A[1], 2)
Expand All @@ -796,7 +810,7 @@ function vcat{T}(A::AbstractMatrix{T}...)
throw(ArgumentError("number of columns of each array must match (got $(map(x->size(x,2), A)))"))
end
end
B = similar(full(A[1]), nrows, ncols)
B = similar(full(A[1]), T, nrows, ncols)
pos = 1
for k=1:nargs
Ak = A[k]
Expand Down
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ collect(itr) = collect(eltype(itr), itr)
## Iteration ##
start(A::Array) = 1
next(a::Array,i) = (a[i],i+1)
done(a::Array,i) = (i > length(a))
done(a::Array,i) = i == length(a)+1

## Indexing: getindex ##

Expand Down
13 changes: 6 additions & 7 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1738,22 +1738,21 @@ function vcat(A::BitMatrix...)
return B
end

function cat(catdim::Integer, X::Integer...)
reshape([X...], (ones(Int,catdim-1)..., length(X)))
end

# general case, specialized for BitArrays and Integers
function cat(catdim::Integer, X::Union{BitArray, Integer}...)
nargs = length(X)
# using integers results in conversion to Array{Int}
# (except in the all-Bool case)
has_bitarray = false
has_integer = false
for a in X
if isa(a, BitArray)
has_bitarray = true
else
has_integer = true
if isa(a, Integer)
has_integer = true; break
end
end
# just integers and no BitArrays -> general case
has_bitarray || return invoke(cat, Tuple{Integer, Vararg{Any}}, catdim, X...)
dimsX = map((a->isa(a,BitArray) ? size(a) : (1,)), X)
ndimsX = map((a->isa(a,BitArray) ? ndims(a) : 1), X)
d_max = maximum(ndimsX)
Expand Down
4 changes: 2 additions & 2 deletions base/channels.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

abstract AbstractChannel{T}
abstract AbstractChannel

type Channel{T} <: AbstractChannel{T}
type Channel{T} <: AbstractChannel
cond_take::Condition # waiting for data to become available
cond_put::Condition # waiting for a writeable slot
state::Symbol
Expand Down
Loading

0 comments on commit 3660d47

Please sign in to comment.