Skip to content

Commit

Permalink
Merge pull request #33075 from JuliaLang/backports-release-1.0
Browse files Browse the repository at this point in the history
Backports for 1.0.5
  • Loading branch information
ararslan authored Aug 31, 2019
2 parents 58db74d + b717256 commit 712150c
Show file tree
Hide file tree
Showing 60 changed files with 548 additions and 198 deletions.
5 changes: 1 addition & 4 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,7 @@ else ifeq ($(OS), Darwin)
RPATH_ESCAPED_ORIGIN := $(RPATH_ORIGIN)
RPATH_LIB := -Wl,-rpath,'@loader_path/julia/' -Wl,-rpath,'@loader_path/'
else
RPATH := -Wl,-rpath,'$$ORIGIN/$(build_libdir_rel)' -Wl,-rpath-link,$(build_shlibdir) -Wl,-z,origin
ifeq ($(OS), FreeBSD)
RPATH += -Wl,-rpath,'$$ORIGIN/$(build_private_libdir_rel)'
endif
RPATH := -Wl,-rpath,'$$ORIGIN/$(build_libdir_rel)' -Wl,-rpath,'$$ORIGIN/$(build_private_libdir_rel)' -Wl,-rpath-link,$(build_shlibdir) -Wl,-z,origin
RPATH_ORIGIN := -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin
RPATH_ESCAPED_ORIGIN := -Wl,-rpath,'\$$\$$ORIGIN' -Wl,-z,origin -Wl,-rpath-link,$(build_shlibdir)
RPATH_LIB := -Wl,-rpath,'$$ORIGIN/julia' -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@ ifeq ($(BUNDLE_DEBUG_LIBS),1)
$(INSTALL_M) $(build_bindir)/julia-debug $(DESTDIR)$(bindir)/
endif
ifeq ($(OS),WINNT)
-$(INSTALL_M) $(build_bindir)/*.dll $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(filter-out $(build_bindir)/libjulia-debug.dll,$(wildcard $(build_bindir)/*.dll)) $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
ifeq ($(BUNDLE_DEBUG_LIBS),1)
-$(INSTALL_M) $(build_bindir)/libjulia-debug.dll $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
endif
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
Expand Down
6 changes: 6 additions & 0 deletions base/compiler/ssair/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ function replace_code_newstyle!(ci::CodeInfo, ir::IRCode, nargs::Int)
ci.linetable = ir.linetable
ci.ssavaluetypes = ir.types
ci.ssaflags = ir.flags
for metanode in ir.meta
push!(ci.code, metanode)
push!(ci.codelocs, 1)
push!(ci.ssavaluetypes, Any)
push!(ci.ssaflags, 0x00)
end
# Translate BB Edges to statement edges
# (and undo normalization for now)
for i = 1:length(ci.code)
Expand Down
12 changes: 9 additions & 3 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
found_def = false
## Track which PhiNodes, SSAValue intermediaries
## we forwarded through.
visited = IdSet{Any}()
visited = IdDict{Any, Any}()
worklist_defs = Any[]
worklist_constraints = Any[]
leaves = Any[]
Expand All @@ -183,7 +183,7 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
while !isempty(worklist_defs)
defssa = pop!(worklist_defs)
typeconstraint = pop!(worklist_constraints)
push!(visited, defssa)
visited[defssa] = typeconstraint
def = compact[defssa]
if isa(def, PhiNode)
push!(visited_phinodes, defssa)
Expand All @@ -207,9 +207,15 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
if isa(val, AnySSAValue)
new_def, new_constraint = simple_walk_constraint(compact, val, typeconstraint)
if isa(new_def, AnySSAValue)
if !(new_def in visited)
if !haskey(visited, new_def)
push!(worklist_defs, new_def)
push!(worklist_constraints, new_constraint)
elseif !(new_constraint <: visited[new_def])
# We have reached the same definition via a different
# path, with a different type constraint. We may have
# to redo some work here with the wider typeconstraint
push!(worklist_defs, new_def)
push!(worklist_constraints, tmerge(new_constraint, visited[new_def]))
end
continue
end
Expand Down
12 changes: 8 additions & 4 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,14 @@ function atanh(z::Complex{T}) where T<:AbstractFloat
return Complex(copysign(zero(x),x), copysign(oftype(y,pi)/2, y))
end
return Complex(real(1/z), copysign(oftype(y,pi)/2, y))
elseif ax==1
end
β = copysign(one(T), x)
z *= β
x, y = reim(z)
if x == 1
if y == 0
ξ = copysign(oftype(x,Inf),x)
η = zero(y)
ξ = oftype(x, Inf)
η = y
else
ym = ay+ρ
ξ = log(sqrt(sqrt(4+y*y))/sqrt(ym))
Expand All @@ -935,7 +939,7 @@ function atanh(z::Complex{T}) where T<:AbstractFloat
end
η = angle(Complex((1-x)*(1+x)-ysq, 2y))/2
end
Complex(ξ, η)
β * Complex(ξ, η)
end
atanh(z::Complex) = atanh(float(z))

Expand Down
9 changes: 7 additions & 2 deletions base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,13 @@ We can see the [`mtime`](@ref) has been modified by `touch`.
function touch(path::AbstractString)
f = open(path, JL_O_WRONLY | JL_O_CREAT, 0o0666)
try
t = time()
futime(f,t,t)
if Sys.isunix()
ret = ccall(:futimes, Cint, (Cint, Ptr{Cvoid}), fd(f), C_NULL)
systemerror(:futimes, ret != 0, extrainfo=path)
else
t = time()
futime(f,t,t)
end
finally
close(f)
end
Expand Down
14 changes: 10 additions & 4 deletions base/filesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,19 @@ function close(f::File)
return nothing
end

# sendfile is the most efficient way to copy a file (or any file descriptor)
# sendfile is the most efficient way to copy from a file descriptor
function sendfile(dst::File, src::File, src_offset::Int64, bytes::Int)
check_open(dst)
check_open(src)
err = ccall(:jl_fs_sendfile, Int32, (OS_HANDLE, OS_HANDLE, Int64, Csize_t),
src.handle, dst.handle, src_offset, bytes)
uv_error("sendfile", err)
while true
result = ccall(:jl_fs_sendfile, Int32, (OS_HANDLE, OS_HANDLE, Int64, Csize_t),
src.handle, dst.handle, src_offset, bytes)
uv_error("sendfile", result)
nsent = result
bytes -= nsent
src_offset += nsent
bytes <= 0 && break
end
nothing
end

Expand Down
17 changes: 10 additions & 7 deletions base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,18 @@ for Ti in (Int64,UInt64,Int128,UInt128)
end
end
end
for op in (:(==), :<, :<=)
@eval begin
($op)(x::Float16, y::Union{Int128,UInt128,Int64,UInt64}) = ($op)(Float64(x), Float64(y))
($op)(x::Union{Int128,UInt128,Int64,UInt64}, y::Float16) = ($op)(Float64(x), Float64(y))

==(x::Float32, y::Union{Int32,UInt32}) = Float64(x)==Float64(y)
==(x::Union{Int32,UInt32}, y::Float32) = Float64(x)==Float64(y)

<(x::Float32, y::Union{Int32,UInt32}) = Float64(x)<Float64(y)
<(x::Union{Int32,UInt32}, y::Float32) = Float64(x)<Float64(y)
($op)(x::Union{Float16,Float32}, y::Union{Int32,UInt32}) = ($op)(Float64(x), Float64(y))
($op)(x::Union{Int32,UInt32}, y::Union{Float16,Float32}) = ($op)(Float64(x), Float64(y))

<=(x::Float32, y::Union{Int32,UInt32}) = Float64(x)<=Float64(y)
<=(x::Union{Int32,UInt32}, y::Float32) = Float64(x)<=Float64(y)
($op)(x::Float16, y::Union{Int16,UInt16}) = ($op)(Float32(x), Float32(y))
($op)(x::Union{Int16,UInt16}, y::Float16) = ($op)(Float32(x), Float32(y))
end
end


abs(x::Float16) = reinterpret(Float16, reinterpret(UInt16, x) & 0x7fff)
Expand Down
6 changes: 4 additions & 2 deletions base/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ function tryparse_internal(::Type{T}, s::AbstractString, startpos::Int, endpos::
_Z = UInt32('Z')
_z = UInt32('z')
while n <= m
_c = UInt32(c)
# Fast path from `UInt32(::Char)`; non-ascii will be >= 0x80
_c = reinterpret(UInt32, c) >> 24
d::T = _0 <= _c <= _9 ? _c-_0 :
_A <= _c <= _Z ? _c-_A+ UInt32(10) :
_a <= _c <= _z ? _c-_a+a : base
Expand All @@ -139,7 +140,8 @@ function tryparse_internal(::Type{T}, s::AbstractString, startpos::Int, endpos::
end
(T <: Signed) && (n *= sgn)
while !isspace(c)
_c = UInt32(c)
# Fast path from `UInt32(::Char)`; non-ascii will be >= 0x80
_c = reinterpret(UInt32, c) >> 24
d::T = _0 <= _c <= _9 ? _c-_0 :
_A <= _c <= _Z ? _c-_A+ UInt32(10) :
_a <= _c <= _z ? _c-_a+a : base
Expand Down
2 changes: 1 addition & 1 deletion deps/Versions.make
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ 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 := 2019-01-23
MOZILLA_CACERT_VERSION := 2019-05-15
1 change: 0 additions & 1 deletion deps/checksums/cacert-2019-01-23.pem/md5

This file was deleted.

1 change: 0 additions & 1 deletion deps/checksums/cacert-2019-01-23.pem/sha512

This file was deleted.

1 change: 1 addition & 0 deletions deps/checksums/cacert-2019-05-15.pem/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f4a13fcdd32ca18c3e62c7a728ebb378
1 change: 1 addition & 0 deletions deps/checksums/cacert-2019-05-15.pem/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6dff0130bdc7c9b211d437598d6caf1b5bb7f7268ce66713e9701890f8924c98ab5a4c0df28dac4fdfea439ad61b46861d0c5b2986ac8c8b4a47218a2b9ba02f
8 changes: 4 additions & 4 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1808,10 +1808,10 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
}
else if (!jl_has_free_typevars(ety)) {
Value *idx = emit_unbox(ctx, T_size, idxv, (jl_value_t*)jl_ulong_type);
Value *arrayptr = emit_bitcast(ctx, emit_arrayptr(ctx, aryv, aryex), T_ppjlvalue);
Value *slot_addr = ctx.builder.CreateGEP(arrayptr, idx);
Value *load = tbaa_decorate(tbaa_arraybuf, ctx.builder.CreateLoad(slot_addr));
Value *res = ctx.builder.CreateZExt(ctx.builder.CreateICmpNE(load, V_null), T_int32);
Value *arrayptr = emit_bitcast(ctx, emit_arrayptr(ctx, aryv, aryex), T_pprjlvalue);
Value *slot_addr = ctx.builder.CreateInBoundsGEP(T_prjlvalue, arrayptr, idx);
Value *load = tbaa_decorate(tbaa_ptrarraybuf, ctx.builder.CreateLoad(T_prjlvalue, slot_addr));
Value *res = ctx.builder.CreateZExt(ctx.builder.CreateICmpNE(load, Constant::getNullValue(T_prjlvalue)), T_int32);
JL_GC_POP();
return mark_or_box_ccall_result(ctx, res, retboxed, rt, unionall, static_rt);
}
Expand Down
39 changes: 25 additions & 14 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,18 @@ static unsigned get_box_tindex(jl_datatype_t *jt, jl_value_t *ut)

static Value *emit_nthptr_addr(jl_codectx_t &ctx, Value *v, ssize_t n, bool gctracked = true)
{
return ctx.builder.CreateInBoundsGEP(emit_bitcast(ctx, maybe_decay_tracked(v), T_pprjlvalue),
ConstantInt::get(T_size, n));
return ctx.builder.CreateInBoundsGEP(
T_prjlvalue,
emit_bitcast(ctx, maybe_decay_tracked(v), T_pprjlvalue),
ConstantInt::get(T_size, n));
}

static Value *emit_nthptr_addr(jl_codectx_t &ctx, Value *v, Value *idx)
{
return ctx.builder.CreateInBoundsGEP(emit_bitcast(ctx, maybe_decay_tracked(v), T_pprjlvalue), idx);
return ctx.builder.CreateInBoundsGEP(
T_prjlvalue,
emit_bitcast(ctx, maybe_decay_tracked(v), T_pprjlvalue),
idx);
}

static Value *emit_nthptr(jl_codectx_t &ctx, Value *v, ssize_t n, MDNode *tbaa)
Expand Down Expand Up @@ -1457,8 +1462,10 @@ static bool emit_getfield_unknownidx(jl_codectx_t &ctx,
minimum_align = std::min(minimum_align,
(size_t)julia_alignment(ft));
}
Value *fldptr = ctx.builder.CreateInBoundsGEP(maybe_decay_tracked(
emit_bitcast(ctx, data_pointer(ctx, strct), T_pprjlvalue)), idx);
Value *fldptr = ctx.builder.CreateInBoundsGEP(
T_prjlvalue,
maybe_decay_tracked(emit_bitcast(ctx, data_pointer(ctx, strct), T_pprjlvalue)),
idx);
Value *fld = tbaa_decorate(strct.tbaa,
maybe_mark_load_dereferenceable(
ctx.builder.CreateLoad(T_prjlvalue, fldptr),
Expand Down Expand Up @@ -1539,8 +1546,9 @@ static jl_cgval_t emit_getfield_knownidx(jl_codectx_t &ctx, const jl_cgval_t &st
// can pessimize mem2reg
if (byte_offset > 0) {
addr = ctx.builder.CreateInBoundsGEP(
emit_bitcast(ctx, staddr, T_pint8),
ConstantInt::get(T_size, byte_offset));
T_int8,
emit_bitcast(ctx, staddr, T_pint8),
ConstantInt::get(T_size, byte_offset));
}
else {
addr = staddr;
Expand Down Expand Up @@ -1896,8 +1904,8 @@ static Value *emit_array_nd_index(
ctx.builder.SetInsertPoint(failBB);
// CreateAlloca is OK here since we are on an error branch
Value *tmp = ctx.builder.CreateAlloca(T_size, ConstantInt::get(T_size, nidxs));
for(size_t k=0; k < nidxs; k++) {
ctx.builder.CreateStore(idxs[k], ctx.builder.CreateInBoundsGEP(tmp, ConstantInt::get(T_size, k)));
for (size_t k = 0; k < nidxs; k++) {
ctx.builder.CreateStore(idxs[k], ctx.builder.CreateInBoundsGEP(T_size, tmp, ConstantInt::get(T_size, k)));
}
ctx.builder.CreateCall(prepare_call(jlboundserrorv_func),
{ mark_callee_rooted(a), tmp, ConstantInt::get(T_size, nidxs) });
Expand Down Expand Up @@ -2410,8 +2418,9 @@ static void emit_setfield(jl_codectx_t &ctx,
Value *addr = data_pointer(ctx, strct);
if (byte_offset > 0) {
addr = ctx.builder.CreateInBoundsGEP(
emit_bitcast(ctx, maybe_decay_tracked(addr), T_pint8),
ConstantInt::get(T_size, byte_offset)); // TODO: use emit_struct_gep
T_int8,
emit_bitcast(ctx, maybe_decay_tracked(addr), T_pint8),
ConstantInt::get(T_size, byte_offset)); // TODO: use emit_struct_gep
}
jl_value_t *jfty = jl_svecref(sty->types, idx0);
if (jl_field_isptr(sty, idx0)) {
Expand Down Expand Up @@ -2531,7 +2540,9 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
if (!jl_field_isptr(sty, i) && jl_is_uniontype(jl_field_type(sty, i))) {
tbaa_decorate(tbaa_unionselbyte, ctx.builder.CreateStore(
ConstantInt::get(T_int8, 0),
ctx.builder.CreateInBoundsGEP(emit_bitcast(ctx, strct, T_pint8),
ctx.builder.CreateInBoundsGEP(
T_int8,
emit_bitcast(ctx, strct, T_pint8),
ConstantInt::get(T_size, jl_field_offset(sty, i) + jl_field_size(sty, i) - 1))));
}
}
Expand All @@ -2551,15 +2562,15 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
tbaa_decorate(strctinfo.tbaa, ctx.builder.CreateStore(
ConstantPointerNull::get(cast<PointerType>(T_prjlvalue)),
ctx.builder.CreateInBoundsGEP(T_prjlvalue, emit_bitcast(ctx, strct, T_pprjlvalue),
ConstantInt::get(T_size, jl_field_offset(sty, i) / sizeof(void*)))));
ConstantInt::get(T_size, jl_field_offset(sty, i) / sizeof(void*)))));
}
}
for (size_t i = nargs; i < nf; i++) {
if (!jl_field_isptr(sty, i) && jl_is_uniontype(jl_field_type(sty, i))) {
tbaa_decorate(tbaa_unionselbyte, ctx.builder.CreateStore(
ConstantInt::get(T_int8, 0),
ctx.builder.CreateInBoundsGEP(emit_bitcast(ctx, strct, T_pint8),
ConstantInt::get(T_size, jl_field_offset(sty, i) + jl_field_size(sty, i) - 1))));
ConstantInt::get(T_size, jl_field_offset(sty, i) + jl_field_size(sty, i) - 1))));
}
}
bool need_wb = false;
Expand Down
5 changes: 0 additions & 5 deletions src/flisp/system.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,6 @@
#;(define (table.values t)
(table.foldl (lambda (k v z) (cons v z))
() t))
#;(define (table.clone t)
(let ((nt (table)))
(table.foldl (lambda (k v z) (put! nt k v))
() t)
nt))
#;(define (table.invert t)
(let ((nt (table)))
(table.foldl (lambda (k v z) (put! nt v k))
Expand Down
5 changes: 3 additions & 2 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,9 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
}
jl_options.code_coverage = codecov;
jl_options.malloc_log = malloclog;
*argvp += optind;
*argcp -= optind;
int proc_args = *argcp < optind ? *argcp : optind;
*argvp += proc_args;
*argcp -= proc_args;
}

JL_DLLEXPORT void jl_set_ARGS(int argc, char **argv)
Expand Down
Loading

0 comments on commit 712150c

Please sign in to comment.