RJIT: Prefix rjit_options with rb_
This commit is contained in:
parent
4e440d6990
commit
d189f8d870
@ -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;
|
||||
|
6
rjit.c
6
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);
|
||||
|
||||
|
6
rjit.h
6
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);
|
||||
|
28
rjit_c.rb
28
rjit_c.rb
@ -251,7 +251,7 @@ module RubyVM::RJIT # :nodoc: all
|
||||
|
||||
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 @@ module RubyVM::RJIT # :nodoc: all
|
||||
)
|
||||
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 @@ module RubyVM::RJIT # :nodoc: all
|
||||
)
|
||||
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
|
||||
|
2
ruby.c
2
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
|
||||
|
@ -588,7 +588,7 @@ generator = BindingGenerator.new(
|
||||
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[
|
||||
|
Loading…
x
Reference in New Issue
Block a user