Граф коммитов

1625 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada ab2a43265c Warn suspicious flag to `Regexp.new`
Now second argument should be `true`, `false`, `nil` or Integer.
This flag is confused with third argument some times.
2022-06-20 19:35:12 +09:00
John Hawthorn 17d260a87f Restore rb_exec_recursive_outer
This was a public method, so we should probably keep it.
2022-06-15 16:07:29 -07:00
Takashi Kokubun 23459e4dbb
Move RubyVM::MJIT to builtin Ruby
just less C code to maintain
2022-06-15 10:52:37 -07:00
Takashi Kokubun 1162523bae
Remove MJIT worker thread (#6006)
[Misc #18830]
2022-06-15 09:40:54 -07:00
Jun Aruga a80f5c5365 Enable "make annocheck" on platforms other than Linux.
The annocheck supports ELF format binaries compiled for any OS and for any
architecture. It can work in not only Linux but also FreeBSD and Solaris.
It is designed to be independent of the host OS and the architecture.

Even in Mac, as the binaries are Mach-O foramt, the annocheck fails correctly
with the message.

e.g. Test binaries compiled for Mac OSX 10.13.6 (target_os: darwin17) in Fedora 35.

```
$ cat /etc/fedora-release
Fedora release 35 (Thirty Five)

$ file ruby
ruby: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>

$ annocheck ruby
annocheck: Version 10.66.
annocheck: Warning: ruby: is not an ELF format file.
```

See <https://sourceware.org/bugzilla/show_bug.cgi?id=29173> for details.
2022-06-13 12:12:18 +02:00
Takashi Kokubun 790825db44
Update the help message on /benchmark
I wanted to point out there's --output=all.
2022-06-07 21:30:28 -07:00
Nobuyoshi Nakada a7577dbfd3
`annobin` works only when targeting Fedora
And hopefully for other Linux.  Since it is not run on the build os,
`TEST_RUNNABLE` is not suitable for this case.
2022-05-16 19:27:37 +09:00
Jun Aruga dccfff943c Add `make test-annocheck` to detect security issues.
* Note that as the annocheck binary package is not available on Ubuntu, and it
  is working in progress in Debian, the script uses Fedora container, and
  it requires docker or podman command.
  https://www.debian.org/devel/wnpp/itp.en.html
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=926470
* .github/workflows/compilers.yml: Add "gcc-11 annocheck" case.
  To pass the CI, set `TEST_ANNOCHECK_OPTS: "--skip-pie --skip-notes"` for now.
  See <https://bugs.ruby-lang.org/issues/18061>.
* Skip MJIT tests in case of annocheck case.
  The MJIT tests fail in the annocheck case.
  See <https://bugs.ruby-lang.org/issues/18781>.
2022-05-16 10:10:16 +02:00
Alan Wu f90549cd38 Rust YJIT
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:
1fd9573d8b

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>
2022-04-27 11:00:22 -04:00
Nobuyoshi Nakada bb0a22a8c0 Obey spec file locations to rubygems 2022-04-07 09:47:10 +09:00
Nobuyoshi Nakada 97ce030954 Load fake.rb at `BTESTRUBY`
So that `mkmf` checks work from `make run`, and also remove
duplicate `$(MINIRUBYOPT)` which is used in `$(MINIRUBY)`.
2022-04-05 22:35:40 +09:00
Nobuyoshi Nakada abfd859b13
Remove github and git related files from extracted bundled gems 2022-03-31 10:49:55 +09:00
Yusuke Endoh ad808506b3 Update dependencies 2022-03-30 16:50:46 +09:00
Martin Dürst 6d603cfde1 add Unicode auxiliary files and Unicode UCD emoji files download for ALWAYS_UPDATE_UNICODE 2022-03-16 15:15:44 +09:00
Martin Dürst 8e1f3a96ae switch UNICODE_BETA back to NO 2022-03-13 09:19:52 +09:00
Martin Dürst 45e0711f29 update Unicode Version to 14.0.0 and Emoji version to 14.0 2022-03-13 09:19:52 +09:00
Yuta Saito 77f3f8a1d4 exts.mk.tmpl: propagate MINIRUBY to enc.mk even though invoking from exts.mk
This is another attempt to fix out-of-src build with
--with-static-linked-ext. The first attempt was
4f1888bda70981d9f5b1bf55ab692e0ce18e79f4 but reverted because it broke
out-of-src build from pre-generated sources via `make dist`.
This patch fixes the second trans C source gen, mentioned in the
previous commit message, by passing MINIRUBY as well as when invoking
from common.mk
2022-03-09 22:43:02 +09:00
Peter Zhu 2d5ecd60a5 [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
Nobuyoshi Nakada f92f08ff23
[DOC] Set the documentation title and main page
Copied from https://github.com/ruby/docs.ruby-lang.org/ to be as
same as docs.ruby-lang.org.
2022-02-21 13:08:06 +09:00
David Rodríguez 6623d60ec8 Try make this more readable and consistent with other targets 2022-02-01 08:09:23 +09:00
David Rodríguez e53af7d1fb Tweaks to freeze bundler CI
Currently some specs are broken because `rspec-mocks-3.10.3` is used,
which has some breaking changes, apparently.

This change makes ruby-core install the same gems installed upstream for
running bundle specs, so that things never break with 3rd party
releases.
2022-02-01 08:09:23 +09:00
Nobuyoshi Nakada c1bcfeec38
Transfer the responsibility for MJIT options to mjit.c 2022-01-15 18:57:33 +09:00
Nobuyoshi Nakada abc4a46046
Get rid of building main again when test-bundled-gems 2022-01-14 14:54:29 +09:00
Nobuyoshi Nakada 071653ecd7
Run the prerequisites of test-bundled-gems in order 2022-01-02 02:04:05 +09:00
NARUSE, Yui 8325094177 Revert "Do not include external library sources into packages"
This reverts commit a042043487.
2021-12-25 21:22:02 +09:00
Samuel Williams bed920f073
Add fiber scheduler hooks for `pread`/`pwrite`, and add support to `IO::Buffer`. 2021-12-23 12:20:09 +13:00
Samuel Williams e30920354f
Extended interface for IO::Buffer & documentation. 2021-12-22 10:57:34 +13:00
Yuta Saito 3c7e95966d rbinstall.rb: install ext only when it's configured [Bug #18414] 2021-12-21 15:14:54 +09:00
Koichi Sasada 0eafba3610 use `RB_VM_LOCK_ENTER()`
We found that we need to make Ruby objects while locking the environ
to ENV operation atomically, so we decided to use `RB_VM_LOCK_ENTER()`
instead of `env_lock`.
2021-12-15 15:04:34 +09:00
Nobuyoshi Nakada b43338ccc4 Update dependencies 2021-12-15 15:04:34 +09:00
John Hawthorn de9a1e4a96
YJIT: Implement new struct accessors (#5161)
* YJIT: Implement optimized_method_struct_aref

* YJIT: Implement struct_aref without method call

Struct member reads can be compiled directly into a memory read (with
either one or two levels of indirection).

* YJIT: Implement optimized struct aset

* YJIT: Update tests for struct access

* YJIT: Add counters for remaining optimized methods

* Check for INT32_MAX overflow

It only takes a struct with 0x7fffffff/8+1 members. Also add some
cheap compile time checks.

* Add tests for non-embedded struct aref/aset

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2021-11-25 11:56:58 -08:00
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Yusuke Endoh feda058531 Refactor hacky ID tables to struct rb_ast_id_table_t
The implementation of a local variable tables was represented as `ID*`,
but it was very hacky: the first element is not an ID but the size of
the table, and, the last element is (sometimes) a link to the next local
table only when the id tables are a linked list.

This change converts the hacky implementation to a normal struct.
2021-11-21 08:59:24 +09:00
Koichi Sasada 82ea287018 optimize `Struct` getter/setter
Introduce new optimized method type
`OPTIMIZED_METHOD_TYPE_STRUCT_AREF/ASET` with index information.
2021-11-19 08:32:39 +09:00
Koichi Sasada c347038d4e GC measurement feature
* `GC.measure_total_time = true` enables total time measurement (default: true)
* `GC.measure_total_time` returns current flag.
* `GC.total_time` returns measured total time in nano seconds.
* `GC.stat(:time)` (and Hash) returns measured total time in milli seconds.
2021-11-19 08:32:07 +09:00
Jeremy Evans b08dacfea3
Optimize dynamic string interpolation for symbol/true/false/nil/0-9
This provides a significant speedup for symbol, true, false,
nil, and 0-9, class/module, and a small speedup in most other cases.

Speedups (using included benchmarks):
:symbol        :: 60%
0-9            :: 50%
Class/Module   :: 50%
nil/true/false :: 20%
integer        :: 10%
[]             :: 10%
""             :: 3%

One reason this approach is faster is it reduces the number of
VM instructions for each interpolated value.

Initial idea, approach, and benchmarks from Eric Wong. I applied
the same approach against the master branch, updating it to handle
the significant internal changes since this was first proposed 4
years ago (such as CALL_INFO/CALL_CACHE -> CALL_DATA). I also
expanded it to optimize true/false/nil/0-9/class/module, and added
handling of missing methods, refined methods, and RUBY_DEBUG.

This renames the tostring insn to anytostring, and adds an
objtostring insn that implements the optimization. This requires
making a few functions non-static, and adding some non-static
functions.

This disables 4 YJIT tests.  Those tests should be reenabled after
YJIT optimizes the new objtostring insn.

Implements [Feature #13715]

Co-authored-by: Eric Wong <e@80x24.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-11-18 15:10:20 -08:00
Nobuyoshi Nakada 89b440bf72
Expect bool as `sort:` option at glob [Feature #18287] 2021-11-18 21:47:18 +09:00
Samuel Williams 81d0ce7e97 Mark IO::Buffer as experimental. 2021-11-10 19:21:05 +13:00
Samuel Williams 4b89034218 IO::Buffer for scheduler interface. 2021-11-10 19:21:05 +13:00
Koichi Sasada 77544caaf4 add `make runirb` rule
it's start irb on built ruby (not installed ruby).
2021-10-28 14:31:02 +09:00
Ian C. Anderson e943511455
YJIT: Implement duphash (#5009)
`duphash` showed up in the top-20 most frequent exit ops for @jhawthorn's benchmark that renders github.com/about

The implementation was almost exactly the same as `duparray`

Co-authored-by: John Hawthorn <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-10-25 10:40:33 -04:00
Yusuke Endoh 13068ebe32
process.c: Add Process._fork (#5017)
* process.c: Add Process._fork

This API is supposed for application monitoring libraries to hook fork
event.

[Feature #17795]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-10-25 20:47:19 +09:00
Nobuyoshi Nakada 185c573821
Add INSTRUBY_OPTS to INSTRUBY_ARGS [ci skip]
For extra options from the `make` command line.
Also add explicit `--install` option to install-nodoc.
2021-10-23 22:19:04 +09:00
Koichi Sasada 7185c00fcc freeze (make shareable) script_lines 2021-10-21 16:17:39 +09:00
Koichi Sasada c7550537f1 `RubyVM.keep_script_lines`
`RubyVM.keep_script_lines` enables to keep script lines
for each ISeq and AST. This feature is for debugger/REPL
support.

```ruby
RubyVM.keep_script_lines = true
RubyVM::keep_script_lines = true

eval("def foo = nil\ndef bar = nil")
pp RubyVM::InstructionSequence.of(method(:foo)).script_lines
```
2021-10-21 16:17:39 +09:00
Alan Wu 1e23b1a6c2 Actually, tabs are okay in Makefile 2021-10-20 18:19:43 -04:00
Alan Wu 454fbe1046 Expand tabs 2021-10-20 18:19:43 -04:00
Alan Wu 38f364b8f5 Update dependencies 2021-10-20 18:19:43 -04:00
Alan Wu ed723ca76f Remove yjit_backend to help with upstreaming
The new backend isn't used at the moment and adds to our diff against
upstream so remove it for now. We can reverse the removal later with git
history.
2021-10-20 18:19:42 -04:00
Alan Wu f6da559d5b Put YJIT into a single compilation unit
For upstreaming, we want functions we export either prefixed with "rb_"
or made static. Historically we haven't been following this rule, so we
were "leaking" a lot of symbols as `make leak-globals` would tell us.

This change unifies everything YJIT into a single compilation unit,
yjit.o, and makes everything unprefixed static to pass `make leak-globals`.
This manual "unified build" setup is similar to that of vm.o.

Having everything in one compilation unit allows static functions to
be visible across YJIT files and removes the need for declarations in
headers in some cases. Unnecessary declarations were removed.

Other changes of note:
  - switched to MJIT_SYMBOL_EXPORT_BEGIN which indicates stuff as being
    off limits for native extensions
  - the first include of each YJIT file is change to be "internal.h"
  - undefined MAP_STACK before explicitly redefining it since it
    collide's with a definition in system headers. Consider renaming?
2021-10-20 18:19:42 -04:00