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
|
#else
|
||||||
#define YJIT_DESCRIPTION " +YJIT"
|
#define YJIT_DESCRIPTION " +YJIT"
|
||||||
#endif
|
#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
|
#if USE_MODULAR_GC
|
||||||
#define GC_DESCRIPTION " +GC"
|
#define GC_DESCRIPTION " +GC"
|
||||||
#else
|
#else
|
||||||
@ -162,6 +172,12 @@ Init_version(void)
|
|||||||
#define YJIT_OPTS_ON 0
|
#define YJIT_OPTS_ON 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if USE_ZJIT
|
||||||
|
#define ZJIT_OPTS_ON opt->zjit
|
||||||
|
#else
|
||||||
|
#define ZJIT_OPTS_ON 0
|
||||||
|
#endif
|
||||||
|
|
||||||
int ruby_mn_threads_enabled;
|
int ruby_mn_threads_enabled;
|
||||||
|
|
||||||
#ifndef RB_DEFAULT_PARSER
|
#ifndef RB_DEFAULT_PARSER
|
||||||
@ -186,7 +202,7 @@ define_ruby_description(const char *const jit_opt)
|
|||||||
{
|
{
|
||||||
static char desc[
|
static char desc[
|
||||||
sizeof(ruby_description)
|
sizeof(ruby_description)
|
||||||
+ rb_strlen_lit(YJIT_DESCRIPTION)
|
+ rb_strlen_lit(JIT_DESCRIPTION)
|
||||||
+ rb_strlen_lit(" +MN")
|
+ rb_strlen_lit(" +MN")
|
||||||
+ rb_strlen_lit(" +PRISM")
|
+ rb_strlen_lit(" +PRISM")
|
||||||
#if USE_MODULAR_GC
|
#if USE_MODULAR_GC
|
||||||
@ -203,7 +219,7 @@ define_ruby_description(const char *const jit_opt)
|
|||||||
memcpy(desc, ruby_description, n);
|
memcpy(desc, ruby_description, n);
|
||||||
# define append(s) (n += (int)strlcpy(desc + n, s, sizeof(desc) - n))
|
# define append(s) (n += (int)strlcpy(desc + n, s, sizeof(desc) - n))
|
||||||
if (*jit_opt) append(jit_opt);
|
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 (ruby_mn_threads_enabled) append(" +MN");
|
||||||
if (rb_ruby_prism_p()) append(" +PRISM");
|
if (rb_ruby_prism_p()) append(" +PRISM");
|
||||||
#if USE_MODULAR_GC
|
#if USE_MODULAR_GC
|
||||||
@ -232,6 +248,7 @@ Init_ruby_description(ruby_cmdline_options_t *opt)
|
|||||||
{
|
{
|
||||||
const char *const jit_opt =
|
const char *const jit_opt =
|
||||||
YJIT_OPTS_ON ? YJIT_DESCRIPTION :
|
YJIT_OPTS_ON ? YJIT_DESCRIPTION :
|
||||||
|
ZJIT_OPTS_ON ? ZJIT_DESCRIPTION :
|
||||||
"";
|
"";
|
||||||
define_ruby_description(jit_opt);
|
define_ruby_description(jit_opt);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user