ruby-changes:60964
From: Takashi <ko1@a...>
Date: Fri, 1 May 2020 17:58:50 +0900 (JST)
Subject: [ruby-changes:60964] 72aa4dd183 (master): c_file_access_mode should be defined for Windows
https://git.ruby-lang.org/ruby.git/commit/?id=72aa4dd183 From 72aa4dd183921aaf7405d8611af4ca5613bfaf4d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 1 May 2020 01:56:04 -0700 Subject: c_file_access_mode should be defined for Windows as well. And also unit->c_file doesn't exist in mswin. https://github.com/ruby/ruby/runs/635915704 diff --git a/mjit_worker.c b/mjit_worker.c index b64c769..5a108c7 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -725,6 +725,12 @@ sprint_funcname(char *funcname, const struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L725 } } +static const int c_file_access_mode = +#ifdef O_BINARY + O_BINARY| +#endif + O_WRONLY|O_EXCL|O_CREAT; + #define append_str2(p, str, len) ((char *)memcpy((p), str, (len))+(len)) #define append_str(p, str) append_str2(p, str, sizeof(str)-1) #define append_lit(p, str) append_str2(p, str, rb_strlen_lit(str)) @@ -874,12 +880,6 @@ compile_c_to_so(const char *c_file, const char *so_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L880 static void compile_prelude(FILE *f); -static const int c_file_access_mode = -#ifdef O_BINARY - O_BINARY| -#endif - O_WRONLY|O_EXCL|O_CREAT; - static bool compile_compact_jit_code(char* c_file) { @@ -1145,7 +1145,10 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1145 start_time = real_ms_time(); success = compile_c_to_so(c_file, so_file); -#ifndef _MSC_VER +#ifdef _MSC_VER + if (!mjit_opts.save_temps) + remove_file(c_file); +#else if (success) { // Always set c_file for compaction. The value is also used for lazy deletion. unit->c_file = strdup(c_file); @@ -1153,9 +1156,9 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1156 mjit_warning("failed to allocate memory to remember '%s' (%s), removing it...", c_file, strerror(errno)); } } -#endif if (!mjit_opts.save_temps && unit->c_file == NULL) remove_file(c_file); +#endif end_time = real_ms_time(); if (!success) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/