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

2889 Коммитов

Автор SHA1 Сообщение Дата
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
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
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
Takashi Kokubun 06eb9af8c0
Add mjit-bindgen workflow (#6327) 2022-09-05 01:06:37 -07:00
Takashi Kokubun c2986f7d28
Fix warnings from private_constant
`private_constant *constants` seems to be warned for some reason
2022-09-05 00:27:49 -07:00
Hiroshi SHIBATA 3eca1e438d Merge 16c3535413 2022-09-05 14:37:12 +09:00
Takashi Kokubun 3767c6a90d
Ruby MJIT (#6028) 2022-09-04 21:53:46 -07:00
Nobuyoshi Nakada 4d469472e2
Debugging snapshot [ci skip] 2022-09-05 13:08:23 +09:00
Nobuyoshi Nakada 85a483169f
Use cross compiling settings as fake.rb for snapshots 2022-09-05 11:16:20 +09:00
Nobuyoshi Nakada 2767cb2825
Now fake.rb is needed to prepare sources 2022-09-03 21:57:17 +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
Nobuyoshi Nakada 462a8be511
VCS#revision_header: Make arguments optional 2022-09-01 20:57:30 +09:00
Nobuyoshi Nakada 55b1600987
Update revision.h in packages using `VCS#revision_header` 2022-09-01 18:45:09 +09:00
Nobuyoshi Nakada ee09f75a6b
Extract `VCS#revision_header` 2022-09-01 18:01:40 +09:00
Nobuyoshi Nakada 762fca9b12
Prefer `File` class methods to write a string 2022-09-01 18:01:40 +09:00
Hiroshi SHIBATA f3becd73e3
Ignore test libraries like assert_ractor from did_you_mean 2022-09-01 17:02:55 +09:00
Hiroshi SHIBATA f229b36087
Fix test fail with assert_ractor outside of ruby/ruby repo
Revert 806583c093
2022-09-01 16:15:51 +09:00
Hiroshi SHIBATA 41a275c89a
Support main branch for syntax_suggest 2022-08-29 09:52:09 +09:00
Hiroshi SHIBATA 1cbee173be Sync examples and cli from syntax_suggest 2022-08-26 12:15:47 +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
Takashi Kokubun b93d554be9
Fix a typo [ci skip] 2022-08-20 18:36:52 -07:00
Takashi Kokubun ddf96b7693
Drop mswin support of MJIT (#6265)
The current MJIT relies on SIGCHLD and fork(2) to be performant, and
it's something mswin can't offer. You could run Linux MJIT on WSL
instead.

[Misc #18968]
2022-08-20 18:35:36 -07:00
Takashi Kokubun 485019c2bd
Rename mjit_exec to jit_exec (#6262)
* Rename mjit_exec to jit_exec

* Rename mjit_exec_slowpath to mjit_check_iseq

* Remove mjit_exec references from comments
2022-08-19 23:57:17 -07:00
Hiroshi SHIBATA 17d0e5bee7
syntax_suggest moved to under the ruby organization. 2022-08-19 13:20:20 +09:00
schneems a50df1ab0e Setup SyntaxSuggest as default gem
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.
2022-08-19 10:02:24 +09:00
Nobuyoshi Nakada d903e76726 Allow strings in assert_pattern_list 2022-08-19 01:28:31 +09:00
Nobuyoshi Nakada 7c1ed47097
Add tests for assert_pattern_list 2022-08-18 23:38:56 +09:00
Nobuyoshi Nakada ac890ec062
Make date in installed gemspec files stable
Set `date` member to `RUBY_RELEASE_DATE` instead of the date at the
build time, to make installed files reproducible.
2022-08-17 00:58:56 +09:00
Nobuyoshi Nakada cc443f6cde
Refactor `RbInstall::Specs::FileCollector`
- Split into `Ext` and `Lib` classes.
- `Ext#files` should not include built extension libraries.
- `Ext#files` should include scripts under its own `lib`.
- `Lib#files` should be prefixed with `lib/`.
2022-08-17 00:58:56 +09:00
Nobuyoshi Nakada e44445596f
Preserve each column positions in gems/bundled_gems 2022-08-12 23:51:55 +09:00
Nobuyoshi Nakada a3a6d2d9a3 No bundled gems to be installed from gem now 2022-08-12 15:55:40 +09:00
Nobuyoshi Nakada 04815ea968 All extensions in bundled gems are built by build-ext now
`RbInstall::GemInstaller#build_extensions` has nothing to do.
2022-08-12 15:55:40 +09:00
Nobuyoshi Nakada 0bb5525eb2
Fix files for gemspec files direct-under lib
Collected `files` lacked `lib` prefix.
2022-08-07 17:01:22 +09:00
Burdette Lamar 412da2c221
Sync new doc in Date (#6215) 2022-08-05 13:05:38 -05:00
Nobuyoshi Nakada 5791171201
Load gemspec file at that directory
Gemspec files generated by old bundler run `git` without changing the
working directory.
Or some gemspec files expect an owned file at the top exists ath the
current working directory.
2022-08-05 09:52:20 +09:00
Nobuyoshi Nakada 44a0a66559
Move to tool/lib/bundled_gem.rb 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
Alan Wu e5a3f23256 Use $(bindir) for path to executable in mkmf
For the macOS -bundle_loader linker option, we need a path to the
Ruby exectuable. $(RUBY) is not necessarily a path since it could
be a command line invocation. That happens during build with
runruby.rb and can happen post installation if the user passes
the --ruby option to a extconf.rb. Use $(bindir) to locate
the executable instead.

Before installation, $(bindir) doesn't exist, so we need to be
able to override $(BUILTRUBY) in such situations so test-spec
and bundled extensions could build. Use a new mkmf global,
$builtruby, to do this; set it in fake.rb and in extmk.rb.

Our build system is quite complex...
2022-08-04 16:29:22 +09:00
Hiroshi SHIBATA 62849b3379 Keep gitignore for libyaml source with psych 2022-07-29 19:10:10 +09:00
Nobuyoshi Nakada 464f73a5f0
Do not load library files from repository only for test
What we want to test should be the bundled and to be installed files,
but not the upstream.
2022-07-27 17:36:45 +09:00
Nobuyoshi Nakada 456e1d1eaa
Try the tag without "v" prefix to checkout upstream repositories 2022-07-26 21:12:58 +09:00
Hiroshi SHIBATA b404a5f106
8fa66467de is broken with rubygems/rubygems and flori/json.
Revert "Fix sync_default_gems.rb to use absolute path"

This reverts commit 8fa66467de.
2022-07-26 13:42:37 +09:00
Peter Zhu 8fa66467de Fix sync_default_gems.rb to use absolute path 2022-07-25 16:29:14 -04:00
Burdette Lamar 43c11f6c49
For rdoc, copy doc/rdoc to doc/ (#6181) 2022-07-25 14:58:41 -05:00
Nobuyoshi Nakada b291c972fa Use built bundled gems in test-bundled-gems 2022-07-25 08:50:07 +09:00
Nobuyoshi Nakada e0a7e5e131
Kill bundled gem tests when interrupted 2022-07-24 16:36:33 +09:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Jemma Issroff 85ea46730d Separate TS_IVC and TS_ICVARC in is_entries buffers
This allows us to treat cvar caches differently than ivar caches.
2022-07-18 14:06:30 -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 d20886dd22
Create build-only gemspec files only if having an extension 2022-07-17 10:30:56 +09:00
Nobuyoshi Nakada 6c1d7dab52
Fix conversion from absolute path to relative path 2022-07-16 17:58:52 +09:00
Nobuyoshi Nakada c093e7d645
Avoid to symlink under symlink 2022-07-16 16:38:03 +09:00
Nobuyoshi Nakada 5101671cbc
Disable parallel built in test-bundled-gems 2022-07-16 15:28:05 +09:00
Nobuyoshi Nakada 78d2be69b5
Move copying/linking extra files to Makefile so removed by `clean` 2022-07-16 10:11:42 +09:00
Peter Zhu 7424ea184f Implement Objects on VWA
This commit implements Objects on Variable Width Allocation. This allows
Objects with more ivars to be embedded (i.e. contents directly follow the
object header) which improves performance through better cache locality.
2022-07-15 09:21:07 -04:00
Nobuyoshi Nakada 9d900620ca Set `GEM_PATH` environment variable in runruby.rb 2022-07-14 09:00:13 +09:00
Nobuyoshi Nakada 416cba90c1 Try to install also gemspec files under gem directories
Gemspec files having extension libraries are placed under each gem
directories now.
2022-07-14 09:00:13 +09:00
Nobuyoshi Nakada a2c66f52f4 Make dependency-free gemspec files
The default gems have not been installed yet in the build directory,
bundled gems depending on them can not work.  As those dependencies
should be usable there even without rubygems, make temporary gemspec
files without the dependencies, and use them in the build directory.
2022-07-14 09:00:13 +09:00
Nobuyoshi Nakada e1a4e44f14 Extract gemspec files to each gem directories
Since extension libraries can not be built in the source directory,
rubygems warns gems have extension libraries as the extensions are not
built.  To order to suppress this warnings, extract such gemspec files
under each gem directories instead of the common `specifications`
directory.
2022-07-14 09:00:13 +09:00
Nobuyoshi Nakada d5c5fcb80a
Bundled gem extensions are out of scope of update-deps 2022-07-13 22:14:30 +09:00
Hiroshi SHIBATA 437a5ae9d6 Merge RubyGems and Bundler master 2022-07-13 14:11:55 +09:00
Nobuyoshi Nakada 1150a54afe
Use `File::PATH_SEPARATOR` for the portability 2022-07-09 19:00:56 +09:00
Nobuyoshi Nakada 67e54ce408
Fallback `mkdir_p` to `as_mkdir_p`
Assume `mkdir -p` to be race-free on recent systems.
And we do not provide install-sh anyway.
2022-07-07 15:06:10 +09:00
Nobuyoshi Nakada 5921bfc7ce
Add `--stdout-on-failure`, the reverse of `--stderr-on-failure` 2022-07-05 14:40:19 +09:00
Nobuyoshi Nakada 1b34bd07c1
Separate failed output option
It is unrelated to `GlobOption` at all.
2022-07-05 14:40:19 +09:00
Nobuyoshi Nakada 841521b7c1
Adjust indent [ci skip] 2022-06-30 10:50:31 +09:00
Aaron Patterson 8d157bc806 Move function to `static inline` so we don't have leaked globals
This function shouldn't leak and is only needed during instruction
assembly
2022-06-29 16:21:48 -07:00
Nobuyoshi Nakada f159bbd17d
Prevent accidental use of assert_raises 2022-06-25 19:09:06 +09:00
David Rodríguez 12a5fa408b Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
Nobuyoshi Nakada 7fd51c0241
vcs.rb: ignore configuration files get rid of aliases [ci skip] 2022-06-22 09:33:25 +09:00
Nobuyoshi Nakada bc77cda8fd
vcs.rb: just one log to check if `--date` option works [ci skip] 2022-06-22 09:32:01 +09:00
Nobuyoshi Nakada 0dcd25b711
vcs.rb: show diagnostic/progressing messages when debugging [ci skip] 2022-06-22 09:31:19 +09:00
Alan Wu 4b7c4bb92e tool/extlibs.rb: Use Exception#message for older rubies
This script runs with BASERUBY, which can be as old as 2.2.x.
Exception#full_message is new in 2.5.0.

I saw a NoMethodError on the AppVeyor CI where BASERUBY is 2.4.6:
https://ci.appveyor.com/project/ruby/ruby/builds/43870654/job/kae4uo2xbhuhqmdw#L121
2022-06-17 18:13:19 -04:00
Nobuyoshi Nakada 983f2688db
Hack to avoid leak checker 2022-05-25 18:48:01 +09:00
Nobuyoshi Nakada 78785fb990 [ruby/date] Constify gperf-generated table
https://github.com/ruby/date/commit/6d7ab08ffc
2022-05-24 17:23:42 +09:00
Takashi Kokubun ead96e7b44
Rename test_jit to test_mjit
to avoid confusion with YJIT
2022-05-20 21:32:55 -07: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
Kazuhiro NISHIYAMA 2d1032075a
Stop `build_extensions` when DESTDIR set
Try to fix `make install without root privilege` failures on snapshot CIs.

example: https://github.com/ruby/actions/actions/runs/2315349280
2022-05-13 08:44:17 +09:00
Nobuyoshi Nakada c7d2247e35
Honor --with-thread option to enable pthread 2022-05-10 09:24:28 +09:00
Alan Wu b989c7c6ac
[DOC] Move :nodoc: so rdoc finds `RbConfig.ruby`
Rdoc [build] of `master` did not have this method but the reference manual [did].

[build]: https://docs.ruby-lang.org/en/master/RbConfig.html
[did]: https://docs.ruby-lang.org/ja/master/class/RbConfig.html#S_RUBY
2022-04-25 14:28:39 -04:00
Alan Wu 79fa27acc4 rbinstall: Also do `Gem.ruby` patching for unpacked bundled gems
Pointing `Gem.ruby` to the newly installed ruby gives mkmf the right
inputs to build extensions in bundled gems. Previously, this patching
was only done for compressed bundled gems.

This patch also prevents `tool/fake.rb` from propagating to the child
process running mkmf for the native extension. The way `tool/fake.rb`
changes mkmf variables using `Kernel#trace_var` created spooky action at
a distance which made debugging difficult.

AppVeyor Windows CI started to fail starting with
8a3663789c because it enabled extension
building for bundled gems on mswin. This patch should address the CI
failures.
2022-04-22 16:21:48 -04:00
Hiroshi SHIBATA c506ddac6c
Added assert_true and assert_false same as test-unit gem 2022-04-20 14:13:10 +09:00
Nobuyoshi Nakada a3ef0746ce
Extract `pipe_readlines` method which reads from the pipeline 2022-04-16 17:13:24 +09:00
Nobuyoshi Nakada b09e96341e
Simplify the condition expression to ignore commits 2022-04-16 16:45:46 +09:00
Nobuyoshi Nakada 492185e39c
Do not import any files under rakelib 2022-04-16 16:45:11 +09:00
Nobuyoshi Nakada 8a3663789c
Fix bundled gems installation when relative loading 2022-04-16 09:03:51 +09:00
Kazuhiro NISHIYAMA 7e4ac434b9
Skip build extensions again on cross compiling too 2022-04-13 14:40:24 +09:00
Kazuhiro NISHIYAMA 3112475469
Skip build extensions again on mswin and mingw 2022-04-13 13:40:57 +09:00
Kazuhiro NISHIYAMA 4246e102d4
Enabled to build extensions with the bundled gems again
cbb115213c
5c1b76a3a5
2022-04-13 11:09:23 +09:00
Nobuyoshi Nakada 5c1b76a3a5 Install built gem extension binaries 2022-04-07 09:47:10 +09:00
Nobuyoshi Nakada bb0a22a8c0 Obey spec file locations to rubygems 2022-04-07 09:47:10 +09:00
Alan Wu 21c8b9eb99 Copyedit parallel test harness crash message
Mea culpa.

Co-authored-by: Kaíque Kandy Koga <kaiquekandykoga@gmail.com>
2022-04-06 18:39:27 -04:00
Alan Wu 399ef463f7 Copyedit parallel test harness crash message 2022-04-06 18:11:43 -04:00
Kazuhiro NISHIYAMA d9c6f8d45c
Try to fix NoMethodError on slow environments
```
  1) Failure:
TestParallel::TestParallel#test_hungup [/home/user/ruby/tool/test/testunit/test_parallel.rb:215]:
Expected /^Retrying hung up testcases\.+$/ to match "Run options: \n" +
"  --seed=43403\n" +
"  --ruby\n" +
"  \"./miniruby -I../lib -I. -I.ext/common ../tool/runruby.rb --extout=.ext -- --disable-gems\"\n" +
"  -j\n" +
"  t1\n" +
"  --worker-timeout=1\n" +
"\n" +
"# Running tests:\n" +
"\n" +
"/home/user/ruby/tool/lib/test/unit.rb:687:in `block in _run_parallel': undefined method `<' for nil:NilClass (NoMethodError)\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:538:in `block in quit_workers'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:537:in `reject!'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:537:in `quit_workers'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:687:in `_run_parallel'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:810:in `_run_suites'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:849:in `_run_suites'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1479:in `_run_anything'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1263:in `_run_anything'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1654:in `run_tests'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1641:in `block in _run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1640:in `each'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1640:in `_run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1682:in `run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1034:in `run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:882:in `run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:154:in `run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1761:in `run'\n" +
"\tfrom /home/user/ruby/tool/lib/test/unit.rb:1765:in `run'\n" +
"\tfrom /home/user/ruby/tool/test/testunit/tests_for_parallel/runner.rb:14:in `<main>'\n".
```
2022-04-05 19:23:38 +09:00