Skip to content

Commit

Permalink
Merge branch 'master' into aa/libgit2-renames
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Jan 8, 2017
2 parents 7d9edd3 + 69c1c8f commit b50967b
Show file tree
Hide file tree
Showing 154 changed files with 2,167 additions and 1,757 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ before_install:
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
export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1";
BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1";
done;
export LDFLAGS="-L$(brew --prefix openblas-julia)/lib -L$(brew --prefix suite-sparse-julia)/lib";
export DYLD_FALLBACK_LIBRARY_PATH="/usr/local/lib:/lib:/usr/lib:$(brew --prefix openblas-julia)/lib:$(brew --prefix suite-sparse-julia)/lib:$(brew --prefix arpack-julia)/lib";
Expand All @@ -94,7 +94,8 @@ before_install:
TESTSTORUN="all --skip linalg/triangular subarray"; fi # TODO: re enable these if possible without timing out
- git clone -q git:https://git.kitenet.net/moreutils
script:
- echo $BUILDOPTS
- echo BUILDOPTS=$BUILDOPTS
- export BUILDOPTS
- contrib/download_cmake.sh
- make -C moreutils mispipe
- make $BUILDOPTS -C base version_git.jl.phony
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ julia-inference : julia-base julia-ui-$(JULIA_BUILD_MODE) $(build_prefix)/.examp
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/inference.ji JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

ifneq ($(CPUID_SPECIFIC_BINARIES), 0)
CPUID_TAG = _$(call spawn,$(JULIA_EXECUTABLE) --cpuid)
CPUID_TAG = _$(call exec,$(JULIA_EXECUTABLE) --cpuid)
else
CPUID_TAG =
endif
Expand Down
24 changes: 24 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ Breaking changes

This section lists changes that do not have deprecation warnings.

* `String`s no longer have a `.data` field (as part of a significant performance
improvement). Use `Vector{UInt8}(str)` to access a string as a byte array.
However, allocating the `Vector` object has overhead. You can also use
`codeunit(str, i)` to access the `i`th byte of a `String`.
Use `sizeof(str)` instead of `length(str.data)`, and `pointer(str)` instead of
`pointer(str.data)`. ([#19449])

* Operations between `Float16` and `Integers` now return `Float16` instead of `Float32`. ([#17261])

* Keyword arguments are processed left-to-right: if the same keyword is specified more than
Expand Down Expand Up @@ -75,9 +82,19 @@ This section lists changes that do not have deprecation warnings.

* `quadgk` has been moved from Base into a separate package. ([#19741])

* The `Collections` module has been removed, and all functions defined therein have been
moved to the `DataStructures` package. ([#19800])

* The `RepString` type has been moved to the
[LegacyStrings.jl package](https://github.com/JuliaArchive/LegacyStrings.jl).

* In macro calls with parentheses, e.g. `@m(a=1)`, assignments are now parsed as
`=` expressions, instead of as `kw` expressions. ([#7669])

* (µ "micro" and ɛ "latin epsilon") are considered equivalent to
the corresponding Greek characters in identifiers. `\varepsilon`
now tab-completes to U+03B5 (greek small letter epsilon) ([#19464]).

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

Expand Down Expand Up @@ -136,6 +153,12 @@ Library improvements
implemented; the semantics are as if the `Nullable` were a container with
zero or one elements ([#16961]).

* New `@test_warn` and `@test_nowarn` macros in the `Base.Test` module to
test for the presence or absence of warning messages ([#19903]).

* `logging` can be used to redirect `info`, `warn`, and `error` messages
either universally or on a per-module/function basis ([#16213]).

Compiler/Runtime improvements
-----------------------------

Expand Down Expand Up @@ -802,6 +825,7 @@ Language tooling improvements
[#19233]: https://github.com/JuliaLang/julia/issues/19233
[#19288]: https://github.com/JuliaLang/julia/issues/19288
[#19305]: https://github.com/JuliaLang/julia/issues/19305
[#19449]: https://github.com/JuliaLang/julia/issues/19449
[#19469]: https://github.com/JuliaLang/julia/issues/19469
[#19543]: https://github.com/JuliaLang/julia/issues/19543
[#19598]: https://github.com/JuliaLang/julia/issues/19598
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Julia uses the following external libraries, which are automatically downloaded
- **[curl]** (>= 7.50) — libcurl provides download and proxy support for Julia's package manager
- **[libssh2]** (>= 1.7) — library for SSH transport, used by libgit2 for packages with SSH remotes
- **[mbedtls]** (>= 2.2) — library used for cryptography and transport layer security, used by libssh2
- **[utf8proc]** (>= 2.0) — a library for processing UTF-8 encoded Unicode strings
- **[utf8proc]** (>= 2.1) — a library for processing UTF-8 encoded Unicode strings
- **[libosxunwind]** — clone of [libunwind], a library that determines the call-chain of a program

[GNU make]: http:https://www.gnu.org/software/make
Expand Down
2 changes: 1 addition & 1 deletion base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ function splice_buffer!{T<:Integer}(buf::IOBuffer, r::UnitRange{T}, ins::Abstrac
elseif pos > last(r)
seek(buf, pos - length(r))
end
splice!(buf.data, r + 1, ins.data) # position(), etc, are 0-indexed
splice!(buf.data, r + 1, Vector{UInt8}(ins)) # position(), etc, are 0-indexed
buf.size = buf.size + sizeof(ins) - length(r)
seek(buf, position(buf) + sizeof(ins))
end
Expand Down
14 changes: 2 additions & 12 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,6 @@ function ip_matches_func(ip, func::Symbol)
return false
end

function display_error(io::IO, er, bt)
print_with_color(Base.error_color(), io, "ERROR: "; bold = true)
# remove REPL-related frames from interactive printing
eval_ind = findlast(addr->Base.REPL.ip_matches_func(addr, :eval), bt)
if eval_ind != 0
bt = bt[1:eval_ind-1]
end
showerror(IOContext(io, :limit => true), er, bt)
end

immutable REPLDisplay{R<:AbstractREPL} <: Display
repl::R
end
Expand All @@ -144,8 +134,8 @@ function print_response(errio::IO, val::ANY, bt, show_value::Bool, have_color::B
try
Base.sigatomic_end()
if bt !== nothing
display_error(errio, val, bt)
println(errio)
eval(Main, Expr(:body, Expr(:return, Expr(:call, Base.display_error,
errio, QuoteNode(val), bt))))
iserr, lasterr = false, ()
else
if val !== nothing && show_value
Expand Down
18 changes: 18 additions & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,24 @@ function append!{T}(a::Array{T,1}, items::AbstractVector)
return a
end

append!(a::Vector, iter) = _append!(a, iteratorsize(iter), iter)

function _append!(a, ::HasLength, iter)
n = length(a)
resize!(a, n+length(iter))
@inbounds for (i,item) in zip(n+1:length(a), iter)
a[i] = item
end
a
end

function _append!(a, ::IteratorSize, iter)
for item in iter
push!(a, item)
end
a
end

"""
prepend!(a::Vector, items) -> collection
Expand Down
2 changes: 1 addition & 1 deletion base/arraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Transform an array to its complex conjugate in-place.
See also [`conj`](@ref).
"""
conj!{T<:Number}(A::AbstractArray{T}) = broadcast!(conj, A, A)
conj!{T<:Number}(A::AbstractArray{T}) = (@inbounds broadcast!(conj, A, A); A)

for f in (:-, :~, :conj, :sign, :real, :imag)
@eval ($f)(A::AbstractArray) = broadcast($f, A)
Expand Down
9 changes: 9 additions & 0 deletions base/associative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ push!(t::Associative, p::Pair, q::Pair, r::Pair...) = push!(push!(push!(t, p), q

# hashing objects by identity

"""
ObjectIdDict([itr])
`ObjectIdDict()` constructs a hash table where the keys are (always)
object identities. Unlike `Dict` it is not parameterized on its key
and value type and thus its `eltype` is always `Pair{Any,Any}`.
See [`Dict`](@ref) for further help.
"""
type ObjectIdDict <: Associative{Any,Any}
ht::Vector{Any}
ndel::Int
Expand Down
37 changes: 19 additions & 18 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ else
typealias UInt UInt32
end

abstract AbstractString

function Typeof end
(f::typeof(Typeof))(x::ANY) = isa(x,Type) ? Type{x} : typeof(x)

Expand All @@ -192,12 +190,19 @@ type ErrorException <: Exception
msg::AbstractString
ErrorException(msg::AbstractString) = new(msg)
end

Expr(args::ANY...) = _expr(args...)

macro _noinline_meta()
Expr(:meta, :noinline)
end

immutable BoundsError <: Exception
a::Any
i::Any
BoundsError() = new()
BoundsError(a::ANY) = new(a)
BoundsError(a::ANY, i::ANY) = new(a,i)
BoundsError(a::ANY) = (@_noinline_meta; new(a))
BoundsError(a::ANY, i) = (@_noinline_meta; new(a,i))
end
immutable DivideError <: Exception end
immutable DomainError <: Exception end
Expand All @@ -221,11 +226,7 @@ end

abstract DirectIndexString <: AbstractString

immutable String <: AbstractString
data::Array{UInt8,1}
# required to make String("foo") work (#15120):
String(d::Array{UInt8,1}) = new(d)
end
String(s::String) = s # no constructor yet

# This should always be inlined
getptls() = ccall(:jl_get_ptls_states, Ptr{Void}, ())
Expand Down Expand Up @@ -278,8 +279,6 @@ immutable VecElement{T}
end
VecElement{T}(arg::T) = VecElement{T}(arg)

Expr(args::ANY...) = _expr(args...)

# used by lowering of splicing unquote
splicedexpr(hd::Symbol, args::Array{Any,1}) = (e=Expr(hd); e.args=args; e)

Expand Down Expand Up @@ -338,16 +337,18 @@ Array{T}(::Type{T}, m::Int) = Array{T,1}(m)
Array{T}(::Type{T}, m::Int,n::Int) = Array{T,2}(m,n)
Array{T}(::Type{T}, m::Int,n::Int,o::Int) = Array{T,3}(m,n,o)


# primitive Symbol constructors
Symbol(s::String) = Symbol(s.data)
function Symbol(s::String)
return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int),
ccall(:jl_string_ptr, Ptr{UInt8}, (Any,), s),
sizeof(s))
end
function Symbol(a::Array{UInt8,1})
return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int),
ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), a),
Intrinsics.arraylen(a))
ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), a),
Intrinsics.arraylen(a))
end


# docsystem basics
macro doc(x...)
atdoc(x...)
Expand Down Expand Up @@ -378,8 +379,8 @@ unsafe_write(io::IO, x::Ptr{UInt8}, nb::Int) =
write(io::IO, x::UInt8) =
(ccall(:jl_uv_putb, Void, (Ptr{Void}, UInt8), io_pointer(io), x); 1)
function write(io::IO, x::String)
nb = sizeof(x.data)
unsafe_write(io, ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), x.data), nb)
nb = sizeof(x)
unsafe_write(io, ccall(:jl_string_ptr, Ptr{UInt8}, (Any,), x), nb)
return nb
end

Expand Down
58 changes: 35 additions & 23 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typealias ScalarType Union{Type{Any}, Type{Nullable}}
broadcast!(::typeof(identity), X::AbstractArray, x::Number) = fill!(X, x)
broadcast!(f, X::AbstractArray, x::Number...) = (@inbounds for I in eachindex(X); X[I] = f(x...); end; X)
function broadcast!{T,S,N}(::typeof(identity), x::AbstractArray{T,N}, y::AbstractArray{S,N})
check_broadcast_shape(broadcast_indices(x), broadcast_indices(y))
@boundscheck check_broadcast_shape(broadcast_indices(x), broadcast_indices(y))
copy!(x, y)
end

Expand Down Expand Up @@ -122,6 +122,11 @@ map_newindexer(shape, ::Tuple{}) = (), ()
keep, Idefault = newindexer(shape, A1)
(keep, keeps...), (Idefault, Idefaults...)
end
@inline function map_newindexer(shape, A, Bs)
keeps, Idefaults = map_newindexer(shape, Bs)
keep, Idefault = newindexer(shape, A)
(keep, keeps...), (Idefault, Idefaults...)
end

Base.@propagate_inbounds _broadcast_getindex(A, I) = _broadcast_getindex(containertype(A), A, I)
Base.@propagate_inbounds _broadcast_getindex(::Type{Array}, A::Ref, I) = A[]
Expand All @@ -131,11 +136,13 @@ Base.@propagate_inbounds _broadcast_getindex(::Any, A, I) = A[I]
## Broadcasting core
# nargs encodes the number of As arguments (which matches the number
# of keeps). The first two type parameters are to ensure specialization.
@generated function _broadcast!{K,ID,AT,nargs}(f, B::AbstractArray, keeps::K, Idefaults::ID, As::AT, ::Type{Val{nargs}}, iter)
@generated function _broadcast!{K,ID,AT,BT,N}(f, B::AbstractArray, keeps::K, Idefaults::ID, A::AT, Bs::BT, ::Type{Val{N}}, iter)
nargs = N + 1
quote
$(Expr(:meta, :inline))
# destructure the keeps and As tuples
@nexprs $nargs i->(A_i = As[i])
A_1 = A
@nexprs $N i->(A_{i+1} = Bs[i])
@nexprs $nargs i->(keep_i = keeps[i])
@nexprs $nargs i->(Idefault_i = Idefaults[i])
@simd for I in iter
Expand All @@ -152,11 +159,13 @@ end

# For BitArray outputs, we cache the result in a "small" Vector{Bool},
# and then copy in chunks into the output
@generated function _broadcast!{K,ID,AT,nargs}(f, B::BitArray, keeps::K, Idefaults::ID, As::AT, ::Type{Val{nargs}}, iter)
@generated function _broadcast!{K,ID,AT,BT,N}(f, B::BitArray, keeps::K, Idefaults::ID, A::AT, Bs::BT, ::Type{Val{N}}, iter)
nargs = N + 1
quote
$(Expr(:meta, :inline))
# destructure the keeps and As tuples
@nexprs $nargs i->(A_i = As[i])
A_1 = A
@nexprs $N i->(A_{i+1} = Bs[i])
@nexprs $nargs i->(keep_i = keeps[i])
@nexprs $nargs i->(Idefault_i = Idefaults[i])
C = Vector{Bool}(bitcache_size)
Expand Down Expand Up @@ -193,13 +202,13 @@ Note that `dest` is only used to store the result, and does not supply
arguments to `f` unless it is also listed in the `As`,
as in `broadcast!(f, A, A, B)` to perform `A[:] = broadcast(f, A, B)`.
"""
@inline function broadcast!{nargs}(f, B::AbstractArray, As::Vararg{Any,nargs})
shape = indices(B)
check_broadcast_indices(shape, As...)
keeps, Idefaults = map_newindexer(shape, As)
@inline function broadcast!{N}(f, C::AbstractArray, A, Bs::Vararg{Any,N})
shape = indices(C)
@boundscheck check_broadcast_indices(shape, A, Bs...)
keeps, Idefaults = map_newindexer(shape, A, Bs)
iter = CartesianRange(shape)
_broadcast!(f, B, keeps, Idefaults, As, Val{nargs}, iter)
return B
_broadcast!(f, C, keeps, Idefaults, A, Bs, Val{N}, iter)
return C
end

# broadcast with computed element type
Expand Down Expand Up @@ -244,27 +253,30 @@ function broadcast_t(f, ::Type{Any}, shape, iter, As...)
st = start(iter)
I, st = next(iter, st)
val = f([ _broadcast_getindex(As[i], newindex(I, keeps[i], Idefaults[i])) for i=1:nargs ]...)
B = similar(Array{typeof(val)}, shape)
if val isa Bool
B = similar(BitArray, shape)
else
B = similar(Array{typeof(val)}, shape)
end
B[I] = val
return _broadcast!(f, B, keeps, Idefaults, As, Val{nargs}, iter, st, 1)
end
@inline function broadcast_t{nargs}(f, T, shape, iter, As::Vararg{Any,nargs})
B = similar(Array{T}, shape)
keeps, Idefaults = map_newindexer(shape, As)
_broadcast!(f, B, keeps, Idefaults, As, Val{nargs}, iter)
return B
@inline function broadcast_t{N}(f, T, shape, iter, A, Bs::Vararg{Any,N})
C = similar(Array{T}, shape)
keeps, Idefaults = map_newindexer(shape, A, Bs)
_broadcast!(f, C, keeps, Idefaults, A, Bs, Val{N}, iter)
return C
end

# default to BitArray for broadcast operations producing Bool, to save 8x space
# in the common case where this is used for logical array indexing; in
# performance-critical cases where Array{Bool} is desired, one can always
# use broadcast! instead.
function broadcast_t(f, ::Type{Bool}, shape, iter, As...)
B = similar(BitArray, shape)
nargs = length(As)
keeps, Idefaults = map_newindexer(shape, As)
_broadcast!(f, B, keeps, Idefaults, As, Val{nargs}, iter)
return B
@inline function broadcast_t{N}(f, ::Type{Bool}, shape, iter, A, Bs::Vararg{Any,N})
C = similar(BitArray, shape)
keeps, Idefaults = map_newindexer(shape, A, Bs)
_broadcast!(f, C, keeps, Idefaults, A, Bs, Val{N}, iter)
return C
end

eltypestuple(a) = (Base.@_pure_meta; Tuple{eltype(a)})
Expand Down
Loading

0 comments on commit b50967b

Please sign in to comment.