From 72aa4dd183921aaf7405d8611af4ca5613bfaf4d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun 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 --- mjit_worker.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'mjit_worker.c') diff --git a/mjit_worker.c b/mjit_worker.c index b64c769ef2..5a108c7118 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -725,6 +725,12 @@ sprint_funcname(char *funcname, const struct rb_mjit_unit *unit) } } +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) 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) 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) 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 v1.2.3