Skip to content

Conversation

nsajko
Copy link
Member

@nsajko nsajko commented Sep 14, 2025

  • Use ccall macro, instead of raw ccall, to allow using gc_safe=true.

  • Apply some effects:

    • ccalls get:

      • nothrow, C code does not throw

      • terminates_globally, GMP calls return

      • notaskstate, GMP cannot know about Julia's tasks AFAIK

    • non-mutating functions additionally get:

      • effect_free
  • In the BigInt() constructor, call the new form of finalizer: finalizer(func, b) instead of finalizer(ptr, b). The new form is a builtin, so it is handled better by the compiler. See PR Make finalizer a built-in #45423 and PR assume effects terminates, noub for finalizer #59553.

* Use `ccall` macro, instead of raw `ccall`, to allow using
  `gc_safe=true`.

* Apply some effects:

    * `ccall`s get:

        * `nothrow`, C code does not throw

        * `terminates_globally`, GMP calls return

        * `notaskstate`, GMP cannot know about Julia's tasks AFAIK

    * non-mutating functions additionally get:

        * `effect_free`

* In the `BigInt()` constructor, call the new form of `finalizer`:
  `finalizer(func, b)` instead of `finalizer(ptr, b)`. The new form
  is a builtin, so it is handled better by the compiler. See PR
  JuliaLang#45423 and PR JuliaLang#59553.
@nsajko nsajko added bignums BigInt and BigFloat compiler:effects effect analysis labels Sep 14, 2025
@nsajko
Copy link
Member Author

nsajko commented Sep 14, 2025

The second commit here is not intended to be merged with the PR. I assume PR #59553, or a better one, will get merged before this PR.

@gbaraldi
Copy link
Member

gc_safe might not add much here, in fact it probably adds more overhead than it helps. It's quite useful for long running ccalls of which I don't think any of these are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bignums BigInt and BigFloat compiler:effects effect analysis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants