Skip to content

Commit

Permalink
Merge branch 'master' into gb/refactor-juliac-init
Browse files Browse the repository at this point in the history
gbaraldi authored Nov 15, 2024
2 parents c8b14a4 + 5ec3215 commit 35b7dfa
Showing 5 changed files with 47 additions and 41 deletions.
22 changes: 10 additions & 12 deletions Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
@@ -2182,27 +2182,26 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
lookupsig = rewrap_unionall(Tuple{ft, unwrapped.parameters...}, types)::Type
nargtype = Tuple{ft, nargtype.parameters...}
argtype = Tuple{ft, argtype.parameters...}
match, valid_worlds = findsup(lookupsig, method_table(interp))
match === nothing && return Future(CallMeta(Any, Any, Effects(), NoCallInfo()))
matched, valid_worlds = findsup(lookupsig, method_table(interp))
matched === nothing && return Future(CallMeta(Any, Any, Effects(), NoCallInfo()))
update_valid_age!(sv, valid_worlds)
method = match.method
method = matched.method
tienv = ccall(:jl_type_intersection_with_env, Any, (Any, Any), nargtype, method.sig)::SimpleVector
ti = tienv[1]
env = tienv[2]::SimpleVector
mresult = abstract_call_method(interp, method, ti, env, false, si, sv)::Future
match = MethodMatch(ti, env, method, argtype <: method.sig)
ft_box = Core.Box(ft)
ft′_box = Core.Box(ft′)
lookupsig_box = Core.Box(lookupsig)
invokecall = InvokeCall(types, lookupsig)
return Future{CallMeta}(mresult, interp, sv) do result, interp, sv
(; rt, exct, effects, edge, volatile_inf_result) = result
local argtypes = arginfo.argtypes
local ft = ft_box.contents
local ft′ = ft′_box.contents
sig = match.spec_types
argtypes′ = invoke_rewrite(argtypes)
argtypes′ = invoke_rewrite(arginfo.argtypes)
fargs = arginfo.fargs
fargs′ = fargs === nothing ? nothing : invoke_rewrite(fargs)
arginfo = ArgInfo(fargs′, argtypes′)
arginfo = ArgInfo(fargs′, argtypes′)
# # typeintersect might have narrowed signature, but the accuracy gain doesn't seem worth the cost involved with the lattice comparisons
# for i in 1:length(argtypes′)
# t, a = ti.parameters[i], argtypes′[i]
@@ -2211,9 +2210,8 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
𝕃ₚ = ipo_lattice(interp)
, , = partialorder(𝕃ₚ), strictneqpartialorder(𝕃ₚ), join(𝕃ₚ)
f = singleton_type(ft′)
invokecall = InvokeCall(types, lookupsig)
const_call_result = abstract_call_method_with_const_args(interp,
result, f, arginfo, si, match, sv, invokecall)
result, f, arginfo, si, match, sv, invokecall)
const_result = volatile_inf_result
if const_call_result !== nothing
const_edge = nothing
@@ -2227,8 +2225,8 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
edge = const_edge
end
end
rt = from_interprocedural!(interp, rt, sv, arginfo, sig)
info = InvokeCallInfo(edge, match, const_result, lookupsig)
rt = from_interprocedural!(interp, rt, sv, arginfo, sig)
info = InvokeCallInfo(edge, match, const_result, lookupsig_box.contents)
if !match.fully_covers
effects = Effects(effects; nothrow=false)
exct = exct TypeError
20 changes: 13 additions & 7 deletions Make.inc
Original file line number Diff line number Diff line change
@@ -28,13 +28,7 @@ BOOTSTRAP_DEBUG_LEVEL ?= 0
OPENBLAS_TARGET_ARCH:=
OPENBLAS_SYMBOLSUFFIX:=
OPENBLAS_LIBNAMESUFFIX:=

# If OPENBLAS_TARGET_ARCH is set, we default to disabling OPENBLAS_DYNAMIC_ARCH
ifneq ($(OPENBLAS_TARGET_ARCH),)
OPENBLAS_DYNAMIC_ARCH:=0
else
OPENBLAS_DYNAMIC_ARCH:=1
endif
OPENBLAS_USE_THREAD:=1

# Flags for using libraries available on the system instead of building them.
@@ -995,9 +989,15 @@ MTUNE=native
endif
endif

