@@ -307,7 +307,9 @@ usage(const char *name, int help, int highlight, int columns)
307307#define M (shortopt , longopt , desc ) RUBY_OPT_MESSAGE(shortopt, longopt, desc)
308308
309309#if USE_YJIT
310- # define PLATFORM_JIT_OPTION "--yjit"
310+ # define DEFAULT_JIT_OPTION "--yjit"
311+ #elif USE_ZJIT
312+ # define DEFAULT_JIT_OPTION "--zjit"
311313#endif
312314
313315 /* This message really ought to be max 23 lines.
@@ -338,13 +340,15 @@ usage(const char *name, int help, int highlight, int columns)
338340 M ("-W[level=2|:category]" , "" , "Set warning flag ($-W):\n"
339341 "0 for silent; 1 for moderate; 2 for verbose." ),
340342 M ("-x[dirpath]" , "" , "Execute Ruby code starting from a #!ruby line." ),
341- #if USE_YJIT
342- M ("--jit" , "" , "Enable JIT for the platform ; same as " PLATFORM_JIT_OPTION "." ),
343+ #if USE_YJIT || USE_ZJIT
344+ M ("--jit" , "" , "Enable the default JIT for the build ; same as " DEFAULT_JIT_OPTION "." ),
343345#endif
344346#if USE_YJIT
345347 M ("--yjit" , "" , "Enable in-process JIT compiler." ),
346348#endif
347- M ("--zjit" , "" , "Enable in-process JIT compiler." ),
349+ #if USE_ZJIT
350+ M ("--zjit" , "" , "Enable method-based JIT compiler." ),
351+ #endif
348352 M ("-h" , "" , "Print this help message; use --help for longer message." ),
349353 };
350354 STATIC_ASSERT (usage_msg_size , numberof (usage_msg ) < 26 );
@@ -381,6 +385,9 @@ usage(const char *name, int help, int highlight, int columns)
381385 M ("frozen-string-literal" , "" , "Freeze all string literals (default: disabled)." ),
382386#if USE_YJIT
383387 M ("yjit" , "" , "In-process JIT compiler (default: disabled)." ),
388+ #endif
389+ #if USE_ZJIT
390+ M ("zjit" , "" , "Method-based JIT compiler (default: disabled)." ),
384391#endif
385392 };
386393 static const struct ruby_opt_message warn_categories [] = {
@@ -419,6 +426,11 @@ usage(const char *name, int help, int highlight, int columns)
419426 printf ("%s" "YJIT options:%s\n" , sb , se );
420427 rb_yjit_show_usage (help , highlight , w , columns );
421428#endif
429+ #if USE_ZJIT
430+ printf ("%s" "ZJIT options:%s\n" , sb , se );
431+ extern void rb_zjit_show_usage (int help , int highlight , unsigned int width , int columns );
432+ rb_zjit_show_usage (help , highlight , w , columns );
433+ #endif
422434}
423435
424436#define rubylib_path_new rb_str_new
@@ -1993,7 +2005,7 @@ copy_str(VALUE str, rb_encoding *enc, bool intern)
19932005 return rb_enc_interned_str (RSTRING_PTR (str ), RSTRING_LEN (str ), enc );
19942006}
19952007
1996- #if USE_YJIT
2008+ #if USE_YJIT || USE_ZJIT
19972009// Check that an environment variable is set to a truthy value
19982010static bool
19992011env_var_truthy (const char * name )
@@ -2345,6 +2357,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
23452357 if (!FEATURE_USED_P (opt -> features , yjit ) && env_var_truthy ("RUBY_YJIT_ENABLE" )) {
23462358 FEATURE_SET (opt -> features , FEATURE_BIT (yjit ));
23472359 }
2360+ #elif USE_ZJIT
2361+ if (!FEATURE_USED_P (opt -> features , zjit ) && env_var_truthy ("RUBY_ZJIT_ENABLE" )) {
2362+ FEATURE_SET (opt -> features , FEATURE_BIT (zjit ));
2363+ }
23482364#endif
23492365 }
23502366 if (MULTI_BITS_P (FEATURE_SET_BITS (opt -> features ) & feature_jit_mask )) {
0 commit comments