[前][次][番号順一覧][スレッド一覧]

ruby-changes:53372

From: nobu <ko1@a...>
Date: Wed, 7 Nov 2018 13:02:18 +0900 (JST)
Subject: [ruby-changes:53372] nobu:r65588 (trunk): ruby-runner.c: enable MJIT_SEARCH_BUILD_DIR

nobu	2018-11-07 13:02:14 +0900 (Wed, 07 Nov 2018)

  New Revision: 65588

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65588

  Log:
    ruby-runner.c: enable MJIT_SEARCH_BUILD_DIR

  Modified files:
    trunk/ruby-runner.c
    trunk/template/ruby-runner.h.in
Index: ruby-runner.c
===================================================================
--- ruby-runner.c	(revision 65587)
+++ ruby-runner.c	(revision 65588)
@@ -3,6 +3,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L3
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "ruby-runner.h"
 
@@ -57,13 +59,19 @@ main(int argc, char **argv) https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L59
 	PATH_SEPARATOR
 	EXTOUT_DIR"/"ARCH
 	;
+    static const char mjit_build_dir[] = BUILDDIR"/mjit_build_dir."SOEXT;
     const size_t dirsize = sizeof(builddir);
     const size_t namesize = sizeof(rubypath) - dirsize;
     const char *rubyname = rubypath + dirsize;
     char *arg0 = argv[0], *p;
+    struct stat stbuf;
 
     insert_env_path(LIBPATHENV, builddir, dirsize, 1);
     insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
+    if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) {
+        insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1);
+        setenv("MJIT_SEARCH_BUILD_DIR", "true", 0);
+    }
 
     if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
     if (strlen(p) < namesize - 1) {
Index: template/ruby-runner.h.in
===================================================================
--- template/ruby-runner.h.in	(revision 65587)
+++ template/ruby-runner.h.in	(revision 65588)
@@ -1,7 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-runner.h.in#L1
 #define ABS_SRCDIR "@abs_srcdir@"
 #define BUILDDIR   "@abs_top_builddir@"
 #define LIBPATHENV "@LIBPATHENV@"
+#define PRELOADENV "@PRELOADENV@"
 #define PATH_SEPARATOR "@PATH_SEPARATOR@"
 #define PATH_SEP   '@PATH_SEPARATOR@'
 #define EXTOUT     "@EXTOUT@"
 #define ARCH       "@arch@"
+#define SOEXT      "@SOEXT@"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]