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

2682 Коммитов

Автор SHA1 Сообщение Дата
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
Nobuyoshi Nakada ab31d2e69f
Add `--zone` option to `VCS`
Which controls the timezone offset for `RUBY_RELEASE_DATE`.
2022-09-30 10:39:43 +09:00
Nobuyoshi Nakada 5a5644dadc
Introduce `VCS::Null` for fallback 2022-09-30 10:39:42 +09:00
Nobuyoshi Nakada f70ba9cf80
Check for the availability of the command when detecting 2022-09-30 10:39:42 +09:00
Nobuyoshi Nakada 58b3a535cc
Pull up `VCS.short_revision` from `VCS::SVN` 2022-09-30 09:21:02 +09: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 247d598477
Install all file trees for lldb [ci skip]
It is no longer single lldb_cruby.py only.
2022-09-28 21:27:42 +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
Takashi Kokubun 7588f21851
Allow changing conversion macro in MJIT bindgen
This is necessary for object shapes.
2022-09-24 00:02:21 +09:00
Takashi Kokubun 0c9dc01a2a Skip struct fields whose output differs
across different environments
2022-09-23 06:44:28 +09:00
Takashi Kokubun dfc311c0b3 Swap the positions of offsetof and type 2022-09-23 06:44:28 +09:00
Takashi Kokubun dc5b536468 Bindgen offsetof struct and union with builtin
except for bit fields.

