Implement version string for ZJIT
This commit is contained in:
parent
6bc9e8e423
commit
1906db9c78
Notes:
git
2025-04-18 13:49:10 +00:00
21
version.c
21
version.c
@ -61,6 +61,16 @@ const int ruby_api_version[] = {
|
||||
#else
|
||||
#define YJIT_DESCRIPTION " +YJIT"
|
||||
#endif
|
||||
#ifdef ZJIT_SUPPORT
|
||||
#define ZJIT_DESCRIPTION " +ZJIT " STRINGIZE(ZJIT_SUPPORT)
|
||||
#else
|
||||
#define ZJIT_DESCRIPTION " +ZJIT"
|
||||
#endif
|
||||
#if USE_ZJIT
|
||||
#define JIT_DESCRIPTION ZJIT_DESCRIPTION
|
||||
#else
|
||||
#define JIT_DESCRIPTION YJIT_DESCRIPTION
|
||||
#endif
|
||||
#if USE_MODULAR_GC
|
||||
#define GC_DESCRIPTION " +GC"
|
||||
#else
|
||||
@ -162,6 +172,12 @@ Init_version(void)
|
||||
#define YJIT_OPTS_ON 0
|
||||
#endif
|
||||
|
||||
#if USE_ZJIT
|
||||
#define ZJIT_OPTS_ON opt->zjit
|
||||
#else
|
||||
#define ZJIT_OPTS_ON 0
|
||||
#endif
|
||||
|
||||
int ruby_mn_threads_enabled;
|
||||
|
||||
#ifndef RB_DEFAULT_PARSER
|
||||
@ -186,7 +202,7 @@ define_ruby_description(const char *const jit_opt)
|
||||
{
|
||||
static char desc[
|
||||
sizeof(ruby_description)
|
||||
+ rb_strlen_lit(YJIT_DESCRIPTION)
|
||||
+ rb_strlen_lit(JIT_DESCRIPTION)
|
||||
+ rb_strlen_lit(" +MN")
|
||||
+ rb_strlen_lit(" +PRISM")
|
||||
#if USE_MODULAR_GC
|
||||
@ -203,7 +219,7 @@ define_ruby_description(const char *const jit_opt)
|
||||
memcpy(desc, ruby_description, n);
|
||||
# define append(s) (n += (int)strlcpy(desc + n, s, sizeof(desc) - n))
|
||||
if (*jit_opt) append(jit_opt);
|
||||
RUBY_ASSERT(n <= ruby_description_opt_point + (int)rb_strlen_lit(YJIT_DESCRIPTION));
|
||||
RUBY_ASSERT(n <= ruby_description_opt_point + (int)rb_strlen_lit(JIT_DESCRIPTION));
|
||||
if (ruby_mn_threads_enabled) append(" +MN");
|
||||
if (rb_ruby_prism_p()) append(" +PRISM");
|
||||
#if USE_MODULAR_GC
|
||||
@ -232,6 +248,7 @@ Init_ruby_description(ruby_cmdline_options_t *opt)
|
||||
{
|
||||
const char *const jit_opt =
|
||||
YJIT_OPTS_ON ? YJIT_DESCRIPTION :
|
||||
ZJIT_OPTS_ON ? ZJIT_DESCRIPTION :
|
||||
"";
|
||||
define_ruby_description(jit_opt);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user