Skip to content

Commit

Permalink
RJIT: Rename pause/resume to disable/enable
Browse files Browse the repository at this point in the history
like YJIT. They don't work in the same way yet, but it's nice to make
the naming consistent first so that we will not need to rename them
later.
  • Loading branch information
k0kubun committed Dec 21, 2023
1 parent 69bed94 commit c73959c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions rjit.c
Expand Up @@ -139,9 +139,8 @@ rb_rjit_setup_options(const char *s, struct rb_rjit_options *rjit_opt)
else if (opt_match_noarg(s, l, "verify-ctx")) {
rjit_opt->verify_ctx = true;
}
// --rjit=pause is an undocumented feature for experiments
else if (opt_match_noarg(s, l, "pause")) {
rjit_opt->pause = true;
else if (opt_match_noarg(s, l, "disable")) {
rjit_opt->disable = true;
}
else {
rb_raise(rb_eRuntimeError,
Expand Down Expand Up @@ -437,7 +436,7 @@ rb_rjit_init(const struct rb_rjit_options *opts)
}

// Enable RJIT and stats from here
rb_rjit_call_p = !rb_rjit_opts.pause;
rb_rjit_call_p = !rb_rjit_opts.disable;
rjit_stats_p = rb_rjit_opts.stats;
}

Expand Down
2 changes: 1 addition & 1 deletion rjit.h
Expand Up @@ -35,7 +35,7 @@ struct rb_rjit_options {
// Verify context objects
bool verify_ctx;
// [experimental] Do not start RJIT until RJIT.resume is called.
bool pause;
bool disable;
};

RUBY_SYMBOL_EXPORT_BEGIN
Expand Down
4 changes: 2 additions & 2 deletions rjit.rb
Expand Up @@ -4,8 +4,8 @@ def self.enabled?
Primitive.cexpr! 'RBOOL(rb_rjit_enabled)'
end

# Start generating JITed code again after --rjit-pause.
def self.resume
# Start generating JITed code again after --rjit-disable.
def self.enable
Primitive.cstmt! %{
rb_rjit_call_p = true;
return Qnil;
Expand Down
2 changes: 1 addition & 1 deletion rjit_c.rb
Expand Up @@ -1332,7 +1332,7 @@ def C.rb_rjit_options
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)")],
verify_ctx: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), verify_ctx)")],
pause: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), pause)")],
disable: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_options *)NULL)), disable)")],
)
end

Expand Down

0 comments on commit c73959c

Please sign in to comment.