From 07b81320ea82c31a7387125e5a39102fbd75c0c0 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 26 Jul 2023 16:08:50 -0400 Subject: [PATCH] Change `Random` to use `dSFMT_jll` --- pkgimage.mk | 4 ++-- stdlib/Random/Project.toml | 1 + stdlib/Random/src/DSFMT.jl | 15 ++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgimage.mk b/pkgimage.mk index 9ee39d10209ac5..bd8d46a1a289eb 100644 --- a/pkgimage.mk +++ b/pkgimage.mk @@ -86,17 +86,17 @@ $(eval $(call sysimg_builder,nghttp2_jll,Artifacts Libdl)) $(eval $(call pkgimg_builder,OpenLibm_jll,Artifacts Libdl)) $(eval $(call pkgimg_builder,PCRE2_jll,Artifacts Libdl)) $(eval $(call sysimg_builder,Zlib_jll,Artifacts Libdl)) -$(eval $(call pkgimg_builder,dSFMT_jll,Artifacts Libdl)) +$(eval $(call sysimg_builder,dSFMT_jll,Artifacts Libdl)) $(eval $(call pkgimg_builder,libLLVM_jll,Artifacts Libdl)) $(eval $(call sysimg_builder,libblastrampoline_jll,Artifacts Libdl)) $(eval $(call sysimg_builder,OpenBLAS_jll,Artifacts Libdl)) $(eval $(call sysimg_builder,Markdown,Base64)) $(eval $(call sysimg_builder,Printf,Unicode)) -$(eval $(call sysimg_builder,Random,SHA)) $(eval $(call sysimg_builder,Tar,ArgTools,SHA)) $(eval $(call pkgimg_builder,DelimitedFiles,Mmap)) # 2-depth packages +$(eval $(call sysimg_builder,Random,SHA dSFMT_jll)) $(eval $(call pkgimg_builder,LLD_jll,Zlib_jll libLLVM_jll Artifacts Libdl)) $(eval $(call sysimg_builder,LibSSH2_jll,Artifacts Libdl MbedTLS_jll)) $(eval $(call pkgimg_builder,MPFR_jll,Artifacts Libdl GMP_jll)) diff --git a/stdlib/Random/Project.toml b/stdlib/Random/Project.toml index f32fc3e2a4f846..0cb89ddecdf5c9 100644 --- a/stdlib/Random/Project.toml +++ b/stdlib/Random/Project.toml @@ -2,6 +2,7 @@ name = "Random" uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [deps] +dSFMT_jll = "05ff407c-b0c1-5878-9df8-858cc2e60c36" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" [extras] diff --git a/stdlib/Random/src/DSFMT.jl b/stdlib/Random/src/DSFMT.jl index 4c5cb8c522667a..a78a8124758ed7 100644 --- a/stdlib/Random/src/DSFMT.jl +++ b/stdlib/Random/src/DSFMT.jl @@ -4,6 +4,7 @@ module DSFMT import Base: copy, copy!, ==, hash using Base.GMP.MPZ +using dSFMT_jll export DSFMT_state, dsfmt_get_min_array_size, dsfmt_get_idstring, dsfmt_init_gen_rand, dsfmt_init_by_array, dsfmt_gv_init_by_array, @@ -44,14 +45,14 @@ hash(s::DSFMT_state, h::UInt) = hash(s.val, h) ## wrapper functions function dsfmt_get_idstring() - idstring = ccall((:dsfmt_get_idstring,:libdSFMT), + idstring = ccall((:dsfmt_get_idstring,libdSFMT), Ptr{UInt8}, ()) return unsafe_string(idstring) end function dsfmt_get_min_array_size() - min_array_size = ccall((:dsfmt_get_min_array_size,:libdSFMT), + min_array_size = ccall((:dsfmt_get_min_array_size,libdSFMT), Int32, ()) end @@ -59,21 +60,21 @@ end const dsfmt_min_array_size = dsfmt_get_min_array_size() function dsfmt_init_gen_rand(s::DSFMT_state, seed::UInt32) - ccall((:dsfmt_init_gen_rand,:libdSFMT), + ccall((:dsfmt_init_gen_rand,libdSFMT), Cvoid, (Ptr{Cvoid}, UInt32,), s.val, seed) end function dsfmt_init_by_array(s::DSFMT_state, seed::Vector{UInt32}) - ccall((:dsfmt_init_by_array,:libdSFMT), + ccall((:dsfmt_init_by_array,libdSFMT), Cvoid, (Ptr{Cvoid}, Ptr{UInt32}, Int32), s.val, seed, length(seed)) end function dsfmt_gv_init_by_array(seed::Vector{UInt32}) - ccall((:dsfmt_gv_init_by_array,:libdSFMT), + ccall((:dsfmt_gv_init_by_array,libdSFMT), Cvoid, (Ptr{UInt32}, Int32), seed, length(seed)) @@ -82,7 +83,7 @@ end function dsfmt_fill_array_close1_open2!(s::DSFMT_state, A::Ptr{Float64}, n::Int) @assert Csize_t(A) % 16 == 0 # the underlying C array must be 16-byte aligned @assert dsfmt_min_array_size <= n && iseven(n) - ccall((:dsfmt_fill_array_close1_open2,:libdSFMT), + ccall((:dsfmt_fill_array_close1_open2,libdSFMT), Cvoid, (Ptr{Cvoid}, Ptr{Float64}, Int), s.val, A, n) @@ -91,7 +92,7 @@ end function dsfmt_fill_array_close_open!(s::DSFMT_state, A::Ptr{Float64}, n::Int) @assert Csize_t(A) % 16 == 0 # the underlying C array must be 16-byte aligned @assert dsfmt_min_array_size <= n && iseven(n) - ccall((:dsfmt_fill_array_close_open,:libdSFMT), + ccall((:dsfmt_fill_array_close_open,libdSFMT), Cvoid, (Ptr{Cvoid}, Ptr{Float64}, Int), s.val, A, n)