diff options
| author | Max Bernstein <rubybugs@bernsteinbear.com> | 2025-10-09 19:06:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-09 17:06:49 +0000 |
| commit | 09e5c5eed1ee9a58ffa37ecdda999a6ffaea6eb4 (patch) | |
| tree | 92b5bdfe04abde915f8aef942e8f8a4c89dfa1ad | |
| parent | d7f2a1ec9a1ae569bf79f06ad44e0f76292c9b06 (diff) | |
ZJIT: Name enum for bindgen (#14802)
Relying on having the same compiler version and behavior across
platforms is brittle, as Kokubun points out. Instead, name the enum so
we don't have to rely on gensym stability.
Fix https://github.com/Shopify/ruby/issues/787
| -rw-r--r-- | zjit.c | 2 | ||||
| -rw-r--r-- | zjit/bindgen/src/main.rs | 2 | ||||
| -rw-r--r-- | zjit/src/cruby_bindings.inc.rs | 4 |
3 files changed, 4 insertions, 4 deletions
@@ -235,7 +235,7 @@ rb_zjit_print_exception(void) rb_warn("Ruby error: %"PRIsVALUE"", rb_funcall(exception, rb_intern("full_message"), 0)); } -enum { +enum zjit_exported_constants { RB_INVALID_SHAPE_ID = INVALID_SHAPE_ID, }; diff --git a/zjit/bindgen/src/main.rs b/zjit/bindgen/src/main.rs index e1d19f9442..64b235b838 100644 --- a/zjit/bindgen/src/main.rs +++ b/zjit/bindgen/src/main.rs @@ -290,7 +290,7 @@ fn main() { .allowlist_function("rb_zjit_insn_leaf") .allowlist_type("robject_offsets") .allowlist_type("rstring_offsets") - .allowlist_var("RB_INVALID_SHAPE_ID") + .allowlist_type("zjit_exported_constants") .allowlist_function("rb_assert_holding_vm_lock") .allowlist_function("rb_jit_shape_too_complex_p") .allowlist_function("rb_jit_multi_ractor_p") diff --git a/zjit/src/cruby_bindings.inc.rs b/zjit/src/cruby_bindings.inc.rs index 8eac87c965..ab442841ff 100644 --- a/zjit/src/cruby_bindings.inc.rs +++ b/zjit/src/cruby_bindings.inc.rs @@ -723,8 +723,8 @@ pub const DEFINED_REF: defined_type = 15; pub const DEFINED_FUNC: defined_type = 16; pub const DEFINED_CONST_FROM: defined_type = 17; pub type defined_type = u32; -pub const RB_INVALID_SHAPE_ID: _bindgen_ty_38 = 4294967295; -pub type _bindgen_ty_38 = u32; +pub const RB_INVALID_SHAPE_ID: zjit_exported_constants = 4294967295; +pub type zjit_exported_constants = u32; pub const ROBJECT_OFFSET_AS_HEAP_FIELDS: robject_offsets = 16; pub const ROBJECT_OFFSET_AS_ARY: robject_offsets = 16; pub type robject_offsets = u32; |
