Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement Write Barrier and dsize for FFI::DynamicLibrary#1004

Merged
larskanis merged 1 commit intoffi:masterfrom
casperisfine:symbol-write-barrier
Mar 6, 2023
Merged

Implement Write Barrier and dsize for FFI::DynamicLibrary#1004
larskanis merged 1 commit intoffi:masterfrom
casperisfine:symbol-write-barrier

Conversation

@casperisfine
Copy link

@casperisfine casperisfine commented Mar 6, 2023

And FFI::DynamicLibrary::Symbol

Ref: #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.

@casperisfine casperisfine force-pushed the symbol-write-barrier branch from 3c01d11 to 5c00dd3 Compare March 6, 2023 11:27
And FFI::DynamicLibrary::Symbol

Ref: ffi#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.
@casperisfine casperisfine force-pushed the symbol-write-barrier branch from 5c00dd3 to c05fa02 Compare March 6, 2023 13:43
@casperisfine
Copy link
Author

Rebased.

@larskanis larskanis merged commit c409c15 into ffi:master Mar 6, 2023
@casperisfine casperisfine mentioned this pull request Apr 3, 2023
40 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants