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

1860 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA d275adde78 Pin simplecov-0.20.0 2023-01-18 20:19:08 +09:00
Hiroshi SHIBATA 18d8333c30 Switch to use gem version of simplecov, not git clone 2023-01-18 20:19:08 +09:00
Takashi Kokubun 5fc97f34c6 benchmark_driver v0.16.3
Some chruby-related features and bug fixes.
2023-01-17 22:26:45 -08:00
Hiroshi SHIBATA 01e28afd0a
test-syntax-suggest is now part of make check 2023-01-17 16:56:57 +09:00
Hiroshi SHIBATA aad1563c1a
Added make exam to help message 2023-01-17 16:50:19 +09:00
Hiroshi SHIBATA da7818e682
Added test-syntax-suggest to help message 2023-01-17 16:48:44 +09:00
Hiroshi SHIBATA ff3c1d9e13
SimpleCov is hosted under simplecov-ruby org now 2023-01-17 14:31:36 +09:00
Alan Wu 14fe7a081a YJIT: Use ThinLTO for Rust parts in release mode
This reduces the code size of libyjit.a by a lot. On darwin it went from
23 MiB to 12 MiB for me. I chose ThinLTO over fat LTO for the relatively
fast build time; in case we need to debug release-build-only problems
it won't be painful.
2023-01-16 17:32:15 -05:00
Nobuyoshi Nakada 088132fb33 Do not depend on `REVISION_H`
Disable for now, since this seems causing infinite rebuilding.
2023-01-15 17:21:59 +09:00
Nobuyoshi Nakada 1ddeb7473d
Move the dependency of makefiles on revision header [ci skip]
Since `REVISION_H` is defined in common.mk which is appended or
included after Makefile.in, it was undefined yet at the point of the
dependency.
2023-01-14 20:30:19 +09:00
Hiroshi SHIBATA fe11bee507
Suppressing installation messages with test-bundler
Ignoring the following messages:

    ```
    (snip)
            -e 'load "spec/bundler/support/bundle.rb"' -- install --gemfile=tool/bundler/dev_gems.rb
    Using rake 13.0.6
    Using bundler 2.5.0.dev
    Using diff-lcs 1.5.0
    Using parallel 1.22.1
    Using parallel_tests 2.32.0
    Using power_assert 2.0.2
    Using rb_sys 0.9.52
    Using rspec-support 3.12.0
    Using rspec-core 3.12.0
    Using rspec-expectations 3.12.0
    Using rspec-mocks 3.12.1
    Using test-unit 3.5.5
    Using uri 0.12.0
    Using webrick 1.7.0
    Bundle complete! 11 Gemfile dependencies, 14 gems now installed.
    Gems in the groups 'lint' and 'doc' were not installed.
    Use `bundle info [gemname]` to see where a bundled gem is installed.
    ```
2023-01-12 10:46:54 +09:00
Hiroshi SHIBATA b311c35bdb Suppressing pending messages with RSpec 2023-01-11 20:00:21 +09:00
Takashi Kokubun df76c54fc2 Allow overriding a gdb command on `make gdb`
With --enable-yjit, you see an annoying warning like this:

warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/k0kubun/src/github.com/ruby/ruby/.ruby/miniruby.
Use `info auto-load python-scripts [REGEXP]' to list them.

Using `rust-gdb` instead fixes it. I use this like `make gdb GDB=rust-gdb`.
2023-01-09 16:45:50 -08:00
Yusuke Endoh 4959e01932 common.mk: Do not invoke outdate-bundled-gems by default
If baseruby is available (and its version is different from one being
built) when compiling ruby, tool/outdate-bundled-gems.rb (which is
invoked by `make install`) wrongly deletes debug.so and rbs_extension.so
in .bundle/extension/*.

This leads to a broken installation of ruby which lacks the libraries,
which may make rubygems show the following warnings (in some additional
complex conditions):

```
$ irb
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
irb(main):001:0>
```

According to some committers, tool/outdate-bundled-gems.rb is introduced
for fixing a build issue, but the detail is not recorded. The issue
seems to occur only when debug gem or rbs gem is updated, so it is
difficult to fix the script so soon.

Tentatively, this change stops invoking the script by default.
This should be backported to ruby_3_2.

Fixes [Bug #19271]
2023-01-05 18:26:35 +09:00
Nobuyoshi Nakada c6c7f5900f Test bundler and bundled gems by exam 2022-12-28 09:15:31 +09:00
Nobuyoshi Nakada 84a4f1b3b2 Order test-bundler-parallel dependency 2022-12-28 09:15:31 +09:00
Nobuyoshi Nakada be7cb324a5
Clean yjit directory in build directory [ci skip] 2022-12-25 12:19:23 +09:00
Nobuyoshi Nakada 18c1ca8f4c
Fix test-syntax-suggest order
Prepare for test-syntax-suggest after other tests finished.
2022-12-24 20:18:10 +09:00
Takashi Kokubun b9332ac8e7
MJIT: Cancel all on disastrous situations (#7019)
I noticed this while running test_yjit with --mjit-call-threshold=1, 
which redefines `Integer#<`. When Ruby is monkey-patched, 
MJIT itself could be broken.

