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

2889 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun 0b2aea861c Polish the public docs for MJIT [ci skip]
Now every private interface is cleaned up, and the public interface is
documented.
2022-12-22 14:30:09 -08:00
Takashi Kokubun bb4cbd0803
Put RubyVM::MJIT::Compiler under ruby_vm directory (#6989)
[Misc #19250]
2022-12-21 22:46:15 -08:00
Nobuyoshi Nakada 398aaed2f0
Fix the case trailer without newline
cf0b413ef8
2022-12-22 00:34:21 +09:00
Soutaro Matsumoto 6af6857ecf
Set up RBS_SKIP_TESTS (#6862)
* Set up RBS_SKIP_TESTS
2022-12-21 22:11:51 +09:00
Nobuyoshi Nakada befc99c008
[DOC] tool/update-NEWS-refs.rb: Align footnotes 2022-12-21 20:48:51 +09:00
Nobuyoshi Nakada c7c006cc68
[DOC] tool/update-NEWS-refs.rb: Remove extra brackets
Surrounding with brackets is just a convention for the bugs tracker
links.
2022-12-21 20:48:51 +09:00
Yuta Saito afd46429fc tool/m4/ruby_wasm_tools.m4: force passing WASI_SDK_PATH when building for wasi
Make the WASI_SDK_PATH variable mandatory when building for wasi host.
This requirement prevents developers from being stuck due to unfriendly
configuration's error message.
2022-12-21 11:19:23 +09:00
Nobuyoshi Nakada 031bc21abb
expand-config.rb: search revision.h to extract release date 2022-12-20 17:40:19 +09:00
Yusuke Endoh 2605ff79aa tool/update-NEWS-refs.rb: Accept non-redmine url links 2022-12-19 14:48:18 +09:00
Yusuke Endoh b9ea83fc1c Update NEWS.md
Regexp optimization and Wasm support are added.
2022-12-16 02:21:50 +09:00
Hiroshi SHIBATA f2690be746
Removed temporary workaround for syntax_suggest tags 2022-12-16 15:48:00 +09:00
Hiroshi SHIBATA 49b0f3b024 Merge RubyGems/Bundler master
Pick from 084f7d1f21
2022-12-15 19:06:40 +09:00
Samuel Williams d20bd06a97
Remove `require 'io/wait'` where it's no longer necessary. (#6932)
* Remove `require 'io/wait'` as it's part of core now.

* Update ruby specs using version gates.

* Add note about why it's conditional.
2022-12-15 11:37:01 +13:00
Hiroshi SHIBATA 20c34f10d7
Use versioning sort for released version detection 2022-12-14 15:46:19 +09:00
Takashi Kokubun abf9a32182
Match ABI versions precisely
"3.2.0+33" starts with "3.2.0+3", but it doesn't mean that they are the
same ABI version.
2022-12-13 22:07:42 -08:00
Jimmy Miller 2d5b723b2f
Fix build when enable_shared is on (#6924)
Before this change, if enable_shared was true, the directory would have a suffix of -static and be deleted on each make install. This would cause a second make install to fail.
2022-12-13 21:59:21 -08:00
Hiroshi SHIBATA 03927b565b
Pin syntax_suggest-1.0.1 manually because it mixed dead_end tags 2022-12-14 12:57:30 +09:00
Takashi Kokubun 3262842e0a
Skip calling f.read for `overwrite: true`-only cases
We only need to set outpath for that case.
2022-12-13 00:25:02 -08:00
Takashi Kokubun 5ba9dcff16
Make sure f.read is not called twice
--revision.h and --if-change are not used simultaneously, but they might
be in the future.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-12-13 00:17:47 -08:00
Takashi Kokubun 7edcdc380f
Avoid overwriting revision.h when .git doesn't exist (#6915)
* Avoid overwriting revision.h when .git doesn't exist

* Overwrite revision.h if it's blank
2022-12-12 23:34:30 -08:00
David Rodríguez 17559f0420 Don't leave backup file around
I suspect this was for debugging? If not, these days we have source
control tools, so this wouldn't seem necessary?
2022-12-13 07:01:52 +09:00
Nobuyoshi Nakada 6d6b1e5990
Display error messages outside the groups so can be found quickly 2022-12-12 23:32:37 +09:00
Nobuyoshi Nakada e809bd31fd
Fix positional argument color [ci skip] 2022-12-12 23:32:37 +09:00
Nobuyoshi Nakada 0ba65c689e
outdate-bundled-gems.rb: check for gemspec files for extensions
https://github.com/ruby/setup-ruby/issues/415#issuecomment-1345662263
2022-12-12 17:05:37 +09:00
Nobuyoshi Nakada ff6831c334
outdate-bundled-gems.rb: remove unused option 2022-12-12 17:05:03 +09:00
Hiroshi SHIBATA bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
Nobuyoshi Nakada 0645c8b3c1
[DOC] Fix update-NEWS-refs.rb
* Issue numbers are path components but not fragments
* Align justification width to Feature lines
2022-12-10 19:01:29 +09:00
Hiroshi SHIBATA 2efaa80523
Don't sync jar artifact of CGI 2022-12-08 12:22:02 +09: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
Yusuke Endoh bcd8b2f00a NEWS.md: Added some missing features
Also, tool/update-NEWS-refs.rb is added to help the update of NEWS.md.
2022-12-07 12:32:29 +09:00
Nobuyoshi Nakada 901471ab8a
[Bug #18623] Link only existing excutables to make runnable [ci skip] 2022-12-06 17:52:58 +09:00
Yuta Saito 48644e7109 tool/runruby.rb: remove LD_PRELOAD-like env-var options from runruby.rb
LD_PRELOAD sometimes forces loading libraries into unrelated
executables. For example, macOS on recent Apple Silicon can execute
arm64 and arm64e binaries by default, and /usr/bin/clang is built as
arm64e. If Ruby is built as arm64, and mkmf launched through runruby.rb
spawns /usr/bin/clang, dynamic loader tries to load libruby (arm64e)
into clang (arm64). This force-load causes library load failure.
In theory, we don't need both LD_PRELOAD and LD_LIBRARY_PATH at the same
time, because executables requiring libruby already have libruby
dependency, so LD_LIBRARY_PATH is enough for this case.
2022-12-05 17:24:17 +09:00
Nobuyoshi Nakada c2671fa051
downloader.rb: Select less components path 2022-12-03 02:03:23 +09:00
Nobuyoshi Nakada e558c374b7
downloader.rb: Fix link to absolute cache path 2022-12-03 01:28:34 +09:00
Takashi Kokubun 07ac707758 MJIT: Use install = true for bundler/inline
It prints a `bundle install`-like output, which seems more useful than
a silent output.
2022-12-01 23:56:02 -08:00
Nobuyoshi Nakada d752cf7601 Use class methods of `File` over `Kernel.open` and `IO.read` 2022-12-01 02:28:49 +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
Nobuyoshi Nakada ed4b5c4f21
Extract outdate-bundled-gems.rb 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 ee11090b28 sync_default_gems.rb: move default_branch to REPOSITORIES
`sync_default_gems_with_commits` also needs the default branch.
2022-11-28 20:55:09 +09:00
Nobuyoshi Nakada 6559ba3b5c sync_default_gems.rb: suppress a duplicated range warning 2022-11-28 20:55:09 +09:00
Nobuyoshi Nakada d72f6749cb sync_default_gems.rb: adjust indent [ci skip] 2022-11-28 20:55:09 +09:00
Nobuyoshi Nakada 906a2f067d
sync_default_gems.rb: extend for singleton methods 2022-11-28 17:17:06 +09:00
Nobuyoshi Nakada 93e87c0217 Fix the case of multiple trailers 2022-11-28 16:30:40 +09:00
Nobuyoshi Nakada 5a171ee4c0 Add tests for sync_default_gems.rb 2022-11-28 16:30:40 +09:00
Takashi Kokubun 6844bcc6b4 MJIT: Use a String buffer in builtin compilers
instead of FILE*.

Using C.fprintf is slower than String manipulation on memory. I'm going
to change the way MJIT writes files, and this is a prerequisite for it.
2022-11-27 21:11:33 -08:00
Takashi Kokubun 6d26f78f68 MJIT: Clear .cache/clangd on bindgen if exists 2022-11-27 21:04:41 -08:00
Takashi Kokubun 29bf5495a9 Do not use the same variable for multiple things
`conv` proc is used before and after the `url` variable is updated. So
this script didn't seem to behave correctly for the "Close #xxx" syntax.

Reusing the same variable name for different things seems prone to errors.
2022-11-25 21:45:28 -08:00
Takashi Kokubun 95647378ff Support other GitHub PR/issue syntaxes
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
2022-11-25 21:44:21 -08:00
Nobuyoshi Nakada 612aa5c24a
Use class methods of `File` over `Kernel.open` and `IO.read` 2022-11-21 22:16:49 +09:00
Takashi Kokubun 1753cf59cc
Fix a broken interpolation #{head} 2022-11-20 21:23:28 -08:00
Nobuyoshi Nakada 230c7de252
sync_default_gems.rb: Fix substitution [ci skip]
As there should be no modified files just affter `git cherry-pick`
succeeded in `sync_default_gems_with_commits`, reset to the previous
revision once to pick up the committed files.
2022-11-20 18:51:41 +09:00
Alan Wu 574d849869 Run skipped minitest tests that now pass
The mentioned PR was merged.
2022-11-19 10:36:51 +09:00
Aaron Patterson 6582f34831 rename SHAPE_BITS to SHAPE_ID_NUM_BITS 2022-11-18 12:04:10 -08:00
Yusuke Endoh 417f3cd893 tool/generic_erb.rb: Add a hack to prevent "unused variable" warnings 2022-11-18 14:56:55 +09:00
Yusuke Endoh e19afe36ca Revert "tool/generic_erb.rb: Use ERB#result_with_hash instead of #result"
This reverts commit bd148a2bdd.

ERB#result_with_hash does not work on Ruby 2.2

https://ci.appveyor.com/project/ruby/ruby/builds/45420170
```
../tool/generic_erb.rb:33:in `block (2 levels) in <main>': undefined method `result_with_hash' for #<ERB:0x0000000002516650> (NoMethodError)
```
2022-11-18 14:45:21 +09:00
Yusuke Endoh bd148a2bdd tool/generic_erb.rb: Use ERB#result_with_hash instead of #result
to prevent the warnings:
```
./tool/generic_erb.rb:23: warning: assigned but unused variable - output
./tool/generic_erb.rb:24: warning: assigned but unused variable - vpath
```
2022-11-18 14:38:49 +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
Nobuyoshi Nakada ac063fd4c4
Depending on revision.h with VPATH 2022-11-16 00:44:34 +09:00
Takashi Kokubun 1a9e87fe3a
MJIT: Fix vm_cc_cme(cc).def.type to use bit field
access properly. Because the libclang node had two children, it wasn't
handled well by the pattern matching for the bit field case.

In addition to that, this bit field has a non-1 width. Because we're
returning true/false for a width-1 bit field, I added another behavior
that works like a char value for bit fields with width 2-8.
2022-11-15 00:34:00 -08:00
David Rodríguez c925a2ee91
Update RSpec gems 2022-11-15 14:45:51 +09:00
Aaron Patterson b7d591643a Remove USE_RVARGC code
We don't need this constant to be exposed anymore, so remove it
2022-11-14 15:42:11 -08:00
Takashi Kokubun a8537aa6a5
Import shape constants with mjit-bindgen 2022-11-14 00:29:28 -08:00
Takashi Kokubun 80bab6c8ed
Import class constants with mjit-bindgen 2022-11-14 00:24:08 -08:00
Nobuyoshi Nakada 70c9d5b504
Try to overwrite the file in VPATH if possible 2022-11-13 18:05:11 +09:00
Nobuyoshi Nakada b7504af8fc Preprocess for older bison is no longer needed 2022-11-10 09:51:50 +09:00
Nobuyoshi Nakada ab01b8f23f
jobserver option may not be at the last 2022-11-07 10:08:09 +09:00
Nobuyoshi Nakada 180d37c817
Set `autoclose:` for inherited FDs only [ci skip] 2022-11-07 09:06:15 +09:00
Nobuyoshi Nakada 12883f8fa6
GNU make 4.4 now uses a fifo for the jobserver 2022-11-06 23:39:55 +09:00
Peter Zhu 6d83590157 Don't report changed ENV caused by Bundler
Bundler's backups changes environment variables starting with
BUNDLER_ORIG_. This causes a lot of noise in tests as the leakchecker
reports them as changed.
2022-11-04 15:36:30 -04:00
Nobuyoshi Nakada ed9d761217
mkconfig.rb: take CPU name from arch flag 2022-11-04 18:19:30 +09:00
Nobuyoshi Nakada 7e3af23d1d
sync_default_gems.rb: fix a typo [ci skip] 2022-11-04 16:22:47 +09:00
Nobuyoshi Nakada b6d7e98f25
sync_default_gems.rb: fix the position to insert the original URL
Since the regexp had expected an empty line before `Co-Authored-By:`
trailer lines, it failed to match when the body has the trailer only.
2022-11-04 15:43:29 +09:00
Nobuyoshi Nakada 570dee15a6
sync_default_gems.rb: accept log input from other than STDIN 2022-11-04 15:43:29 +09:00
Peter Zhu b777408c33 Fix crash in test runner on timeout
When a test worker hangs and timeouts, the test runner crashes with the
following stack trace:

ruby/tool/lib/test/unit.rb:1747:in `puke': undefined method `backtrace' for Timeout::Error:Class (NoMethodError)
	from ruby/tool/lib/test/unit.rb:790:in `block in _run_parallel'
	from ruby/tool/lib/test/unit.rb:788:in `each'

This commit adds handling for Timeout::Error and outputs a message.
2022-11-02 13:34:02 -04:00
Nobuyoshi Nakada 8e2c70af14
file2lastrev.rb: changed revision may be `nil` [ci skip]
When `--suppress_not_found` option is given, no revision information
is available.  And remove extraneous newline, when result is empty or
ends with a newline.
2022-11-02 13:37:50 +09:00
Nobuyoshi Nakada 3475b66160
file2lastrev.rb: try to overwrite the found revision.h as before 2022-11-02 12:38:31 +09:00
Nobuyoshi Nakada ac06951c31
file2lastrev.rb: separate options for `Output` and `VPath`
So the `--srcdir` option in this file can override the same option in
`VPath`.
2022-11-02 12:38:03 +09:00
Nobuyoshi Nakada 6bf458eefd
file2lastrev.rb: use output.rb for the options 2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada 7e6e94262c
file2lastrev.rb: rename output as format
Also:
- format -> time_format
- output -> formatter
2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada a2e7b11f2a
output.rb: extract from generic_erb.rb
- writing to a file or stdout
- touching timestamp files
- overwriting only if changed
- colorizing
2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada 99a79dc40b
colorize.rb: support for NO_COLOR 2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada f0c8c1e878
vpath.rb: tweak --vpath option message 2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada aa8c6759ee
vcs.rb: do not reference the constant before assignment 2022-11-01 11:40:32 +09:00
Nobuyoshi Nakada 00d5b7ce7c vcs.rb: copy safe directory configuration
Now revision.tmp will be regenerated always and every times, even if
the recent file exists in the source directory, as far as using git.
On the other hand, VirtualBox mounts shared folders as root, and git
rejects the repository there as dubious ownership.
2022-10-30 17:06:33 +09:00
Nobuyoshi Nakada b64514f132 vcs.rb: prettify debug print 2022-10-30 17:06:33 +09:00
Nobuyoshi Nakada 1de8a42869
sync_default_gems.rb: do not add extra empty lines [ci skip] 2022-10-28 19:04:53 +09:00
Nobuyoshi Nakada e6e202234c
sync_default_gems.rb: append orignal commit URLs to subject only log 2022-10-28 13:15:14 +09:00
Nobuyoshi Nakada d76284dfb7
sync_default_gems.rb: Ignore unmergeable files [ci skip] 2022-10-25 13:52:53 +09:00
John Hawthorn b652dbf63b Remove iv_index_tbl_entry 2022-10-24 10:54:01 -07:00
Nobuyoshi Nakada 6cca8a0ceb
Strip trailing spaces [ci skip] 2022-10-24 18:38:09 +09:00
Nobuyoshi Nakada 8873c420d3
Fix error when commit hash is removed [ci skip] 2022-10-24 18:12:25 +09:00
Sergey Fedorov 567725ed30
Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975) 2022-10-19 23:49:45 +13:00
Nobuyoshi Nakada 1654f88ca7
sync_default_gems.rb: commit all after replaced rdoc-ref [ci skip] 2022-10-19 09:11:11 +09:00
Nobuyoshi Nakada e1ca90c2a4
sync_default_gems.rb: fold too long subject [ci skip]
Line with substituted issue references with URLs are often very long.
Although Git (and GitHub) recommends folding subject lines less than
50 columns, but many commits ignore this, so fold at 68 columns for
now.
2022-10-18 17:43:43 +09:00
Takashi Kokubun 134acf98d8
ruby/ruby-commit-hook has been renamed [ci skip]
to ruby/git.ruby-lang.org
2022-10-17 21:16:09 -07:00
Nobuyoshi Nakada ab3b1b2381
sync_default_gems.rb: fix links to GitHub issues
- Substitute `GH-xxxx` which does not contain `#` too.
- Split each substitutions.
2022-10-18 11:37:12 +09:00
Aaron Patterson e5058b58c2
Only expose Ruby Shape API if VM_CHECK_MODE is enabled 2022-10-13 13:11:01 -07:00
Nobuyoshi Nakada c50623f093
Revert "FreeBSD make uses the target under srcdir [ci skip]"
This reverts commit 751ffb276f, which
caused build failures on other platforms.
2022-10-13 12:24:59 +09:00
Nobuyoshi Nakada 751ffb276f
FreeBSD make uses the target under srcdir [ci skip] 2022-10-13 12:10:10 +09:00
Nobuyoshi Nakada 80da7250c5
file2lastrev.rb: Refactor VCS directory search
Search VCS directory after other options are in effective, i.e.,
`--srcdir=nonexitent --suppress_not_found` options, as well as the
reverse order case, should print the current date only and exit
successfully.
2022-10-12 22:24:53 +09:00
Nobuyoshi Nakada b57ecc3eb8
sync_default_gems: Replace the URIs to be redirected
The reference generated by using RDoc without the proper `--page-dir`
option (or `.rdoc_options`) file may contain `/doc/`.  Since these
URIs are redirected by the server now, replace such URIs with the
corresponding rdoc-refs too.
2022-10-12 13:24:53 +09:00
Nobuyoshi Nakada 2b5d4fe28d
sync_default_gems: Add rdoc-ref command to test 2022-10-12 12:27:40 +09:00
Nobuyoshi Nakada df588440ee
sync_default_gems: Replace the external URIs to docs with rdoc-ref 2022-10-12 12:27:40 +09:00
Nobuyoshi Nakada c67e496886
sync_default_gems: Should match with the beginning of the strings
`git status -z` result is NUL-separated, and can contain newline
characters.
2022-10-12 12:27:40 +09: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
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