summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac14
-rw-r--r--mjit.c18
-rw-r--r--mjit_worker.c55
3 files changed, 11 insertions, 76 deletions
diff --git a/configure.ac b/configure.ac
index aef679296d..50ccc76504 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3702,12 +3702,12 @@ AS_CASE(["$RDOCTARGET:$CAPITARGET"],[nodoc:nodoc],[INSTALLDOC=nodoc],[INSTALLDOC
AC_SUBST(INSTALLDOC)
AC_ARG_ENABLE(jit-support,
- AS_HELP_STRING([--disable-jit-support], [disable JIT features]),
- [MJIT_SUPPORT=$enableval],
- # Enable mjit by default except for WASI
- [AS_IF([test x"$target_os" != "xwasi"],
- [MJIT_SUPPORT=yes],
- [MJIT_SUPPORT=no ])])
+ AS_HELP_STRING([--disable-jit-support], [disable JIT features]),
+ [MJIT_SUPPORT=$enableval],
+ [AS_CASE(["$target_os"],
+ [wasi | mingw*], [MJIT_SUPPORT=no],
+ [MJIT_SUPPORT=yes]
+ )])
AS_IF([test x"$MJIT_SUPPORT" = "xyes"],
[AC_DEFINE(USE_MJIT, 1)],
@@ -4413,7 +4413,7 @@ config_summary "debugflags" "$debugflags"
config_summary "warnflags" "$warnflags"
config_summary "strip command" "$STRIP"
config_summary "install doc" "$DOCTARGETS"
-config_summary "JIT support" "$MJIT_SUPPORT"
+config_summary "MJIT support" "$MJIT_SUPPORT"
config_summary "YJIT support" "$YJIT_SUPPORT"
config_summary "man page type" "$MANTYPE"
config_summary "search path" "$search_path"
diff --git a/mjit.c b/mjit.c
index 414088e9e4..b36331e72e 100644
--- a/mjit.c
+++ b/mjit.c
@@ -879,20 +879,6 @@ mjit_resume(void)
return Qtrue;
}
-// Skip calling `clean_temp_files` for units which currently exist in the list.
-static void
-skip_cleaning_object_files(struct rb_mjit_unit_list *list)
-{
- struct rb_mjit_unit *unit = NULL, *next;
-
- // No mutex for list, assuming MJIT worker does not exist yet since it's immediately after fork.
- ccan_list_for_each_safe(&list->head, unit, next, unode) {
-#if defined(_WIN32) // mswin doesn't reach here either. This is for MinGW.
- if (unit->so_file) unit->so_file = NULL;
-#endif
- }
-}
-
// This is called after fork initiated by Ruby's method to launch MJIT worker thread
// for child Ruby process.
//
@@ -914,10 +900,6 @@ mjit_child_after_fork(void)
if (!mjit_enabled)
return;
- /* Let parent process delete the already-compiled object files.
- This must be done before starting MJIT worker on child process. */
- skip_cleaning_object_files(&active_units);
-
/* MJIT worker thread is not inherited on fork. Start it for this child process. */
start_worker();
}
diff --git a/mjit_worker.c b/mjit_worker.c
index 3f482db006..1d0150a2c8 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -242,7 +242,7 @@ static bool stop_worker_p;
// Set to true if worker is stopped.
static bool worker_stopped = true;
-// Path of "/tmp", which can be changed to $TMP in MinGW.
+// Path of "/tmp", which is different on Windows or macOS. See: system_default_tmpdir()
static char *tmp_dir;
// Used C compiler path.
@@ -281,7 +281,7 @@ static char *libruby_pathflag;
# define MJIT_CFLAGS_PIPE 0
#endif
-// Use `-nodefaultlibs -nostdlib` for GCC where possible, which does not work on mingw, cygwin, AIX, and OpenBSD.
+// Use `-nodefaultlibs -nostdlib` for GCC where possible, which does not work on cygwin, AIX, and OpenBSD.
// This seems to improve MJIT performance on GCC.
#if defined __GNUC__ && !defined __clang__ && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(_AIX) && !defined(__OpenBSD__)
# define GCC_NOSTDLIB_FLAGS "-nodefaultlibs", "-nostdlib",
@@ -309,13 +309,10 @@ static const char *const CC_LINKER_ARGS[] = {
static const char *const CC_LIBS[] = {
#if defined(_WIN32) || defined(__CYGWIN__)
- MJIT_LIBS // mswin, mingw, cygwin
+ MJIT_LIBS // mswin, cygwin
#endif
#if defined __GNUC__ && !defined __clang__
-# if defined(_WIN32)
- "-lmsvcrt", // mingw
-# endif
- "-lgcc", // mingw, cygwin, and GCC platforms using `-nodefaultlibs -nostdlib`
+ "-lgcc", // cygwin, and GCC platforms using `-nodefaultlibs -nostdlib`
#endif
#if defined __ANDROID__
"-lm", // to avoid 'cannot locate symbol "modf" referenced by .../_ruby_mjit_XXX.so"'
@@ -907,49 +904,6 @@ make_pch(void)
}
// Compile .c file to .so file. It returns true if it succeeds. (non-mswin)
-// MinGW compiles it in two steps because otherwise it fails without any error output.
-# ifdef _WIN32 // MinGW
-static bool
-compile_c_to_so(const char *c_file, const char *so_file)
-{
- char* o_file = alloca(strlen(c_file) + 1);
- strcpy(o_file, c_file);
- o_file[strlen(c_file) - 1] = 'o';
-
- const char *o_args[] = {
- "-o", o_file, c_file,
-# ifdef __clang__
- "-include-pch", pch_file,
-# endif
- "-c", NULL
- };
- char **args = form_args(5, cc_common_args, CC_CODEFLAG_ARGS, cc_added_args, o_args, CC_LINKER_ARGS);
- if (args == NULL) return false;
- int exit_code = exec_process(cc_path, args);
- free(args);
- if (exit_code != 0) {
- verbose(2, "compile_c_to_so: failed to compile .c to .o: %d", exit_code);
- return false;
- }
-
- const char *so_args[] = {
- "-o", so_file,
-# ifdef _WIN32
- libruby_pathflag,
-# endif
- o_file, NULL
- };
- args = form_args(6, CC_LDSHARED_ARGS, CC_CODEFLAG_ARGS, so_args, CC_LIBS, CC_DLDFLAGS_ARGS, CC_LINKER_ARGS);
- if (args == NULL) return false;
- exit_code = exec_process(cc_path, args);
- free(args);
- if (!mjit_opts.save_temps) remove_file(o_file);
- if (exit_code != 0) {
- verbose(2, "compile_c_to_so: failed to link .o to .so: %d", exit_code);
- }
- return exit_code == 0;
-}
-# else // _WIN32
static bool
compile_c_to_so(const char *c_file, const char *so_file)
{
@@ -973,7 +927,6 @@ compile_c_to_so(const char *c_file, const char *so_file)
}
return exit_code == 0;
}
-# endif // _WIN32
#endif // _MSC_VER
#if USE_JIT_COMPACTION