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

ruby-changes:69232

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:24:17 +0900 (JST)
Subject: [ruby-changes:69232] bc7652998e (master): Fix warnings about redefining YJIT_STATS

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

From bc7652998eb0f05379ba4247ab5202dc853496fa Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Tue, 14 Sep 2021 15:13:15 -0400
Subject: Fix warnings about redefining YJIT_STATS

Follow up for ecb5b383a0c17550b9b27663005049ddac871edb. Now that
YJIT_STATS is defined in yjit.h, it shoudl be the only place that
defines it.
---
 yjit_codegen.c |  8 ++------
 yjit_iface.c   |  7 +------
 yjit_iface.h   | 14 +++++---------
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index e9f6e996f9..be0c7ca255 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -203,8 +203,7 @@ record_global_inval_patch(const codeblock_t *cb, uint32_t outline_block_target_p https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L203
 
 static bool jit_guard_known_klass(jitstate_t *jit, ctx_t* ctx, VALUE known_klass, insn_opnd_t insn_opnd, VALUE sample_instance, const int max_chain_depth, uint8_t *side_exit);
 
-#if RUBY_DEBUG
-# define YJIT_STATS 1
+#if YJIT_STATS
 
 // Add a comment at the current position in the code block
 static void
@@ -290,14 +289,11 @@ verify_ctx(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L289
 }
 
 #else
-#ifndef YJIT_STATS
-#define YJIT_STATS 0
-#endif // ifndef YJIT_STATS
 
 #define ADD_COMMENT(cb, comment) ((void)0)
 #define verify_ctx(jit, ctx) ((void)0)
 
-#endif // if RUBY_DEBUG
+#endif // if YJIT_STATS
 
 #if YJIT_STATS
 
diff --git a/yjit_iface.c b/yjit_iface.c
index dc38b57b5c..42f22f3939 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -24,13 +24,8 @@ static VALUE cYjitDisasmInsn; https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L24
 static VALUE mYjit;
 static VALUE cYjitBlock;
 
-#if RUBY_DEBUG
-# define YJIT_STATS 1
+#if YJIT_STATS
 static VALUE cYjitCodeComment;
-#else
-# ifndef YJIT_STATS
-#  define YJIT_STATS 0
-# endif
 #endif
 
 #if YJIT_STATS
diff --git a/yjit_iface.h b/yjit_iface.h
index 65e3c28558..a0fcb931a2 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -6,8 +6,9 @@ https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L6
 #ifndef YJIT_IFACE_H
 #define YJIT_IFACE_H 1
 
-#include "ruby/ruby.h"
-#include "ruby/assert.h" // for RUBY_DEBUG
+#include "ruby/internal/config.h"
+#include "ruby_assert.h" // for RUBY_DEBUG
+#include "yjit.h" // for YJIT_STATS
 #include "vm_core.h"
 #include "yjit_core.h"
 
@@ -15,8 +16,7 @@ https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L16
 # define YJIT_DEFAULT_CALL_THRESHOLD 10
 #endif
 
-#if RUBY_DEBUG
-# define YJIT_STATS 1
+#if YJIT_STATS
 struct yjit_comment {
     uint32_t offset;
     const char *comment;
@@ -25,11 +25,7 @@ struct yjit_comment { https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L25
 typedef rb_darray(struct yjit_comment) yjit_comment_array_t;
 
 extern yjit_comment_array_t yjit_code_comments;
-#else
-# ifndef YJIT_STATS
-#  define YJIT_STATS 0
-# endif // ifndef YJIT_STATS
-#endif // if RUBY_DEBUG
+#endif // if YJIT_STATS
 
 
 #if YJIT_STATS
-- 
cgit v1.2.1


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

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