Skip to content

Commit

Permalink
Merge pull request #30954 from JuliaLang/backport-1.0.4
Browse files Browse the repository at this point in the history
Backports for 1.0.4
  • Loading branch information
ararslan committed May 9, 2019
2 parents 5b7e8d9 + e5de459 commit 51496aa
Show file tree
Hide file tree
Showing 70 changed files with 930 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ matrix:
- gfortran-5
- os: osx
env: ARCH="x86_64"
osx_image: xcode8
osx_image: xcode8.3
cache: ccache
branches:
only:
Expand Down
6 changes: 4 additions & 2 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ function union!(s::AbstractSet, sets...)
end

max_values(::Type) = typemax(Int)
max_values(T::Type{<:Union{Nothing,BitIntegerSmall}}) = 1 << (8*sizeof(T))
max_values(T::Union) = max(max_values(T.a), max_values(T.b))
max_values(T::Union{map(X -> Type{X}, BitIntegerSmall_types)...}) = 1 << (8*sizeof(T))
# saturated addition to prevent overflow with typemax(Int)
max_values(T::Union) = max(max_values(T.a), max_values(T.b), max_values(T.a) + max_values(T.b))
max_values(::Type{Bool}) = 2
max_values(::Type{Nothing}) = 1

function union!(s::AbstractSet{T}, itr) where T
haslength(itr) && sizehint!(s, length(s) + length(itr))
Expand Down
7 changes: 4 additions & 3 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,11 @@ function show_vector(io::IO, v, opn='[', cls=']')
io = IOContext(io, :typeinfo => eltype(v), :compact => get(io, :compact, true))
limited = get(io, :limit, false)
if limited && length(v) > 20
inds = axes1(v)
show_delim_array(io, v, opn, ",", "", false, inds[1], inds[1]+9)
axs1 = axes1(v)
f, l = first(axs1), last(axs1)
show_delim_array(io, v, opn, ",", "", false, f, f+9)
print(io, "")
show_delim_array(io, v, "", ",", cls, false, inds[end-9], inds[end])
show_delim_array(io, v, "", ",", cls, false, l-9, l)
else
show_delim_array(io, v, opn, ",", cls, false)
end
Expand Down
30 changes: 20 additions & 10 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function simple_walk(compact::IncrementalCompact, @nospecialize(defssa#=::AnySSA
return defssa
end
if isa(def.val, SSAValue)
if isa(defssa, OldSSAValue) && !already_inserted(compact, defssa)
if is_old(compact, defssa)
defssa = OldSSAValue(def.val.id)
else
defssa = def.val
Expand Down Expand Up @@ -191,7 +191,7 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
collect(Iterators.filter(1:length(def.edges)) do n
isassigned(def.values, n) || return false
val = def.values[n]
if isa(defssa, OldSSAValue) && isa(val, SSAValue)
if is_old(compact, defssa) && isa(val, SSAValue)
val = OldSSAValue(val.id)
end
edge_typ = widenconst(compact_exprtype(compact, val))
Expand All @@ -201,7 +201,7 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
for n in possible_predecessors
pred = def.edges[n]
val = def.values[n]
if isa(defssa, OldSSAValue) && isa(val, SSAValue)
if is_old(compact, defssa) && isa(val, SSAValue)
val = OldSSAValue(val.id)
end
if isa(val, AnySSAValue)
Expand Down Expand Up @@ -281,7 +281,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
end
if is_tuple_call(compact.ir, def) && isa(field, Int) && 1 <= field < length(def.args)
lifted = def.args[1+field]
if isa(leaf, OldSSAValue) && isa(lifted, SSAValue)
if is_old(compact, leaf) && isa(lifted, SSAValue)
lifted = OldSSAValue(lifted.id)
end
if isa(lifted, GlobalRef) || isa(lifted, Expr)
Expand Down Expand Up @@ -320,7 +320,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
compact[leaf] = def
end
lifted = def.args[1+field]
if isa(leaf, OldSSAValue) && isa(lifted, SSAValue)
if is_old(compact, leaf) && isa(lifted, SSAValue)
lifted = OldSSAValue(lifted.id)
end
if isa(lifted, GlobalRef) || isa(lifted, Expr)
Expand All @@ -339,7 +339,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
# N.B.: This can be a bit dangerous because it can lead to
# infinite loops if we accidentally insert a node just ahead
# of where we are
if isa(leaf, OldSSAValue) && (isa(field, Int) || isa(field, Symbol))
if is_old(compact, leaf) && (isa(field, Int) || isa(field, Symbol))
(isa(typ, DataType) && (!typ.abstract)) || return nothing
@assert !typ.mutable
# If there's the potential for an undefref error on access, we cannot insert a getfield
Expand Down Expand Up @@ -425,6 +425,12 @@ struct LiftedPhi
need_argupdate::Bool
end

function is_old(compact, @nospecialize(old_node_ssa))
isa(old_node_ssa, OldSSAValue) &&
!is_pending(compact, old_node_ssa) &&
!already_inserted(compact, old_node_ssa)
end

function perform_lifting!(compact::IncrementalCompact,
visited_phinodes::Vector{Any}, @nospecialize(cache_key),
lifting_cache::IdDict{Pair{AnySSAValue, Any}, AnySSAValue},
Expand Down Expand Up @@ -455,7 +461,7 @@ function perform_lifting!(compact::IncrementalCompact,
isassigned(old_node.values, i) || continue
val = old_node.values[i]
orig_val = val
if isa(old_node_ssa, OldSSAValue) && !is_pending(compact, old_node_ssa) && !already_inserted(compact, old_node_ssa) && isa(val, SSAValue)
if is_old(compact, old_node_ssa) && isa(val, SSAValue)
val = OldSSAValue(val.id)
end
if isa(val, Union{NewSSAValue, SSAValue, OldSSAValue})
Expand Down Expand Up @@ -688,10 +694,14 @@ function getfield_elim_pass!(ir::IRCode, domtree::DomTree)
compact[idx] = val === nothing ? nothing : val.x
end

# Copy the use count, `finish` may modify it and for our predicate
# below we need it consistent with the state of the IR here.

non_dce_finish!(compact)
# Copy the use count, `simple_dce!` may modify it and for our predicate
# below we need it consistent with the state of the IR here (after tracking
# phi node arguments, but before dce).
used_ssas = copy(compact.used_ssas)
ir = finish(compact)
simple_dce!(compact)
ir = complete(compact)
# Now go through any mutable structs and see which ones we can eliminate
for (idx, (intermediaries, defuse)) in defuses
intermediaries = collect(intermediaries)
Expand Down
2 changes: 1 addition & 1 deletion base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ updated as appropriate before returning.
"""
deepcopy(x) = deepcopy_internal(x, IdDict())::typeof(x)

deepcopy_internal(x::Union{Symbol,Core.MethodInstance,Method,GlobalRef,DataType,Union,Task},
deepcopy_internal(x::Union{Symbol,Core.MethodInstance,Method,GlobalRef,DataType,Union,UnionAll,Task},
stackdict::IdDict) = x
deepcopy_internal(x::Tuple, stackdict::IdDict) =
ntuple(i->deepcopy_internal(x[i], stackdict), length(x))
Expand Down
5 changes: 2 additions & 3 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1094,10 +1094,9 @@ end

@inline peek(s::Stateful, sentinel=nothing) = s.nextvalstate !== nothing ? s.nextvalstate[1] : sentinel
@inline iterate(s::Stateful, state=nothing) = s.nextvalstate === nothing ? nothing : (popfirst!(s), nothing)
IteratorSize(::Type{Stateful{VS,T}} where VS) where {T} =
isa(IteratorSize(T), SizeUnknown) ? SizeUnknown() : HasLength()
IteratorSize(::Type{Stateful{T,VS}}) where {T,VS} = IteratorSize(T) isa HasShape ? HasLength() : IteratorSize(T)
eltype(::Type{Stateful{T, VS}} where VS) where {T} = eltype(T)
IteratorEltype(::Type{Stateful{VS,T}} where VS) where {T} = IteratorEltype(T)
IteratorEltype(::Type{Stateful{T,VS}}) where {T,VS} = IteratorEltype(T)
length(s::Stateful) = length(s.itr) - s.taken

end
2 changes: 1 addition & 1 deletion base/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function tryparse_internal(::Type{Complex{T}}, s::Union{String,SubString{String}
end

if i₊ == 0 # purely real or imaginary value
if iᵢ > 0 # purely imaginary
if iᵢ > i && !(iᵢ == i+1 && s[i] in ('+','-')) # purely imaginary (not "±inf")
x = tryparse_internal(T, s, i, iᵢ-1, raise)
x === nothing && return nothing
return Complex{T}(zero(x),x)
Expand Down
4 changes: 2 additions & 2 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ function getindex(v::AbstractRange{T}, i::Integer) where T
@_inline_meta
ret = convert(T, first(v) + (i - 1)*step_hp(v))
ok = ifelse(step(v) > zero(step(v)),
(ret <= v.stop) & (ret >= v.start),
(ret <= v.start) & (ret >= v.stop))
(ret <= last(v)) & (ret >= first(v)),
(ret <= first(v)) & (ret >= last(v)))
@boundscheck ((i > 0) & ok) || throw_boundserror(v, i)
ret
end
Expand Down
5 changes: 4 additions & 1 deletion base/reinterpretarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S, N}} <: AbstractArray{T, N}
isbitstype(T) || throwbits(S, T, T)
isbitstype(S) || throwbits(S, T, S)
(N != 0 || sizeof(T) == sizeof(S)) || throwsize0(S, T)
ax1 = axes(a)[1]
if N != 0 && sizeof(S) != sizeof(T)
ax1 = axes(a)[1]
dim = length(ax1)
rem(dim*sizeof(S),sizeof(T)) == 0 || thrownonint(S, T, dim)
first(ax1) == 1 || throwaxes1(S, T, ax1)
Expand Down Expand Up @@ -68,19 +68,22 @@ IndexStyle(a::ReinterpretArray) = IndexStyle(a.parent)

parent(a::ReinterpretArray) = a.parent
dataids(a::ReinterpretArray) = dataids(a.parent)
unaliascopy(a::ReinterpretArray{T}) where {T} = reinterpret(T, unaliascopy(a.parent))

function size(a::ReinterpretArray{T,N,S} where {N}) where {T,S}
psize = size(a.parent)
size1 = div(psize[1]*sizeof(S), sizeof(T))
tuple(size1, tail(psize)...)
end
size(a::ReinterpretArray{T,0}) where {T} = ()

function axes(a::ReinterpretArray{T,N,S} where {N}) where {T,S}
paxs = axes(a.parent)
f, l = first(paxs[1]), length(paxs[1])
size1 = div(l*sizeof(S), sizeof(T))
tuple(oftype(paxs[1], f:f+size1-1), tail(paxs)...)
end
axes(a::ReinterpretArray{T,0}) where {T} = ()

elsize(::Type{<:ReinterpretArray{T}}) where {T} = sizeof(T)
unsafe_convert(::Type{Ptr{T}}, a::ReinterpretArray{T,N,S} where N) where {T,S} = Ptr{T}(unsafe_convert(Ptr{S},a.parent))
Expand Down
3 changes: 3 additions & 0 deletions base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ julia> chop(a, head = 5, tail = 5)
```
"""
function chop(s::AbstractString; head::Integer = 0, tail::Integer = 1)
if isempty(s)
return SubString(s)
end
SubString(s, nextind(s, firstindex(s), head), prevind(s, lastindex(s), tail))
end

Expand Down
Binary file modified contrib/mac/app/julia.icns
Binary file not shown.
4 changes: 2 additions & 2 deletions deps/Versions.make
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ SUITESPARSE_VER = 4.4.5
UNWIND_VER = 1.1-julia2
OSXUNWIND_VER = 0.0.5
GMP_VER = 6.1.2
MPFR_VER = 4.0.1
MPFR_VER = 4.0.2
PATCHELF_VER = 0.9
MBEDTLS_VER = 2.6.0
CURL_VER = 7.56.0

# Specify the version of the Mozilla CA Certificate Store to obtain.
# The versions of cacert.pem are identified by the date (YYYY-MM-DD) of their changes.
# See https://curl.haxx.se/docs/caextract.html for more details.
MOZILLA_CACERT_VERSION := 2018-06-20
MOZILLA_CACERT_VERSION := 2019-01-23
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4e0bcbf65c67c86b1604e103db173d77
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
95022a2aee8bca4b8e1ce65b5e5840209cd7adb7d048a647c9501e15e0ebd37fb4e4a95e707a5ec001893789ae841e3300a615f8e21a711694fc288777eed726

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions deps/checksums/cacert-2019-01-23.pem/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fccbe6cec7a76e3351ad32e305184787
1 change: 1 addition & 0 deletions deps/checksums/cacert-2019-01-23.pem/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01faebab60b49a30736e0c88b713999f48c99b425889f7df9bbb80eb91367a6f26f20befdf8ac72b8d77659b143b7b37f91ad7dac5fde37c1d621fc663003687
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bcf01c3fa49a1684edc2d637ad7e03d6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ae4c798ae5c13ad1574646896665ccd1f7d91e64573a23662ce7016b00109c1c351013856c25bf12284d9c3996ca3b828506825e50fcb059969adc02a96c06f8

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion deps/checksums/mpfr-4.0.1.tar.bz2/md5

This file was deleted.

1 change: 0 additions & 1 deletion deps/checksums/mpfr-4.0.1.tar.bz2/sha512

This file was deleted.

1 change: 1 addition & 0 deletions deps/checksums/mpfr-4.0.2.tar.bz2/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6d8a8bb46fe09ff44e21cdbf84f5cdac
1 change: 1 addition & 0 deletions deps/checksums/mpfr-4.0.2.tar.bz2/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18bb3a87123d02b7537bc298d41bdbb33e58b8c196cc4040578e3b470e86c6c89e1bd8ab8b3919d106fe5b86922ef8999dc1aba7c521ee90a69f690be288a30d
8 changes: 7 additions & 1 deletion deps/gmp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ $(SRCCACHE)/gmp-$(GMP_VER)/build-patched: $(SRCCACHE)/gmp-$(GMP_VER)/source-extr
cd $(dir $@) && patch < $(SRCDIR)/patches/gmp-exception.patch
echo 1 > $@

$(BUILDDIR)/gmp-$(GMP_VER)/build-configured: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted $(SRCCACHE)/gmp-$(GMP_VER)/build-patched
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-config-ldflags.patch-applied: | $(SRCCACHE)/gmp-$(GMP_VER)/build-patched
cd $(dir $@) && patch -p1 < $(SRCDIR)/patches/gmp-config-ldflags.patch
echo 1 > $@

$(BUILDDIR)/gmp-$(GMP_VER)/build-configured: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-config-ldflags.patch-applied

$(BUILDDIR)/gmp-$(GMP_VER)/build-configured: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted
mkdir -p $(dir $@)
cd $(dir $@) && \
$(dir $<)/configure $(CONFIGURE_COMMON) F77= --enable-shared --disable-static $(GMP_CONFIGURE_OPTS)
Expand Down
4 changes: 2 additions & 2 deletions deps/libssh2.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LIBSSH2_BRANCH=libssh2-1.8.0
LIBSSH2_SHA1=30e9c1347e3b8baa2951db612f05e6d87fc8e2f2
LIBSSH2_BRANCH=libssh2-1.8.2
LIBSSH2_SHA1=02ecf17a6d5f9837699e8fb3aad0c804caa67eeb
2 changes: 1 addition & 1 deletion deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ LLVM_CXXFLAGS += $(CXXFLAGS)
LLVM_CPPFLAGS += $(CPPFLAGS)
LLVM_LDFLAGS += $(LDFLAGS)
LLVM_CMAKE += -DLLVM_TARGETS_TO_BUILD:STRING="$(LLVM_TARGETS)" -DCMAKE_BUILD_TYPE="$(LLVM_CMAKE_BUILDTYPE)"
LLVM_CMAKE += -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF
LLVM_CMAKE += -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_HOST_TRIPLE="$(or $(XC_HOST),$(BUILD_MACHINE))"
ifeq ($(USE_POLLY_ACC),1)
LLVM_CMAKE += -DPOLLY_ENABLE_GPGPU_CODEGEN=ON
endif
Expand Down
Loading

0 comments on commit 51496aa

Please sign in to comment.