I made a risky assumption on leading bit fields and just gave up
non-leading bit fields for now. I'll change it to let C code access bit
fields later.
2022-09-23 06:44:28 +09:00
Takashi Kokubun 2ce1460c65 Bindgen sizeof struct and union with builtin 2022-09-23 06:44:28 +09:00
Takashi Kokubun 4c6e1556b1 Bindgen immediate types with builtin 2022-09-23 06:44:28 +09:00
Takashi Kokubun 280ff1707e Drop c_64 and c_32 2022-09-23 06:44:28 +09:00
Takashi Kokubun 5cda5938f8 Bindgen enum with builtin 2022-09-23 06:44:28 +09:00
Takashi Kokubun 2f5b37533e Builtin needs to be baseruby-compatible 2022-09-23 06:44:28 +09:00
Takashi Kokubun 591c3c7a1a Automatically setup bundler of bindgen.rb
to easily use it with `tool/mjit/bindgen.rb BUILDDIR` instead of using
`make mjit-bindgen`.
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 334b8bd459 Mix manual and auto-generated C APIs 2022-09-23 06:44:28 +09:00
Takashi Kokubun 00c441ce7a Bindgen macro with builtin 2022-09-23 06:44:28 +09:00
Takashi Kokubun e81a612413 Auto-generate mjit_c.rb.erb 2022-09-23 06:44:28 +09:00
Takashi Kokubun f2bea691cd Builtin RubyVM::MJIT::C 2022-09-23 06:44:28 +09:00
Takashi Kokubun 69130e1614
Expand paths used for dumper.rb
This seems to be needed on Samuel's environment
2022-09-22 21:07:22 +09:00
Aaron Patterson ec93d09c94 add rb_execution_context 2022-09-21 22:20:35 -07:00
Aaron Patterson 083b4bb655 add rb_control_frame_t 2022-09-21 22:20:35 -07:00
卜部昌平 45741918e1 reserved_word: just use gperf 3.1 declaration
The reason why this was commented out was because of gperf 3.0 vs 3.1
differences (see [Feature #13883]).  Five years passed, I am pretty
confident that we can drop support of old versions here.

Ditto for uniname2ctype_p(), onig_jis_property(), and zonetab().
2022-09-21 11:44:09 +09:00
Nobuyoshi Nakada 9de11fe796
Quiet if the target is already linked the same source 2022-09-20 12:54:08 +09:00
Takashi Kokubun b4546d26f2
Fix the trailing comma comment for builtin [ci skip]
so that it's clear why not args.last but args[1]
2022-09-20 09:43:50 +09:00
Takashi Kokubun 76a0e81f40
Support trailing commas in builtin
`foo(Primitive.cexpr!('Qnil'),)` causes SEGV without this change.
2022-09-20 07:38:58 +09:00
Nobuyoshi Nakada cc533cb607
Downloader: Define long option aliases 2022-09-19 01:09:47 +09:00
Nobuyoshi Nakada a0b0991eed
Downloader: Define per-class command line options
Move `Downloader::Unicode` specific options, and parse options after
the downloader specificier.
2022-09-19 01:09:47 +09:00
Takashi Kokubun a988fe0b3e
Introduce --basedir to insns2vm.rb
and leverage that to preserve the directory structure under tool/ruby_vm/views
2022-09-18 14:39:53 +09:00
Takashi Kokubun 12023c833f
Revert "Preserve the directory structure under tool/ruby_vm/views"
This reverts commit 62ec621f8c.

will revisit this once fixing non-MJIT targets
2022-09-18 14:21:40 +09:00
Takashi Kokubun 62ec621f8c
Preserve the directory structure under tool/ruby_vm/views
for nested target directories
2022-09-18 14:19:22 +09:00
Takashi Kokubun 0e816e6d30
Demote mjit_instruction.rb from builtin to stdlib 2022-09-18 14:04:20 +09:00
Takashi Kokubun 922e61fcc2
Remove git command existence check again
With 33c6dd2cc8, it's no longer necessary.

This is what I got on openbsd-current:

```
-bash-5.1$ git -v
unknown option: -v
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]
-bash-5.1$ git version
git version 2.35.1
```
2022-09-17 23:05:10 +09:00
Takashi Kokubun 33c6dd2cc8
Fallback to VCS.release_date on VCS::NotFoundError
when -q is given.

One of the RubyCI servers, freebsd12, had a broken git environment:

```
$ git show
fatal: detected dubious ownership in repository at '/usr/home/chkbuild/chkbuild/tmp/build/20220917T123002Z/ruby'
To add an exception for this directory, call:

        git config --global --add safe.directory /usr/home/chkbuild/chkbuild/tmp/build/20220917T123002Z/ruby
```

tool/lib/vcs.rb doesn't work normally for that server.
Even for such cases, we'd like to generate a usable revision.h.

So this patch lets revision.h fallback to default VCS.release_date
when VCS::NotFoundError is raised.
2022-09-17 22:24:10 +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 03ce48dac7
Emoji files header changed at 15.0 again 2022-09-17 12:37:48 +09:00
Nobuyoshi Nakada 76c0056505
Follow emoji data files header change
The header of emoji data files in UCD, which were moved at 13.0.0, has
been changed since 14.0.0.  It seems to be the same as other files in
UCD.
2022-09-17 12:37:48 +09:00
Hiroshi SHIBATA 6b2b9e0019 [rubygems/rubygems] Also added x86_64-darwin-21
https://github.com/rubygems/rubygems/commit/c03e7e1564
2022-09-15 12:50:48 +09:00
Hiroshi SHIBATA ec0d9a6a6f [rubygems/rubygems] Added arm64-darwin-22 to lockfiles for testing
https://github.com/rubygems/rubygems/commit/d7956e9ce5
2022-09-15 12:50:48 +09:00
Nobuyoshi Nakada c28a4e0340
Replace "Fixes"/"Fixed" in commit logs as well as vcs.rb [ci skip]
Use the same regexp to replace "(#NNNN)" and "GH-NNNN" style
references in vcs.rb, too.
2022-09-14 11:24:06 +09:00
Benoit Daloze 92b907d12d Enable deprecation warnings for test-all
* So deprecated methods/constants/functions are dealt with early,
  instead of many tests breaking suddenly when removing a deprecated
  method/constant/function.
* Follows https://bugs.ruby-lang.org/issues/17591
2022-09-10 13:14:18 +02:00
Nobuyoshi Nakada 9faa9ced96 Support sub-library in builtin-loader
Previously, it was supported in prelude.c, but has not followed up the
builtin-loader system.
2022-09-09 15:47:24 +09:00
Aaron Patterson 56e5210cde
More robust macro parser (#6343)
I want to use more complicated macros with MJIT.  For example:

```
  # define SHAPE_MASK (((unsigned int)1 << SHAPE_BITS) - 1)
```

This commit adds a simple recursive descent parser that produces an AST
and a small visitor that converts the AST to Ruby.
2022-09-09 15:19:23 +09:00
Nobuyoshi Nakada 59eadf3d25
Ignore EACCES on Windows 2022-09-09 11:36:15 +09:00