diff --git a/internal/cmdlineopt.h b/internal/cmdlineopt.h index 914bb776612556..483a5d4f75fde2 100644 --- a/internal/cmdlineopt.h +++ b/internal/cmdlineopt.h @@ -24,7 +24,7 @@ typedef struct ruby_cmdline_options { ruby_features_t warn; unsigned int dump; #if USE_RJIT - struct rjit_options rjit; + struct rb_rjit_options rjit; #endif int sflag, xflag; diff --git a/rjit.c b/rjit.c index 3137ba00957dce..b9f11a08007547 100644 --- a/rjit.c +++ b/rjit.c @@ -63,7 +63,7 @@ // A copy of RJIT portion of MRI options since RJIT initialization. We // need them as RJIT threads still can work when the most MRI data were // freed. -struct rjit_options rb_rjit_opts; +struct rb_rjit_options rb_rjit_opts; // true if RJIT is enabled. bool rb_rjit_enabled = false; @@ -112,7 +112,7 @@ VALUE rb_rjit_line_samples = 0; opt_match(s, l, name) && (*(s) ? 1 : (rb_raise(rb_eRuntimeError, "--rjit-" name " needs an argument"), 0)) void -rb_rjit_setup_options(const char *s, struct rjit_options *rjit_opt) +rb_rjit_setup_options(const char *s, struct rb_rjit_options *rjit_opt) { const size_t l = strlen(s); if (l == 0) { @@ -384,7 +384,7 @@ rb_rjit_branch_stub_hit(VALUE branch_stub, int sp_offset, int target0_p) } void -rb_rjit_init(const struct rjit_options *opts) +rb_rjit_init(const struct rb_rjit_options *opts) { VM_ASSERT(rb_rjit_enabled); diff --git a/rjit.h b/rjit.h index 0b92b5293f170a..aeb0a933df4fbe 100644 --- a/rjit.h +++ b/rjit.h @@ -22,7 +22,7 @@ #include "vm_core.h" // RJIT options which can be defined on the MRI command line. -struct rjit_options { +struct rb_rjit_options { // Converted from "rjit" feature flag to tell the enablement // information to ruby_show_version(). bool on; @@ -41,7 +41,7 @@ struct rjit_options { }; RUBY_SYMBOL_EXPORT_BEGIN -RUBY_EXTERN struct rjit_options rb_rjit_opts; +RUBY_EXTERN struct rb_rjit_options rb_rjit_opts; RUBY_EXTERN bool rb_rjit_call_p; #define rb_rjit_call_threshold() rb_rjit_opts.call_threshold @@ -50,7 +50,7 @@ extern void rb_rjit_compile(const rb_iseq_t *iseq); RUBY_SYMBOL_EXPORT_END extern void rb_rjit_cancel_all(const char *reason); -extern void rb_rjit_init(const struct rjit_options *opts); +extern void rb_rjit_init(const struct rb_rjit_options *opts); extern void rb_rjit_free_iseq(const rb_iseq_t *iseq); extern void rb_rjit_iseq_update_references(struct rb_iseq_constant_body *const body); extern void rb_rjit_mark(void); diff --git a/rjit_c.rb b/rjit_c.rb index cc0b8b8541714c..d2e342a24efcfe 100644 --- a/rjit_c.rb +++ b/rjit_c.rb @@ -251,7 +251,7 @@ def vm_ci_mid(ci) def rjit_opts addr = Primitive.cexpr! 'SIZET2NUM((VALUE)&rb_rjit_opts)' - rjit_options.new(addr) + rb_rjit_options.new(addr) end def rjit_cancel_all(reason) @@ -1139,6 +1139,19 @@ def C.rb_proc_t ) end + def C.rb_rjit_options + @rb_rjit_options ||= CType::Struct.new( + "rb_rjit_options", Primitive.cexpr!("SIZEOF(struct rb_rjit_options)"), + on: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), on)")], + call_threshold: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), call_threshold)")], + exec_mem_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), exec_mem_size)")], + stats: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), stats)")], + trace_exits: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), trace_exits)")], + dump_disasm: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), dump_disasm)")], + pause: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), pause)")], + ) + end + def C.rb_rjit_runtime_counters @rb_rjit_runtime_counters ||= CType::Struct.new( "rb_rjit_runtime_counters", Primitive.cexpr!("SIZEOF(struct rb_rjit_runtime_counters)"), @@ -1301,19 +1314,6 @@ def C.rb_thread_struct ) end - def C.rjit_options - @rjit_options ||= CType::Struct.new( - "rjit_options", Primitive.cexpr!("SIZEOF(struct rjit_options)"), - on: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), on)")], - call_threshold: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), call_threshold)")], - exec_mem_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), exec_mem_size)")], - stats: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), stats)")], - trace_exits: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), trace_exits)")], - dump_disasm: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), dump_disasm)")], - pause: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rjit_options *)NULL)), pause)")], - ) - end - def C.VALUE @VALUE ||= CType::Immediate.find(Primitive.cexpr!("SIZEOF(VALUE)"), Primitive.cexpr!("SIGNED_TYPE_P(VALUE)")) end diff --git a/ruby.c b/ruby.c index f307a2b5a0f2cd..19c38966dfb6a3 100644 --- a/ruby.c +++ b/ruby.c @@ -1494,7 +1494,7 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) } else if (is_option_with_optarg("rjit", '-', true, false, false)) { #if USE_RJIT - extern void rb_rjit_setup_options(const char *s, struct rjit_options *rjit_opt); + extern void rb_rjit_setup_options(const char *s, struct rb_rjit_options *rjit_opt); FEATURE_SET(opt->features, FEATURE_BIT(rjit)); rb_rjit_setup_options(s, &opt->rjit); #else diff --git a/tool/rjit/bindgen.rb b/tool/rjit/bindgen.rb index 17d078377a583f..52d338e1a9a107 100755 --- a/tool/rjit/bindgen.rb +++ b/tool/rjit/bindgen.rb @@ -588,7 +588,7 @@ def push_target(target) rb_thread_struct rb_jit_func_t rb_iseq_param_keyword - rjit_options + rb_rjit_options ], # #ifdef-dependent immediate types, which need Primitive.cexpr! for type detection dynamic_types: %w[