summaryrefslogtreecommitdiff
path: root/ruby.c
AgeCommit message (Collapse)Author
2023-09-25[Feature #19790] Rename BUGREPORT_PATH as CRASH_REPORTNobuyoshi Nakada
2023-09-25Honor the same option given laterNobuyoshi Nakada
2023-09-25Add `--bugreport-path` optionNobuyoshi Nakada
It has precedence over the environment variable `RUBY_BUGREPORT_PATH`.
2023-09-25Test bug_reportNobuyoshi Nakada
2023-09-18[Bug #19887] RUBYOPT should work without leading `-`Nobuyoshi Nakada
2023-08-30Change heap init environment variable namesPeter Zhu
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the user does not need to determine the slot sizes (which can vary between 32 and 64 bit systems). They now just use the heap names (`GC.stat_heap.keys`). Notes: Merged: https://github.com/ruby/ruby/pull/8335
2023-08-25[Feature #19785] Deprecate RUBY_GC_HEAP_INIT_SLOTSPeter Zhu
This environment variable is replaced by `RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS`, so it doesn't make sense to keep it. Notes: Merged: https://github.com/ruby/ruby/pull/8147
2023-08-25Move SCRIPT_LINES__ away from parse.yNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8289
2023-08-22Call ruby_init_setproctitle before process_optionsJeremy Evans
Fixes [Bug #11269] Notes: Merged: https://github.com/ruby/ruby/pull/8265
2023-08-13Fix the precedence of `--backtrace-limit` optionNobuyoshi Nakada
In general, if the same option specifying a single value is given multiple times at the same level, the last one overrides the earlier ones, unless prohibited. Notes: Merged: https://github.com/ruby/ruby/pull/8212
2023-08-11Fix range of `--backtrace-limit`Nobuyoshi Nakada
Also an option command line should have precedence over `RUBYOPT`. Notes: Merged: https://github.com/ruby/ruby/pull/8200
2023-08-02Fix encoding switches when RUBYOPT is empty or only spacesBenoit Daloze
* Follow-up of dbbc3583ba432c279f07b1fa0afb0a8a9ba50c91 which broke this.
2023-07-16Allow -1 as the value of `--backtrace-limit` optionTom Stuart
-1 is a legitimate backtrace limit — in fact, it’s the default — so it should be possible to provide it with the `--backtrace-limit` option.
2023-07-16Allow `--backtrace-limit` option to appear in RUBYOPTTom Stuart
There’s no reason to prevent RUBYOPT from controlling the backtrace limit. In fact, Matz said [0] he was expecting this to be possible. [0] https://bugs.ruby-lang.org/issues/8661#note-27
2023-07-13Set backtrace length limit at lastNobuyoshi Nakada
Command line options should have higher precedence than the same options in shebang and `RUBYOPT`. Notes: Merged: https://github.com/ruby/ruby/pull/8068
2023-07-13Preserve already set options in `moreswitches`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8068
2023-07-13Shrink `ruby_cmdline_options_t` a bitNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8068
2023-07-05YJIT: Use --yjit-exec-mem-size=128 by default (#8031)Takashi Kokubun
Notes: Merged-By: k0kubun <[email protected]>
2023-06-12[Feature #19719] Universal Parseryui-knk
Introduce Universal Parser mode for the parser. This commit includes these changes: * Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions are passed via `struct rb_parser_config_struct` when this macro is enabled. * Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu. Notes: Merged: https://github.com/ruby/ruby/pull/7927
2023-06-08Split long options from `proc_options`Nobuyoshi Nakada
2023-06-08Split some options from `proc_options`Nobuyoshi Nakada
`-W`, `-e`, `-K`, `-0`, `-E` and `--encoding` options.
2023-06-05Move per sections in help messageNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7906
2023-06-05Add additional info for `-0` to `--help` messageNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7906
2023-06-05Fold option lines in help messageNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7906
2023-06-05[Bug #19685]: Add `-y` and `--yydebug` document to `--help`Yla Aioi
Add -y option information to `--help` Fix a warning on the man page Notes: Merged: https://github.com/ruby/ruby/pull/7870 Merged-By: nobu <[email protected]>
2023-05-31Assertion on message length for the `-h` optionNobuyoshi Nakada
2023-05-21Put `rb_fork` back into process.cNobuyoshi Nakada
Now, calling `rb_fork` directly breaks the PID cache and the timer thread, so must use `rb_fork_ruby` or similar instead. Notes: Merged: https://github.com/ruby/ruby/pull/7834
2023-05-21Use `rb_fork_ruby` for `--help` pagerNobuyoshi Nakada
Instead of `rb_fork`, to update `current_fork_gen` which has been introduced at 3563e1383fe4ce13168cd3b9f4d5222d69d00061. Otherwise, the forked process attempts to stop the timer thread, but raises an exception because the thread is not alive in the child and dies because already no tag is present at that time. Notes: Merged: https://github.com/ruby/ruby/pull/7833
2023-05-10[Bug #19597] Freeze script nameNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7709
2023-04-14Add RB_WARN_CATEGORY_DEFAULT_BITSJean Boussier
Followup: ac123f167a364c3d7a43eca78d564e41f6dbb91e RB_WARN_CATEGORY_ALL_BITS is exposed in a public header, so it makes sense for it to be updated to contain all valid bits. Instead we introduce RB_WARN_CATEGORY_DEFAULT_BITS to list the categories that are enabled by default. Notes: Merged: https://github.com/ruby/ruby/pull/7710
2023-04-13Emit a performance warning when a class reached max variationsJean Boussier
[Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true` Notes: Merged: https://github.com/ruby/ruby/pull/7708
2023-04-13YJIT: Add a sampling option to exit tracing (#7693)Adam Hess
Add a sampling option to trace exits Running YJIT with trace exits enabled can make very large metrics files. This allows us to configure a sample rate to make tracing exits possible on larger tests. This also updates the documented YJIT options. Co-authored-by: Alan Wu <[email protected]> Co-authored-by: John Hawthorn <[email protected]> Co-authored-by: Maxime Chevalier-Boisvert <[email protected]> Notes: Merged-By: maximecb <[email protected]>
2023-04-07[Bug #19584] Register global variable address before assignmentNobuyoshi Nakada
2023-04-04[Feature #19579] Remove !USE_RVARGC code (#7655)Peter Zhu
Remove !USE_RVARGC code [Feature #19579] The Variable Width Allocation feature was turned on by default in Ruby 3.2. Since then, we haven't received bug reports or backports to the non-Variable Width Allocation code paths, so we assume that nobody is using it. We also don't plan on maintaining the non-Variable Width Allocation code, so we are going to remove it. Notes: Merged-By: maximecb <[email protected]>
2023-03-18RJIT: Prefix rjit_options with rb_Takashi Kokubun
2023-03-12RJIT: Implement --rjit-trace-exitsTakashi Kokubun
2023-03-08RJIT: Stop allowing leaked globals rjit_*Takashi Kokubun
2023-03-07Update documentation about RJITTakashi Kokubun
2023-03-07Update options available in RJITTakashi Kokubun
2023-03-06s/mjit/rjit/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-03-06s/MJIT/RJIT/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-03-05Skip compiling at_exit without --mjit-statsTakashi Kokubun
2023-03-02YJIT: Fix default call threshold in help (#7424)Takashi Kokubun
Notes: Merged-By: maximecb <[email protected]>
2023-02-27Revert "reuse open(2) from rb_file_load_ok on POSIX-like system"Takashi Kokubun
This reverts commit 35136e1e9c232ad7a03407b992b2e86b6df43f63. test-spec has been failing since this revision. .github/workflows/compilers.yml:82 https://github.com/ruby/ruby/actions/runs/4276884159/jobs/7445299562 ``` env: # Minimal flags to pass the check. default_cc: 'gcc-11 -fcf-protection -Wa,--generate-missing-build-notes=yes' optflags: '-O2' LDFLAGS: '-Wl,-z,now' # FIXME: Drop skipping options # https://bugs.ruby-lang.org/issues/18061 # https://sourceware.org/annobin/annobin.html/Test-pie.html TEST_ANNOCHECK_OPTS: "--skip-pie --skip-gaps" ``` Failure: ``` 1) An exception occurred during: Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 2) An exception occurred during: Kernel#require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel#require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 3) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 4) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 5) An exception occurred during: Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 6) An exception occurred during: Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 7) An exception occurred during: Kernel.require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel.require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 8) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 9) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 10) An exception occurred during: Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 11) An exception occurred during: Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:197 Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 12) An exception occurred during: Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:205 Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 13) An exception occurred during: Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:399 Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' 14) An exception occurred during: Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:407 Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' ```
2023-02-26reuse open(2) from rb_file_load_ok on POSIX-like systemEric Wong
When loading Ruby source files, we can save the result of successful opens as open(2)/openat(2) are a fairly expensive syscalls. This also avoids a time-of-check-to-time-of-use (TOCTTOU) problem. This reduces open(2) syscalls during `require'; but should be most apparent when users have a small $LOAD_PATH. Users with large $LOAD_PATH will benefit less since there'll be more open(2) failures due to ENOENT. With `strace -c -e openat ruby -e exit' under Linux, this results in a ~14% reduction of openat(2) syscalls (glibc uses openat(2) to implement open(2)). % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 0.00 0.000000 0 296 110 openat 0.00 0.000000 0 254 110 openat Additionally, the introduction of `struct ruby_file_load_state' may make future optimizations more apparent. This change cannot benefit binary (.so) loading since the dlopen(3) API requires a filename and I'm not aware of an alternative that takes a pre-existing FD. In typical situations, Ruby source files outnumber the mount of .so files.
2023-02-01Fix a typoNobuyoshi Nakada
2023-02-01Suppress an unused-function warningNobuyoshi Nakada
2023-01-31Make sure RUBY_YJIT_ENABLE only enables YJIT for truthy values (#7208)Maxime Chevalier-Boisvert
* Make sure RUBY_YJIT_ENABLE only enables YJIT for truthy values Addresses bug reported in: https://github.com/Shopify/yjit/issues/309 * Update ruby.c Co-authored-by: Alan Wu <[email protected]> --------- Co-authored-by: Alan Wu <[email protected]> Notes: Merged-By: maximecb <[email protected]>
2022-12-19YJIT: Make --yjit-stats always visible on --help (#6946)Takashi Kokubun
Notes: Merged-By: maximecb <[email protected]>
2022-12-13YJIT: Change the default mem size to 64MiB (#6912)Takashi Kokubun
* YJIT: Change the default mem size to 64MiB * Also update ruby --help Co-authored-by: Alan Wu <[email protected]> Notes: Merged-By: maximecb <[email protected]>