ruby-changes:72155
From: Takashi <ko1@a...>
Date: Tue, 14 Jun 2022 01:28:46 +0900 (JST)
Subject: [ruby-changes:72155] f8502a2699 (master): Drop MinGW support of MJIT (#6012)
https://git.ruby-lang.org/ruby.git/commit/?id=f8502a2699 From f8502a26990c652a2c3c1131614230fec446ab25 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 13 Jun 2022 09:28:28 -0700 Subject: Drop MinGW support of MJIT (#6012) [Feature #18824] --- configure.ac | 14 +++++++------- mjit.c | 18 ------------------ mjit_worker.c | 55 ++++--------------------------------------------------- 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 https://github.com/ruby/ruby/blob/trunk/configure.ac#L3702 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" https://github.com/ruby/ruby/blob/trunk/configure.ac#L4413 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) https://github.com/ruby/ruby/blob/trunk/mjit.c#L879 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) https://github.com/ruby/ruby/blob/trunk/mjit.c#L900 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; https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L242 // 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; https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L281 # 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[] = { https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L309 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) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L904 } // 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) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L927 } return exit_code == 0; } -# endif // _WIN32 #endif // _MSC_VER #if USE_JIT_COMPACTION -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/