Similarly, Ruby scripts could break MJIT in many different ways. I
prepared the same set of hooks as YJIT so that we could possibly
override it and disable it on those moments. Every constant under
RubyVM::MJIT is private and thus it's an unsupported behavior though.
2022-12-24 01:13:40 -08:00
Nobuyoshi Nakada cae5384273 Test syntax_suggest by `make check` 2022-12-23 20:33:27 +09:00
Takashi Kokubun bb4cbd0803
Put RubyVM::MJIT::Compiler under ruby_vm directory (#6989)
[Misc #19250]
2022-12-21 22:46:15 -08:00
Benoit Daloze d557f17974 Use an experimental warning for Fiber#storage= 2022-12-20 19:32:23 +01:00
Nobuyoshi Nakada 5716c0f1f8
MSVS lacks `touch` [ci skip] 2022-12-20 17:53:41 +09:00
Nobuyoshi Nakada 0ccc498e6e
loadpath.c does not depend on revision.h since 947ebd0ac5 2022-12-20 16:06:32 +09:00
Hiroshi SHIBATA 5e5f3f6bd1
Followed up ad18d1297e with tool/update-deps --fix 2022-12-16 13:59:04 +09:00
Peter Zhu c505448cdb Move definition of SIZE_POOL_COUNT back to gc.h
SIZE_POOL_COUNT is a GC macro, it should belong in gc.h and not shape.h.
SIZE_POOL_COUNT doesn't depend on shape.h so we can have shape.h depend
on gc.h.

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2022-12-15 16:33:46 -05:00
Alan Wu 258ac07907
YJIT: Generate debug info in release builds (#6910)
* YJIT: Generate debug info in release builds

They are helpful in case we need to do core dump debugging.

* Remove Cirrus DOC skip rule

The syntax for this is weird, and escaping [ and ] cause parse failures.
Cirrus' docs said to surround with .*, but then that seems to skip
everything. Revert e0a4205eb7 for now.
2022-12-12 15:59:29 -05:00
Nobuyoshi Nakada 7a976c1060
[Bug #19181] Separate the rule for unicode_normalize/tables.rb timestamp
It should depends on only existing data files (except for the tools),
unless `ALWAYS_UPDATE_UNICODE=yes`.
2022-12-10 13:58:20 +09:00
Jean Boussier 73771e4b19 ObjectSpace.dump_all: dump shapes as well
I see several arguments in doing so.

First they use a non trivial amount of memory, so for various memory
profiling/mapping tools it is relevant to have visibility of the space
occupied by shapes.

Then, some pathological code can create a tons of shape, so it is
valuable to have a way to have a way to observe shapes without having
to compile Ruby with `SHAPE_DEBUG=1`.

And additionally it's likely much faster to dump then this way than
to use `RubyVM::Shape`.

There are however a few open questions:

- Shapes can't respect the `since:` argument. Not sure what to do when
  it is provided. Would probably make sense to not dump them.
- Maybe it would make more sense to have a separate `ObjectSpace.dump_shapes`?
- Maybe instead `dump_all` should take a `shapes: false` argument?

Additionally, `ObjectSpace.dump_shapes` is added for the use case of
debugging the evolution of the shape tree.
2022-12-08 18:46:16 +01:00
Aaron Patterson edc7af48ac Stop transitioning to UNDEF when undefining an instance variable
Cases like this:

```ruby
obj = Object.new
loop do
  obj.instance_variable_set(:@foo, 1)
  obj.remove_instance_variable(:@foo)
end
```

can cause us to use many more shapes than we want (and even run out).
This commit changes the code such that when an instance variable is
removed, we'll walk up the shape tree, find the shape, then rebuild any
child nodes that happened to be below the "targetted for removal" IV.

This also requires moving any instance variables so that indexes derived
from the shape tree will work correctly.

Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
Co-authored-by: John Hawthorn <jhawthorn@github.com>
2022-12-07 09:57:11 -08:00
Daniel Colson 64cdf8bae7 Update dependencies 2022-12-06 12:37:23 -08:00
Nobuyoshi Nakada e9a0f45dc4
[Bug #19180] rbconfig.rb depends on common.mk 2022-12-06 11:06:15 +09:00
Martin Dürst f82a38be26 change Unicode version to 15.0.0 2022-12-06 10:11:33 +09:00
Nobuyoshi Nakada 30379e33c3
Handle depend files on nmake 2022-12-05 17:09:49 +09:00
Nobuyoshi Nakada facb5cd4d5
Clean compiler intermediate files more 2022-12-05 17:09:49 +09:00
S-H-GAMELINKS 1a64d45c67 Introduce encoding check macro 2022-12-02 01:31:27 +09:00
Takashi Kokubun a1d70f5b12 MJIT: Rename mjit_compile_attr to mjit_sp_inc
There's no mjit_compile.inc, so no need to use this prefix anymore.
2022-11-29 21:45:34 -08:00
Takashi Kokubun 7a2b1364ef MJIT: Merge mjit_unit.h into mjit_c.h
The distinction doesn't make much difference today.
2022-11-29 21:34:46 -08:00
Takashi Kokubun ecc15bc94a MJIT: Rename mjit_compiler.c to mjit_c.c
It's no longer about the compiler logic itself.
2022-11-29 21:26:59 -08:00
Nobuyoshi Nakada ed4b5c4f21
Extract outdate-bundled-gems.rb 2022-11-29 18:12:43 +09:00
Nobuyoshi Nakada 8e3ac264df
Fix dependencies of outdate-bundled-gems
Extract new gems then remove outdated gem directories.
2022-11-29 18:12:43 +09:00
Nobuyoshi Nakada aacaa2ec5e
Refine outdate-bundled-gems 2022-11-29 18:12:43 +09:00
Takashi Kokubun acb76663ba MJIT: Rename mjit_compiler.h to mjit_c.h
because it exists primarily for generating mjit_c.rb.
2022-11-28 21:23:14 -08:00
Nobuyoshi Nakada b649850d4a
Force to update revision.h after the source updated [ci skip] 2022-11-28 23:36:58 +09:00
Takashi Kokubun b2dcde839d MJIT: Merge mjit_compiler.rb into mjit.rb
There are too many mjit_compiler.* files. It was hard to find files.
2022-11-26 15:31:38 -08:00
zverok eaf2b6c439 Add Time#deconstruct_keys 2022-11-22 23:10:46 +02:00
Nobuyoshi Nakada 65e31402ae
Use double quotes for nmake [ci skip] 2022-11-21 16:35:28 +09:00
Nobuyoshi Nakada 166598a6eb
Add outdate-bundled-gems target [ci skip] 2022-11-21 15:10:29 +09:00
Nobuyoshi Nakada 01bc2fc514
Update fake.rb for test-spec
spec/ruby/command_line/dash_v_spec.rb needs it.
2022-11-20 01:10:40 +09:00
Nobuyoshi Nakada 24cbc50c76 Remove duplicate `.rbinc` on `.rb` dependencies 2022-11-16 20:47:23 +09:00
Takashi Kokubun fca50abb7c
Let mjit-bindgen use BASERUBY and bundle/inline (#6740) 2022-11-15 23:42:41 -08:00
Takashi Kokubun e7443dbbca
Rewrite Symbol#to_sym and #intern in Ruby (#6683) 2022-11-15 21:34:30 -08:00
Nobuyoshi Nakada ac063fd4c4
Depending on revision.h with VPATH 2022-11-16 00:44:34 +09:00
Nobuyoshi Nakada 1221c77489
Clean YJIT libraries [ci skip] 2022-11-14 22:41:59 +09:00
Nobuyoshi Nakada 3fae53a343
[Bug #19127] Fix revision.h dependency when no baseruby
Disconnect the dependency of revision.h on the timestamp file if no
baseruby is available
2022-11-14 18:59:06 +09:00
Nobuyoshi Nakada 2f7d2662dd
Control non-parallel parts with `.WAIT` if available 2022-11-13 23:54:43 +09:00
Jemma Issroff 5246f4027e Transition shape when object's capacity changes
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.

This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-11-10 10:11:34 -05:00
Nobuyoshi Nakada b7504af8fc Preprocess for older bison is no longer needed 2022-11-10 09:51:50 +09:00
Nobuyoshi Nakada 9627aab825
`--disable-jit-support` should disable YJIT successfully
Even if `rustc` is available, it should not be an error unless
`--enable-yjit` is explicitly given.
2022-11-06 17:07:44 +09:00
Nobuyoshi Nakada 1454f8f219 Add `--target` option to RUSTC when cross-compiling 2022-11-06 06:47:38 +09:00
Nobuyoshi Nakada 6b90910973
Update dependencies 2022-11-05 00:18:02 +09:00
Takashi Kokubun 1956fb9b78
Bump benchmark-driver version
https://github.com/benchmark-driver/benchmark-driver/pull/75 is useful
for quickly benchmarking a single method in CRuby.
2022-11-03 17:27:37 -07:00
Nobuyoshi Nakada 265a96b005 Manage the timestamp for revision.h 2022-11-02 11:10:00 +09:00
Nobuyoshi Nakada 37593c7950
Ignore failure at moving revision.h [ci skip]
The source directory may be read-only.
2022-10-30 20:35:41 +09: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
Takashi Kokubun e7c71c6c92
Make mjit_cont sharable with YJIT (#6556)
* Make mjit_cont sharable with YJIT

* Update dependencies

* Update YJIT binding
2022-10-17 09:27:59 -07:00
Samuel Williams ced1d17280
Improvements to IO::Buffer implementation and documentation. (#6525) 2022-10-12 12:59:05 +13:00
Jemma Issroff ad63b668e2
Revert "Revert "This commit implements the Object Shapes technique in CRuby.""
This reverts commit 9a6803c90b.
2022-10-11 08:40:56 -07:00
Aaron Patterson 9a6803c90b
Revert "This commit implements the Object Shapes technique in CRuby."
This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
2022-09-30 16:01:50 -07:00
Jemma Issroff d594a5a8bd
This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-28 08:26:21 -07:00
Nobuyoshi Nakada 09bce061af bootstraptest/runner: manage sub processes with the job server 2022-09-28 23:18:55 +09:00
Aaron Patterson 06abfa5be6
Revert this until we can figure out WB issues or remove shapes from GC
Revert "* expand tabs. [ci skip]"

This reverts commit 830b5b5c35.

Revert "This commit implements the Object Shapes technique in CRuby."

This reverts commit 9ddfd2ca00.
2022-09-26 16:10:11 -07:00
Jemma Issroff 9ddfd2ca00 This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-26 09:21:30 -07:00
Samuel Williams 411d0eec11
Update `IO::Buffer` read/write to use rb_thread_io_blocking_region. (#6438) 2022-09-26 19:37:28 +13:00
Samuel Williams 025b8701c0
Add several new methods for getting and setting buffer contents. (#6434) 2022-09-26 18:06:12 +13:00
Takashi Kokubun 5cda5938f8 Bindgen enum with builtin 2022-09-23 06:44:28 +09:00
Takashi Kokubun 4e0db2f753 mjit_c.rb doesn't need to be an erb 2022-09-23 06:44:28 +09:00
Takashi Kokubun f2bea691cd Builtin RubyVM::MJIT::C 2022-09-23 06:44:28 +09:00
Alan Wu a8dc49b4d5 YJIT: Support MAKE=bmake for release build
This add support for bmake, which should allow building with
`configure --enable-yjit` for the BSDs. Tested on FreeBSD 13 and
on macOS with `configure MAKE=bmake` on a case-sensitive file system.

It works by including a fragment into the Makefile through the configure
script, similar to common.mk. It uses the always rebuild approach to
keep build system changes minimal.
2022-09-20 14:17:27 -04:00
Yusuke Endoh b3d8dddee7 Try to ignore a noisy ASAN warning for continuation 2022-09-20 22:25:05 +09:00
Nobuyoshi Nakada ea22403653
Extract UNICODE_DOWNLOADER 2022-09-19 01:09:47 +09:00
Takashi Kokubun e2e1058e66
Include lib/mjit/instruction.rb in a snapshot
baseruby shouldn't be necessary once a snapshot is built.
2022-09-18 21:21:37 +09:00
Takashi Kokubun 45ecc30a63 Move mjit/instruction.rb rule to common.mk
as suggested by nobu. We don't really need to generate this for Windows,
but using common.mk whenever possible would probably make maintenance
easier.
2022-09-18 21:16:15 +09:00
Takashi Kokubun 0e816e6d30
Demote mjit_instruction.rb from builtin to stdlib 2022-09-18 14:04:20 +09:00
Takashi Kokubun 67417e795a
Replace revision.tmp with the HAVE_BASERUBY trick
but without relying on replacement.

This seems to work on OpenBSD as well.
2022-09-18 00:10:30 +09:00
Takashi Kokubun 39f91bc24b
Always generate non-empty revision.h
Non-GNU make seems to generate empty revision.h, but it doesn't make
sense since https://github.com/ruby/ruby/pull/6382.

Also the $(HAVE_BASERUBY:yes=tmp) hack doesn't seem to be working on
OpenBSD. I'll remove it to focus on fixing RubyCI first, and then deal
with baseruby-missing environments. At least a snapshot should have
revision.h and it might work fine though.
2022-09-17 23:44:14 +09:00
Takashi Kokubun 38a7a13ac6
Auto-generate the release date on version.h from git CommitDate (#6382)
* Auto-generate the release date on version.h

from git CommitDate

* Generate revision.h on mswin
2022-09-17 21:16:06 +09:00
Nobuyoshi Nakada ca4cbe59ed
Move case-folding.rb to tooldir with enc-prefix 2022-09-17 12:37:48 +09:00
Nobuyoshi Nakada e9982fd679
Derive UNICODE_EMOJI_VERSION from UNICODE_VERSION 2022-09-17 12:37:48 +09:00
Nobuyoshi Nakada c8d94d2797
Now test-bundler nees fake.rb 2022-09-16 14:46:21 +09:00
Nobuyoshi Nakada b6a9e68391
Add noarch-fake.rb target
`yes-fake` depends on it when `arch=noarch` is given, but the rule to
generate it from fake.rb.in is ignored now.
2022-09-15 00:31:35 +09:00
Nobuyoshi Nakada 2e324b645e Manage paths for bundler tests 2022-09-14 11:27:05 +09:00
Nobuyoshi Nakada 035978d7be Pass job-server FDs to bundler tests 2022-09-14 11:27:05 +09:00
Benoit Daloze 14bcf69c9c Deprecate Encoding#replicate
* See [Feature #18949].
2022-09-10 19:02:15 +02:00
Nobuyoshi Nakada c722597103
[MSWin] Get rid of single quotes in sed command lines
GnuWin32 sed strips only double quotes, but not single quotes, and
dies:

```
sed: -e expression #1, char 1: unknown command: `''
```
2022-09-10 20:50:37 +09:00
Nobuyoshi Nakada bcf82b7c26
Process token IDs from id.def without id.h
Fixes id.h error during updating ripper.c by `make after-update`.

While it used to update id.h in the build directory, but was trying to
update ripper.c in the source directory.  In principle, files in the
source directory can or should not depend on files in the build
directory.
2022-09-08 18:22:47 +09:00
Nobuyoshi Nakada 35c493ecf5
Dump cross.rb only when verbose [ci skip] 2022-09-07 14:48:54 +09:00
Nobuyoshi Nakada 1f91dcdab3
Define BOOTSTRAPRUBY from HAVE_BASERUBY 2022-09-07 14:33:25 +09:00
Nobuyoshi Nakada 6a43245e6c
Use BOOTSTRAPRUBY_COMMAND instead of fake.rb directly 2022-09-07 10:08:24 +09:00
Takashi Kokubun 06eb9af8c0
Add mjit-bindgen workflow (#6327) 2022-09-05 01:06:37 -07:00
Takashi Kokubun 3767c6a90d
Ruby MJIT (#6028) 2022-09-04 21:53:46 -07:00
Nobuyoshi Nakada 76664905a5
Ignore fake.rb for snapshot 2022-09-04 23:59:55 +09:00
Nobuyoshi Nakada 45004bba6b
fake.rb needs id.h 2022-09-04 02:07:11 +09:00
Nobuyoshi Nakada 7b11247b4d
Fix potential target type confliction [ci skip] 2022-09-03 21:02:29 +09:00
Nobuyoshi Nakada 7c67d0fd79
Make sources by BASERUBY if available instead of miniruby 2022-09-03 19:25:29 +09:00
Nobuyoshi Nakada 8f13d75a8c
Generate the prelude sources by common-srcs 2022-09-03 19:20:03 +09:00
Nobuyoshi Nakada 6f5305e0d2
Exclude LIBPATHENV wrapper from PREP 2022-09-03 19:20:03 +09:00
Nobuyoshi Nakada d8f81ffdff
builtin.c includes mini_builtin.c when cross-compiling 2022-09-03 19:20:03 +09:00
Nobuyoshi Nakada bc5b9be1ee
Move duplicate dependencies 2022-09-03 15:01:05 +09:00
John Hawthorn 679ef34586 New constant caching insn: opt_getconstant_path
Previously YARV bytecode implemented constant caching by having a pair
of instructions, opt_getinlinecache and opt_setinlinecache, wrapping a
series of getconstant calls (with putobject providing supporting
arguments).

This commit replaces that pattern with a new instruction,
opt_getconstant_path, handling both getting/setting the inline cache and
fetching the constant on a cache miss.

This is implemented by storing the full constant path as a
null-terminated array of IDs inside of the IC structure. idNULL is used
to signal an absolute constant reference.

    $ ./miniruby --dump=insns -e '::Foo::Bar::Baz'
    == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE)
    0000 opt_getconstant_path                   <ic:0 ::Foo::Bar::Baz>      (   1)[Li]
    0002 leave

The motivation for this is that we had increasingly found the need to
disassemble the instructions between the opt_getinlinecache and
opt_setinlinecache in order to determine the constant we are fetching,
or otherwise store metadata.

This disassembly was done:
* In opt_setinlinecache, to register the IC against the constant names
  it is using for granular invalidation.
* In rb_iseq_free, to unregister the IC from the invalidation table.
* In YJIT to find the position of a opt_getinlinecache instruction to
  invalidate it when the cache is populated
* In YJIT to register the constant names being used for invalidation.

With this change we no longe need disassemly for these (in fact
rb_iseq_each is now unused), as the list of constant names being
referenced is held in the IC. This should also make it possible to make
more optimizations in the future.

This may also reduce the size of iseqs, as previously each segment
required 32 bytes (on 64-bit platforms) for each constant segment. This
implementation only stores one ID per-segment.

There should be no significant performance change between this and the
previous implementation. Previously opt_getinlinecache was a "leaf"
instruction, but it included a jump (almost always to a separate cache
line). Now opt_getconstant_path is a non-leaf (it may
raise/autoload/call const_missing) but it does not jump. These seem to
even out.
2022-09-01 15:20:49 -07:00
Hiroshi SHIBATA 098a3cfaa7 Fixed typo 2022-08-26 12:15:47 +09:00
Hiroshi SHIBATA bd1b1eeb0e ruby-prof is now optional 2022-08-26 12:15:47 +09:00
Hiroshi SHIBATA 9c2af0a171 added test-syntax-suggest and prepare tasks 2022-08-26 12:15:47 +09:00
Hiroshi SHIBATA 6afb4f0a28
Added help entry for test-bundler-parallel 2022-08-22 12:23:38 +09:00
Takashi Kokubun a60507f616
Rename mjit_compile.c to mjit_compiler.c
I'm planning to introduce mjit_compiler.rb, and I want to make this
consistent with it. Consistency with compile.c doesn't seem important
for MJIT anyway.
2022-08-21 11:33:06 -07:00
Nobuyoshi Nakada f6d4d73abd
Use `rb_fork` to suppress deprecated-declarations warnings 2022-08-21 14:04:52 +09:00
Nobuyoshi Nakada 72adee6e36 Update dependencies 2022-08-17 15:23:01 +09:00
John Hawthorn 0608a9a086
Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229)
* Optimize Marshal dump of large fixnum

Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit
platforms the 63-bit fixnums need to be represented in Marshal's
BIGNUM.

Previously this was done by converting to a bugnum and serializing the
bignum object.

This commit avoids allocating the intermediate bignum object, instead
outputting the T_FIXNUM directly to a Marshal bignum. This maintains the
same representation as the previous implementation, including not using
LINKs for these large fixnums (an artifact of the previous
implementation always allocating a new BIGNUM).

This commit also avoids unnecessary st_lookups on immediate values,
which we know will not be in that table.

* Fastpath for loading FIXNUM from Marshal bignum

* Run update-deps
2022-08-15 16:14:12 -07:00
Nobuyoshi Nakada cb12d7c71b
Update dependencies 2022-08-14 19:45:55 +09:00
Nobuyoshi Nakada 0c9803b0fd
The "gems" build directory was rename as ".bundle" 2022-08-11 17:45:39 +09:00
Nobuyoshi Nakada 44a0a66559
Move to tool/lib/bundled_gem.rb 2022-08-05 09:44:18 +09:00
Nobuyoshi Nakada 41516b3541
Extract bundled gems by BASERUBY 2022-08-05 09:44:18 +09:00
Nobuyoshi Nakada 6a8f1a9e5c
Copy from bundled gem source for test 2022-08-05 09:44:18 +09:00
Nobuyoshi Nakada 87d8d25796
Use configured GIT 2022-08-05 09:39:47 +09:00
Jean Boussier e3aabe93aa Implement Queue#pop(timeout: sec)
[Feature #18774]

As well as `SizedQueue#pop(timeout: sec)`

If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
2022-08-02 11:04:28 +02:00
Nobuyoshi Nakada e0a7e5e131
Kill bundled gem tests when interrupted 2022-07-24 16:36:33 +09:00
Nobuyoshi Nakada 804b073573 Update common sources including id.h after update 2022-07-21 22:32:33 +09:00
Peter Zhu 1c9acb6bb1 Refactor macros of array.c
Move some macros in array.c to internal/array.h so that other files
can also access these macros.
2022-07-21 09:02:45 -04:00
Jemma Issroff ecff334995 Extract vm_ic_entry API to mimic vm_cc behavior 2022-07-18 12:44:01 -07:00
Nobuyoshi Nakada 64cff78005 `Gem.unpack` extracts gems so able to execute
Creates simple bin stubs to load the extracted executable files.
After only extracted under `gems` directory, the gems are considered
installed but the executable scripts are not found.
Also the second argument is now the parent of the previous second and
third arguments.
2022-07-17 19:57:48 +09:00
Nobuyoshi Nakada 5101671cbc
Disable parallel built in test-bundled-gems 2022-07-16 15:28:05 +09:00
Nobuyoshi Nakada b536ac2cd0
test-bundled-gems.rb needs `+` with GNU make
This script runs `make` internally, and sub-`make`s need the
environment variable for the job server when compiling in parallel.
2022-07-16 11:26:15 +09:00
Takashi Kokubun 6c2cad835a MJIT: Share rb_mjit_unit through mjit_unit.h
mjit_compile.c should be able to access this more easily.
2022-07-14 22:54:20 -07:00
Takashi Kokubun 439d31bc77
MJIT: Merge mjit_worker.c back to mjit.c (#6138)
Since #6006, we no longer avoid executing GC on mjit_worker.c and thus
there's no need to carefully change how we write code whether you're in
mjit.c or mjit_worker.c anymore.
2022-07-14 20:34:46 -07:00
Kevin Backhouse 8c1808151f
Fix some UBSAN false positives (#6115)
* Fix some UBSAN false positives.
* ruby tool/update-deps --fix
2022-07-12 11:48:10 -07:00
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