Skip to content

Commit

Permalink
Merge 21fc367 into 8a84ba5
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Apr 15, 2019
2 parents 8a84ba5 + 21fc367 commit c8aa3bb
Show file tree
Hide file tree
Showing 17 changed files with 148 additions and 96 deletions.
98 changes: 44 additions & 54 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,104 +4,93 @@ Julia v1.2 Release Notes
New language features
---------------------

* Argument splatting (`x...`) can now be used in calls to the `new` pseudo-function in
constructors ([#30577]).

* Objects created by calling `skipmissing` on an array can now be indexed using indices
from the parent at non-missing positions. This allows functions such as
`findall`, `findfirst`, `argmin`/`argmax` and `findmin`/`findmax` to work with these
objects, returning the index of matching non-missing elements in the parent ([#31008]).

* `inv(::Missing)` has now been added and returns `missing` ([#31451]).
* Argument splatting (`x...`) can now be used in calls to the `new` pseudo-function in
constructors ([#30577]).
* Support for Unicode 12.0.0 ([#31561]).
* Added `` (`\star`) as unary operator ([#31604]).

* `nextfloat(::BigFloat, n::Integer)` and `prevfloat(::BigFloat, n::Integer)` methods
have been added ([#31310]).
Language changes
----------------

* Support for Unicode 12.0.0 ([#31561]).
* Empty entries in `JULIA_DEPOT_PATH` are now expanded to default depot entries ([#31009]).

Multi-threading changes
-----------------------

* The `Condition` type now has a thread-safe replacement, accessed as `Threads.Condition`.
With that addition, task scheduling primitives such as `ReentrantLock` are now thread-safe ([#30061]).

* It is possible to schedule and switch Tasks during `@threads` loops, and perform limited I/O ([#31438]).

Language changes
----------------
* Empty entries in `JULIA_DEPOT_PATH` are now expanded to default depot entries ([#31009]).
* `Enum` now behaves like a scalar when used in broadcasting ([#30670]).
* If a `pipeline` is specified with `append=true` set, but no redirection, an `ArgumentError`
is thrown, rather than a `ErrorException` ([#27900]).
* Functions that invoke commands (e.g. `run(::Cmd)`) now throw a `ProcessFailedException`
rather than an `ErrorException`, if those commands exit with non-zero exit code.
([#27900]).
* Added `` (`\star`) as unary operator ([#31604]).
With that addition, task scheduling primitives such as `ReentrantLock` are now thread-safe ([#30061]).
* It is possible to schedule and switch Tasks during `@threads` loops, and perform limited I/O ([#31438]).

Command-line option changes
---------------------------
Build system changes
--------------------

* The build system now prefers downloading prebuilt binary tarballs for most dependencies on
supported systems, disable by setting `USE_BINARYBUILDER=0` at `make` time ([#31441]).

New library functions
---------------------

* `getipaddrs()` function returns all the IP addresses of the local machine, with IPv4 addresses sorting before IPv6 addresses ([#30349, #30604])
* `getipaddr(addr_type)` and `getipaddrs(addr_type)` functions returns an IP address(es) of the desired type of the local machine ([#30604])
* `getipaddrs()` function returns all the IP addresses of the local machine, with IPv4 addresses sorting before IPv6 addresses ([#30349, #30604]).
* `getipaddr(addr_type)` and `getipaddrs(addr_type)` functions returns an IP address(es) of the desired type of the local machine ([#30604]).
* Added `Base.hasproperty` and `Base.hasfield` ([#28850]).
* One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` has been added for currying,
similar to the existing `==(x)` and `isequal(x)` methods ([#30915]).
* One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` have been added, returning partially-applied
versions of the functions, similar to the existing `==(x)` and `isequal(x)` methods ([#30915]).

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

* `Enum` now behaves like a scalar when used in broadcasting ([#30670]).
* If a `pipeline` is specified with `append=true` set, but no redirection, an `ArgumentError`
is thrown, rather than a `ErrorException` ([#27900]).
* Functions that invoke commands (e.g. `run(::Cmd)`) now throw a `ProcessFailedException`
rather than an `ErrorException`, if those commands exit with non-zero exit code ([#27900]).
* The `extrema` function now accepts a function argument in the same manner as `minimum` and
`maximum` ([#30323]).
* `hasmethod` can now check for matching keyword argument names ([#30712]).
* `startswith` and `endswith` now accept a `Regex` for the second argument ([#29790]).
* `retry` supports arbitrary callable objects ([#30382]).
* `filter` now supports `SkipMissing`-wrapped arrays ([#31235]).
* A no-argument construct to `Ptr{T}` has been added which constructs a null pointer ([#30919])
* `strip` now accepts a function argument in the same manner as `lstrip` and `rstrip` ([#31211])
* `mktempdir` now accepts a `prefix` keyword argument to customize the file name ([#31230], [#22922])
* A no-argument constructor for `Ptr{T}` has been added which constructs a null pointer ([#30919]).
* `strip` now accepts a function argument in the same manner as `lstrip` and `rstrip` ([#31211]).
* `mktempdir` now accepts a `prefix` keyword argument to customize the file name ([#31230], [#22922]).
* `keytype` and `valtype` now work on `AbstractArray`, and return the `eltype` of `keys(...)` and
`values(...)` respectively ([#27749]).
* `nextfloat(::BigFloat)` and `prevfloat(::BigFloat)` now returns a value with the same precision
as their argument, which means that (in particular) `nextfloat(prevfloat(x)) == x` whereas
previously this could result in a completely different value with a different precision ([#31310])
* `mapreduce` now accept multiple iterators, similar to `map` ([#31532]).
previously this could result in a completely different value with a different precision ([#31310]).
* `mapreduce` now accepts multiple iterators, similar to `map` ([#31532]).
* `filter` now supports `SkipMissing`-wrapped arrays ([#31235]).
* Objects created by calling `skipmissing` on an array can now be indexed using indices
from the parent at non-missing positions. This allows functions such as
`findall`, `findfirst`, `argmin`/`argmax` and `findmin`/`findmax` to work with these
objects, returning the index of matching non-missing elements in the parent ([#31008]).
* `inv(::Missing)` has now been added and returns `missing` ([#31451]).
* `nextfloat(::BigFloat, n::Integer)` and `prevfloat(::BigFloat, n::Integer)` methods
have been added ([#31310]).

#### LinearAlgebra

* Added keyword arguments `rtol`, `atol` to `pinv` and `nullspace` ([#29998]).
* `UniformScaling` instances are now callable such that e.g. `I(3)` will produce a `Diagonal` matrix ([#30298]).
* Eigenvalues λ of general matrices are now sorted lexicographically by (Re λ, Im λ) ([#21598]).
* `one` for structured matrices (`Diagonal`, `Bidiagonal`, `Tridiagonal`, `Symtridiagonal`) now preserves
structure and type. ([#29777])
* `diagm(v)` is now a shorthand for `diagm(0 => v)`. ([#31125]).
structure and type ([#29777]).
* `diagm(v)` is now a shorthand for `diagm(0 => v)` ([#31125]).

#### SparseArrays

* performance improvements for sparse matrix-matrix multiplication ([#30372]).
* Performance improvements for sparse matrix-matrix multiplication ([#30372]).
* Sparse vector outer products are more performant and maintain sparsity in products of the
form `kron(u, v')`, `u * v'`, and `u .* v'` where `u` and `v` are sparse vectors or column
views. ([#24980])
views ([#24980]).

#### Dates

* Fixed `repr` such that it displays `DateTime` as it would be entered in Julia ([#30200]).

#### Statistics

* `quantile` now accepts in all cases collections whose `eltype` is not a subtype of `Number` ([#30938]).

#### Miscellaneous

* Since environment variables on Windows are case-insensitive, `ENV` now converts its keys
to uppercase for display, iteration, and copying ([#30593]).

* Build system now prefers downloading prebuilt binary tarballs for most dependencies on
supported systems, disable by setting `USE_BINARYBUILDER=0` at `make` time ([#31441]).

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

Expand All @@ -110,14 +99,12 @@ External dependencies
* MbedTLS has been updated to v2.16.0 ([#30618]).
* libunwind has been updated to v1.3.1 ([#30724]).

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


<!--- generated by NEWS-update.jl: -->
[#21598]: https://github.com/JuliaLang/julia/issues/21598
[#22922]: https://github.com/JuliaLang/julia/issues/22922
[#24980]: https://github.com/JuliaLang/julia/issues/24980
[#27749]: https://github.com/JuliaLang/julia/issues/27749
[#27900]: https://github.com/JuliaLang/julia/issues/27900
[#28850]: https://github.com/JuliaLang/julia/issues/28850
[#29777]: https://github.com/JuliaLang/julia/issues/29777
[#29790]: https://github.com/JuliaLang/julia/issues/29790
Expand Down Expand Up @@ -147,6 +134,9 @@ Deprecated or removed
[#31230]: https://github.com/JuliaLang/julia/issues/31230
[#31235]: https://github.com/JuliaLang/julia/issues/31235
[#31310]: https://github.com/JuliaLang/julia/issues/31310
[#31438]: https://github.com/JuliaLang/julia/issues/31438
[#31441]: https://github.com/JuliaLang/julia/issues/31441
[#31451]: https://github.com/JuliaLang/julia/issues/31451
[#31532]: https://github.com/JuliaLang/julia/issues/31532
[#31561]: https://github.com/JuliaLang/julia/issues/31561
[#31604]: https://github.com/JuliaLang/julia/issues/31604
51 changes: 25 additions & 26 deletions base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ Stacktrace:
```
"""
function bind(c::Channel, task::Task)
ref = WeakRef(c)
register_taskdone_hook(task, tsk->close_chnl_on_taskdone(tsk, ref))
# TODO: implement "schedulewait" and deprecate taskdone_hook
#T = Task(() -> close_chnl_on_taskdone(task, c))
#schedulewait(task, T)
register_taskdone_hook(task, tsk -> close_chnl_on_taskdone(tsk, c))
return c
end

Expand Down Expand Up @@ -223,33 +225,30 @@ function channeled_tasks(n::Int, funcs...; ctypes=fill(Any,n), csizes=fill(0,n))
return (chnls, tasks)
end

function close_chnl_on_taskdone(t::Task, ref::WeakRef)
c = ref.value
if c isa Channel
isopen(c) || return
cleanup = () -> try
isopen(c) || return
if istaskfailed(t)
excp = task_result(t)
if excp isa Exception
close(c, excp)
return
end
function close_chnl_on_taskdone(t::Task, c::Channel)
isopen(c) || return
cleanup = () -> try
isopen(c) || return
if istaskfailed(t)
excp = task_result(t)
if excp isa Exception
close(c, excp)
return
end
close(c)
return
finally
unlock(c)
end
if trylock(c)
# can't use `lock`, since attempts to task-switch to wait for it
# will just silently fail and leave us with broken state
cleanup()
else
# so schedule this to happen once we are finished destroying our task
# (on a new Task)
@async (lock(c); cleanup())
close(c)
return
finally
unlock(c)
end
if trylock(c)
# can't use `lock`, since attempts to task-switch to wait for it
# will just silently fail and leave us with broken state
cleanup()
else
# so schedule this to happen once we are finished destroying our task
# (on a new Task)
@async (lock(c); cleanup())
end
nothing
end
Expand Down
2 changes: 1 addition & 1 deletion base/strings/unicode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Give the number of columns needed to print a character.
julia> textwidth('α')
1
julia> textwidth('')
julia> textwidth('')
2
```
"""
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2c2343daca203daefb590ce4eb44ff74
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36cb49dad15a49d37af1bb712ed89c2945c5257176aa8fee12842c1305be8aeb114e20e082e636276a4c7c3a486ec3d0b1b7663a4b467f67f75ec567425a24c2
6 changes: 5 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6103,7 +6103,11 @@ static std::unique_ptr<Module> emit_function(
} else if (expr->head == popaliasscope_sym) {
scope_stack.pop_back();
scope_list_stack.pop_back();
current_aliasscope = scope_list_stack.back();
if (scope_list_stack.empty()) {
current_aliasscope = NULL;
} else {
current_aliasscope = scope_list_stack.back();
}
}
}
aliasscopes[i+1] = current_aliasscope;
Expand Down
8 changes: 4 additions & 4 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ JL_DLLEXPORT void jl_set_typeinf_func(jl_value_t *f)

static int very_general_type(jl_value_t *t)
{
return (t == (jl_value_t*)jl_any_type || t == (jl_value_t*)jl_type_type || jl_types_equal(t, (jl_value_t*)jl_type_type));
return (t == (jl_value_t*)jl_any_type || jl_types_equal(t, (jl_value_t*)jl_type_type));
}

jl_value_t *jl_nth_slot_type(jl_value_t *sig, size_t i)
Expand Down Expand Up @@ -528,17 +528,17 @@ static void jl_compilation_sig(
}
}

if (jl_types_equal(elt, (jl_value_t*)jl_typetype_type)) {
if (jl_types_equal(elt, (jl_value_t*)jl_typetype_type)) { // elt == Type{T} where T
// not triggered for isdispatchtuple(tt), this attempts to handle
// some cases of adapting a random signature into a compilation signature
}
else if (!jl_is_datatype(elt) && !jl_has_empty_intersection((jl_value_t*)jl_type_type, elt)) {
else if (!jl_is_datatype(elt) && jl_subtype(elt, (jl_value_t*)jl_type_type)) { // elt <: Type{T}
// not triggered for isdispatchtuple(tt), this attempts to handle
// some cases of adapting a random signature into a compilation signature
if (!*newparams) *newparams = jl_svec_copy(tt->parameters);
jl_svecset(*newparams, i, jl_typetype_type);
}
else if (jl_is_type_type(elt)) {
else if (jl_is_type_type(elt)) { // elt isa Type{T}
if (very_general_type(decl_i)) {
/*
here's a fairly simple heuristic: if this argument slot's
Expand Down
3 changes: 3 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ static void jl_close_item_atexit(uv_handle_t *handle)

JL_DLLEXPORT void jl_atexit_hook(int exitcode)
{
if (jl_all_tls_states == NULL)
return;

jl_ptls_t ptls = jl_get_ptls_states();

if (exitcode == 0)
Expand Down
24 changes: 23 additions & 1 deletion src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ static int forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t *e, in
int set = e->Lunions.more;
if (!sub || !set)
break;
free(se.buf);
save_env(e, &saved, &se);
for (int i = set; i <= lastset; i++)
statestack_set(&e->Lunions, i, 0);
Expand Down Expand Up @@ -2444,11 +2445,23 @@ static jl_value_t *intersect_all(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
e->Runions.more = 0;
memset(e->Runions.stack, 0, sizeof(e->Runions.stack));
jl_value_t **is;
JL_GC_PUSHARGS(is, 2);
JL_GC_PUSHARGS(is, 3);
jl_value_t **saved = &is[2];
jl_savedenv_t se;
save_env(e, saved, &se);
int lastset = 0, niter = 0, total_iter = 0;
jl_value_t *ii = intersect(x, y, e, 0);
is[0] = ii; // root
if (ii == jl_bottom_type) {
restore_env(e, *saved, &se);
}
else {
free(se.buf);
save_env(e, saved, &se);
}
while (e->Runions.more) {
if (e->emptiness_only && ii != jl_bottom_type) {
free(se.buf);
JL_GC_POP();
return ii;
}
Expand All @@ -2462,6 +2475,13 @@ static jl_value_t *intersect_all(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)

is[0] = ii;
is[1] = intersect(x, y, e, 0);
if (is[1] == jl_bottom_type) {
restore_env(e, *saved, &se);
}
else {
free(se.buf);
save_env(e, saved, &se);
}
if (is[0] == jl_bottom_type)
ii = is[1];
else if (is[1] == jl_bottom_type)
Expand All @@ -2473,10 +2493,12 @@ static jl_value_t *intersect_all(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
}
total_iter++;
if (niter > 3 || total_iter > 400000) {
free(se.buf);
JL_GC_POP();
return y;
}
}
free(se.buf);
JL_GC_POP();
return ii;
}
Expand Down
2 changes: 2 additions & 0 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ JL_DLLEXPORT void jl_threading_run(jl_value_t *func)
jl_apply(args, 2);
}
_threadedregion -= 1;
// make sure no threads are sitting in the event loop
jl_wake_libuv();
JL_GC_POP();
jl_gc_unsafe_leave(ptls, gc_state);
}
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Pkg.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PKG_BRANCH = master
PKG_SHA1 = 3b456141de8bc5ab5ba040221391ffc78701f750
PKG_SHA1 = eecc7149ed927869e0e61fa03ce478ecefc8917a
Loading

0 comments on commit c8aa3bb

Please sign in to comment.