| Commit message (Collapse) | Author | Age | Files | Lines |
| |\
| |
| | |
Add support for passing ABI version to `FFI.map_library_name`.
|
| | | |
|
| |\ \ |
|
| | | |
| | |
| | |
| | | |
..until necessary native methods are added.
|
| | | |
| | |
| | |
| | | |
For consistency and to ease proting to JRuby and Truffleruby.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | | | |
|
| | | |
| | |
| | |
| | | |
And remove support for older rubies.
|
| | | |
| | |
| | |
| | |
| | | |
Shareable instance variables on modules are essential for most Ractor specs.
They were introduced in ruby-3.1.
|
| | | |
| | |
| | |
| | |
| | | |
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
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | | |
.. and test Ractor compatibility there.
|
| | | |
| | |
| | |
| | | |
It is incompatible to our usage of instance variables by the Struct class.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
| | |
| | |
| | | |
No need to share per thread data object accross ractors.
|
| | | |
| | |
| | |
| | |
| | | |
The callback is now routet to the Ractor, that created the FFI::Function .
Within this Ractor a new ruby thread is created to execute the Proc, like before.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | |
| | |
| | |
| | | |
Instead, the function pointers must be a typdef. For what its worth, see https://stackoverflow.com/a/37114318.
|
| | | |
| | |
| | |
| | | |
compiling with MSVC 22. These apis take a widechar - LPCWSTR. Thus these tests fail because Windows considers the pipe names to be invalid. Thus switch to the Ansi versions.
|
| |/ / |
|
| | |
| |
| |
| | |
It was not yet tested.
|
| |\ \
| | |
| | | |
Implement Write Barrier and dsize for FFI::Pointer
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As well as FFI::MemoryPointer and FFI::AbstractMemory
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.
|
| |\ \ \
| |/ /
|/| |
| | | |
https://github.com/casperisfine/ffi into casperisfine-struct-layout-write-barrier
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |\ \ \
| | | |
| | | | |
Implement Write Barrier and dsize for FFI::Struct
|
| | |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
And FFI::Struct::InlineArray.
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.
|
| |\ \ \
| | | |
| | | | |
Implement Write Barrier and dsize for FFI::Type
|
| | |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Ref: https://github.com/ffi/ffi/pull/991
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.
While I was at it I removed the `strdup` of `BuiltinType.name`,
I don't see why we wouldn't directly point at static memory, that
saves copying type names, and makes freeing builtin types easier.
|
| |\ \ \
| | | |
| | | | |
Implement Write Barrier and dsize for FFI::DynamicLibrary
|
| | |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
And FFI::DynamicLibrary::Symbol
Ref: https://github.com/ffi/ffi/pull/991
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. It's not counting everything
because some types are opaque right now, so a larger refactoring would be needed.
While I was at it, I moved `Symbol.library` into the unused `Symbol.base.rbParent`
which seemed appropriate and saves a pointer.
|
| |/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ref: https://github.com/ffi/ffi/pull/991
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. It's not counting everything
because some types are opaque right now, so a larger refactoring would be needed.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | | |
|
| | |
| |
| | |
See https://github.com/jruby/jruby/issues/7521
|
| | |
| |
| |
| |
| |
| |
| | |
It fails in Macos-12, since that version raises a different error message than Macos-11.
On the other hand, linker script emulation seems not to be in use on Macos at all, since Macos uses .dylib file extansion rather than .so.
Fixes #981
|
| |\ \
| | |
| | | |
Rename sparc64-linux -> sparcv9-linux
|
| | |/ |
|
| | | |
|
| | |
| |
| |
| | |
This isn't yet supported by truffleruby
|
| |/
|
|
|
|
|
|
|
| |
If the high bit of the address was set this would raise RangeError
(bignum too big to convert into long long). This is not uncommon on
platforms that use the high bits of pointers for purposes such as
pointer authentication
This also now matches Pointer#address which uses ULL2NUM.
|
| |\
| |
| | |
Bitmask improvement
|
| | | |
|
| | | |
|
| | | |
|