Skip to content

Commit

Permalink
Merge branch 'master' into sf/bb_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat authored Jan 11, 2020
2 parents 043dd7f + edc1b7d commit 598ba89
Show file tree
Hide file tree
Showing 155 changed files with 985 additions and 448 deletions.
5 changes: 0 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ own licenses:
- [LLVM](https://releases.llvm.org/6.0.0/LICENSE.TXT) [BSD-3, effectively]
- [UTF8PROC](https://github.com/JuliaStrings/utf8proc) [MIT]

The following components included in `stdlib` have their own separate licenses:

- stdlib/SuiteSparse/umfpack.jl (see [SUITESPARSE](http://suitesparse.com))
- stdlib/SuiteSparse/cholmod.jl (see [SUITESPARSE](http://suitesparse.com))

Julia's `stdlib` uses the following external libraries, which have their own licenses:

- [DSFMT](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/LICENSE.txt) [BSD-3]
Expand Down
23 changes: 21 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ New library features

Standard library changes
------------------------

* The `@timed` macro now returns a `NamedTuple` ([#34149])

#### LinearAlgebra

* The BLAS submodule now supports the level-2 BLAS subroutine `hpmv!` ([#34211]).
* `normalize` now supports multidimensional arrays ([#34239])

#### Markdown

Expand All @@ -42,6 +43,24 @@ Standard library changes


#### SparseArrays
* `lu!` accepts `UmfpackLU` as an argument to make use of its symbolic factorization.

#### Dates

#### Statistics


#### Sockets


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

External dependencies
---------------------

Tooling Improvements
---------------------


<!--- generated by NEWS-update.jl: -->
2 changes: 1 addition & 1 deletion base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ but it also repeated every M elements if desired.
"""
function print_matrix_vdots(io::IO, vdots::AbstractString,
A::Vector, sep::AbstractString, M::Integer, m::Integer,
pad_right::Bool)
pad_right::Bool = true)
for k = 1:length(A)
w = A[k][1] + A[k][2]
if k % M == m
Expand Down
1 change: 1 addition & 0 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ _bcsm(a::Number, b::Number) = a == b || b == 1
# (We may not want to define general promotion rules between, say, OneTo and Slice, but if
# we get here we know the axes are at least consistent for the purposes of broadcasting)
axistype(a::T, b::T) where T = a
axistype(a::OneTo, b::OneTo) = OneTo{Int}(a)
axistype(a, b) = UnitRange{Int}(a)

## Check that all arguments are broadcast compatible with shape
Expand Down
7 changes: 7 additions & 0 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
end
elseif isa(leaf, QuoteNode)
leaf = leaf.value
elseif isa(leaf, GlobalRef)
mod, name = leaf.mod, leaf.name
if isdefined(mod, name) && isconst(mod, name)
leaf = getfield(mod, name)
else
return nothing
end
elseif isa(leaf, Union{Argument, Expr})
return nothing
end
Expand Down
15 changes: 0 additions & 15 deletions base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,6 @@ function is_derived_type(@nospecialize(t), @nospecialize(c), mindepth::Int)
for p in cP
is_derived_type(t, p, mindepth) && return true
end
if isconcretetype(c) && isbitstype(c)
# see if it was extracted from a fieldtype
# however, only look through types that can be inlined
# to ensure monotonicity of derivation
# since we know that for immutable, concrete, bits types,
# the field types must have been constructed prior to the type,
# it cannot have a reference cycle in the type graph
cF = c.types
for f in cF
# often a parameter is also a field type; avoid searching twice
if !contains_is(c.parameters, f)
is_derived_type(t, f, mindepth) && return true
end
end
end
end
return false
end
Expand Down
12 changes: 11 additions & 1 deletion base/div.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,17 @@ julia> divrem(7,3)
```
"""
divrem(x, y) = divrem(x, y, RoundToZero)
divrem(a, b, r::RoundingMode) = (div(a, b, r), rem(a, b, r))
function divrem(a, b, r::RoundingMode)
if r == RoundToZero
# For compat. Remove in 2.0.
(div(a, b), rem(a, b))
elseif r === RoundDown
# For compat. Remove in 2.0.
(fld(a, b), mod(a, b))
else
(div(a, b, r), rem(a, b, r))
end
end
function divrem(x::Integer, y::Integer, rnd::typeof(RoundNearest))
(q, r) = divrem(x, y)
if x >= 0
Expand Down
11 changes: 10 additions & 1 deletion base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ resulting expression is substituted directly into the program at the point where
the macro is invoked.
Macros are a way to run generated code without calling [`eval`](@ref Base.eval), since the generated
code instead simply becomes part of the surrounding program.
Macro arguments may include expressions, literal values, and symbols.
Macro arguments may include expressions, literal values, and symbols. Macros can be defined for
variable number of arguments (varargs), but do not accept keyword arguments.
# Examples
```jldoctest
Expand All @@ -169,6 +170,14 @@ julia> macro sayhello(name)
julia> @sayhello "Charlie"
Hello, Charlie!
julia> macro saylots(x...)
return :( println("Say: ", \$(x...)) )
end
@saylots (macro with 1 method)
julia> @saylots "hey " "there " "friend"
Say: hey there friend
```
"""
kw"macro"
Expand Down
25 changes: 8 additions & 17 deletions base/gcutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,20 @@ Module with garbage collection utilities.
"""
module GC

# @enum-like structure
struct CollectionType
x::Int
end
Base.cconvert(::Type{Cint}, collection::CollectionType) = Cint(collection.x)

const Auto = CollectionType(0)
const Full = CollectionType(1)
const Incremental = CollectionType(2)

"""
GC.gc(full::Bool=true)
GC.gc(collection::CollectionType)
GC.gc()
GC.gc(full::Bool)
Perform garbage collection. The argument `full` determines whether a full, but more costly
collection is performed. Otherwise, heuristics are used to determine which type of
collection is needed. For exact control, pass an argument of type `CollectionType`.
Perform garbage collection. The argument `full` determines the kind of collection: A full
collection scans all objects, while an incremental collection only scans so-called young
objects and is much quicker. If called without an argument, heuristics are used to determine
which type of collection is needed.
!!! warning
Excessive use will likely lead to poor performance.
"""
gc(full::Bool=true) = ccall(:jl_gc_collect, Cvoid, (Cint,), full)
gc(collection::CollectionType) = ccall(:jl_gc_collect, Cvoid, (Cint,), collection)
gc() = ccall(:jl_gc_collect, Cvoid, (Cint,), 0)
gc(full::Bool) = ccall(:jl_gc_collect, Cvoid, (Cint,), full ? 1 : 2)

"""
GC.enable(on::Bool)
Expand Down
4 changes: 2 additions & 2 deletions base/int.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ julia> signed(unsigned(-2))
-2
```
"""
unsigned(x) = convert(Unsigned, x)
unsigned(x) = x % typeof(convert(Unsigned, zero(x)))
unsigned(x::BitSigned) = reinterpret(typeof(convert(Unsigned, zero(x))), x)

"""
Expand All @@ -164,7 +164,7 @@ unsigned(x::BitSigned) = reinterpret(typeof(convert(Unsigned, zero(x))), x)
Convert a number to a signed integer. If the argument is unsigned, it is reinterpreted as
signed without checking for overflow.
"""
signed(x) = convert(Signed, x)
signed(x) = x % typeof(convert(Signed, zero(x)))
signed(x::BitUnsigned) = reinterpret(typeof(convert(Signed, zero(x))), x)

div(x::BitSigned, y::Unsigned) = flipsign(signed(div(unsigned(abs(x)), y)), x)
Expand Down
3 changes: 2 additions & 1 deletion base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ end

const empty_sym = Symbol("")

function kwarg_decl(m::Method)
# NOTE: second argument is deprecated and is no longer used
function kwarg_decl(m::Method, kwtype = nothing)
mt = get_methodtable(m)
if isdefined(mt, :kwsorter)
kwtype = typeof(mt.kwsorter)
Expand Down
3 changes: 3 additions & 0 deletions base/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ function splitext(path::String)
a*m.captures[1], String(m.captures[2])
end

# NOTE: deprecated in 1.4
pathsep() = path_separator

"""
splitpath(path::AbstractString) -> Vector{String}
Expand Down
8 changes: 4 additions & 4 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -868,14 +868,14 @@ end
Return the method table for `f`.
If `types` is specified, return an array of methods whose types match.
If `module` is specified, return an array of methods defined in this module.
A list of modules can also be specified as an array or tuple.
If `module` is specified, return an array of methods defined in that module.
A list of modules can also be specified as an array.
!!! compat "Julia 1.4"
At least Julia 1.4 is required for specifying a module.
"""
function methods(@nospecialize(f), @nospecialize(t),
@nospecialize(mod::Union{Module,AbstractArray{Module},Tuple{Vararg{Module}},Nothing}=nothing))
@nospecialize(mod::Union{Module,AbstractArray{Module},Nothing}=nothing))
if mod isa Module
mod = (mod,)
end
Expand All @@ -900,7 +900,7 @@ function methods_including_ambiguous(@nospecialize(f), @nospecialize(t))
end

function methods(@nospecialize(f),
@nospecialize(mod::Union{Module,AbstractArray{Module},Tuple{Vararg{Module}},Nothing}=nothing))
@nospecialize(mod::Union{Module,AbstractArray{Module},Nothing}=nothing))
# return all matches
return methods(f, Tuple{Vararg{Any}}, mod)
end
Expand Down
17 changes: 17 additions & 0 deletions base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,23 @@ matching sequence is found, like the return value of [`findnext`](@ref).
If `overlap=true`, the matching sequences are allowed to overlap indices in the
original string, otherwise they must be from disjoint character ranges.
# Examples
```jldoctest
julia> findall("a", "apple")
1-element Array{UnitRange{Int64},1}:
1:1
julia> findall("nana", "banana")
1-element Array{UnitRange{Int64},1}:
3:6
julia> findall("a", "banana")
3-element Array{UnitRange{Int64},1}:
2:2
4:4
6:6
```
"""
function findall(t::Union{AbstractString,Regex}, s::AbstractString; overlap::Bool=false)
found = UnitRange{Int}[]
Expand Down
26 changes: 22 additions & 4 deletions base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,37 @@ end

function searchsortedlast(a::AbstractRange{<:Integer}, x::Real, o::DirectOrdering)
require_one_based_indexing(a)
if step(a) == 0
h = step(a)
if h == 0
lt(o, x, first(a)) ? 0 : length(a)
elseif h > 0 && x < first(a)
firstindex(a) - 1
elseif h > 0 && x >= last(a)
lastindex(a)
elseif h < 0 && x > first(a)
firstindex(a) - 1
elseif h < 0 && x <= last(a)
lastindex(a)
else
clamp( fld(floor(Integer, x) - first(a), step(a)) + 1, 0, length(a))
fld(floor(Integer, x) - first(a), h) + 1
end
end

function searchsortedfirst(a::AbstractRange{<:Integer}, x::Real, o::DirectOrdering)
require_one_based_indexing(a)
if step(a) == 0
h = step(a)
if h == 0
lt(o, first(a), x) ? length(a)+1 : 1
elseif h > 0 && x <= first(a)
firstindex(a)
elseif h > 0 && x > last(a)
lastindex(a) + 1
elseif h < 0 && x >= first(a)
firstindex(a)
elseif h < 0 && x < last(a)
lastindex(a) + 1
else
clamp(-fld(floor(Integer, -x) + first(a), step(a)) + 1, 1, length(a) + 1)
-fld(floor(Integer, -x) + first(a), h) + 1
end
end

Expand Down
4 changes: 2 additions & 2 deletions base/sysinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,14 @@ end
"""
Sys.free_memory()
Get the total free memory in RAM in kilobytes.
Get the total free memory in RAM in bytes.
"""
free_memory() = ccall(:uv_get_free_memory, UInt64, ())

"""
Sys.total_memory()
Get the total memory in RAM (including that which is currently used) in kilobytes.
Get the total memory in RAM (including that which is currently used) in bytes.
"""
total_memory() = ccall(:uv_get_total_memory, UInt64, ())

Expand Down
4 changes: 2 additions & 2 deletions base/threadingconstructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ threadid() = Int(ccall(:jl_threadid, Int16, ())+1)
Threads.nthreads()
Get the number of threads available to the Julia process. This is the inclusive upper bound
on `threadid()`.
on [`threadid()`](@ref).
"""
nthreads() = Int(unsafe_load(cglobal(:jl_n_threads, Cint)))

Expand Down Expand Up @@ -75,7 +75,7 @@ end
"""
Threads.@threads
A macro to parallelize a for-loop to run with multiple threads. This spawns `nthreads()`
A macro to parallelize a for-loop to run with multiple threads. This spawns [`nthreads()`](@ref)
number of threads, splits the iteration space amongst them, and iterates in parallel.
A barrier is placed at the end of the loop which waits for all the threads to finish
execution, and the loop returns.
Expand Down
Loading

0 comments on commit 598ba89

Please sign in to comment.