Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃攰 MEGA ISSUE - ABI stability for ruby-head #227

Closed
5 tasks
ianks opened this issue Jun 14, 2023 · 1 comment
Closed
5 tasks

馃攰 MEGA ISSUE - ABI stability for ruby-head #227

ianks opened this issue Jun 14, 2023 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@ianks
Copy link
Collaborator

ianks commented Jun 14, 2023

At shopify, we test extensively against ruby-head in order to improve performance and improve Ruby for our apps. Unlike stable Ruby releases, ruby-head is subject to breaking ABI changes on a per-commit basis. This means that extensions that rely on libruby ABI compatibility (i.e. assuming certain struct layouts / fields being available) can break on a moments notice.

These breaking changes are currently very disruptive, because it prevents us from deploying new versions of ruby-head for our apps that use Rust gems (including the core monolith and SFR).

For example, a recent change to the RString struct and subsequent update to magnus made it so extensions would not compile, and thus CI going 馃敶 .

To fix this, rb-sys should provide a ABI stability guarantees where it makes sense, so upstream crates like magnus do not have to rely on Ruby internal data structures to do their job (example). We can do this by providing implementations for the common C macros and inline functions libruby provides that are currently inaccessible from Rust.

  • Implement missing RSTRING_PTR, RSTRING_LEN macros in Rust for all released versions of Ruby
  • Add support for detecting dev (unreleased) versions of Ruby
  • When a dev build is detecting, skip using the Rust implementations entirely, and instead compile and link the C glue code versions (via ruby-macros feature) instead (since those should be ABI compatible, albeit more of a pain to use and slower)
  • Submit patches to magnus to use new Rust implementations
  • Mark RString and RArray types as opaque, so upstream consumers of rb-sys are forced to use the ABI stable macros instead (to ensure they are protected from breaking ABI changes).
@ianks ianks added the help wanted Extra attention is needed label Jun 14, 2023
@ianks
Copy link
Collaborator Author

ianks commented Jun 14, 2023

cc: @matsadler putting this on your radar 鉂わ笍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant