Skip to content

Commit

Permalink
merged with master
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausC committed Aug 26, 2018
2 parents 0facd1d + a2a1506 commit 3a58908
Show file tree
Hide file tree
Showing 220 changed files with 1,977 additions and 30,613 deletions.
24 changes: 8 additions & 16 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
Julia v1.0.0 Release Notes
==========================

New language features
---------------------

Language changes
----------------

Breaking changes
----------------
Julia v1.0 is identical to the v0.7 release, with the exception that
it removes all deprecations and deprecation related warnings. When
upgrading a codebase from v0.6, the process is to first get the code
to work on v0.7, and fix all the deprecation warnings. Once the code
runs on v0.7 without warnings, it should be good to run on v1.0.

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

Compiler/Runtime improvements
-----------------------------
Refer to the [Release Notes for
v0.7](https://github.com/JuliaLang/julia/blob/master/HISTORY.md) for a
detailed list of changes from Julia v0.6.

Deprecated or removed
---------------------

The old package manager (now called `OldPkg`) has been moved to a
separate repository at https://github.com/JuliaArchive/OldPkg.jl ([#27930])

Command-line option changes
---------------------------

<!--- generated by NEWS-update.jl: -->
[#27930]: https://github.com/JuliaLang/julia/issues/27930
3 changes: 3 additions & 0 deletions base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ f (generic function with 1 method)
julia> f(apple)
"I'm a Fruit with value: 1"
julia> Fruit(1)
apple::Fruit = 1
```
Values can also be specified inside a `begin` block, e.g.
Expand Down
17 changes: 9 additions & 8 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,15 @@ end
<=(l::AbstractSet, r::AbstractSet) = l r

function issubset(l, r)

rlen = length(r)
#This threshold was empirically determined by repeatedly
#sampling using these two methods.
lenthresh = 70

if rlen > lenthresh && !isa(r, AbstractSet)
return issubset(l, Set(r))
if haslength(r)
rlen = length(r)
#This threshold was empirically determined by repeatedly
#sampling using these two methods (see #26198)
lenthresh = 70

if rlen > lenthresh && !isa(r, AbstractSet)
return issubset(l, Set(r))
end
end

for elt in l
Expand Down
9 changes: 3 additions & 6 deletions base/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ export
atomic_max!, atomic_min!,
atomic_fence

# Disable 128-bit types on 32-bit Intel systems due to LLVM problems;
# see <https://github.com/JuliaLang/julia/issues/14818> (fixed on LLVM 3.9)
# 128-bit atomics do not exist on AArch32.
if (Base.libllvm_version < v"3.9-" && ARCH === :i686) ||
startswith(string(ARCH), "arm")
if startswith(string(ARCH), "arm")
const inttypes = (Int8, Int16, Int32, Int64,
UInt8, UInt16, UInt32, UInt64)
else
Expand Down Expand Up @@ -345,8 +342,8 @@ gc_alignment(::Type{T}) where {T} = ccall(:jl_alignment, Cint, (Csize_t,), sizeo
for typ in atomictypes
lt = llvmtypes[typ]
ilt = llvmtypes[inttype(typ)]
rt = Base.libllvm_version >= v"3.6" ? "$lt, $lt*" : "$lt*"
irt = Base.libllvm_version >= v"3.6" ? "$ilt, $ilt*" : "$ilt*"
rt = "$lt, $lt*"
irt = "$ilt, $ilt*"
@eval getindex(x::Atomic{$typ}) =
llvmcall($"""
%ptr = inttoptr i$WORD_SIZE %0 to $lt*
Expand Down
24 changes: 24 additions & 0 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,30 @@ Like [`broadcast`](@ref), but store the result of
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)`.
# Examples
```jldoctest
julia> A = [1.0; 0.0]; B = [0.0; 0.0];
julia> broadcast!(+, B, A, (0, -2.0));
julia> B
2-element Array{Float64,1}:
1.0
-2.0
julia> A
2-element Array{Float64,1}:
1.0
0.0
julia> broadcast!(+, A, A, (0, -2.0));
julia> A
2-element Array{Float64,1}:
1.0
-2.0
```
"""
broadcast!(f::Tf, dest, As::Vararg{Any,N}) where {Tf,N} = (materialize!(dest, broadcasted(f, As...)); dest)

Expand Down
2 changes: 1 addition & 1 deletion base/cartesian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ would generate:
end
end
If you want just a post-expression, supply `nothing` for the pre-expression. Using
If you want just a post-expression, supply [`nothing`](@ref) for the pre-expression. Using
parentheses and semicolons, you can supply multi-statement expressions.
"""
macro nloops(N, itersym, rangeexpr, args...)
Expand Down
4 changes: 0 additions & 4 deletions base/checked.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ if Core.sizeof(Ptr{Cvoid}) == 4
brokenSignedIntMul = Union{brokenSignedIntMul, Int64}
brokenUnsignedIntMul = Union{brokenUnsignedIntMul, UInt64}
end
if llvm_version < 30500
brokenSignedIntMul = Union{brokenSignedIntMul, Int8}
brokenUnsignedIntMul = Union{brokenUnsignedIntMul, UInt8}
end
const BrokenSignedInt = brokenSignedInt
const BrokenUnsignedInt = brokenUnsignedInt
const BrokenSignedIntMul = brokenSignedIntMul
Expand Down
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function repl_cmd(cmd, out)
# If it's intended to simulate `cd`, it should instead be doing
# more nearly `cd $dir && printf %s \$PWD` (with appropriate quoting),
# since shell `cd` does more than just `echo` the result.
dir = read(`$shell -c "printf %s $(shell_escape_posixly(dir))"`, String)
dir = read(`$shell -c "printf '%s' $(shell_escape_posixly(dir))"`, String)
end
cd(dir)
end
Expand Down
6 changes: 3 additions & 3 deletions base/compiler/ssair/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function show_ir(io::IO, code::IRCode, expr_type_printer=default_expr_type_print
bb_idx = 1
new_nodes = code.new_nodes
if any(i -> !isassigned(code.new_nodes, i), 1:length(code.new_nodes))
printstyled(io, :red, "ERROR: New node array has unset entry\n")
printstyled(io, "ERROR: New node array has unset entry\n", color=:red)
new_nodes = new_nodes[filter(i -> isassigned(code.new_nodes, i), 1:length(code.new_nodes))]
end
for nn in new_nodes
Expand All @@ -354,7 +354,7 @@ function show_ir(io::IO, code::IRCode, expr_type_printer=default_expr_type_print
if !isassigned(stmts, idx)
# This is invalid, but do something useful rather
# than erroring, to make debugging easier
printstyled(io, :red, "#UNDEF\n")
printstyled(io, "#UNDEF\n", color=:red)
continue
end
stmt = stmts[idx]
Expand Down Expand Up @@ -495,7 +495,7 @@ function show_ir(io::IO, code::CodeInfo, expr_type_printer=default_expr_type_pri
if !isassigned(stmts, idx)
# This is invalid, but do something useful rather
# than erroring, to make debugging easier
printstyled(io, :red, "#UNDEF\n")
printstyled(io, "#UNDEF\n", color=:red)
continue
end
stmt = stmts[idx]
Expand Down
3 changes: 3 additions & 0 deletions base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ function tuplemerge(a::DataType, b::DataType)
for loop_b = (false, true)
for i = (lt + 1):(loop_b ? lbr : lar)
ti = unwrapva(loop_b ? bp[i] : ap[i])
while ti isa TypeVar
ti = ti.ub
end
# compare (ti <-> tail), (wrapper ti <-> tail), (ti <-> wrapper tail), then (wrapper ti <-> wrapper tail)
# until we find the first element that contains the other in the pair
# TODO: this result would be more stable (and more associative and more commutative)
Expand Down
2 changes: 1 addition & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function astname(x::Expr, ismacro::Bool)
ismacro ? macroname(x) : x
# Call overloading, e.g. `(a::A)(b) = b` or `function (a::A)(b) b end` should document `A(b)`
elseif (isexpr(x, :function) || isexpr(x, :(=))) && isexpr(x.args[1], :call) && isexpr(x.args[1].args[1], :(::))
return astname(x.args[1].args[1].args[2], ismacro)
return astname(x.args[1].args[1].args[end], ismacro)
else
n = isexpr(x, (:module, :struct)) ? 2 : 1
astname(x.args[n], ismacro)
Expand Down
2 changes: 1 addition & 1 deletion base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ isdone(itr, state...) = missing
iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}}
Advance the iterator to obtain the next element. If no elements
remain, nothing should be returned. Otherwise, a 2-tuple of the
remain, `nothing` should be returned. Otherwise, a 2-tuple of the
next element and the new iteration state should be returned.
"""
function iterate end
Expand Down
8 changes: 4 additions & 4 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ count_ones_abs(x::BigInt) = iszero(x) ? 0 : MPZ.mpn_popcount(x)

divrem(x::BigInt, y::BigInt) = MPZ.tdiv_qr(x, y)

cmp(x::BigInt, y::BigInt) = MPZ.cmp(x, y)
cmp(x::BigInt, y::ClongMax) = MPZ.cmp_si(x, y)
cmp(x::BigInt, y::CulongMax) = MPZ.cmp_ui(x, y)
cmp(x::BigInt, y::BigInt) = sign(MPZ.cmp(x, y))
cmp(x::BigInt, y::ClongMax) = sign(MPZ.cmp_si(x, y))
cmp(x::BigInt, y::CulongMax) = sign(MPZ.cmp_ui(x, y))
cmp(x::BigInt, y::Integer) = cmp(x, big(y))
cmp(x::Integer, y::BigInt) = -cmp(y, x)

cmp(x::BigInt, y::CdoubleMax) = isnan(y) ? -1 : MPZ.cmp_d(x, y)
cmp(x::BigInt, y::CdoubleMax) = isnan(y) ? -1 : sign(MPZ.cmp_d(x, y))
cmp(x::CdoubleMax, y::BigInt) = -cmp(y, x)

isqrt(x::BigInt) = MPZ.sqrt(x)
Expand Down
33 changes: 29 additions & 4 deletions base/indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,47 @@ Indices{N} = NTuple{N,AbstractUnitRange}
## Traits for array types ##

abstract type IndexStyle end
"""
IndexLinear()
Subtype of [`IndexStyle`](@ref) used to describe arrays which
are optimally indexed by one linear index.
A linear indexing style uses one integer to describe the position in the array
(even if it's a multidimensional array) and column-major
ordering is used to access the elements. For example,
if `A` were a `(2, 3)` custom matrix type with linear indexing,
and we referenced `A[5]` (using linear style), this would
be equivalent to referencing `A[1, 3]` (since `2*1 + 3 = 5`).
See also [`IndexCartesian`](@ref).
"""
struct IndexLinear <: IndexStyle end
"""
IndexCartesian()
Subtype of [`IndexStyle`](@ref) used to describe arrays which
are optimally indexed by a Cartesian index.
A cartesian indexing style uses multiple integers/indices to describe the position in the array.
For example, if `A` were a `(2, 3, 4)` custom matrix type with cartesian indexing,
we could reference `A[2, 1, 3]` and Julia would automatically convert this into the
correct location in the underlying memory. See also [`IndexLinear`](@ref).
"""
struct IndexCartesian <: IndexStyle end

"""
IndexStyle(A)
IndexStyle(typeof(A))
`IndexStyle` specifies the "native indexing style" for array `A`. When
you define a new `AbstractArray` type, you can choose to implement
either linear indexing or cartesian indexing. If you decide to
implement linear indexing, then you must set this trait for your array
you define a new [`AbstractArray`](@ref) type, you can choose to implement
either linear indexing (with [`IndexLinear`](@ref)) or cartesian indexing.
If you decide to implement linear indexing, then you must set this trait for your array
type:
Base.IndexStyle(::Type{<:MyArray}) = IndexLinear()
The default is `IndexCartesian()`.
The default is [`IndexCartesian()`](@ref).
Julia's internal indexing machinery will automatically (and invisibly)
convert all indexing operations into the preferred style. This allows users
Expand Down
3 changes: 2 additions & 1 deletion base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ function init_load_path()
unsafe_string(Base.JLOptions().project) :
get(ENV, "JULIA_PROJECT", nothing))
HOME_PROJECT[] =
project == nothing ? nothing :
project == "" ? nothing :
project == "@." ? current_project() : project
project == "@." ? current_project() : abspath(project)
append!(empty!(LOAD_PATH), paths)
end

Expand Down
15 changes: 12 additions & 3 deletions base/int.jl
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,18 @@ end
@big_str str
@big_str(str)
`@big_str` parses a string into a BigInt
Throws an `ArgumentError` if the string is not a valid integer
Removes all underscores `_` from the string
Parse a string into a [`BigInt`](@ref) or [`BigFloat`](@ref),
and throw an `ArgumentError` if the string is not a valid number.
For integers `_` is allowed in the string as a separator.
# Examples
```jldoctest
julia> big"123_456"
123456
julia> big"7891.5"
7.8915e+03
```
"""
macro big_str(s)
if '_' in s
Expand Down
16 changes: 8 additions & 8 deletions base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -543,35 +543,35 @@ function bin(x::Unsigned, pad::Int, neg::Bool)
i = neg + max(pad,sizeof(x)<<3-leading_zeros(x))
a = StringVector(i)
while i > neg
a[i] = '0'+(x&0x1)
@inbounds a[i] = 48+(x&0x1)
x >>= 1
i -= 1
end
if neg; a[1]='-'; end
if neg; @inbounds a[1]=0x2d; end
String(a)
end

function oct(x::Unsigned, pad::Int, neg::Bool)
i = neg + max(pad,div((sizeof(x)<<3)-leading_zeros(x)+2,3))
a = StringVector(i)
while i > neg
a[i] = '0'+(x&0x7)
@inbounds a[i] = 48+(x&0x7)
x >>= 3
i -= 1
end
if neg; a[1]='-'; end
if neg; @inbounds a[1]=0x2d; end
String(a)
end

function dec(x::Unsigned, pad::Int, neg::Bool)
i = neg + ndigits(x, base=10, pad=pad)
a = StringVector(i)
while i > neg
a[i] = '0'+rem(x,10)
@inbounds a[i] = 48+rem(x,10)
x = oftype(x,div(x,10))
i -= 1
end
if neg; a[1]='-'; end
if neg; @inbounds a[1]=0x2d; end
String(a)
end

Expand All @@ -580,11 +580,11 @@ function hex(x::Unsigned, pad::Int, neg::Bool)
a = StringVector(i)
while i > neg
d = x & 0xf
a[i] = '0'+d+39*(d>9)
@inbounds a[i] = 48+d+39*(d>9)
x >>= 4
i -= 1
end
if neg; a[1]='-'; end
if neg; @inbounds a[1]=0x2d; end
String(a)
end

Expand Down
6 changes: 3 additions & 3 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ Also similar to `enumerate(A)`, except `i` will be a valid index
for `A`, while `enumerate` always counts from 1 regardless of the indices
of `A`.
Specifying `IndexLinear()` ensures that `i` will be an integer;
specifying `IndexCartesian()` ensures that `i` will be a
`CartesianIndex`; specifying `IndexStyle(A)` chooses whichever has
Specifying [`IndexLinear()`](@ref) ensures that `i` will be an integer;
specifying [`IndexCartesian()`](@ref) ensures that `i` will be a
[`CartesianIndex`](@ref); specifying `IndexStyle(A)` chooses whichever has
been defined as the native indexing style for array `A`.
Mutation of the bounds of the underlying array will invalidate this iterator.
Expand Down
Loading

0 comments on commit 3a58908

Please sign in to comment.