1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

1731 commits

Author SHA1 Message Date
Koichi Sasada
e2a45cb984 use builtin for TracePoint.
Define TracePoint in trace_point.rb and use __builtin_ syntax.
2019-11-08 09:09:29 +09:00
Koichi Sasada
46acd0075d support builtin features with Ruby and C.
Support loading builtin features written in Ruby, which implement
with C builtin functions.
[Feature ]

Several features:

(1) Load .rb file at boottime with native binary.

Now, prelude.rb is loaded at boottime. However, this file is contained
into the interpreter as a text format and we need to compile it.
This patch contains a feature to load from binary format.

(2) __builtin_func() in Ruby call func() written in C.

In Ruby file, we can write `__builtin_func()` like method call.
However this is not a method call, but special syntax to call
a function `func()` written in C. C functions should be defined
in a file (same compile unit) which load this .rb file.

Functions (`func` in above example) should be defined with
  (a) 1st parameter: rb_execution_context_t *ec
  (b) rest parameters (0 to 15).
  (c) VALUE return type.
This is very similar requirements for functions used by
rb_define_method(), however `rb_execution_context_t *ec`
is new requirement.

(3) automatic C code generation from .rb files.

tool/mk_builtin_loader.rb creates a C code to load .rb files
needed by miniruby and ruby command. This script is run by
BASERUBY, so *.rb should be written in BASERUBY compatbile
syntax. This script load a .rb file and find all of __builtin_
prefix method calls, and generate a part of C code to export
functions.

tool/mk_builtin_binary.rb creates a C code which contains
binary compiled Ruby files needed by ruby command.
2019-11-08 09:09:29 +09:00
卜部昌平
d45a013a1a extend rb_call_cache
Prior to this changeset, majority of inline cache mishits resulted
into the same method entry when rb_callable_method_entry() resolves
a method search.  Let's not call the function at the first place on
such situations.

In doing so we extend the struct rb_call_cache from 44 bytes (in
case of 64 bit machine) to 64 bytes, and fill the gap with
secondary class serial(s).  Call cache's class serials now behavies
as a LRU cache.

Calculating -------------------------------------
                           ours         2.7         2.6
vm2_poly_same_method     2.339M      1.744M      1.369M i/s - 6.000M times in 2.565086s 3.441329s 4.381386s

Comparison:
             vm2_poly_same_method
                ours:   2339103.0 i/s
                 2.7:   1743512.3 i/s - 1.34x  slower
                 2.6:   1369429.8 i/s - 1.71x  slower
2019-11-07 17:41:30 +09:00
Hiroshi SHIBATA
fc85bdeb77
Promote cgi to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
223d3c460a
Promote net-smtp to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
eb0b13596d
Promote net-pop to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
77c94e0dd8
Promote benchmark to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
1159dbf305
Promote delegate to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
3b0bd34001
Promote pstore to default gems 2019-11-07 16:36:14 +09:00
Hiroshi SHIBATA
478f6e2b34
Fixed an Errno::ENOENT with non-test libraries 2019-11-07 16:36:13 +09:00
Hiroshi SHIBATA
d1630d41ad
Promote open3 to default gems 2019-11-07 07:16:27 +09:00
Hiroshi SHIBATA
ec2603c353
fallback standard structure library to sync_lib_gem method 2019-11-07 07:16:26 +09:00
Hiroshi SHIBATA
91135f6d29
Promote singleton to default gems 2019-11-07 07:16:26 +09:00
Nobuyoshi Nakada
c7632fa80c Do not occupy ARGV by XRUBY command
Instead run test-bundled-gems.rb by `ENV['RUBY']`, which should be
set by runruby.rb.
2019-11-05 08:45:19 +09:00
Nobuyoshi Nakada
823f25bb96
sync_default_gems.rb: Show the progress at fetching
It looks like hanging up when fetching from a remote first time.
2019-11-04 09:40:26 +09:00
Hiroshi SHIBATA
c38ba75780
Fixed the sync task for json
* Ignode to change ext/json/depend
  * Fixed to ignore json_pure files
