diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-08 15:00:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-08 15:00:28 +0000 |
commit | b2104fa810709b4365a780dc8113010234283f51 (patch) | |
tree | 72bffd1f8a5f51208b7fdde25c31c39a73fa08ea /mjit.c | |
parent | 4f6e16bd8591aa15fafc037eed773228e0b12c43 (diff) | |
download | ruby-b2104fa810709b4365a780dc8113010234283f51.tar.gz |
mjit.c: ruby_version from version.c
* mjit.c (init_header_filename): get version name from the
particular global variable, not from the macro in version.h.
to get rid of re-compilation for each revision.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -76,12 +76,12 @@ #include "internal.h" #include "vm_core.h" #include "mjit.h" -#include "version.h" #include "gc.h" #include "constant.h" #include "id_table.h" #include "ruby_assert.h" #include "ruby/util.h" +#include "ruby/version.h" #ifdef _WIN32 #include <winsock2.h> @@ -1113,7 +1113,7 @@ mjit_get_iseq_func(const struct rb_iseq_constant_body *body) } /* A name of the header file included in any C file generated by MJIT for iseqs. */ -#define RUBY_MJIT_HEADER_FILE "rb_mjit_min_header-" RUBY_VERSION ".h" +#define RUBY_MJIT_HEADER_NAME "rb_mjit_min_header-" /* GCC and CLANG executable paths. TODO: The paths should absolute ones to prevent changing C compiler for security reasons. */ #define GCC_PATH "gcc" @@ -1130,8 +1130,9 @@ init_header_filename(void) VALUE basedir_val; char *basedir; size_t baselen; + size_t verlen; static const char header_name[] = - "/" MJIT_HEADER_INSTALL_DIR "/" RUBY_MJIT_HEADER_FILE; + "/" MJIT_HEADER_INSTALL_DIR "/" RUBY_MJIT_HEADER_NAME; char *p; #ifdef _WIN32 static const char libpathflag[] = @@ -1146,12 +1147,15 @@ init_header_filename(void) basedir_val = rb_const_get(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX")); basedir = StringValuePtr(basedir_val); baselen = RSTRING_LEN(basedir_val); + verlen = strlen(ruby_version); - header_file = xmalloc(baselen + sizeof(header_name)); + header_file = xmalloc(baselen + sizeof(header_name) + verlen + 2); if (header_file == NULL) return; p = append_str2(header_file, basedir, baselen); - p = append_str2(p, header_name, sizeof(header_name)); + p = append_str2(p, header_name, sizeof(header_name)-1); + p = append_str2(p, ruby_version, verlen); + p = append_str2(p, ".h", 3); if ((fd = rb_cloexec_open(header_file, O_RDONLY, 0)) < 0) { xfree(header_file); header_file = NULL; |