aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-07 23:44:26 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-07 23:59:50 -0800
commit9ad19069f9d10dcab33bcee8502d587020bad2a4 (patch)
tree9d8d1286f69ba1bf38f65b822dc931ed8cac48a4
parent4bf037bebdc37671ca292dc8f500e1bede077163 (diff)
downloadruby-9ad19069f9d10dcab33bcee8502d587020bad2a4.tar.gz
Remove obsoleted functions in rjit.c
-rw-r--r--eval.c2
-rw-r--r--iseq.c2
-rw-r--r--process.c7
-rw-r--r--rjit.c96
-rw-r--r--rjit.h25
-rw-r--r--rjit.rb6
-rw-r--r--rjit_c.rb11
-rw-r--r--thread.c3
8 files changed, 13 insertions, 139 deletions
diff --git a/eval.c b/eval.c
index 26dc5ec06b..adacde9e2f 100644
--- a/eval.c
+++ b/eval.c
@@ -257,8 +257,6 @@ rb_ec_cleanup(rb_execution_context_t *ec, enum ruby_tag_type ex)
}
}
- rjit_finish(true); // We still need ISeqs here, so it's before rb_ec_finalize().
-
rb_ec_finalize(ec);
/* unlock again if finalizer took mutexes. */
diff --git a/iseq.c b/iseq.c
index f6bc4202ec..2e072f9ac2 100644
--- a/iseq.c
+++ b/iseq.c
@@ -164,7 +164,7 @@ rb_iseq_free(const rb_iseq_t *iseq)
if (iseq && ISEQ_BODY(iseq)) {
iseq_clear_ic_references(iseq);
struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
- rjit_free_iseq(iseq); /* Notify RJIT */
+ rb_rjit_free_iseq(iseq); /* Notify RJIT */
#if USE_YJIT
rb_yjit_iseq_free(body->yjit_payload);
#endif
diff --git a/process.c b/process.c
index 4bcbb2705c..37ef23204b 100644
--- a/process.c
+++ b/process.c
@@ -3049,7 +3049,6 @@ rb_f_exec(int argc, const VALUE *argv)
execarg_obj = rb_execarg_new(argc, argv, TRUE, FALSE);
eargp = rb_execarg_get(execarg_obj);
- if (rjit_enabled) rjit_finish(false); // avoid leaking resources, and do not leave files. XXX: JIT-ed handle can leak after exec error is rescued.
before_exec(); /* stop timer thread before redirects */
rb_protect(rb_execarg_parent_start1, execarg_obj, &state);
@@ -4244,7 +4243,6 @@ rb_fork_ruby2(struct rb_process_status *status)
while (1) {
prefork();
- if (rjit_enabled) rjit_pause(false); // Don't leave locked mutex to child. Note: child_handler must be enabled to pause RJIT.
disable_child_handler_before_fork(&old);
before_fork_ruby();
pid = rb_fork();
@@ -4256,8 +4254,6 @@ rb_fork_ruby2(struct rb_process_status *status)
after_fork_ruby();
disable_child_handler_fork_parent(&old); /* yes, bad name */
- if (rjit_enabled && pid > 0) rjit_resume(); /* child (pid == 0) is cared by rb_thread_atfork */
-
if (pid >= 0) { /* fork succeed */
if (pid == 0) rb_thread_atfork();
return pid;
@@ -7035,11 +7031,10 @@ rb_daemon(int nochdir, int noclose)
{
int err = 0;
#ifdef HAVE_DAEMON
- if (rjit_enabled) rjit_pause(false); // Don't leave locked mutex to child.
before_fork_ruby();
err = daemon(nochdir, noclose);
after_fork_ruby();
- rb_thread_atfork(); /* calls rjit_resume() */
+ rb_thread_atfork();
#else
int n;
diff --git a/rjit.c b/rjit.c
index 1997db76ba..6ea880f7f4 100644
--- a/rjit.c
+++ b/rjit.c
@@ -99,15 +99,8 @@ verbose(int level, const char *format, ...)
}
}
-int
-rjit_capture_cc_entries(const struct rb_iseq_constant_body *compiled_iseq, const struct rb_iseq_constant_body *captured_iseq)
-{
- // TODO: remove this
- return 0;
-}
-
void
-rjit_cancel_all(const char *reason)
+rb_rjit_cancel_all(const char *reason)
{
if (!rjit_enabled)
return;
@@ -120,15 +113,9 @@ rjit_cancel_all(const char *reason)
}
void
-rjit_free_iseq(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
-void
-rjit_notify_waitpid(int exit_code)
+rb_rjit_free_iseq(const rb_iseq_t *iseq)
{
- // TODO: remove this function
+ // TODO: implement this. GC_REFS should remove this iseq's mjit_blocks
}
// RubyVM::RJIT
@@ -144,49 +131,6 @@ static VALUE rb_cRJITCfpPtr = 0;
// RubyVM::RJIT::Hooks
static VALUE rb_mRJITHooks = 0;
-void
-rb_rjit_add_iseq_to_process(const rb_iseq_t *iseq)
-{
- // TODO: implement
-}
-
-struct rb_rjit_compile_info*
-rb_rjit_iseq_compile_info(const struct rb_iseq_constant_body *body)
-{
- // TODO: remove this
- return NULL;
-}
-
-void
-rb_rjit_recompile_send(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
-void
-rb_rjit_recompile_ivar(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
-void
-rb_rjit_recompile_exivar(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
-void
-rb_rjit_recompile_inlining(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
-void
-rb_rjit_recompile_const(const rb_iseq_t *iseq)
-{
- // TODO: remove this
-}
-
// Default permitted number of units with a JIT code kept in memory.
#define DEFAULT_MAX_CACHE_SIZE 100
// A default threshold used to add iseq to JIT.
@@ -236,34 +180,6 @@ const struct ruby_opt_message rjit_option_messages[] = {
};
#undef M
-VALUE
-rjit_pause(bool wait_p)
-{
- // TODO: remove this
- return Qtrue;
-}
-
-VALUE
-rjit_resume(void)
-{
- // TODO: remove this
- return Qnil;
-}
-
-void
-rjit_child_after_fork(void)
-{
- // TODO: remove this
-}
-
-// Compile ISeq to C code in `f`. It returns true if it succeeds to compile.
-bool
-rjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id)
-{
- // TODO: implement
- return false;
-}
-
//================================================================================
//
// New stuff from here
@@ -621,12 +537,6 @@ rjit_init(const struct rjit_options *opts)
#endif
}
-void
-rjit_finish(bool close_handle_p)
-{
- // TODO: implement
-}
-
// Same as `RubyVM::RJIT::C.enabled?`, but this is used before rjit_init.
static VALUE
rjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self)
diff --git a/rjit.h b/rjit.h
index 4f61927760..2f4883eb2e 100644
--- a/rjit.h
+++ b/rjit.h
@@ -93,18 +93,11 @@ RUBY_EXTERN bool rjit_call_p;
#define rb_rjit_call_threshold() rjit_opts.call_threshold
extern void rb_rjit_compile(const rb_iseq_t *iseq);
-extern struct rb_rjit_compile_info* rb_rjit_iseq_compile_info(const struct rb_iseq_constant_body *body);
-extern void rb_rjit_recompile_send(const rb_iseq_t *iseq);
-extern void rb_rjit_recompile_ivar(const rb_iseq_t *iseq);
-extern void rb_rjit_recompile_exivar(const rb_iseq_t *iseq);
-extern void rb_rjit_recompile_inlining(const rb_iseq_t *iseq);
-extern void rb_rjit_recompile_const(const rb_iseq_t *iseq);
RUBY_SYMBOL_EXPORT_END
-extern void rjit_cancel_all(const char *reason);
-extern bool rjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id);
+extern void rb_rjit_cancel_all(const char *reason);
extern void rjit_init(const struct rjit_options *opts);
-extern void rjit_free_iseq(const rb_iseq_t *iseq);
+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 rjit_mark(void);
extern void rb_rjit_iseq_mark(VALUE rjit_blocks);
@@ -117,8 +110,6 @@ extern void rb_rjit_constant_state_changed(ID id);
extern void rb_rjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic, unsigned insn_idx);
extern void rb_rjit_tracing_invalidate_all(rb_event_flag_t new_iseq_events);
-void rjit_child_after_fork(void);
-
extern void rb_rjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
extern void rb_rjit_before_ractor_spawn(void);
extern void rb_rjit_tracing_invalidate_all(rb_event_flag_t new_iseq_events);
@@ -126,18 +117,14 @@ extern void rb_rjit_collect_vm_usage_insn(int insn);
extern bool rjit_enabled;
extern bool rjit_stats_enabled;
-VALUE rjit_pause(bool wait_p);
-VALUE rjit_resume(void);
-void rjit_finish(bool close_handle_p);
# else // USE_RJIT
static inline void rb_rjit_compile(const rb_iseq_t *iseq){}
-static inline void rjit_cancel_all(const char *reason){}
-static inline void rjit_free_iseq(const rb_iseq_t *iseq){}
+static inline void rb_rjit_cancel_all(const char *reason){}
+static inline void rb_rjit_free_iseq(const rb_iseq_t *iseq){}
static inline void rjit_mark(void){}
-static inline void rjit_child_after_fork(void){}
static inline void rb_rjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
static inline void rb_rjit_cme_invalidate(rb_callable_method_entry_t *cme) {}
@@ -152,10 +139,6 @@ static inline void rb_rjit_tracing_invalidate_all(rb_event_flag_t new_iseq_event
#define rb_rjit_call_threshold() UINT_MAX
-static inline VALUE rjit_pause(bool wait_p){ return Qnil; } // unreachable
-static inline VALUE rjit_resume(void){ return Qnil; } // unreachable
-static inline void rjit_finish(bool close_handle_p){}
-
static inline void rb_rjit_collect_vm_usage_insn(int insn) {}
# endif // USE_RJIT
diff --git a/rjit.rb b/rjit.rb
index 26f008915b..f4bbd76490 100644
--- a/rjit.rb
+++ b/rjit.rb
@@ -5,13 +5,13 @@ module RubyVM::RJIT
end
# Stop generating JITed code.
- def self.pause(wait: true)
- Primitive.cexpr! 'rjit_pause(RTEST(wait))'
+ def self.pause
+ # TODO: implement this
end
# Start generating JITed code again after pause.
def self.resume
- Primitive.cexpr! 'rjit_resume()'
+ # TODO: implement this
end
if Primitive.rjit_stats_enabled_p
diff --git a/rjit_c.rb b/rjit_c.rb
index 7236a2d844..a6fe74db2d 100644
--- a/rjit_c.rb
+++ b/rjit_c.rb
@@ -515,18 +515,9 @@ module RubyVM::RJIT # :nodoc: all
rjit_options.new(addr)
end
- def rjit_capture_cc_entries(compiled_body, captured_body)
- _compiled_body_addr = compiled_body.to_i
- _captured_body_addr = captured_body.to_i
- Primitive.cstmt! %{
- extern int rjit_capture_cc_entries(const struct rb_iseq_constant_body *compiled_iseq, const struct rb_iseq_constant_body *captured_iseq);
- return INT2NUM(rjit_capture_cc_entries((struct rb_iseq_constant_body *)NUM2PTR(_compiled_body_addr), (struct rb_iseq_constant_body *)NUM2PTR(_captured_body_addr)));
- }
- end
-
def rjit_cancel_all(reason)
Primitive.cstmt! %{
- rjit_cancel_all(RSTRING_PTR(reason));
+ rb_rjit_cancel_all(RSTRING_PTR(reason));
return Qnil;
}
end
diff --git a/thread.c b/thread.c
index 4e033b7e09..b82e9a6578 100644
--- a/thread.c
+++ b/thread.c
@@ -4642,9 +4642,6 @@ rb_thread_atfork(void)
/* We don't want reproduce CVE-2003-0900. */
rb_reset_random_seed();
-
- /* For child, starting RJIT worker thread in this place which is safer than immediately after `after_fork_ruby`. */
- rjit_child_after_fork();
}
static void