summaryrefslogtreecommitdiff
path: root/ruby.c
Commit message (Collapse)AuthorAgeFilesLines
* [Bug #19016] `SyntaxError` with parser error messagesNobuyoshi Nakada2022-11-221-2/+3
| | | | | | Raise a `SyntaxError` with the parser error message, in the case reading from a file instead of the `-e` option or standard input. So syntax_suggest can get the message from the caught error.
* YJIT: Lazily enable YJIT after prelude (#6597)Takashi Kokubun2022-10-241-18/+15
| | | | | | | * YJIT: Lazily enable YJIT after prelude * Update dependencies * Use a bit field for opt->yjit
* Move "special consts" so `Qundef` and `Qnil` differ just 1 bitNobuyoshi Nakada2022-10-201-0/+1
|
* Remove a leftover comment [ci skip]Takashi Kokubun2022-10-191-2/+0
|
* MJIT: Stop using the VM barrier for jit_contTakashi Kokubun2022-10-191-5/+10
| | | | | | | | | | | | | | | | This solves multiple problems. First, RB_VM_LOCK_ENTER/LEAVE is a barrier. We could at least use the _NO_BARRIER variant. Second, this doesn't need to interfere with GC or other GVL users when multiple Ractors are used. This needs to be used in very few places, so the benefit of fine-grained locking would outweigh its small maintenance cost. Third, it fixes a crash for YJIT. Because YJIT is never disabled until a process exits unlike MJIT that finishes earlier, we could call jit_cont_free when EC no longer exists, which crashes RB_VM_LOCK_ENTER.
* Assert for RTEST that Qnil and Qfalse differ just 1 bitNobuyoshi Nakada2022-10-191-0/+3
|
* Make mjit_cont sharable with YJIT (#6556)Takashi Kokubun2022-10-171-0/+7
| | | | | | | * Make mjit_cont sharable with YJIT * Update dependencies * Update YJIT binding
* Allow abbreviated dump options with additional optionsNobuyoshi Nakada2022-10-091-6/+44
|
* Support "+error-tolerant" as ruby optionyui-knk2022-10-081-3/+12
| | | | [Feature #19013]
* Ruby MJIT (#6028)Takashi Kokubun2022-09-041-6/+12
|
* Prefer stdbool for MJIT optionsTakashi Kokubun2022-09-031-1/+1
| | | | same motivation as d6f21b308bcff03e82f8b3dbf11a852ce111b3b3
* Setup SyntaxSuggest as default gemschneems2022-08-191-0/+6
| | | | | | | | | | | | | | | | | Adds the `syntax_suggest` syntax error display tool to Ruby through the same mechanism as `error_highlight` and `did_you_mean`. Reference ticket: https://bugs.ruby-lang.org/issues/18159 close #4845 ## What is syntax_suggest? When a syntax error is raised by requiring a file, dead_end will use a combination of indentation and lexing to identify the problem. > Note: Previously this tool was named `dead_end`. ## Known issues - SyntaxSearch's approach of showing syntax errors only works through integration with `require`, `load`, `autoload`, and `require_relative` (since it monkeypatches them to detect syntax errors). It does not work with direct Ruby file invocations https://github.com/zombocom/dead_end/issues/31. - This causes failure in the test suite (test_expected_backtrace_location_when_inheriting_from_basic_object_and_including_kernel) and confusion when inspecting backtraces if there's a different error when trying to require a file such as measuring memory (https://github.com/zombocom/syntax_suggest/issues/124#issuecomment-1006705016). - Discussed fix. We previously talked about opening up `SyntaxError` to be monkeypatched in the same way that other gems hook into `NoMethodError`. This is currently not possible and requires development work. When we last talked about it at RubyKaigi Nobu expressed an ability to make such a change.
* Simplify around `USE_YJIT` macro (#6240)Nobuyoshi Nakada2022-08-151-10/+10
| | | | | | | | * Simplify around `USE_YJIT` macro - Use `USE_YJIT` macro only instead of `YJIT_BUILD`. - An intermediate macro `YJIT_SUPPORTED_P` is no longer used. * Bail out if YJIT is enabled on unsupported platforms
* Duplicate libruby self pathNobuyoshi Nakada2022-08-071-1/+7
| | | | | | When LOAD_RELATIVE, as `sopath` is truncated to the prefix path, make the duplicate before it. Also make `rb_libruby_selfpath` frozen and hidden.
* Adjust styles [ci skip]Nobuyoshi Nakada2022-08-061-1/+2
|
* Add `-bundle_loader` to mjit compilation args on macOSYuta Saito2022-08-041-3/+15
|
* Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu2022-07-261-1/+1
| | | | | | rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new.
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-924/+924
| | | | [Misc #18891]
* See the environment variable and then check if JIT options conflictNobuyoshi Nakada2022-07-081-5/+5
|
* [Bug #18892] Reset `ARGF.lineno` after reading shebangNobuyoshi Nakada2022-07-071-0/+3
|
* Fallback to the default JIT only when no JIT is enabledNobuyoshi Nakada2022-07-021-15/+22
| | | | | Usually, command line options are given precedence first, environment variables next, and fall back to configuration options at last.
* Remove redundant parentheses [ci skip]Nobuyoshi Nakada2022-07-011-1/+1
|
* Make `FEATURE_SET_P` macro to include `FEATURE_BIT`Nobuyoshi Nakada2022-06-301-7/+7
|
* Do not call `exit()` directlyNobuyoshi Nakada2022-06-291-1/+1
|
* When YJIT is not built, hide options and use MJIT for --jitAlan Wu2022-06-231-6/+6
| | | | | | | YJIT is now a build-time opt-in so on platforms that YJIT could support it could still be unavailable due to user discretion. Use MJIT for --jit and don't display YJIT related command line options in --help when YJIT is not included in the build.
* Include JIT information in crash reportsChris Seaton2022-06-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rust YJITAlan Wu2022-04-271-33/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In December 2021, we opened an [issue] to solicit feedback regarding the porting of the YJIT codebase from C99 to Rust. There were some reservations, but this project was given the go ahead by Ruby core developers and Matz. Since then, we have successfully completed the port of YJIT to Rust. The new Rust version of YJIT has reached parity with the C version, in that it passes all the CRuby tests, is able to run all of the YJIT benchmarks, and performs similarly to the C version (because it works the same way and largely generates the same machine code). We've even incorporated some design improvements, such as a more fine-grained constant invalidation mechanism which we expect will make a big difference in Ruby on Rails applications. Because we want to be careful, YJIT is guarded behind a configure option: ```shell ./configure --enable-yjit # Build YJIT in release mode ./configure --enable-yjit=dev # Build YJIT in dev/debug mode ``` By default, YJIT does not get compiled and cargo/rustc is not required. If YJIT is built in dev mode, then `cargo` is used to fetch development dependencies, but when building in release, `cargo` is not required, only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer. The YJIT command-line options remain mostly unchanged, and more details about the build process are documented in `doc/yjit/yjit.md`. The CI tests have been updated and do not take any more resources than before. The development history of the Rust port is available at the following commit for interested parties: https://github.com/Shopify/ruby/commit/1fd9573d8b4b65219f1c2407f30a0a60e537f8be Our hope is that Rust YJIT will be compiled and included as a part of system packages and compiled binaries of the Ruby 3.2 release. We do not anticipate any major problems as Rust is well supported on every platform which YJIT supports, but to make sure that this process works smoothly, we would like to reach out to those who take care of building systems packages before the 3.2 release is shipped and resolve any issues that may come up. [issue]: https://bugs.ruby-lang.org/issues/18481 Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com> Co-authored-by: Kevin Newton <kddnewton@gmail.com>
* ruby.c: initialize extra optional extensions linked staticallyYuta Saito2022-01-191-0/+10
| | | | | | | Add a hook point to initialize extra extension libraries. The default hook function is replaced when linking a strong `Init_extra_exts` symbol. A builder can insert an object file that defines Init_extra_exts by XLDFLAGS.
* [Feature #18491] Drop support for HP-UXPeter Zhu2022-01-181-4/+0
| | | | | IA64 support was dropped in ticket #15894, so we can drop support for HP-UX.
* `O_NONBLOCK` is not always a preprocessor constant on all platformsNobuyoshi Nakada2022-01-161-6/+7
|
* Transfer the responsibility for MJIT options to mjit.cNobuyoshi Nakada2022-01-151-117/+14
|
* Define the default JIT feature bitNobuyoshi Nakada2022-01-151-15/+10
|
* Show JIT options only when supportedNobuyoshi Nakada2022-01-121-1/+17
|
* Fix compile errorsKazuhiro NISHIYAMA2022-01-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` compiling ../ruby.c ../ruby.c:1547:17: error: implicit declaration of function 'setup_yjit_options' is invalid in C99 [-Werror,-Wimplicit-function-declaration] setup_yjit_options(s, &opt->yjit); ^ ../ruby.c:1547:17: note: did you mean 'setup_mjit_options'? ../ruby.c:1122:1: note: 'setup_mjit_options' declared here setup_mjit_options(const char *s, struct mjit_options *mjit_opt) ^ ../ruby.c:1547:45: error: no member named 'yjit' in 'struct ruby_cmdline_options'; did you mean 'mjit'? setup_yjit_options(s, &opt->yjit); ^~~~ mjit ../ruby.c:192:25: note: 'mjit' declared here struct mjit_options mjit; ^ ../ruby.c:1924:28: error: no member named 'yjit' in 'struct ruby_cmdline_options'; did you mean 'mjit'? rb_yjit_init(&opt->yjit); ^~~~ mjit ../ruby.c:192:25: note: 'mjit' declared here struct mjit_options mjit; ^ 3 errors generated. ```
* Use `setup_yjit_options` only when supportedNobuyoshi Nakada2022-01-111-16/+13
|
* Reject command line option ending with `-`Nobuyoshi Nakada2022-01-111-1/+2
|
* Define YJIT options only when supportedNobuyoshi Nakada2022-01-111-0/+2
|
* Fix default --jit-max-cache in `ruby --help`Kazuhiro NISHIYAMA2022-01-101-1/+1
| | | | changed at 028f1887c2bfa50dcfc1b623470d6ab1b880fdde
* Add `=num` to yjit optionsKazuhiro NISHIYAMA2022-01-091-5/+5
| | | | `--yjit-call-threshold` and `--yjit-max-versions` need an argument.
* Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stressPeter Zhu2022-01-041-1/+4
| | | | | | We need to unshare the array loaded_features because the shared root could be old gen (while loaded_features is young) which causes a WB miss.
* Rename --jit to --mjit (#5248)Takashi Kokubun2021-12-131-20/+42
| | | | | | | | | | | | | | | * 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
* ruby.c: Fix typoYusuke Endoh2021-12-131-1/+1
|
* Introduce an option "--dump=insns_without_opt" for debugging purposesYusuke Endoh2021-12-131-3/+6
|
* Revert "Force disable yjit on OpenBSD"Aaron Patterson2021-12-011-6/+0
| | | | This reverts commit 119626da947bf6492ef7a27abf3bf12de5d0d95a.
* Add --yjit-no-type-prop so we can test YJIT without type propagation (#5135)Maxime Chevalier-Boisvert2021-11-181-0/+3
| | | | | | | * Add --yjit-no-type-prop so we can test YJIT without type propagation * Fix typo in command line option * Leave just two test workflows enable for YJIT
* [Feature #18239] Implement VWA for stringsPeter Zhu2021-10-251-1/+6
| | | | | This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings.
* Fix TestRubyOptions#test_enable for -DMJIT_FORCE_ENABLETakashi Kokubun2021-10-211-0/+5
| | | | --enable=all didn't work when cppflags=-DMJIT_FORCE_ENABLE was given.
* Force disable yjit on OpenBSDJeremy Evans2021-10-211-0/+6
| | | | | | | | | | | | | | TestRubyOptions#test_enable was broken on OpenBSD after the yjit merge. --yjit (and --enable-all, which enables --yjit) fails on OpenBSD because yjit uses an insecure mmap call (both writable and executable), in alloc_exec_mem, which OpenBSD does not allow. This can probably be reverted if yjit switches to a more secure mmap design (writable xor executable). This would involve initially calling mmap with PROT_READ | PROT_WRITE, and after writing of executable code has finished, using mprotect to switch to PROT_READ | PROT_EXEC. I believe Firefox uses this approach for their Javascript engine since Firefox 46.
* Fix indentation in ruby.cAlan Wu2021-10-201-2/+2
|
* Warn when trying to use YJIT in --disable-jit-support buildsAlan Wu2021-10-201-0/+4
|