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

ruby-changes:51977

From: k0kubun <ko1@a...>
Date: Sun, 5 Aug 2018 14:34:43 +0900 (JST)
Subject: [ruby-changes:51977] k0kubun:r64192 (trunk): mjit.c: link precompiled object

k0kubun	2018-08-05 14:34:37 +0900 (Sun, 05 Aug 2018)

  New Revision: 64192

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

  Log:
    mjit.c: link precompiled object
    
    This is needed to resolve:
    "error LNK2011: precompiled object not linked in; image may not run"
    
    win32/Makefile.sub: Use the same flags as ones for precompiled header.
    
    This is needed to resolve:
    "error C2855: command-line option '/Z7' inconsistent with precompiled header"

  Modified files:
    trunk/mjit.c
    trunk/win32/Makefile.sub
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 64191)
+++ win32/Makefile.sub	(revision 64192)
@@ -316,9 +316,13 @@ MJIT_PRECOMPILED_HEADER = $(MJIT_HEADER_ https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L316
 MJIT_CC = $(CC)
 !endif
 !ifndef MJIT_OPTFLAGS
-MJIT_OPTFLAGS = $(OPTFLAGS)
+# Short-term TODO: Include `$(XCFLAGS) $(CPPFLAGS)` to suppress warning. Currently adding them breakes JIT.
+# Long-term  TODO: Use only $(OPTFLAGS) for performance. It requires to modify flags for precompiled header too.
+# Using flags used for building precompiled header to make JIT succeed.
+MJIT_OPTFLAGS = -DMJIT_HEADER $(CFLAGS)
 !endif
 !ifndef MJIT_DEBUGFLAGS
+# TODO: Make this work... Another header for debug build needs to be installed first.
 MJIT_DEBUGFLAGS = $(DEBUGFLAGS)
 !endif
 !ifndef MJIT_LDSHARED
Index: mjit.c
===================================================================
--- mjit.c	(revision 64191)
+++ mjit.c	(revision 64192)
@@ -732,7 +732,7 @@ static int https://github.com/ruby/ruby/blob/trunk/mjit.c#L732
 compile_c_to_so(const char *c_file, const char *so_file)
 {
     int exit_code;
-    const char *files[] = { NULL, NULL, NULL, "-link", libruby_pathflag, NULL };
+    const char *files[] = { NULL, NULL, NULL, NULL, "-link", libruby_pathflag, NULL };
     char **args;
     char *p;
 
@@ -748,7 +748,13 @@ compile_c_to_so(const char *c_file, cons https://github.com/ruby/ruby/blob/trunk/mjit.c#L748
     p = append_str2(p, pch_file, strlen(pch_file));
     *p = '\0';
 
-    files[2] = c_file;
+    /* files[2] = "C:/.../rb_mjit_header-*.obj" */
+    files[2] = p = (char *)alloca(sizeof(char) * (strlen(pch_file) + 1));
+    p = append_str2(p, pch_file, strlen(pch_file) - strlen(".pch"));
+    p = append_lit(p, ".obj");
+    *p = '\0';
+
+    files[3] = c_file;
     args = form_args(5, CC_LDSHARED_ARGS, CC_CODEFLAG_ARGS,
                      files, CC_LIBS, CC_DLDFLAGS_ARGS);
     if (args == NULL)
@@ -1801,7 +1807,7 @@ mjit_finish(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1807
         return;
 
     /* Wait for pch finish */
-    verbose(2, "Canceling pch and worker threads");
+    verbose(2, "Canceling worker thread");
     CRITICAL_SECTION_START(3, "in mjit_finish to wakeup from pch");
     /* As our threads are detached, we could just cancel them.  But it
        is a bad idea because OS processes (C compiler) started by

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

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