2019-10-31 10:19:57 +09:00
Hiroshi SHIBATA
1c03026ea3 Try to run assert_output_unchanged with racc tests 2019-10-31 08:39:48 +09:00
Hiroshi SHIBATA
d3272fcba3
Update the latest structure for racc upstream 2019-10-30 21:00:01 +09:00
Yusuke Endoh
1820aeeeb2 tool/lib/minitest/unit.rb: add "omit" as an alias to "skip"
According to rdoc, test-unit provides omit instead of skip.
This is a compatibility layer to make it work with both test-unit and
tool/lib/minitest.
2019-10-29 13:15:09 +09:00
Nobuyoshi Nakada
48f982aba7
test-bundled-gems.rb: fixed for out-of-place build 2019-10-28 19:14:38 +09:00
卜部昌平
356e203a3a more on struct rb_call_data
Replacing adjacent struct rb_call_info and struct rb_call_cache
into a struct rb_call_data.
2019-10-25 12:24:22 +09:00
Alan Wu
89e7997622 Combine call info and cache to speed up method invocation
To perform a regular method call, the VM needs two structs,
`rb_call_info` and `rb_call_cache`. At the moment, we allocate these two
structures in separate buffers. In the worst case, the CPU needs to read
4 cache lines to complete a method call. Putting the two structures
together reduces the maximum number of cache line reads to 2.

Combining the structures also saves 8 bytes per call site as the current
layout uses separate two pointers for the call info and the call cache.
This saves about 2 MiB on Discourse.

This change improves the Optcarrot benchmark at least 3%. For more
details, see attached bugs.ruby-lang.org ticket.

Complications:
 - A new instruction attribute `comptime_sp_inc` is introduced to
 calculate SP increase at compile time without using call caches. At
 compile time, a `TS_CALLDATA` operand points to a call info struct, but
 at runtime, the same operand points to a call data struct. Instruction
 that explicitly define `sp_inc` also need to define `comptime_sp_inc`.
 - MJIT code for copying call cache becomes slightly more complicated.
 - This changes the bytecode format, which might break existing tools.

[Misc ]
2019-10-24 18:03:42 +09:00
Hiroshi SHIBATA
2791989a31
Fixed sync path of e2mmap structure for gemspec. 2019-10-24 16:11:01 +09:00
Nobuyoshi Nakada
601f1fb456
Catch syntax error even if fatal 2019-10-23 02:05:28 +09:00
NARUSE, Yui
99ca5705a2 tool/release.sh uses ruby-actions' result
https://github.com/ruby/actions
2019-10-22 22:15:52 +09:00
NARUSE, Yui
d736511e42 Move format-release to tool and fix bugs 2019-10-22 21:44:19 +09:00
Nobuyoshi Nakada
ed3333f873
make-snapshot: Regexp#match raises on nil now 2019-10-22 21:05:52 +09:00
Nobuyoshi Nakada
f8fb51c976
Revert "alias assert_raise_message for compatibility with test-unit"
This reverts commit 43015275b9.

