Skip to content

Commit 9bc4903

Browse files
authored
Merge branch 'master' into jn/protect-visibility
2 parents 5c7f78e + 33a2a9d commit 9bc4903

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1166
-829
lines changed

base/boot.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ ccall(:jl_toplevel_eval_in, Any, (Any, Any),
245245
(f::typeof(Typeof))(x) = ($(_expr(:meta,:nospecialize,:x)); isa(x,Type) ? Type{x} : typeof(x))
246246
end)
247247

248-
249248
macro nospecialize(x)
250249
_expr(:meta, :nospecialize, x)
251250
end
@@ -256,7 +255,15 @@ TypeVar(n::Symbol, @nospecialize(lb), @nospecialize(ub)) = _typevar(n, lb, ub)
256255

257256
UnionAll(v::TypeVar, @nospecialize(t)) = ccall(:jl_type_unionall, Any, (Any, Any), v, t)
258257

259-
const Vararg = ccall(:jl_toplevel_eval_in, Any, (Any, Any), Core, _expr(:new, TypeofVararg))
258+
# simple convert for use by constructors of types in Core
259+
# note that there is no actual conversion defined here,
260+
# so the methods and ccall's in Core aren't permitted to use convert
261+
convert(::Type{Any}, @nospecialize(x)) = x
262+
convert(::Type{T}, x::T) where {T} = x
263+
cconvert(::Type{T}, x) where {T} = convert(T, x)
264+
unsafe_convert(::Type{T}, x::T) where {T} = x
265+
266+
const Vararg = ccall(:jl_wrap_vararg, Any, (Int, Int), 0, 0)
260267

261268
# dispatch token indicating a kwarg (keyword sorter) call
262269
function kwcall end
@@ -448,14 +455,6 @@ function _Task(@nospecialize(f), reserved_stack::Int, completion_future)
448455
return ccall(:jl_new_task, Ref{Task}, (Any, Any, Int), f, completion_future, reserved_stack)
449456
end
450457

451-
# simple convert for use by constructors of types in Core
452-
# note that there is no actual conversion defined here,
453-
# so the methods and ccall's in Core aren't permitted to use convert
454-
convert(::Type{Any}, @nospecialize(x)) = x
455-
convert(::Type{T}, x::T) where {T} = x
456-
cconvert(::Type{T}, x) where {T} = convert(T, x)
457-
unsafe_convert(::Type{T}, x::T) where {T} = x
458-
459458
_is_internal(__module__) = __module__ === Core
460459
# can be used in place of `@assume_effects :foldable` (supposed to be used for bootstrapping)
461460
macro _foldable_meta()

base/compiler/inferencestate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ function IRInterpretationState(interp::AbstractInterpreter,
688688
code::CodeInstance, mi::MethodInstance, argtypes::Vector{Any}, world::UInt)
689689
@assert code.def === mi
690690
src = @atomic :monotonic code.inferred
691-
if isa(src, Vector{UInt8})
691+
if isa(src, String)
692692
src = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), mi.def, C_NULL, src)::CodeInfo
693693
else
694694
isa(src, CodeInfo) || return nothing

base/compiler/optimize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const TOP_TUPLE = GlobalRef(Core, :tuple)
4343
const InlineCostType = UInt16
4444
const MAX_INLINE_COST = typemax(InlineCostType)
4545
const MIN_INLINE_COST = InlineCostType(10)
46-
const MaybeCompressed = Union{CodeInfo, Vector{UInt8}}
46+
const MaybeCompressed = Union{CodeInfo, String}
4747

4848
is_inlineable(@nospecialize src::MaybeCompressed) =
4949
ccall(:jl_ir_inlining_cost, InlineCostType, (Any,), src) != MAX_INLINE_COST

base/compiler/ssair/inlining.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ end
944944
function may_have_fcalls(m::Method)
945945
isdefined(m, :source) || return true
946946
src = m.source
947-
isa(src, CodeInfo) || isa(src, Vector{UInt8}) || return true
947+
isa(src, MaybeCompressed) || return true
948948
return ccall(:jl_ir_flag_has_fcall, Bool, (Any,), src)
949949
end
950950

@@ -982,8 +982,8 @@ function analyze_method!(match::MethodMatch, argtypes::Vector{Any},
982982
return resolve_todo(mi, match, argtypes, info, flag, state; invokesig)
983983
end
984984

985-
function retrieve_ir_for_inlining(mi::MethodInstance, src::Array{UInt8, 1})
986-
src = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), mi.def, C_NULL, src::Vector{UInt8})::CodeInfo
985+
function retrieve_ir_for_inlining(mi::MethodInstance, src::String)
986+
src = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), mi.def, C_NULL, src)::CodeInfo
987987
return inflate_ir!(src, mi)
988988
end
989989
retrieve_ir_for_inlining(mi::MethodInstance, src::CodeInfo) = inflate_ir(src, mi)

