summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #1021 from larskanis/compactLars Kanis2023-04-1613-37/+197
|\ \ \ | | | | | | | | Make FFI classes GC.compact friendly
| * | | Make FFI classes GC.compact friendlyLars Kanis2023-04-1413-37/+197
| |/ / | | | | | | | | | | | | | | | This allows to relocate all FFI objects. Also remove marking of StructLayout->cache_row in favour of clearing it at GC.compact only.
* | | Merge pull request #1020 from larskanis/update-libffiLars Kanis2023-04-162-1/+3
|\ \ \ | | | | | | | | Update libffi
| * | | Disable custom trampoline when using libffi closure allocationLars Kanis2023-04-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is because libffi changed the way how closures are allocated to static trampolines. `codeloc` is an opaque pointer now, to the internal `struct tramp` struct - and not to executable code. The executable code of trampolines is static and no longer written or writable at runtime.
| * | | Update libffi to latest masterLars Kanis2023-04-141-0/+0
| |/ /
* | | Update "rake clean" for ruby-3Lars Kanis2023-04-141-2/+1
|/ /
* | Merge pull request #1015 from matoro/masterLars Kanis2023-03-161-1/+1
|\ \ | | | | | | Update gen/Rakefile for Ruby 3 compat
| * | Update gen/Rakefile for Ruby 3 compatmatoro2023-03-141-1/+1
|/ / | | | | | | | | | | | | Ruby 3 changed the 'mode' argument from an option hash to keyword argument. This change is backwards-compatible with Ruby 2. See: https://github.com/ruby/fileutils/commit/482de6d397742526d1111576e2791f9b7051e3c0
* | Merge pull request #1012 from larskanis/type-check-by-typed-dataLars Kanis2023-03-066-25/+20
|\ \ | | | | | | Use type checking by TypedData and remove duplocated check by rb_obj_is_kind_of
| * | Use type checking by TypedData and remove duplocated check by rb_obj_is_kind_ofLars Kanis2023-03-066-25/+20
| | | | | | | | | | | | This is now possible with new typed data objects.
* | | Merge pull request #1013 from larskanis/undef-abstractmem-newLars Kanis2023-03-061-12/+1
|\ \ \ | | | | | | | | Remove allocator of AbstractMemory
| * | | Remove allocator of AbstractMemoryLars Kanis2023-03-061-12/+1
| |/ / | | | | | | | | | | | | | | | This disables AbstractMemory.new, which has no practical use. As discussed in #1010
* | | Merge pull request #1011 from casperisfine/array-type-write-barrierLars Kanis2023-03-063-9/+36
|\ \ \ | |/ / |/| | Implement the last missing Write Barriers and dsize
| * | Implement the last missing Write Barriers and dsizeJean Boussier2023-03-063-9/+36
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #1010 from casperisfine/pointer-write-barrierLars Kanis2023-03-067-17/+104
|\ \ | | | | | | Implement Write Barrier and dsize for FFI::Pointer
| * | Implement Write Barrier and dsize for FFI::PointerJean Boussier2023-03-067-17/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'struct-layout-write-barrier' of ↵Lars Kanis2023-03-065-16/+70
|\ \ \ | |/ / |/| | | | | https://github.com/casperisfine/ffi into casperisfine-struct-layout-write-barrier
| * | Implement Write Barrier and dsize for FFI::StructLayoutJean Boussier2023-03-065-15/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #1009 from casperisfine/struct-by-value-write-barrierLars Kanis2023-03-061-6/+15
|\ \ \ | | | | | | | | Implement Write Barrier and dsize for FFI::StructByValue
| * | | Implement Write Barrier and dsize for FFI::StructByValueJean Boussier2023-03-061-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #1008 from casperisfine/variadic-write-barrierLars Kanis2023-03-061-8/+17
|\ \ \ \ | | | | | | | | | | Implement Write Barrier and dsize for FFI::VariadicInvoker
| * | | | Implement Write Barrier and dsize for FFI::VariadicInvokerJean Boussier2023-03-061-8/+17
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #1007 from casperisfine/struct-write-barrierLars Kanis2023-03-062-29/+63
|\ \ \ \ | | | | | | | | | | Implement Write Barrier and dsize for FFI::Struct
| * | | | Implement Write Barrier and dsize for FFI::StructJean Boussier2023-03-062-29/+63
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #1005 from casperisfine/type-write-barrierLars Kanis2023-03-065-23/+83
|\ \ \ \ | |_|/ / |/| | | Implement Write Barrier and dsize for FFI::Type
| * | | Implement Write Barrier and dsize for FFI::TypeJean Boussier2023-03-065-23/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge branch 'master' of github.com:ffi/ffiLars Kanis2023-03-062-10/+33
|\ \ \ \
| * \ \ \ Merge pull request #1004 from casperisfine/symbol-write-barrierLars Kanis2023-03-062-10/+33
| |\ \ \ \ | | | | | | | | | | | | Implement Write Barrier and dsize for FFI::DynamicLibrary
| | * | | | Implement Write Barrier and dsize for FFI::DynamicLibraryJean Boussier2023-03-062-10/+33
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge branch 'master' of github.com:ffi/ffiLars Kanis2023-03-062-8/+33
|\ \ \ \ \ | |/ / / /
| * | | | Merge pull request #1003 from casperisfine/function-write-barrier-2Lars Kanis2023-03-062-8/+33
| |\ \ \ \ | | |_|/ / | |/| | | Implement Write Barrier and dsize for FFI::Function
| | * | | Implement Write Barrier and dsize for FFI::FunctionJean Boussier2023-03-062-8/+33
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Fix class name of Symbol#inspectLars Kanis2023-03-061-1/+1
|/ / /
* | | Increment callbackCount outside of the macro RB_OBJ_WRITELars Kanis2023-03-061-1/+2
|/ / | | | | | | .. to ensure it is called exactly once.
* | Merge pull request #1002 from casperisfine/builtin-type-inspectLars Kanis2023-03-061-2/+2
|\ \ | | | | | | Fix `Type#inspect` to properly display the constant name
| * | Fix `Type#inspect` to properly display the constant nameJean Boussier2023-03-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | before: ```ruby >> FFI::Type::Builtin::CHAR => #<FFI::Type::Builtin:INT8 size=1 alignment=1> ``` after: ```ruby >> FFI::Type::Builtin::CHAR => #<FFI::Type::Builtin::INT8 size=1 alignment=1> ```
* | | Merge pull request #1001 from casperisfine/function-type-write-barrierLars Kanis2023-03-063-15/+63
|\ \ \ | |/ / |/| | Implement Write Barrier and dsize for FFI::FunctionType
| * | Implement Write Barrier and dsize for FFI::FunctionTypeJean Boussier2023-03-063-15/+63
|/ / | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #1000 from larskanis/typeddataLars Kanis2023-03-042-12/+20
|\ \ | | | | | | Convert FFI::DynamicLibrary to TypedData
| * | Convert FFI::DynamicLibrary to TypedDataLars Kanis2023-03-031-7/+19
| | | | | | | | | | | | | | | | | | | | | Ref: ffi#991 The old untyped DATA API is soft deprecated and this new one open the door to write barriers, compaction, memsize etc.
| * | Change remaining use of TypedData objectLars Kanis2023-03-031-5/+1
|/ / | | | | | | for completeness even if this code part is commented out
* | Merge branch 'typed-data-struct' of https://github.com/casperisfine/ffi into ↵Lars Kanis2023-03-034-19/+37
|\ \ | | | | | | | | | casperisfine-typed-data-struct
| * | Convert FFI::Struct to TypedDataJean Boussier2023-03-025-37/+65
| | | | | | | | | | | | | | | | | | | | | Ref: https://github.com/ffi/ffi/pull/991 The old untyped DATA API is soft deprecated and this new one open the door to write barriers, compaction, memsize etc.
* | | Merge branch 'casperisfine-typed-data-abstract-memory'Lars Kanis2023-03-0311-87/+192
|\ \ \
| * | | Convert FFI::AbstractMemory and descendants to TypedDataJean Boussier2023-03-0211-87/+192
| |/ / | | | | | | | | | | | | | | | | | | Ref: https://github.com/ffi/ffi/pull/991 The old untyped DATA API is soft deprecated and this new one open the door to write barriers, compaction, memsize etc.
* | | Merge pull request #997 from casperisfine/typed-data-inline-arrayLars Kanis2023-03-031-11/+22
|\ \ \ | | | | | | | | Convert FFI::Struct::InlineArray to TypedData
| * | | Convert FFI::Struct::InlineArray to TypedDataJean Boussier2023-03-021-11/+22
| |/ / | | | | | | | | | | | | | | | | | | Ref: https://github.com/ffi/ffi/pull/991 The old untyped DATA API is soft deprecated and this new one open the door to write barriers, compaction, memsize etc.
* | | Merge pull request #995 from casperisfine/typed-data-typeLars Kanis2023-03-0316-103/+205
|\ \ \ | | | | | | | | Convert FFI::Type and descendants to TypedData
| * | | Convert FFI::Type and descendants to TypedDataJean Boussier2023-03-0216-103/+205
| |/ / | | | | | | | | | | | | | | | | | | Ref: https://github.com/ffi/ffi/pull/991 The old untyped DATA API is soft deprecated and this new one open the door to write barriers, compaction, memsize etc.
* | | Merge pull request #996 from casperisfine/typed-data-thread-dataLars Kanis2023-03-031-6/+18
|\ \ \ | | | | | | | | Convert FFI::ThreadData to TypedData