103 Commits

Author SHA1 Message Date
NARUSE, Yui
29ffc5d624 Reapply "Extract ruby_api_version_name"
This reverts commit ba2f6972193cdbd7c1e77e26212513e47926b115.

Box already used ruby_api_version_name.
2025-12-24 23:07:35 +09:00
NARUSE, Yui
ba2f697219 Revert "Extract ruby_api_version_name"
This reverts commit 9b576cd6255aba97e5e2f55f4b09f00c7dd0e839.
2025-12-24 22:55:44 +09:00
Nobuyoshi Nakada
352de161ff Remove an extra dot from RUBY_API_VERSION_STR 2025-12-24 14:41:02 +09:00
Nobuyoshi Nakada
4a0e01d768
[Misc #21688] Teach RDoc about the toplevel module Ruby
Re-open the exising module by calling `rb_define_module`.
RDoc (`RDoc::Parser::C#do_classes_and_modules`) does not recognize
`rb_path2class` as a class/module definition.
2025-11-23 19:01:16 +09:00
Godfrey Chan
f84bbb4238 ZJIT: add support for lazy RubyVM::ZJIT.enable
This implements Shopify#854:

- Splits boot-time and enable-time initialization,
  tracks progress with `InitializationState` enum

- Introduces `RubyVM::ZJIT.enable` Ruby method for
  enabling the JIT lazily, if not already enabled

- Introduces `--zjit-disable` flag, which can be
  used alongside the other `--zjit-*` flags but
  prevents enabling the JIT at boot time

- Adds ZJIT infra to support JIT hooks, but this
  is not currently exercised (Shopify/ruby#667)

Left for future enhancements:

- Support kwargs for overriding the CLI flags in
  `RubyVM::ZJIT.enable`

Closes Shopify#854
2025-11-18 08:35:09 -08:00
Nobuyoshi Nakada
3bbd45dd86 Fix RUBY_API_VERSION_NAME fallback definition 2025-11-17 21:34:44 +09:00
Satoshi Tagomori
95a110a9af Define ::Ruby module earlier to define classes under it 2025-11-07 13:14:54 +09:00
Alan Wu
b080fcd3cd ZJIT: Fix assert failure on JIT combo build
Previously, when `./configure --enable-yjit=dev --enable-zjit` JIT_DESCRIPTION was
defined to be "ZJIT", but when running with `--yjit`, ruby_set_yjit_description()
calls `define_ruby_description("+YJIT dev")`, which is longer than the
following assertion expects:

    RUBY_ASSERT(n <= ruby_description_opt_point + (int)rb_strlen_lit(JIT_DESCRIPTION));

Use the concatenation of the two strings -- the contents of the string
is never used. Minimize the scope of the macro, too.
2025-08-14 15:38:52 -04:00
Nobuyoshi Nakada
9b576cd625 Extract ruby_api_version_name 2025-08-14 12:39:19 +09:00
Takashi Kokubun
1906db9c78 Implement version string for ZJIT 2025-04-18 21:52:57 +09:00
Nobuyoshi Nakada
4a67ef09cc
[Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
Stan Lo
afeb17270b Link to Ruby module 2025-01-02 11:05:33 +09:00
Nobuyoshi Nakada
8f11d6cbe2 Show docs of constants under Ruby 2024-12-25 19:12:31 +09:00
Nobuyoshi Nakada
e5e4db1748 [Feature #20884] Define toplevel "Ruby" module with constants 2024-12-25 19:12:31 +09:00
Peter Zhu
ce1ad1b816 Standardize on the name "modular GC"
We have name fragmentation for this feature, including "shared GC",
"modular GC", and "external GC". This commit standardizes the feature
name to "modular GC" and the implementation to "GC library".
2024-12-05 10:33:26 -05:00
Matt Valentine-House
ee290c94a3 Include the currently active GC in RUBY_DESCRIPTION
This will add +MOD_GC to the version string and Ruby description when
Ruby is compiled with shared gc support.

When shared GC support is compiled in and a GC module has been loaded
using RUBY_GC_LIBRARY, the version string will include the name of
the currently active GC as reported by the rb_gc_active_gc_name function
in the form

+MOD_GC[gc_name]

[Feature #20794]
2024-11-14 10:46:36 +00:00
Nobuyoshi Nakada
c1d6d55f5a
Assert in only one place just after adding an argument 2024-10-02 22:03:32 +09:00
Nobuyoshi Nakada
3e1021b144 Make default parser enum and define getter/setter 2024-10-02 20:43:40 +09:00
Nobuyoshi Nakada
4e219d8f7d Split appending options to ruby_description
It's becoming tedious to map each format specifier to an argument.
2024-10-02 20:43:40 +09:00
Kevin Newton
76ea5cde2a Refactor RUBY_DESCRIPTION assertions in test_rubyoptions 2024-07-18 13:03:17 -04:00
HParker
55326a915f Introduce --parser runtime flag
Introduce runtime flag for specifying the parser,

```
ruby --parser=prism
```

also update the description:

```
$ ruby --parser=prism --version
ruby 3.3.0dev (2023-12-08T04:47:14Z add-parser-runtime.. 0616384c9f) +PRISM [x86_64-darwin23]
```

[Bug #20044]
2023-12-15 13:42:19 -05:00
Takashi Kokubun
6beb09c2c9
YJIT: Add RubyVM::YJIT.enable (#8705) 2023-10-19 10:54:35 -07:00
Koichi Sasada
c9990c8d0f "+MN" in description
If `RUBY_MN_THREADS=1` is given, this patch shows `+MN` in
`RUBY_DESCRIPTION` like:

```
$ RUBY_MN_THREADS=1 ./miniruby  --yjit -v
ruby 3.3.0dev (2023-10-17T04:10:14Z master 908f8fffa2) +YJIT +MN [x86_64-linux]
```

Before this patch, a warning is displayed if `$VERBOSE` is given.
However it can make troubles with tests (with `$VERBOSE`), do not
show any warning with a MN threads configuration.
2023-10-17 17:43:52 +09:00
Nobuyoshi Nakada
f6e2f32a96 Build rb_dynamic_description at runtime
To avoid creating literals for all combinations.
2023-10-16 19:57:34 +09:00
Nobuyoshi Nakada
d5ffbca5c4
Move MKSTR markers for fake.rb into coments 2023-08-20 13:29:42 +09:00
Takashi Kokubun
23ec248e48 s/mjit/rjit/ 2023-03-06 23:44:01 -08:00
Takashi Kokubun
2e875549a9 s/MJIT/RJIT/ 2023-03-06 23:44:01 -08:00
Takashi Kokubun
05af417587
YJIT: Show YJIT build option in RUBY_DESCRIPTION (#6738)
YJIT: Show YJIT profile in RUBY_DESCRIPTION
2022-11-16 10:08:52 -08:00
Takashi Kokubun
120b747b7d
YJIT: Lazily enable YJIT after prelude (#6597)
* YJIT: Lazily enable YJIT after prelude

* Update dependencies

* Use a bit field for opt->yjit
2022-10-24 12:20:44 -04:00
Nobuyoshi Nakada
32a0591515
Move macros from version.h to version.c
Moved the contents of `ruby_description` and `ruby_copyright` which
are never used in the other places.
2022-08-31 18:00:45 +09:00
Chris Seaton
31b2cd38c5 Include JIT information in crash reports
Since enabling YJIT or MJIT drastically changes what could go wrong at
runtime, it's good to be front and center about whether they are enabled
when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the
description printed when crashing can be different when a JIT is on.

Introduce a new internal data global, `rb_dynamic_description`, and set
it to be the same as `RUBY_DESCRIPTION` during initialization; use it
when crashing.

 * version.c: Init_ruby_description(): Initialize and use
       `rb_dynamic_description`.
 * error.c: Change crash reports to use `rb_dynamic_description`.
 * ruby.c: Call `Init_ruby_description()` earlier. Slightly more work
       for when we exit right after printing the description but that
       was deemed acceptable.
 * include/ruby/version.h: Talk about how JIT info is not in
      `ruby_description`.
 * test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for
       crash description being different from `RUBY_DESCRIPTION`.
 * test/ruby/test_rubyoptions.rb: ditto

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2022-06-20 17:18:29 -04:00
Takashi Kokubun
11b8aaa26a
Rename --jit to --mjit (#5248)
* Rename --jit to --mjit

[Feature #18349]

* Fix a few more --jit references

* Fix MJIT Actions

* More s/jit/mjit/ and re-introduce --disable-jit

* Update NEWS.md

* Fix test_bug_reporter_add
2021-12-13 16:08:01 -08:00
Alan Wu
efed45966b Show +YJIT in version string and RUBY_DESCRIPTION
There might be code out there that expect `ruby -v` to print only one
line. Since MJIT shows +JIT in `ruby -v` and RUBY_DESCRIPTION, let's
show +YJIT.

The crash report doesn't show anything about MJIT, so adjust the test.
The "test_ruby_version" test was unaware of RUBY_YJIT_ENABLE and so
was failing when the variable is set and inherited into the children
processes it spawns. Explicitly unset the variable in the test.
2021-10-20 18:19:43 -04:00
Jose Narvaez
4e2eb7695e Yet Another Ruby JIT!
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
7f4000b1f4 Machinery to implement deferred compilation 2021-10-20 18:19:31 -04:00
Alan Wu
15b088bd6e ujit.h instead in the rest of Ruby
ujit_iface.h is meant for uJIT internal use only.
2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
6341fc21b2 Don't increment instr/exit counters if stats not requested 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
59eb98fbaa Fix ujit cc/cme invalidation code for opt_send_without_block 2021-10-20 18:19:27 -04:00
Maxime Chevalier-Boisvert
e4c65ec49c Refactor uJIT code into more files for readability 2021-10-20 18:19:26 -04:00
Alan Wu
df15dfa6fd Don't put MicroJIT status in RUBY_DESCRIPTION
That messes with tests too much.
2021-10-20 18:19:24 -04:00
Alan Wu
726bdd4d35 Show whether MicroJIT is enabled in the version string 2021-10-20 18:19:24 -04:00
卜部昌平
f83b14af24 include/ruby/internal/interpreter.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]

In fact many functions declared in the header file are already
documented more or less.  They were just copy & pasted, with applying
some style updates.
2021-09-10 20:00:06 +09:00
Nobuyoshi Nakada
51bab75f49
Provides ruby2_keywords
So that requiring it succeeds even if that forward compatibility
gem is not installed.
2019-10-23 00:19:25 +09:00
Nobuyoshi Nakada
884576bf12
Update RDoc of RUBY_REVISION 2019-06-06 08:21:40 +09:00
Nobuyoshi Nakada
a093c98ddc
Fallback RUBY_FULL_REVISION if not defined 2019-05-23 01:39:43 +09:00
Nobuyoshi Nakada
a205e24747
Make RUBY_REVISION full length 2019-05-22 23:53:21 +09:00
Takashi Kokubun
5da52d1210
Migrate RUBY_VERSION/RUBY_DESCRIPTION to Git
from Subversion.

This behavior is tentative and not discussed well. The point of
discussion will be just the length of commit hash, and I thought we
should include this kind of change in 2.7.0-preview1 release even before
the length is fixed yet.

Let's discuss that afterwards and fix it later as needed. Naruse
suggested that length=10 is very unlikely to cause conflict, and thus
it's used by email notification and rubyci now. This behavior is in
favor of that for now.
2019-04-22 21:27:34 +09:00
nobu
8422725408 Moved version numbers
* Define major and minor version numbers only in the public
  include/ruby/version.h header, as the API version numbers.

* Define only teeny version number in the private version.h
  header.

* RUBY_VERSION moved to version.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28 02:12:34 +00:00
ko1
b710785f1a add disabling MJIT features option.
* configure.ac: introduce new configure option `--enable-mjit` and
  `--disable-mjit`. Default is "enable".
  `--disable-mjit` disables all of MJIT features so that `ruby --jit`
  can't enable MJIT.
  This option affect a macro `USE_MJIT`.
  This change remove `--enable/disable-install-mjit-header` option.

* Makefile.in: introduce the `ENABLE_MJIT` variable.

* common.mk: use `ENABLE_MJIT` option.

* internal.h: respect `USE_MJIT`. Same as other *.c, *.h.

* test/ruby/test_jit.rb: check `ENABLE_MJIT` key of rbconfg.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 06:53:00 +00:00
nobu
7fbd88239f version.c: MKSTR for fake.rb
* version.c (Init_ruby_description): fake.rb needs MKSTR to extract
  constant names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-10 05:20:46 +00:00