Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Migration of the code in here to FLINT_jll #7

@fingolfin

Description

@fingolfin

BinaryBuilder now has support for inserting code into the __init__ function of JLLs using the init_block kwarg (see JuliaPackaging/BinaryBuilder.jl#791). This also available on Yggdrasil (see JuliaPackaging/Yggdrasil#1260).

With this, in principle we should now be able to move the initialization code in LoadFlint.jl directly into FLINT_jll; fewer moving parts should then make things easier for us.

Right now, though, I have some doubt about how the initialization should look. We do this in LoadFlint.jl right now:

  if !Sys.iswindows() && !__isthreaded[]
    #to match the global gmp ones
    fm = dlsym(libflint_handle, :__flint_set_memory_functions)
    ccall(fm, Nothing,
      (Ptr{Nothing},Ptr{Nothing},Ptr{Nothing},Ptr{Nothing}),
        cglobal(:jl_malloc),
        cglobal(:jl_calloc),
        cglobal(:jl_realloc),
        cglobal(:jl_free))
  end      

What I don't understand is why Windows builds and threaded mode are treated differently. Note that jl_malloc and friends ought to be thread safe (they just wrap malloc etc., plus some code which modifies TLS data).

The threaded check was added by @thofma in Nemocas/Nemo.jl@96663d9

The windows check was added by @wbhart in Nemocas/Nemo.jl@77e6667

Unfortunately in both cases it is not clear what the issues were, so...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions