@@ -307,7 +307,9 @@ usage(const char *name, int help, int highlight, int columns)
307
307
#define M (shortopt , longopt , desc ) RUBY_OPT_MESSAGE(shortopt, longopt, desc)
308
308
309
309
#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"
311
313
#endif
312
314
313
315
/* This message really ought to be max 23 lines.
@@ -338,13 +340,15 @@ usage(const char *name, int help, int highlight, int columns)
338
340
M ("-W[level=2|:category]" , "" , "Set warning flag ($-W):\n"
339
341
"0 for silent; 1 for moderate; 2 for verbose." ),
340
342
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 "." ),
343
345
#endif
344
346
#if USE_YJIT
345
347
M ("--yjit" , "" , "Enable in-process JIT compiler." ),
346
348
#endif
347
- M ("--zjit" , "" , "Enable in-process JIT compiler." ),
349
+ #if USE_ZJIT
350
+ M ("--zjit" , "" , "Enable method-based JIT compiler." ),
351
+ #endif
348
352
M ("-h" , "" , "Print this help message; use --help for longer message." ),
349
353
};
350
354
STATIC_ASSERT (usage_msg_size , numberof (usage_msg ) < 26 );
@@ -381,6 +385,9 @@ usage(const char *name, int help, int highlight, int columns)
381
385
M ("frozen-string-literal" , "" , "Freeze all string literals (default: disabled)." ),
382
386
#if USE_YJIT
383
387
M ("yjit" , "" , "In-process JIT compiler (default: disabled)." ),
388
+ #endif
389
+ #if USE_ZJIT
390
+ M ("zjit" , "" , "Method-based JIT compiler (default: disabled)." ),
384
391
#endif
385
392
};
386
393
static const struct ruby_opt_message warn_categories [] = {
@@ -419,6 +426,11 @@ usage(const char *name, int help, int highlight, int columns)
419
426
printf ("%s" "YJIT options:%s\n" , sb , se );
420
427
rb_yjit_show_usage (help , highlight , w , columns );
421
428
#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
422
434
}
423
435
424
436
#define rubylib_path_new rb_str_new
@@ -1993,7 +2005,7 @@ copy_str(VALUE str, rb_encoding *enc, bool intern)
1993
2005
return rb_enc_interned_str (RSTRING_PTR (str ), RSTRING_LEN (str ), enc );
1994
2006
}
1995
2007
1996
- #if USE_YJIT
2008
+ #if USE_YJIT || USE_ZJIT
1997
2009
// Check that an environment variable is set to a truthy value
1998
2010
static bool
1999
2011
env_var_truthy (const char * name )
@@ -2345,6 +2357,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
2345
2357
if (!FEATURE_USED_P (opt -> features , yjit ) && env_var_truthy ("RUBY_YJIT_ENABLE" )) {
2346
2358
FEATURE_SET (opt -> features , FEATURE_BIT (yjit ));
2347
2359
}
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
+ }
2348
2364
#endif
2349
2365
}
2350
2366
if (MULTI_BITS_P (FEATURE_SET_BITS (opt -> features ) & feature_jit_mask )) {
0 commit comments