Skip to content

Commit 02c72cb

Browse files
authored
Merge pull request #221 from Shopify/yjit-stats-warning
Fix warnings about redefining YJIT_STATS
2 parents 23c25fe + 3c464fe commit 02c72cb

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

yjit_codegen.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ record_global_inval_patch(const codeblock_t *cb, uint32_t outline_block_target_p
203203

204204
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);
205205

206-
#if RUBY_DEBUG
207-
# define YJIT_STATS 1
206+
#if YJIT_STATS
208207

209208
// Add a comment at the current position in the code block
210209
static void
@@ -290,14 +289,11 @@ verify_ctx(jitstate_t *jit, ctx_t *ctx)
290289
}
291290

292291
#else
293-
#ifndef YJIT_STATS
294-
#define YJIT_STATS 0
295-
#endif // ifndef YJIT_STATS
296292

297293
#define ADD_COMMENT(cb, comment) ((void)0)
298294
#define verify_ctx(jit, ctx) ((void)0)
299295

300-
#endif // if RUBY_DEBUG
296+
#endif // if YJIT_STATS
301297

302298
#if YJIT_STATS
303299

yjit_iface.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,8 @@ static VALUE cYjitDisasmInsn;
2424
static VALUE mYjit;
2525
static VALUE cYjitBlock;
2626

27-
#if RUBY_DEBUG
28-
# define YJIT_STATS 1
27+
#if YJIT_STATS
2928
static VALUE cYjitCodeComment;
30-
#else
31-
# ifndef YJIT_STATS
32-
# define YJIT_STATS 0
33-
# endif
3429
#endif
3530

3631
#if YJIT_STATS

yjit_iface.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
#ifndef YJIT_IFACE_H
77
#define YJIT_IFACE_H 1
88

9-
#include "ruby/ruby.h"
10-
#include "ruby/assert.h" // for RUBY_DEBUG
9+
#include "ruby/internal/config.h"
10+
#include "ruby_assert.h" // for RUBY_DEBUG
11+
#include "yjit.h" // for YJIT_STATS
1112
#include "vm_core.h"
1213
#include "yjit_core.h"
1314

1415
#ifndef YJIT_DEFAULT_CALL_THRESHOLD
1516
# define YJIT_DEFAULT_CALL_THRESHOLD 10
1617
#endif
1718

18-
#if RUBY_DEBUG
19-
# define YJIT_STATS 1
19+
#if YJIT_STATS
2020
struct yjit_comment {
2121
uint32_t offset;
2222
const char *comment;
@@ -25,11 +25,7 @@ struct yjit_comment {
2525
typedef rb_darray(struct yjit_comment) yjit_comment_array_t;
2626

2727
extern yjit_comment_array_t yjit_code_comments;
28-
#else
29-
# ifndef YJIT_STATS
30-
# define YJIT_STATS 0
31-
# endif // ifndef YJIT_STATS
32-
#endif // if RUBY_DEBUG
28+
#endif // if YJIT_STATS
3329

3430

3531
#if YJIT_STATS

0 commit comments

Comments
 (0)