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

ruby-changes:63673

From: Takashi <ko1@a...>
Date: Sat, 21 Nov 2020 16:49:19 +0900 (JST)
Subject: [ruby-changes:63673] 8750d001c2 (master): Fix wrong #ifdef usages with #if

https://git.ruby-lang.org/ruby.git/commit/?id=8750d001c2

From 8750d001c2d02894d0014c1f61009e2bccb8d428 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Fri, 20 Nov 2020 23:48:39 -0800
Subject: Fix wrong #ifdef usages with #if

Apparently #ifdef is always true

diff --git a/mjit.c b/mjit.c
index 3da9d95..cc6e3da 100644
--- a/mjit.c
+++ b/mjit.c
@@ -887,7 +887,7 @@ skip_cleaning_object_files(struct rb_mjit_unit_list *list) https://github.com/ruby/ruby/blob/trunk/mjit.c#L887
 
     // No mutex for list, assuming MJIT worker does not exist yet since it's immediately after fork.
     list_for_each_safe(&list->head, unit, next, unode) {
-#ifdef USE_JIT_COMPACTION
+#if USE_JIT_COMPACTION
         if (unit->c_file) unit->c_file_inherited_p = true;
 #endif
 
diff --git a/mjit_worker.c b/mjit_worker.c
index 887a68e..2a3cf97 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -140,10 +140,10 @@ typedef intptr_t pid_t; https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L140
 // JIT compaction requires the header transformation because linking multiple .o files
 // doesn't work without having `static` in the same function definitions. We currently
 // don't support transforming the MJIT header on Windows.
-#ifndef _WIN32
-# define USE_JIT_COMPACTION 1
-#else
+#ifdef _WIN32
 # define USE_JIT_COMPACTION 0
+#else
+# define USE_JIT_COMPACTION 1
 #endif
 
 // The unit structure that holds metadata of ISeq for MJIT.
@@ -153,7 +153,7 @@ struct rb_mjit_unit { https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L153
     // Dlopen handle of the loaded object file.
     void *handle;
     rb_iseq_t *iseq;
-#ifdef USE_JIT_COMPACTION
+#if USE_JIT_COMPACTION
     // This value is always set for `compact_all_jit_code`. Also used for lazy deletion.
     char *c_file;
     // true if it's inherited from parent Ruby process and lazy deletion should be skipped.
@@ -401,7 +401,7 @@ remove_file(const char *filename) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L401
 static void
 clean_temp_files(struct rb_mjit_unit *unit)
 {
-#ifdef USE_JIT_COMPACTION
+#if USE_JIT_COMPACTION
     if (unit->c_file) {
         char *c_file = unit->c_file;
 
@@ -1172,7 +1172,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1172
 
     start_time = real_ms_time();
     success = compile_c_to_so(c_file, so_file);
-#ifdef USE_JIT_COMPACTION
+#if USE_JIT_COMPACTION
     if (success) {
         // Always set c_file for compaction. The value is also used for lazy deletion.
         unit->c_file = strdup(c_file);
@@ -1311,7 +1311,7 @@ mjit_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1311
             }
             CRITICAL_SECTION_FINISH(3, "in jit func replace");
 
-#ifdef USE_JIT_COMPACTION
+#if USE_JIT_COMPACTION
             // Combine .o files to one .so and reload all jit_func to improve memory locality.
             if (compact_units.length < max_compact_size
                 && ((!mjit_opts.wait && unit_queue.length == 0 && active_units.length > 1)
-- 
cgit v0.10.2


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

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