summaryrefslogtreecommitdiff
path: root/yjit.h
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-16 02:05:12 +0900
committerGitHub <noreply@github.com>2022-08-15 13:05:12 -0400
commitee864beb7c6730083da656b55f4a9eeaed78bfa8 (patch)
tree21148b3c967a20efcbeefed2aaa1e385129c04f2 /yjit.h
parent0264424d58e0eb3ff6fc42b7b4164b6e3b8ea8ca (diff)
downloadruby-ee864beb7c6730083da656b55f4a9eeaed78bfa8.tar.gz
Simplify around `USE_YJIT` macro (#6240)
* Simplify around `USE_YJIT` macro - Use `USE_YJIT` macro only instead of `YJIT_BUILD`. - An intermediate macro `YJIT_SUPPORTED_P` is no longer used. * Bail out if YJIT is enabled on unsupported platforms
Diffstat (limited to 'yjit.h')
-rw-r--r--yjit.h23
1 files changed, 7 insertions, 16 deletions
diff --git a/yjit.h b/yjit.h
index cf420df251..1f507f1b51 100644
--- a/yjit.h
+++ b/yjit.h
@@ -15,24 +15,15 @@
# define YJIT_STATS RUBY_DEBUG
#endif
-// We generate x86 assembly
-#if (defined(__x86_64__) && !defined(_WIN32)) || (defined(_WIN32) && defined(_M_AMD64)) // x64 platforms without mingw/msys
-# define YJIT_SUPPORTED_P 1
-#else
-# define YJIT_SUPPORTED_P 0
-#endif
+#if USE_YJIT
-// Is the output binary going to include YJIT?
-#if USE_MJIT && USE_YJIT && YJIT_SUPPORTED_P
-# define YJIT_BUILD 1
+// We generate x86 assembly
+#if defined(_WIN32) ? defined(_M_AMD64) : defined(__x86_64__)
+// x86_64 platforms without mingw/msys or x64-mswin
#else
-# define YJIT_BUILD 0
+# error YJIT unsupported platform
#endif
-#undef YJIT_SUPPORTED_P
-
-#if YJIT_BUILD
-
// Expose these as declarations since we are building YJIT.
bool rb_yjit_enabled_p(void);
unsigned rb_yjit_call_threshold(void);
@@ -54,7 +45,7 @@ void rb_yjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic);
void rb_yjit_tracing_invalidate_all(void);
#else
-// !YJIT_BUILD
+// !USE_YJIT
// In these builds, YJIT could never be turned on. Provide dummy implementations.
static inline bool rb_yjit_enabled_p(void) { return false; }
@@ -76,6 +67,6 @@ static inline void rb_yjit_before_ractor_spawn(void) {}
static inline void rb_yjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic) {}
static inline void rb_yjit_tracing_invalidate_all(void) {}
-#endif // #if YJIT_BUILD
+#endif // #if USE_YJIT
#endif // #ifndef YJIT_H