# If we are running on x86 or x86_64, set certain options automatically
ifeq (1,$(ISX86))
OPENBLAS_DYNAMIC_ARCH:=1
endif

# If we are running on powerpc64le or ppc64le, set certain options automatically
ifneq (,$(filter $(ARCH), powerpc64le ppc64le))
JCFLAGS += -fsigned-char
OPENBLAS_DYNAMIC_ARCH:=1
OPENBLAS_TARGET_ARCH:=POWER8
BINARY:=64
# GCC doesn't do -march= on ppc64le
@@ -1054,17 +1054,23 @@ endif
# If we are running on ARM, set certain options automatically
ifneq (,$(findstring arm,$(ARCH)))
JCFLAGS += -fsigned-char
OPENBLAS_DYNAMIC_ARCH:=0
OPENBLAS_TARGET_ARCH:=ARMV7
BINARY:=32
endif

# If we are running on aarch64 (e.g. ARMv8 or ARM64), set certain options automatically
ifneq (,$(findstring aarch64,$(ARCH)))
OPENBLAS_DYNAMIC_ARCH:=1
OPENBLAS_TARGET_ARCH:=ARMV8
BINARY:=64
endif

# If we are running on riscv64, set certain options automatically
ifneq (,$(findstring riscv64,$(ARCH)))
OPENBLAS_DYNAMIC_ARCH:=1
BINARY:=64
endif

# Set MARCH-specific flags
ifneq ($(MARCH),)
CC += -march=$(MARCH)
10 changes: 4 additions & 6 deletions stdlib/Sockets/src/addrinfo.jl
Original file line number Diff line number Diff line change
@@ -282,16 +282,14 @@ See also [`getipaddrs`](@ref).
"""
function getipaddr(addr_type::Type{T}) where T<:IPAddr
addrs = getipaddrs(addr_type)
isempty(addrs) && error("No networking interface available")

if length(addrs) == 0
error("No networking interface available")
end

# Prefer the first IPv4 address
# When `addr_type` is `IPAddr`, `addrs` contain IP addresses of all types
# In that case, we prefer to return the first IPv4
i = something(findfirst(ip -> ip isa IPv4, addrs), 1)
return addrs[i]
end
getipaddr() = getipaddr(IPv4)
getipaddr() = getipaddr(IPAddr)


"""
25 changes: 20 additions & 5 deletions stdlib/Sockets/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -639,11 +639,26 @@ end

@testset "getipaddrs" begin
@test getipaddr() in getipaddrs()
try
getipaddr(IPv6) in getipaddrs(IPv6)
catch
if !isempty(getipaddrs(IPv6))
@test "getipaddr(IPv6) errored when it shouldn't have!"

has_ipv4 = !isempty(getipaddrs(IPv4))
if has_ipv4
@test getipaddr(IPv4) in getipaddrs(IPv4)
else
@test_throws "No networking interface available" getipaddr(IPv4)
end

has_ipv6 = !isempty(getipaddrs(IPv6))
if has_ipv6
@test getipaddr(IPv6) in getipaddrs(IPv6)
else
@test_throws "No networking interface available" getipaddr(IPv6)
end

@testset "getipaddr() prefers IPv4 over IPv6" begin
if has_ipv4
@test getipaddr() isa IPv4
else
@test getipaddr() isa IPv6
end
end

11 changes: 0 additions & 11 deletions test/testhelpers/OffsetArrays.jl
Original file line number Diff line number Diff line change
@@ -571,17 +571,6 @@ Base.reshape(A::OffsetArray, inds::Tuple{Colon}) = _reshape_nov(A, inds)
# This is a stopgap solution
Base.permutedims(v::OffsetVector) = reshape(v, (1, axes(v, 1)))

Base.fill(v, inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {N} =
fill!(similar(Array{typeof(v)}, inds), v)
Base.zeros(::Type{T}, inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {T, N} =
fill!(similar(Array{T}, inds), zero(T))
Base.ones(::Type{T}, inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {T, N} =
fill!(similar(Array{T}, inds), one(T))
Base.trues(inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {N} =
fill!(similar(BitArray, inds), true)
Base.falses(inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {N} =
fill!(similar(BitArray, inds), false)

Base.zero(A::OffsetArray) = parent_call(zero, A)
Base.fill!(A::OffsetArray, x) = parent_call(Ap -> fill!(Ap, x), A)

0 comments on commit 35b7dfa

Please sign in to comment.