Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use extended brackets instead of box-drawing characters in log messages #1

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
640bb57
Add sqrt_llvm_fast intrinsic (see #33220)
smallnamespace Sep 12, 2019
00ede87
Test that sqrt_llvm_fast intrinsic emits 'fast' tag
smallnamespace Sep 14, 2019
350548c
GC diff: avoid generating lots of signedness checks
vtjnash Oct 29, 2019
b9546c8
make allocated macro more reliable
vtjnash Oct 29, 2019
b36a8c6
add compile heuristic to all perf macros
vtjnash Oct 29, 2019
7600b14
datatype: reorder layout computation [NFCI]
vtjnash Oct 30, 2019
b7d5328
datatype: fix memory leak in layout of non-concrete types
vtjnash Oct 30, 2019
4e0d353
datatype: generalize the format used for isptr handling
carnaval Nov 1, 2019
025ac54
Add LIBEXECDIR relative folder constant
musm Nov 6, 2019
445a6fc
test
musm Nov 7, 2019
1ed96b2
Dispatch even more to BLAS (#33743)
dkarrasch Nov 11, 2019
91effa2
rem docstring: fix missing space
rfourquet Nov 11, 2019
3d1c6e2
Fix `realpath()` assumptions in REPL test suite
staticfloat Nov 12, 2019
ce646d5
fix "parallel computing" doc: remove extraneous "forwards"
rfourquet Nov 12, 2019
a77b2c1
codegen: remove some unnecessary write-barriers
vtjnash Nov 12, 2019
629d1a6
gc: add early-out for empty arrays
vtjnash Nov 12, 2019
45d4277
fixup! Fix `realpath()` assumptions in REPL test suite
vtjnash Nov 12, 2019
4ee78b4
fixup! Fix `realpath()` assumptions in REPL test suite
vtjnash Nov 12, 2019
beee107
Add LIBEXECDIR relative folder constant (#33777)
staticfloat Nov 12, 2019
7358173
Automatically up-convert eltype in SPQR (#33601)
dkarrasch Nov 12, 2019
8333297
Fix findfirst with decreasing step range (#33809)
laborg Nov 13, 2019
89a51fb
Fix compat docstring (#33813)
tkf Nov 13, 2019
1731d0a
remove gc-token from WeakKeyDict (#33825)
vtjnash Nov 13, 2019
baa6efd
Merge pull request #33827 from JuliaLang/jn/sf/repl_realpath
vtjnash Nov 13, 2019
08d1fe6
Merge pull request #33828 from JuliaLang/jn/gc-opt1
JeffBezanson Nov 13, 2019
f196d3f
fix #33768, inference of `_apply` with strange argument list lengths …
JeffBezanson Nov 13, 2019
cb0cd91
Merge pull request #33819 from JuliaLang/sf/repl_realpath
staticfloat Nov 14, 2019
77a4d06
Merge pull request #33234 from smallnamespace/smallnamespace-sqrt-fast
vchuravy Nov 14, 2019
2e46386
use 1 object for `SpinLock` instead of 2 (#32836)
JeffBezanson Nov 14, 2019
833b11a
tighten signature of (complex mat) x (real matorvec) (#33843)
dkarrasch Nov 14, 2019
dc9550f
table column alignment in html output (#33849)
pfitzseb Nov 14, 2019
ecb1bff
fix #33841, regression in let-bound function with kwargs (#33848)
JeffBezanson Nov 14, 2019
73a1caf
remove an object allocation in the scheduler (#32835)
JeffBezanson Nov 15, 2019
360c102
mention Pkg's LRU cache in HISTORY.md (#33846)
bjarthur Nov 15, 2019
4e76bcf
Fix left division for Hermitian sparse array and transpose/adjoint rh…
goggle Nov 15, 2019
f5b961e
add missing docstrings for BLAS routines (#33801)
dkarrasch Nov 15, 2019
4d7701e
document return nothing in Functions man page (2nd PR) (#33028)
pierre-haessig Nov 15, 2019
4caf944
[REPL] exit when input stream closes (#33838)
vtjnash Nov 15, 2019
bbccbac
Merge pull request #33717 from JuliaLang/jn/allocated
vtjnash Nov 15, 2019
7f63f00
REPL: make edit_title_case (M-c) call titlecase (#33851)
rfourquet Nov 15, 2019
1b03919
avoid giving useless suggestions for method ambiguities (#33852)
JeffBezanson Nov 15, 2019
38be538
Add line numbers in parser errors for disallowed space (#33855)
c42f Nov 15, 2019
ee3c88b
rename test/bigint.jl to test/gmp.jl (#31992)
rfourquet Nov 15, 2019
44c923a
remove spurious `&` in `get_next_task` (#33860)
JeffBezanson Nov 15, 2019
cf5b905
fix #33338, race condition in triggering method compilation (#33839)
JeffBezanson Nov 15, 2019
b29d951
Makefile cleanups (#33826)
vtjnash Nov 15, 2019
6bf9f72
REPL: fix/add doc for \\M- and \\C- key specifiers (#33771)
rfourquet Nov 16, 2019
6513811
REPL: implement "insert last word from previous history entry" (#33749)
rfourquet Nov 16, 2019
d564afe
docs: disambiguate what rand((2, 3)) does (fix #33309) (#33742)
rfourquet Nov 16, 2019
9e20e03
REPL: allow tweaking the implicit IOContext of the REPL (#29249)
rfourquet Nov 16, 2019
4982b36
REPL: fix yank-twice activates region (#33814)
rfourquet Nov 16, 2019
917c706
remove `register_taskdone_hook` (#33863)
JeffBezanson Nov 16, 2019
98d01b7
Acknowledge `Expr` as a possible type for :struct_type lowered AST (#…
timholy Nov 16, 2019
74f2de1
REPL: prefix search: more "pass through" keys (#33805)
rfourquet Nov 17, 2019
1129464
Switch Void to Cvoid in finalizer docstring
jpsamaroo Nov 17, 2019
96a777d
Merge pull request #33876 from jpsamaroo/jps/finalizer-docstring-nothing
vchuravy Nov 17, 2019
6ac632e
add missing costructor for ReverseOrdering() and tidy sort tests (#33…
oxinabox Nov 17, 2019
b580e34
Sockets,test: try to add debugging for CI issues (#33858)
vtjnash Nov 18, 2019
9446838
codegen: optimize returning an argument (#33829)
vtjnash Nov 18, 2019
05a80e1
fix order of multiplication in axpy! docstring (#33879)
dkarrasch Nov 18, 2019
1e39c69
Merge pull request #33724 from JuliaLang/jn/layout-reorg
vtjnash Nov 18, 2019
9235f45
Use `cache.julialang.org` to download `busybox.exe` at test time
staticfloat Nov 19, 2019
e5ee8da
BUGFIX: genmatmul! for empty input matrices (#33874)
KlausC Nov 19, 2019
0a27781
Use `cache.julialang.org` to download `busybox.exe` at test ti… (#33889)
staticfloat Nov 19, 2019
71c4d9b
Improve REPL printing of UmfpackLU (#33705)
goggle Nov 20, 2019
6c53d82
Use extended brackets instead of box-drawing characters in log messages
waldyrious Nov 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ New library functions
Standard library changes
------------------------

* `Pkg` won't clobber pre-compilation files as often when switching environments ([#32651])
* `Pkg` can now download and install binary artifacts through the `Pkg.Artifacts`
submodule and supporting functions. ([#32918])
* When `wait` (or `@sync`, or `fetch`) is called on a failing `Task`, the exception is propagated as a
Expand Down
1 change: 1 addition & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(libdir))
build_private_libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(build_bindir) $(build_private_libdir))
private_libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(private_libdir))
datarootdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(datarootdir))
libexecdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(libexecdir))
docdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(docdir))
sysconfdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(sysconfdir))
includedir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(includedir))
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ distcleanall: cleanall
julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \
julia-ui-release julia-ui-debug julia-src-release julia-src-debug \
julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \
test testall testall1 test clean distcleanall cleanall clean-* \
test testall testall1 test test-* test-revise-* \
clean distcleanall cleanall clean-* \
run-julia run-julia-debug run-julia-release run \
install binary-dist light-source-dist.tmp light-source-dist \
dist full-source-dist source-dist
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Standard library changes
* The performance of `rand(::Tuple)` is improved in some cases ([#32208]). As a consequence, the
stream of generated values produced for a given seed has changed.

#### REPL

* The attributes of the implicit `IOContext` used by the REPL to display objects can be
modified by the user (experimental feature) ([#29249]).

#### SparseArrays

#### Dates
Expand Down
2 changes: 2 additions & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ ifeq ($(OS),WINNT)
@printf 'const DATAROOTDIR = "%s"\n' '$(subst /,\\,$(datarootdir_rel))' >> $@
@printf 'const DOCDIR = "%s"\n' '$(subst /,\\,$(docdir_rel))' >> $@
@printf 'const LIBDIR = "%s"\n' '$(subst /,\\,$(libdir_rel))' >> $@
@printf 'const LIBEXECDIR = "%s"\n' '$(subst /,\\,$(libexecdir_rel))' >> $@
@printf 'const PRIVATE_LIBDIR = "%s"\n' '$(subst /,\\,$(private_libdir_rel))' >> $@
@printf 'const INCLUDEDIR = "%s"\n' '$(subst /,\\,$(includedir_rel))' >> $@
else
@echo "const SYSCONFDIR = \"$(sysconfdir_rel)\"" >> $@
@echo "const DATAROOTDIR = \"$(datarootdir_rel)\"" >> $@
@echo "const DOCDIR = \"$(docdir_rel)\"" >> $@
@echo "const LIBDIR = \"$(libdir_rel)\"" >> $@
@echo "const LIBEXECDIR = \"$(libexecdir_rel)\"" >> $@
@echo "const PRIVATE_LIBDIR = \"$(private_libdir_rel)\"" >> $@
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
endif
Expand Down
3 changes: 2 additions & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,8 @@ findfirst(testf::Function, A::Union{AbstractArray, AbstractString}) =
findnext(testf, A, first(keys(A)))

function findfirst(p::Union{Fix2{typeof(isequal),T},Fix2{typeof(==),T}}, r::StepRange{T,S}) where {T,S}
first(r) <= p.x <= last(r) || return nothing
isempty(r) && return nothing
minimum(r) <= p.x <= maximum(r) || return nothing
d = convert(S, p.x - first(r))
iszero(d % step(r)) || return nothing
return d ÷ step(r) + 1
Expand Down
37 changes: 13 additions & 24 deletions base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ Stacktrace:
```
"""
function bind(c::Channel, task::Task)
# 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))
T = Task(() -> close_chnl_on_taskdone(task, c))
_wait2(task, T)
return c
end

Expand Down Expand Up @@ -277,28 +275,19 @@ 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
lock(c)
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)
finally
unlock(c)
end
nothing
end
Expand Down
12 changes: 2 additions & 10 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,9 @@ function repl_cmd(cmd, out)
if !haskey(ENV, "OLDPWD")
error("cd: OLDPWD not set")
end
cd(ENV["OLDPWD"])
else
@static if !Sys.iswindows()
# TODO: this is a rather expensive way to copy a string, remove?
# 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)
end
cd(dir)
dir = ENV["OLDPWD"]
end
cd(dir)
else
cd()
end
Expand Down
26 changes: 24 additions & 2 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,33 @@ function pure_eval_call(@nospecialize(f), argtypes::Vector{Any}, @nospecialize(a
end
end

function argtype_by_index(argtypes::Vector{Any}, i::Int)
n = length(argtypes)
if isvarargtype(argtypes[n])
return i >= n ? unwrapva(argtypes[n]) : argtypes[i]
else
return i > n ? Bottom : argtypes[i]
end
end

function argtype_tail(argtypes::Vector{Any}, i::Int)
n = length(argtypes)
if isvarargtype(argtypes[n]) && i > n
i = n
end
return argtypes[i:n]
end

function abstract_call(@nospecialize(f), fargs::Union{Nothing,Vector{Any}}, argtypes::Vector{Any}, vtypes::VarTable, sv::InferenceState, max_methods = sv.params.MAX_METHODS)
if f === _apply
return abstract_apply(nothing, argtypes[2], argtypes[3:end], vtypes, sv, max_methods)
ft = argtype_by_index(argtypes, 2)
ft === Bottom && return Bottom
return abstract_apply(nothing, ft, argtype_tail(argtypes, 3), vtypes, sv, max_methods)
elseif f === _apply_iterate
return abstract_apply(argtypes[2], argtypes[3], argtypes[4:end], vtypes, sv, max_methods)
itft = argtype_by_index(argtypes, 2)
ft = argtype_by_index(argtypes, 3)
(itft === Bottom || ft === Bottom) && return Bottom
return abstract_apply(itft, ft, argtype_tail(argtypes, 4), vtypes, sv, max_methods)
end

la = length(argtypes)
Expand Down
1 change: 1 addition & 0 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ function is_pure_intrinsic_infer(f::IntrinsicFunction)
f === Intrinsics.llvmcall || # this one is never effect-free
f === Intrinsics.arraylen || # this one is volatile
f === Intrinsics.sqrt_llvm || # this one may differ at runtime (by a few ulps)
f === Intrinsics.sqrt_llvm_fast || # this one may differ at runtime (by a few ulps)
f === Intrinsics.cglobal) # cglobal lookup answer changes at runtime
end

Expand Down
3 changes: 3 additions & 0 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ function inline_apply!(ir::IRCode, idx::Int, sig::Signature, params::Params)
while sig.f === Core._apply || sig.f === Core._apply_iterate
arg_start = sig.f === Core._apply ? 2 : 3
atypes = sig.atypes
if arg_start > length(atypes)
return nothing
end
# Try to figure out the signature of the function being called
# and if rewrite_apply_exprargs can deal with this form
for i = (arg_start + 1):length(atypes)
Expand Down
1 change: 1 addition & 0 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ add_tfunc(floor_llvm, 1, 1, math_tfunc, 10)
add_tfunc(trunc_llvm, 1, 1, math_tfunc, 10)
add_tfunc(rint_llvm, 1, 1, math_tfunc, 10)
add_tfunc(sqrt_llvm, 1, 1, math_tfunc, 20)
add_tfunc(sqrt_llvm_fast, 1, 1, math_tfunc, 20)
## same-type comparisons ##
cmp_tfunc(@nospecialize(x), @nospecialize(y)) = Bool
add_tfunc(eq_int, 2, 2, cmp_tfunc, 1)
Expand Down
2 changes: 1 addition & 1 deletion base/div.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ without any intermediate rounding.

- if `r == RoundDown`, then the result is in the interval ``[0, y)`` if `y` is positive, or
``(y, 0]`` otherwise. The result may not be exact if `x` and `y` have different signs, and
`abs(x) < abs(y)`. See also[`RoundDown`](@ref).
`abs(x) < abs(y)`. See also [`RoundDown`](@ref).

- if `r == RoundUp`, then the result is in the interval `(-y,0]` if `y` is positive, or
`[0,-y)` otherwise. The result may not be exact if `x` and `y` have the same sign, and
Expand Down
10 changes: 8 additions & 2 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,14 @@ function showerror_ambiguous(io::IO, meth, f, args)
sigfix = typeintersect(m.sig, sigfix)
end
if isa(unwrap_unionall(sigfix), DataType) && sigfix <: Tuple
print(io, "\nPossible fix, define\n ")
Base.show_tuple_as_call(io, :function, sigfix)
if all(m->morespecific(sigfix, m.sig), meth)
print(io, "\nPossible fix, define\n ")
Base.show_tuple_as_call(io, :function, sigfix)
else
println(io)
print(io, "To resolve the ambiguity, try making one of the methods more specific, or ")
print(io, "adding a new method more specific than any of the existing applicable methods.")
end
end
nothing
end
Expand Down
4 changes: 2 additions & 2 deletions base/fastmath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module FastMath

export @fastmath

import Core.Intrinsics: sqrt_llvm, neg_float_fast,
import Core.Intrinsics: sqrt_llvm_fast, neg_float_fast,
add_float_fast, sub_float_fast, mul_float_fast, div_float_fast, rem_float_fast,
eq_float_fast, ne_float_fast, lt_float_fast, le_float_fast

Expand Down Expand Up @@ -277,7 +277,7 @@ pow_fast(x::Float64, y::Integer) = ccall("llvm.powi.f64", llvmcall, Float64, (Fl
pow_fast(x::FloatTypes, ::Val{p}) where {p} = pow_fast(x, p) # inlines already via llvm.powi
@inline pow_fast(x, v::Val) = Base.literal_pow(^, x, v)

sqrt_fast(x::FloatTypes) = sqrt_llvm(x)
sqrt_fast(x::FloatTypes) = sqrt_llvm_fast(x)

# libm

Expand Down
2 changes: 1 addition & 1 deletion base/gcutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Register a function `f(x)` to be called when there are no program-accessible ref
this function is unpredictable.

`f` must not cause a task switch, which excludes most I/O operations such as `println`.
`@schedule println("message")` or `ccall(:jl_, Void, (Any,), "message")` may be helpful for
`@schedule println("message")` or `ccall(:jl_, Cvoid, (Any,), "message")` may be helpful for
debugging purposes.
"""
function finalizer(@nospecialize(f), @nospecialize(o))
Expand Down
5 changes: 2 additions & 3 deletions base/libuv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ uv_error(prefix::AbstractString, c::Integer) = c < 0 ? throw(_UVError(prefix, c)

## event loop ##

eventloop() = uv_eventloop::Ptr{Cvoid}
eventloop() = ccall(:jl_global_event_loop, Ptr{Cvoid}, ())

function process_events()
return ccall(:jl_process_events, Int32, (Ptr{Cvoid},), eventloop())
return ccall(:jl_process_events, Int32, ())
end

function uv_alloc_buf end
Expand All @@ -119,7 +119,6 @@ function reinit_stdio()
global uv_jl_asynccb = @cfunction(uv_asynccb, Cvoid, (Ptr{Cvoid},))
global uv_jl_timercb = @cfunction(uv_timercb, Cvoid, (Ptr{Cvoid},))

global uv_eventloop = ccall(:jl_global_event_loop, Ptr{Cvoid}, ())
global stdin = init_stdio(ccall(:jl_stdin_stream, Ptr{Cvoid}, ()))
global stdout = init_stdio(ccall(:jl_stdout_stream, Ptr{Cvoid}, ()))
global stderr = init_stdio(ccall(:jl_stderr_stream, Ptr{Cvoid}, ()))
Expand Down
41 changes: 32 additions & 9 deletions base/locks-mt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,42 @@ Test-and-test-and-set spin locks are quickest up to about 30ish
contending threads. If you have more contention than that, different
synchronization approaches should be considered.
"""
struct SpinLock <: AbstractLock
handle::Atomic{Int}
SpinLock() = new(Atomic{Int}(0))
mutable struct SpinLock <: AbstractLock
handle::Int
SpinLock() = new(0)
end

import Base.Sys.WORD_SIZE

@eval _xchg!(x::SpinLock, v::Int) =
llvmcall($"""
%ptr = inttoptr i$WORD_SIZE %0 to i$WORD_SIZE*
%rv = atomicrmw xchg i$WORD_SIZE* %ptr, i$WORD_SIZE %1 acq_rel
ret i$WORD_SIZE %rv
""", Int, Tuple{Ptr{Int}, Int}, unsafe_convert(Ptr{Int}, pointer_from_objref(x)), v)

@eval _get(x::SpinLock) =
llvmcall($"""
%ptr = inttoptr i$WORD_SIZE %0 to i$WORD_SIZE*
%rv = load atomic i$WORD_SIZE, i$WORD_SIZE* %ptr acquire, align $(gc_alignment(Int))
ret i$WORD_SIZE %rv
""", Int, Tuple{Ptr{Int}}, unsafe_convert(Ptr{Int}, pointer_from_objref(x)))

@eval _set!(x::SpinLock, v::Int) =
llvmcall($"""
%ptr = inttoptr i$WORD_SIZE %0 to i$WORD_SIZE*
store atomic i$WORD_SIZE %1, i$WORD_SIZE* %ptr release, align $(gc_alignment(Int))
ret void
""", Cvoid, Tuple{Ptr{Int}, Int}, unsafe_convert(Ptr{Int}, pointer_from_objref(x)), v)

# Note: this cannot assert that the lock is held by the correct thread, because we do not
# track which thread locked it. Users beware.
Base.assert_havelock(l::SpinLock) = islocked(l) ? nothing : concurrency_violation()

function lock(l::SpinLock)
while true
if l.handle[] == 0
p = atomic_xchg!(l.handle, 1)
if _get(l) == 0
p = _xchg!(l, 1)
if p == 0
return
end
Expand All @@ -50,18 +73,18 @@ function lock(l::SpinLock)
end

function trylock(l::SpinLock)
if l.handle[] == 0
return atomic_xchg!(l.handle, 1) == 0
if _get(l) == 0
return _xchg!(l, 1) == 0
end
return false
end

function unlock(l::SpinLock)
l.handle[] = 0
_set!(l, 0)
ccall(:jl_cpu_wake, Cvoid, ())
return
end

function islocked(l::SpinLock)
return l.handle[] != 0
return _get(l) != 0
end
8 changes: 4 additions & 4 deletions base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,14 @@ function handle_message(logger::SimpleLogger, level, message, _module, group, id
iob = IOContext(buf, logger.stream)
levelstr = level == Warn ? "Warning" : string(level)
msglines = split(chomp(string(message)), '\n')
println(iob, " ", levelstr, ": ", msglines[1])
println(iob, " ", levelstr, ": ", msglines[1])
for i in 2:length(msglines)
println(iob, " ", msglines[i])
println(iob, " ", msglines[i])
end
for (key, val) in kwargs
println(iob, " ", key, " = ", val)
println(iob, " ", key, " = ", val)
end
println(iob, " @ ", something(_module, "nothing"), " ",
println(iob, " @ ", something(_module, "nothing"), " ",
something(filepath, "nothing"), ":", something(line, "nothing"))
write(logger.stream, take!(buf))
nothing
Expand Down
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ Function composition also works in prefix form: `∘(f, g)` is the same as `f
The prefix form supports composition of multiple functions: `∘(f, g, h) = f ∘ g ∘ h`
and splatting `∘(fs...)` for composing an iterable collection of functions.

!!!compat "Julia 1.4"
!!! compat "Julia 1.4"
Multiple function composition requires at least Julia 1.4.

# Examples
Expand Down
3 changes: 2 additions & 1 deletion base/ordering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ end

ReverseOrdering(rev::ReverseOrdering) = rev.fwd
ReverseOrdering(fwd::Fwd) where {Fwd} = ReverseOrdering{Fwd}(fwd)
ReverseOrdering() = ReverseOrdering(ForwardOrdering())

const DirectOrdering = Union{ForwardOrdering,ReverseOrdering{ForwardOrdering}}

const Forward = ForwardOrdering()
const Reverse = ReverseOrdering(Forward)
const Reverse = ReverseOrdering()

struct By{T} <: Ordering
by::T
Expand Down
Loading