`assert_raise_message` in test-unit is different from
`assert_raise_with_message`.  It checks the exception message
only, but not the exception class,
2019-10-16 21:00:36 +09:00
Nobuyoshi Nakada
43015275b9
alias assert_raise_message for compatibility with test-unit 2019-10-16 17:44:51 +09:00
Kazuhiro NISHIYAMA
7abb02771a
Fix typo [ci skip]
pointed out by ruby-trunk-changes
2019-10-08 00:00:24 +09:00
Kazuhiro NISHIYAMA
3374e1450c
Write yaml and json under destdir and print to stdout 2019-10-07 19:33:33 +09:00
Kazuhiro NISHIYAMA
96753e8475
Create info.yml and info.json
- `info.yml` is for ruby/www.ruby-lang.org/_data/releases.yml
- `info.json` is meta data for users of snapshot
2019-10-07 19:05:42 +09:00
Kazuhiro NISHIYAMA
bb86611c9b
Remove -s3 option
It will not use in `ruby/actions`, and `default=tmp` is not correct.
2019-10-07 19:03:06 +09:00
Nobuyoshi Nakada
8f7fca784a
make-snapshot: touch updated files after prepared
Align mtime of files updated by `make prepare-package` to make
packages reproducible.
2019-10-03 19:14:49 +09:00
Nobuyoshi Nakada
8142a9b43d
make-snapshot: suppress make error messages unless failed 2019-10-03 19:12:03 +09:00
Nobuyoshi Nakada
47d143be17
make-snapshot: copy cache files instead of linking
To get rid of setting mode and mtime of the original cache files.
2019-10-03 19:09:16 +09:00
Nobuyoshi Nakada
b7ae26e2ee
vcs.rb: fix to export git-svn version
* Use the given branch name instead of implicit 'HEAD".
* Format like as git-svn when `from` or `to` is SVN revision
  number.
2019-10-03 19:07:48 +09:00
Hiroshi SHIBATA
c14755e9ca
[ruby/fileutils] improve the compatibility of minitest
https://github.com/ruby/fileutils/commit/f16f5a0dd6
2019-10-03 18:32:21 +09:00
卜部昌平
84fc1de512 use bind_call for test-all --gc-stress
This one allocation of Method object is worth avoiding.  We don't
want to test UnboundMethod#bind right here.  GC need not run.
2019-10-03 15:24:09 +09:00
Koichi Sasada
9759e3c9f0 fix assertion number.
On parallel test, there are additional tests because of implicit
checkers which are enabled on 84cbce3d88.
2019-10-02 17:19:14 +09:00
Nobuyoshi Nakada
4ed51b3956
Fixed failure message for clean-cache 2019-10-02 17:03:55 +09:00
Koichi Sasada
84cbce3d88 Enable checkers on parallel test.
parallel test (`make test-all TESTS=-j8`) runs tests on specified
number of processes. However, some test checkers written in
`runner.rb` are not loaded. This fix enable these checkers on
parallel tests.

See also: https://github.com/ruby/ruby/pull/2508
2019-10-02 16:23:00 +09:00
NAKAMURA Usaku
a61ae414b6 Fix the order of executing after-update task 2019-10-02 13:00:17 +09:00
NAKAMURA Usaku
5af2c8735a Should fail if system failed 2019-10-02 12:59:59 +09:00
Hiroshi SHIBATA
15606963de expose assert_raise and assert_join_threads 2019-10-01 22:19:18 +09:00
Koichi Sasada
945560008f Revert "introduce debug check."
This reverts commit c3b84f2de8.
Backtrace shows it is before running tests and debug check was
nonsense.
2019-09-30 17:59:10 +09:00
Koichi Sasada
c3b84f2de8 introduce debug check.
There are random failures:

> lib/rubygems/core_ext/kernel_require.rb:61:in `require':
> wrong number of arguments (given 1, expected 0) (ArgumentError)
http://ci.rvm.jp/results/trunk-jemalloc@silicon-docker/2275159

To check this failure, I added a small check code.
2019-09-30 17:23:36 +09:00
Koichi Sasada
bf8d7d9c1d show RUBY_ISEQ_DUMP_DEBUG envval if given. 2019-09-30 15:35:22 +09:00
Benoit Daloze
a27dc83113 Pass $(XRUBY) to test-bundled-gems.rb since RbConfig.ruby is incorrect for miniruby 2019-09-29 13:57:54 +02:00
Benoit Daloze
4096e4b08c Move the logic to test bundled gems to Ruby code
* Writing shell scripts in a Makefile is very error-prone.
* TEST_BUNDLED_GEMS_ALLOW_FAILURES seemed to not work before.
2019-09-29 13:57:54 +02:00