base/compiler/typeinfer.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,15 @@ function CodeInstance(interp::AbstractInterpreter, result::InferenceResult,
325325
const_flags = 0x00
326326
end
327327
end
328-
relocatability = isa(inferred_result, Vector{UInt8}) ? inferred_result[end] :
329-
inferred_result === nothing ? UInt8(1) : UInt8(0)
330-
# relocatability = isa(inferred_result, Vector{UInt8}) ? inferred_result[end] : UInt8(0)
328+
relocatability = 0x0
329+
if isa(inferred_result, String)
330+
t = @_gc_preserve_begin inferred_result
331+
relocatability = unsafe_load(unsafe_convert(Ptr{UInt8}, inferred_result), Core.sizeof(inferred_result))
332+
@_gc_preserve_end t
333+
elseif inferred_result === nothing
334+
relocatability = 0x1
335+
end
336+
# relocatability = isa(inferred_result, String) ? inferred_result[end] : UInt8(0)
331337
return CodeInstance(result.linfo,
332338
widenconst(result_type), rettype_const, inferred_result,
333339
const_flags, first(valid_worlds), last(valid_worlds),
@@ -352,7 +358,7 @@ function maybe_compress_codeinfo(interp::AbstractInterpreter, linfo::MethodInsta
352358
nslots = length(ci.slotflags)
353359
resize!(ci.slottypes::Vector{Any}, nslots)
354360
resize!(ci.slotnames, nslots)
355-
return ccall(:jl_compress_ir, Vector{UInt8}, (Any, Any), def, ci)
361+
return ccall(:jl_compress_ir, String, (Any, Any), def, ci)
356362
else
357363
return ci
358364
end
@@ -1031,7 +1037,7 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance)
10311037
inf.rettype = code.rettype
10321038
end
10331039
return inf
1034-
elseif isa(inf, Vector{UInt8})
1040+
elseif isa(inf, String)
10351041
ccall(:jl_typeinf_timing_end, Cvoid, (UInt64,), start_time)
10361042
inf = _uncompressed_ir(code, inf)
10371043
return inf

base/compiler/utilities.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function retrieve_code_info(linfo::MethodInstance, world::UInt)
137137
if src === nothing
138138
# can happen in images built with --strip-ir
139139
return nothing
140-
elseif isa(src, Array{UInt8,1})
140+
elseif isa(src, String)
141141
c = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), m, C_NULL, src)
142142
else
143143
c = copy(src::CodeInfo)

base/lock.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ end
481481
"""
482482
reset(::Event)
483483
484-
Reset an Event back into an un-set state. Then any future calls to `wait` will
485-
block until `notify` is called again.
484+
Reset an [`Event`](@ref) back into an un-set state. Then any future calls to `wait` will
485+
block until [`notify`](@ref) is called again.
486486
"""
487487
function reset(e::Event)
488488
@atomic e.set = false # full barrier

base/reflection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,8 @@ uncompressed_ir(m::Method) = isdefined(m, :source) ? _uncompressed_ir(m, m.sourc
11631163
isdefined(m, :generator) ? error("Method is @generated; try `code_lowered` instead.") :
11641164
error("Code for this Method is not available.")
11651165
_uncompressed_ir(m::Method, s::CodeInfo) = copy(s)
1166-
_uncompressed_ir(m::Method, s::Array{UInt8,1}) = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), m, C_NULL, s)::CodeInfo
1167-
_uncompressed_ir(ci::Core.CodeInstance, s::Array{UInt8,1}) = ccall(:jl_uncompress_ir, Any, (Any, Any, Any), ci.def.def::Method, ci, s)::CodeInfo
1166+
_uncompressed_ir(m::Method, s::String) = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), m, C_NULL, s)::CodeInfo
1167+
_uncompressed_ir(ci::Core.CodeInstance, s::String) = ccall(:jl_uncompress_ir, Any, (Any, Any, Any), ci.def.def::Method, ci, s)::CodeInfo
11681168
# for backwards compat
11691169
const uncompressed_ast = uncompressed_ir
11701170
const _uncompressed_ast = _uncompressed_ir

base/task.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ end
7070
"""
7171
TaskFailedException
7272
73-
This exception is thrown by a `wait(t)` call when task `t` fails.
73+
This exception is thrown by a [`wait(t)`](@ref) call when task `t` fails.
7474
`TaskFailedException` wraps the failed task `t`.
7575
"""
7676
struct TaskFailedException <: Exception
@@ -362,8 +362,8 @@ fetch(@nospecialize x) = x
362362
"""
363363
fetch(t::Task)
364364
365-
Wait for a Task to finish, then return its result value.
366-
If the task fails with an exception, a `TaskFailedException` (which wraps the failed task)
365+
Wait for a [`Task`](@ref) to finish, then return its result value.
366+
If the task fails with an exception, a [`TaskFailedException`](@ref) (which wraps the failed task)
367367
is thrown.
368368
"""
369369
function fetch(t::Task)

base/twiceprecision.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ julia> Float64(hi) + Float64(lo)
112112
```
113113
"""
114114
function mul12(x::T, y::T) where {T<:AbstractFloat}
115-
(h, l) = Base.Math.two_mul(x, y)
115+
(h, l) = Math.two_mul(x, y)
116116
ifelse(!isfinite(h), (h, h), (h, l))
117117
end
118118
mul12(x::T, y::T) where {T} = (p = x * y; (p, zero(p)))

0 commit comments

Comments
 (0)