| Commit message (Collapse) | Author | Age | Files | Lines |
| |\
| |
| | |
Add support for passing ABI version to `FFI.map_library_name`.
|
| | | |
|
| |\ \ |
|
| | | |
| | |
| | |
| | | |
For consistency and to ease proting to JRuby and Truffleruby.
|
| | | |
| | |
| | |
| | | |
of commit e987ab50366a4b08617a20568eabdaa1fb761317
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
definitions Ractor usable
Freeze objects which are immutable from the start are now freezed.
This allows these objects to be used by Ractor without make_shareable.
This partially reverts commit 4fc6a8c5ec8a9a720330946af9d1103015c62942 in such a way, that functions are stored in a module variable @ffi_functions.
Enums are implemented per FFI::Library not per attached function.
To make them shareable they would have to be copied and freezed per function.
This would increase memory footprint for the sake of Ractor support.
IMHO it's better to mark the module explicit as finished by .freeze to allow its use in a Ractor.
This also enables querying the enum definitions from a Ractor.
Using a Hash instead of per-function variables allow to use foo! and bar? methods as wished in #971.
Fixes #971
|
| | | |
| | |
| | |
| | |
| | | |
The term "return_type" is already used in Truffleruby and sounds better to me.
On the other hand the term "result_type" was only used in C-ffi as FunctionInfo#result_type, which is an internal class only.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
attached
This allows to freeze the FFI::Function immediately, so that it is shareable by Ractor without the need to freeze the module explicit.
To make it shareable the typedef hash used for variadic functions is duplicated and made frozen.
This creates a small compatibility issue:
Only typedefs defined above the variadic function can be used by that function.
If a typedef is created after the definition of the variadic function, then this typedef can no longer be used as parameter to that variadic function.
Also fix the retrieval of simple (non-struct) global variables per #attached_variables.
Closes #975
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | | |
since there's no need to modify it later on
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Ractor-local custom typedefs are used now, since global writable typedefs aren't compatible with Ractor isolation.
Now the builtin typedefs are frozen and available for all Ractors.
But all custom typedefs are only per Ractor.
Actually the global typedefs already were useable in Ractors, if they are resolved in C code.
This is because the C code doesn't check the Ractor boundaries.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
All objects are shareable now when frozen.
All objects can be created in a non-main Ractor.
Typedefs are a global mutable state and are not accessable from Ractor other than the main Ractor.
So all Function, Struct, etc. must be defined in the main Ractor and can then be used in other Ractors.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
FFI users might not want to expose `release` as a public class method, but want to keep it private.
Also re-enable GC tests that were disabled as part of #427, but make them opt-in per env var FFI_TEST_GC.
Derivations of Releaser are no longer necessary, so that they are removed now.
|
| |\ \ \
| |/ /
|/| | |
Use libffi closure allocations on hppa
|
| | | | |
|
| | | | |
|
| |/ / |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
And FFI::StructLayout::Field
Write barrier protected objects are allowed to be promoted to the old generation,
which means they only get marked on major GC.
The downside is that the RB_BJ_WRITE macro MUST be used to set references,
otherwise the referenced object may be garbaged collected.
This commit also implement a `dsize` function so that these instance
report a more relevant size in various memory profilers.
I had to get rid of the `memset(0)` in `struct_layout_mark` has with Write Barriers
it's not guaranteed that the layout will be marked before `fieldName` is moved.
I don't think it was a good fix anyway, it's better to mark these VALUE so the GC pin
them. I think we could go back to an `st_table` and mark only the keys with `rb_mark_set`.
But I didn't want to go down this rabbit hole.
|
| | |
| |
| |
| | |
It makes no sense to initialize the base class with a potentially invalid pointer.
|
| |\ \
| | |
| | | |
Rename sparc64-linux -> sparcv9-linux
|
| | |/
| |
| |
| |
| |
| |
| |
| | |
In https://github.com/ffi/ffi/pull/575, 64-bit sparc was changed to also
use sparcv9 as the platform name, but the types.conf directory was never
renamed. This breaks only on Ruby 3.0 and later due to the fileutils
change to use keyword arguments in
https://github.com/ruby/fileutils/commit/482de6d397742526d1111576e2791f9b7051e3c0
|
| |\ \
| | |
| | | |
Refactor library lookup
|
| | | |
| | |
| | |
| | |
| | | |
* The keys are not used, and the paths are typically already part of the error message.
* Makes it possible to just use a recursive call instead of retry.
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Try every prefix, not just the first one where the file exists.
The first existing file might be for the wrong architecture or have
other issues and cannot be loaded.
* Show which directories were searched in error message.
* Only consider /opt/homebrew/lib on darwin-aarch64.
* Only rescue LoadError and RuntimeError, not Exception.
* Refactor in smaller functions to improve readability.
* Fixes #880.
* Example error message:
Could not open library 'notexist': notexist: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libnotexist.so': libnotexist.so: cannot open shared object file: No such file or directory.
Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib
|
| |/
|
| |
overriden -> overridden
|
| |\
| |
| | |
Add types.conf for loongarch64-linux
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
FFI improvments will probably backported to 9.2 branch.
See https://github.com/jruby/jruby/pull/6747#issuecomment-876610443
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Take the same approach for detection as used in fiddle:
https://github.com/ruby/ruby/blob/79717f81f8ba24960cca6c934d00c72db64139ed/test/fiddle/helper.rb#L55-L56
And use "_time" function on all Windows UCRT platforms.
|
| | |
|
| |
|
|
| |
Same as https://github.com/ffi/ffi/pull/627
|
| |\
| |
| | |
dynlib support for homebrew 3 on Apple Silicon M1
|
| | |
| |
| | |
As the homebrew team discussed in https://github.com/Homebrew/brew/issues/9177 the new library path for homebrew on apple silicon is `/opt/homebrew/lib`. Alongside the PR to support MacPorts https://github.com/ffi/ffi/pull/638 this commits adds support for the new homebrew path.
|
| | | |
|
| | |
| |
| |
| | |
`struct_generator.rb`
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 195e12f3ee52a8f5620fd8286c2b94737b6b4fc2.
Removing constants is contrary to expectation.
It was introduced to replace Rubinius internal FFI in favor of the gem.
We no longer test on Rubinius and Rubinius seems to be dead.
So we can remove this line.
Fixes 896
|
| | | |
|