Skip to content

Commit d347b47

Browse files
committed
Update Base to use JLL-vendored binaries
1 parent cb4ae78 commit d347b47

File tree

11 files changed

+273
-203
lines changed

11 files changed

+273
-203
lines changed

base/Base.jl

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,29 @@ include("strings/substring.jl")
165165
include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
166166
include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)
167167

168+
# Initialize DL_LOAD_PATH as early as possible. We are defining things here in
169+
# a slightly more verbose fashion than usual, because we're running so early.
170+
const DL_LOAD_PATH = String[]
171+
let os = ccall(:jl_get_UNAME, Any, ()),
172+
pathsep = (os == :Windows || os == :NT) ? "\\" : "/"
173+
174+
if (os == :Darwin || os == :Apple)
175+
if Base.DARWIN_FRAMEWORK
176+
push!(DL_LOAD_PATH, "@loader_path/Frameworks")
177+
else
178+
push!(DL_LOAD_PATH, "@loader_path/julia")
179+
end
180+
push!(DL_LOAD_PATH, "@loader_path")
181+
end
182+
183+
# Include some paths for JLL libraries that we need (like pcre) that are so early
184+
# in our boot-up process that we can't use even rewritten JLL packages. We use
185+
# the `@executable_path` format here, having taught `dlload.c` to
186+
if !isempty(Base.PCRE_JLL_LIBDIR)
187+
push!(DL_LOAD_PATH, string("@executable_path", pathsep, Base.PCRE_JLL_LIBDIR))
188+
end
189+
end
190+
168191
include("osutils.jl")
169192
include("c.jl")
170193

@@ -203,15 +226,13 @@ include("version.jl")
203226
include("sysinfo.jl")
204227
include("libc.jl")
205228
using .Libc: getpid, gethostname, time
206-
207-
const DL_LOAD_PATH = String[]
208-
if Sys.isapple()
209-
if Base.DARWIN_FRAMEWORK
210-
push!(DL_LOAD_PATH, "@loader_path/Frameworks")
211-
else
212-
push!(DL_LOAD_PATH, "@loader_path/julia")
229+
macro include_stdlib_jll(name)
230+
quote
231+
Core.include($(esc(__module__)), relpath(
232+
joinpath(Sys.STDLIB, $(esc(name)), "src", string($(esc(name)), ".jl")),
233+
pwd(),
234+
))
213235
end
214-
push!(DL_LOAD_PATH, "@loader_path")
215236
end
216237

217238
include("env.jl")
@@ -245,7 +266,24 @@ include("ttyhascolor.jl")
245266
include("grisu/grisu.jl")
246267
include("secretbuffer.jl")
247268

248-
# core math functions
269+
# basic data structures
270+
include("ordering.jl")
271+
using .Order
272+
273+
# Combinatorics
274+
include("sort.jl")
275+
using .Sort
276+
277+
# reduction along dims
278+
include("reducedim.jl") # macros in this file relies on string.jl
279+
include("accumulate.jl")
280+
281+
282+
283+
# core math functions. They occasionally need to ccall() out to Libm
284+
@include_stdlib_jll("Libm_jll")
285+
using .Libm_jll
286+
Libm_jll.__init__()
249287
include("floatfuncs.jl")
250288
include("math.jl")
251289
using .Math
@@ -268,18 +306,6 @@ let SOURCE_PATH = ""
268306
end
269307
end
270308

271-
# reduction along dims
272-
include("reducedim.jl") # macros in this file relies on string.jl
273-
include("accumulate.jl")
274-
275-
# basic data structures
276-
include("ordering.jl")
277-
using .Order
278-
279-
# Combinatorics
280-
include("sort.jl")
281-
using .Sort
282-
283309
# Fast math
284310
include("fastmath.jl")
285311
using .FastMath
@@ -293,6 +319,7 @@ using .Enums
293319
# BigInts
294320
include("gmp.jl")
295321
using .GMP
322+
import .GMP: libgmp # We need this for hashing
296323

297324
# float printing: requires BigInt
298325
include("ryu/Ryu.jl")
@@ -354,6 +381,13 @@ include("docs/basedocs.jl")
354381

355382
include("client.jl")
356383

384+
# Ensure we are including two important JLLs; CompilerSupportLibraries and libLLVM
385+
@include_stdlib_jll("CompilerSupportLibraries_jll")
386+
using .CompilerSupportLibraries_jll
387+
CompilerSupportLibraries_jll.__init__()
388+
@include_stdlib_jll("libLLVM_jll")
389+
using .libLLVM_jll
390+
357391
# Documentation -- should always be included last in sysimg.
358392
include("docs/Docs.jl")
359393
using .Docs

base/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ ifeq ($(OS),WINNT)
5959
@printf 'const LIBEXECDIR = "%s"\n' '$(subst /,\\,$(libexecdir_rel))' >> $@
6060
@printf 'const PRIVATE_LIBDIR = "%s"\n' '$(subst /,\\,$(private_libdir_rel))' >> $@
6161
@printf 'const INCLUDEDIR = "%s"\n' '$(subst /,\\,$(includedir_rel))' >> $@
62+
@printf 'const PCRE_JLL_LIBDIR = "%s"\n' '$(subst /,\\,$(PCRE_LIBDIR_rel))' >> $@
6263
else
6364
@echo "const SYSCONFDIR = \"$(sysconfdir_rel)\"" >> $@
6465
@echo "const DATAROOTDIR = \"$(datarootdir_rel)\"" >> $@
@@ -67,6 +68,7 @@ else
6768
@echo "const LIBEXECDIR = \"$(libexecdir_rel)\"" >> $@
6869
@echo "const PRIVATE_LIBDIR = \"$(private_libdir_rel)\"" >> $@
6970
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
71+
@echo "const PCRE_JLL_LIBDIR = \"$(PCRE_LIBDIR_rel)\"" >> $@
7072
endif
7173
ifeq ($(DARWIN_FRAMEWORK), 1)
7274
@echo "const DARWIN_FRAMEWORK = true" >> $@

base/fastmath.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import Core.Intrinsics: sqrt_llvm_fast, neg_float_fast,
2828
add_float_fast, sub_float_fast, mul_float_fast, div_float_fast, rem_float_fast,
2929
eq_float_fast, ne_float_fast, lt_float_fast, le_float_fast
3030

31+
using Base.Libm_jll
32+
3133
const fast_op =
3234
Dict(# basic arithmetic
3335
:+ => :add_fast,
@@ -280,9 +282,6 @@ pow_fast(x::FloatTypes, ::Val{p}) where {p} = pow_fast(x, p) # inlines already v
280282
sqrt_fast(x::FloatTypes) = sqrt_llvm_fast(x)
281283

282284
# libm
283-
284-
const libm = Base.libm_name
285-
286285
for f in (:acosh, :asinh, :atanh, :cbrt,
287286
:cosh, :exp2, :expm1, :log10, :log1p, :log2,
288287
:log, :sinh, :tanh)

base/floatfuncs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ algorithms. See [`muladd`](@ref).
313313
function fma end
314314

315315
fma_libm(x::Float32, y::Float32, z::Float32) =
316-
ccall(("fmaf", libm_name), Float32, (Float32,Float32,Float32), x, y, z)
316+
ccall(("fmaf", libm), Float32, (Float32,Float32,Float32), x, y, z)
317317
fma_libm(x::Float64, y::Float64, z::Float64) =
318-
ccall(("fma", libm_name), Float64, (Float64,Float64,Float64), x, y, z)
318+
ccall(("fma", libm), Float64, (Float64,Float64,Float64), x, y, z)
319319
fma_llvm(x::Float32, y::Float32, z::Float32) = fma_float(x, y, z)
320320
fma_llvm(x::Float64, y::Float64, z::Float64) = fma_float(x, y, z)
321321
# Disable LLVM's fma if it is incorrect, e.g. because LLVM falls back

base/gmp.jl

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import .Base: *, +, -, /, <, <<, >>, >>>, <=, ==, >, >=, ^, (~), (&), (|), xor,
1212
widen, signed, unsafe_trunc, trunc, iszero, isone, big, flipsign, signbit,
1313
sign, hastypemax
1414

15+
Base.@include_stdlib_jll("GMP_jll")
16+
using .GMP_jll
17+
GMP_jll.__init__()
18+
1519
if Clong == Int32
1620
const ClongMax = Union{Int8, Int16, Int32}
1721
const CulongMax = Union{UInt8, UInt16, UInt32}
@@ -21,8 +25,8 @@ else
2125
end
2226
const CdoubleMax = Union{Float16, Float32, Float64}
2327

24-
version() = VersionNumber(unsafe_string(unsafe_load(cglobal((:__gmp_version, :libgmp), Ptr{Cchar}))))
25-
bits_per_limb() = Int(unsafe_load(cglobal((:__gmp_bits_per_limb, :libgmp), Cint)))
28+
version() = VersionNumber(unsafe_string(unsafe_load(cglobal((:__gmp_version, libgmp), Ptr{Cchar}))))
29+
bits_per_limb() = Int(unsafe_load(cglobal((:__gmp_bits_per_limb, libgmp), Cint)))
2630

2731
const VERSION = version()
2832
const BITS_PER_LIMB = bits_per_limb()
@@ -54,7 +58,7 @@ mutable struct BigInt <: Signed
5458

5559
function BigInt(; nbits::Integer=0)
5660
b = MPZ.init2!(new(), nbits)
57-
finalizer(cglobal((:__gmpz_clear, :libgmp)), b)
61+
finalizer(cglobal((:__gmpz_clear, libgmp)), b)
5862
return b
5963
end
6064
end
@@ -100,7 +104,7 @@ function __init__()
100104
"Please rebuild Julia.")
101105
end
102106

103-
ccall((:__gmp_set_memory_functions, :libgmp), Cvoid,
107+
ccall((:__gmp_set_memory_functions, libgmp), Cvoid,
104108
(Ptr{Cvoid},Ptr{Cvoid},Ptr{Cvoid}),
105109
cglobal(:jl_gc_counted_malloc),
106110
cglobal(:jl_gc_counted_realloc_with_old_size),
@@ -112,7 +116,7 @@ function __init__()
112116
end
113117
# This only works with a patched version of GMP, ignore otherwise
114118
try
115-
ccall((:__gmp_set_alloc_overflow_function, :libgmp), Cvoid,
119+
ccall((:__gmp_set_alloc_overflow_function, libgmp), Cvoid,
116120
(Ptr{Cvoid},),
117121
cglobal(:jl_throw_out_of_memory_error))
118122
ALLOC_OVERFLOW_FUNCTION[] = true
@@ -132,20 +136,20 @@ module MPZ
132136
# - a method modifying its input has a "!" appendend to its name, according to Julia's conventions
133137
# - some convenient methods are added (in addition to the pure MPZ ones), e.g. `add(a, b) = add!(BigInt(), a, b)`
134138
# and `add!(x, a) = add!(x, x, a)`.
135-
using .Base.GMP: BigInt, Limb, BITS_PER_LIMB
139+
using .Base.GMP: BigInt, Limb, BITS_PER_LIMB, libgmp
136140

137141
const mpz_t = Ref{BigInt}
138142
const bitcnt_t = Culong
139143

140-
gmpz(op::Symbol) = (Symbol(:__gmpz_, op), :libgmp)
144+
gmpz(op::Symbol) = (Symbol(:__gmpz_, op), libgmp)
141145

142-
init!(x::BigInt) = (ccall((:__gmpz_init, :libgmp), Cvoid, (mpz_t,), x); x)
143-
init2!(x::BigInt, a) = (ccall((:__gmpz_init2, :libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
146+
init!(x::BigInt) = (ccall((:__gmpz_init, libgmp), Cvoid, (mpz_t,), x); x)
147+
init2!(x::BigInt, a) = (ccall((:__gmpz_init2, libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
144148

145-
realloc2!(x, a) = (ccall((:__gmpz_realloc2, :libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
149+
realloc2!(x, a) = (ccall((:__gmpz_realloc2, libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
146150
realloc2(a) = realloc2!(BigInt(), a)
147151

148-
sizeinbase(a::BigInt, b) = Int(ccall((:__gmpz_sizeinbase, :libgmp), Csize_t, (mpz_t, Cint), a, b))
152+
sizeinbase(a::BigInt, b) = Int(ccall((:__gmpz_sizeinbase, libgmp), Csize_t, (mpz_t, Cint), a, b))
149153

150154
for (op, nbits) in (:add => :(BITS_PER_LIMB*(1 + max(abs(a.size), abs(b.size)))),
151155
:sub => :(BITS_PER_LIMB*(1 + max(abs(a.size), abs(b.size)))),
@@ -161,7 +165,7 @@ for (op, nbits) in (:add => :(BITS_PER_LIMB*(1 + max(abs(a.size), abs(b.size))))
161165
end
162166

163167
invert!(x::BigInt, a::BigInt, b::BigInt) =
164-
ccall((:__gmpz_invert, :libgmp), Cint, (mpz_t, mpz_t, mpz_t), x, a, b)
168+
ccall((:__gmpz_invert, libgmp), Cint, (mpz_t, mpz_t, mpz_t), x, a, b)
165169
invert(a::BigInt, b::BigInt) = invert!(BigInt(), a, b)
166170
invert!(x::BigInt, b::BigInt) = invert!(x, x, b)
167171

@@ -174,14 +178,14 @@ for op in (:add_ui, :sub_ui, :mul_ui, :mul_2exp, :fdiv_q_2exp, :pow_ui, :bin_ui)
174178
end
175179
end
176180

177-
ui_sub!(x::BigInt, a, b::BigInt) = (ccall((:__gmpz_ui_sub, :libgmp), Cvoid, (mpz_t, Culong, mpz_t), x, a, b); x)
181+
ui_sub!(x::BigInt, a, b::BigInt) = (ccall((:__gmpz_ui_sub, libgmp), Cvoid, (mpz_t, Culong, mpz_t), x, a, b); x)
178182
ui_sub(a, b::BigInt) = ui_sub!(BigInt(), a, b)
179183

180184
for op in (:scan1, :scan0)
181185
@eval $op(a::BigInt, b) = Int(ccall($(gmpz(op)), Culong, (mpz_t, Culong), a, b))
182186
end
183187

184-
mul_si!(x::BigInt, a::BigInt, b) = (ccall((:__gmpz_mul_si, :libgmp), Cvoid, (mpz_t, mpz_t, Clong), x, a, b); x)
188+
mul_si!(x::BigInt, a::BigInt, b) = (ccall((:__gmpz_mul_si, libgmp), Cvoid, (mpz_t, mpz_t, Clong), x, a, b); x)
185189
mul_si(a::BigInt, b) = mul_si!(BigInt(), a, b)
186190
mul_si!(x::BigInt, b) = mul_si!(x, x, b)
187191

@@ -203,47 +207,47 @@ for (op, T) in ((:fac_ui, Culong), (:set_ui, Culong), (:set_si, Clong), (:set_d,
203207
end
204208
end
205209

206-
popcount(a::BigInt) = Int(ccall((:__gmpz_popcount, :libgmp), Culong, (mpz_t,), a))
210+
popcount(a::BigInt) = Int(ccall((:__gmpz_popcount, libgmp), Culong, (mpz_t,), a))
207211

208-
mpn_popcount(d::Ptr{Limb}, s::Integer) = Int(ccall((:__gmpn_popcount, :libgmp), Culong, (Ptr{Limb}, Csize_t), d, s))
212+
mpn_popcount(d::Ptr{Limb}, s::Integer) = Int(ccall((:__gmpn_popcount, libgmp), Culong, (Ptr{Limb}, Csize_t), d, s))
209213
mpn_popcount(a::BigInt) = mpn_popcount(a.d, abs(a.size))
210214

211215
function tdiv_qr!(x::BigInt, y::BigInt, a::BigInt, b::BigInt)
212-
ccall((:__gmpz_tdiv_qr, :libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t), x, y, a, b)
216+
ccall((:__gmpz_tdiv_qr, libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t), x, y, a, b)
213217
x, y
214218
end
215219
tdiv_qr(a::BigInt, b::BigInt) = tdiv_qr!(BigInt(), BigInt(), a, b)
216220

217221
powm!(x::BigInt, a::BigInt, b::BigInt, c::BigInt) =
218-
(ccall((:__gmpz_powm, :libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t), x, a, b, c); x)
222+
(ccall((:__gmpz_powm, libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t), x, a, b, c); x)
219223
powm(a::BigInt, b::BigInt, c::BigInt) = powm!(BigInt(), a, b, c)
220224
powm!(x::BigInt, b::BigInt, c::BigInt) = powm!(x, x, b, c)
221225

222226
function gcdext!(x::BigInt, y::BigInt, z::BigInt, a::BigInt, b::BigInt)
223-
ccall((:__gmpz_gcdext, :libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t, mpz_t), x, y, z, a, b)
227+
ccall((:__gmpz_gcdext, libgmp), Cvoid, (mpz_t, mpz_t, mpz_t, mpz_t, mpz_t), x, y, z, a, b)
224228
x, y, z
225229
end
226230
gcdext(a::BigInt, b::BigInt) = gcdext!(BigInt(), BigInt(), BigInt(), a, b)
227231

228-
cmp(a::BigInt, b::BigInt) = Int(ccall((:__gmpz_cmp, :libgmp), Cint, (mpz_t, mpz_t), a, b))
229-
cmp_si(a::BigInt, b) = Int(ccall((:__gmpz_cmp_si, :libgmp), Cint, (mpz_t, Clong), a, b))
230-
cmp_ui(a::BigInt, b) = Int(ccall((:__gmpz_cmp_ui, :libgmp), Cint, (mpz_t, Culong), a, b))
231-
cmp_d(a::BigInt, b) = Int(ccall((:__gmpz_cmp_d, :libgmp), Cint, (mpz_t, Cdouble), a, b))
232+
cmp(a::BigInt, b::BigInt) = Int(ccall((:__gmpz_cmp, libgmp), Cint, (mpz_t, mpz_t), a, b))
233+
cmp_si(a::BigInt, b) = Int(ccall((:__gmpz_cmp_si, libgmp), Cint, (mpz_t, Clong), a, b))
234+
cmp_ui(a::BigInt, b) = Int(ccall((:__gmpz_cmp_ui, libgmp), Cint, (mpz_t, Culong), a, b))
235+
cmp_d(a::BigInt, b) = Int(ccall((:__gmpz_cmp_d, libgmp), Cint, (mpz_t, Cdouble), a, b))
232236

233-
mpn_cmp(a::Ptr{Limb}, b::Ptr{Limb}, c) = ccall((:__gmpn_cmp, :libgmp), Cint, (Ptr{Limb}, Ptr{Limb}, Clong), a, b, c)
237+
mpn_cmp(a::Ptr{Limb}, b::Ptr{Limb}, c) = ccall((:__gmpn_cmp, libgmp), Cint, (Ptr{Limb}, Ptr{Limb}, Clong), a, b, c)
234238
mpn_cmp(a::BigInt, b::BigInt, c) = mpn_cmp(a.d, b.d, c)
235239

236-
get_str!(x, a, b::BigInt) = (ccall((:__gmpz_get_str,:libgmp), Ptr{Cchar}, (Ptr{Cchar}, Cint, mpz_t), x, a, b); x)
237-
set_str!(x::BigInt, a, b) = Int(ccall((:__gmpz_set_str, :libgmp), Cint, (mpz_t, Ptr{UInt8}, Cint), x, a, b))
238-
get_d(a::BigInt) = ccall((:__gmpz_get_d, :libgmp), Cdouble, (mpz_t,), a)
240+
get_str!(x, a, b::BigInt) = (ccall((:__gmpz_get_str,libgmp), Ptr{Cchar}, (Ptr{Cchar}, Cint, mpz_t), x, a, b); x)
241+
set_str!(x::BigInt, a, b) = Int(ccall((:__gmpz_set_str, libgmp), Cint, (mpz_t, Ptr{UInt8}, Cint), x, a, b))
242+
get_d(a::BigInt) = ccall((:__gmpz_get_d, libgmp), Cdouble, (mpz_t,), a)
239243

240-
limbs_write!(x::BigInt, a) = ccall((:__gmpz_limbs_write, :libgmp), Ptr{Limb}, (mpz_t, Clong), x, a)
241-
limbs_finish!(x::BigInt, a) = ccall((:__gmpz_limbs_finish, :libgmp), Cvoid, (mpz_t, Clong), x, a)
242-
import!(x::BigInt, a, b, c, d, e, f) = ccall((:__gmpz_import, :libgmp), Cvoid,
244+
limbs_write!(x::BigInt, a) = ccall((:__gmpz_limbs_write, libgmp), Ptr{Limb}, (mpz_t, Clong), x, a)
245+
limbs_finish!(x::BigInt, a) = ccall((:__gmpz_limbs_finish, libgmp), Cvoid, (mpz_t, Clong), x, a)
246+
import!(x::BigInt, a, b, c, d, e, f) = ccall((:__gmpz_import, libgmp), Cvoid,
243247
(mpz_t, Csize_t, Cint, Csize_t, Cint, Csize_t, Ptr{Cvoid}), x, a, b, c, d, e, f)
244248

245-
setbit!(x, a) = (ccall((:__gmpz_setbit, :libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
246-
tstbit(a::BigInt, b) = ccall((:__gmpz_tstbit, :libgmp), Cint, (mpz_t, bitcnt_t), a, b) % Bool
249+
setbit!(x, a) = (ccall((:__gmpz_setbit, libgmp), Cvoid, (mpz_t, bitcnt_t), x, a); x)
250+
tstbit(a::BigInt, b) = ccall((:__gmpz_tstbit, libgmp), Cint, (mpz_t, bitcnt_t), a, b) % Bool
247251

248252
end # module MPZ
249253

base/hashing2.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function decompose(x::BigFloat)::Tuple{BigInt, Int, Int}
199199
s = BigInt()
200200
s.size = cld(x.prec, 8*sizeof(GMP.Limb)) # limbs
201201
b = s.size * sizeof(GMP.Limb) # bytes
202-
ccall((:__gmpz_realloc2, :libgmp), Cvoid, (Ref{BigInt}, Culong), s, 8b) # bits
202+
ccall((:__gmpz_realloc2, libgmp), Cvoid, (Ref{BigInt}, Culong), s, 8b) # bits
203203
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), s.d, x.d, b) # bytes
204204
s, x.exp - 8b, x.sign
205205
end

base/irrationals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ macro irrational(sym, val, def)
162162
qsym = esc(Expr(:quote, sym))
163163
bigconvert = isa(def,Symbol) ? quote
164164
function Base.BigFloat(::Irrational{$qsym}, r::MPFR.MPFRRoundingMode=MPFR.ROUNDING_MODE[]; precision=precision(BigFloat))
165-
c = BigFloat(;precision=precision)
166-
ccall(($(string("mpfr_const_", def)), :libmpfr),
165+
c = BigFloat(;precision=precision)
166+
ccall(($(string("mpfr_const_", def)), MPFR.libmpfr),
167167
Cint, (Ref{BigFloat}, MPFR.MPFRRoundingMode), c, r)
168168
return c
169169
end

base/math.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ using .Base: sign_mask, exponent_mask, exponent_one,
2727

2828
using Core.Intrinsics: sqrt_llvm
2929

30-
using .Base: IEEEFloat
30+
using .Base: IEEEFloat, Libm_jll
31+
const libm = Libm_jll.libm
3132

3233
@noinline function throw_complex_domainerror(f::Symbol, x)
3334
throw(DomainError(x, string("$f will only return a complex result if called with a ",
@@ -309,8 +310,6 @@ log(b::Number, x::Number) = log(promote(b,x)...)
309310

310311
# type specific math functions
311312

312-
const libm = Base.libm_name
313-
314313
# functions with no domain error
315314
"""
316315
sinh(x)

0 commit comments

Comments
 (0)