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

2035 Коммитов

Автор SHA1 Сообщение Дата
Vít Ondruch db0eab1c6f Remove `EnvUtil.rubyexec`, because it is not used anywhere. 2020-07-28 12:11:47 +09:00
Hiroshi SHIBATA 7befc0cdfc
Promote optparse to default gems 2020-07-22 18:38:51 +09:00
卜部昌平 1fb4e28002 skip inlining cexpr! that are not attr! inline
Requested by ko1.
2020-07-16 11:49:09 +09:00
Nobuyoshi Nakada 9f4b7fc82e
Check warning flags only if available to run with old versions 2020-07-15 23:33:24 +09:00
卜部昌平 8d3a084572 _mjit_compile_invokebuiltin: sp_inc can be negative
Was my bad to assume sp_inc was positive.  Real criteria is the
calculated sp is non-negative.  We have to assert that.
2020-07-14 13:15:06 +09:00
卜部昌平 927fe2422f mk_builtin_loader.rb: STACK_ADDR_FROM_TOP unusable
Stacks are emulated in MJIT, must not touch the original VM stack.

See also http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3061353
2020-07-13 12:30:43 +09:00
卜部昌平 7e536b3be2 builtin.h: avoid copy&paste
Instead of doubling the invokebuiltin logic here and there, use the same
insns.def definition for both MJIT/non-JIT situations.
2020-07-13 08:56:18 +09:00
卜部昌平 4506f6119a %p is not portable accross platforms
This commit fixes compiler error on MSVC.  %p on that platform is not
suitable to represent a compile-time constant.

https://ci.appveyor.com/project/ruby/ruby/builds/34017163/job/vj2a8uk3gwv9yxak#L24381
2020-07-13 08:56:18 +09:00
卜部昌平 2363a16e9a add comments 2020-07-13 08:56:18 +09:00
卜部昌平 5783d84a17 fix typo 2020-07-13 08:56:18 +09:00
卜部昌平 9721f477c7 inline Primitive.cexpr!
We can obtain the verbatim source code of Primitive.cexpr!.  Why not
paste that content into the JITed program.
2020-07-13 08:56:18 +09:00
卜部昌平 f66e0212ef precalc invokebuiltin destinations
Noticed that struct rb_builtin_function is a purely compile-time
constant.  MJIT can eliminate some runtime calculations by statically
generate dedicated C code generator for each builtin functions.
2020-07-13 08:56:18 +09:00
Nobuyoshi Nakada 6c8af6b6f2
sync_default_gems.rb: Updated comments
* removed out-of-date and duplicate list
* stated that everything synced from github
2020-07-13 00:31:12 +09:00
Nobuyoshi Nakada 49cb2345c6
sync_default_gems.rb: Added `list` subcommand 2020-07-13 00:30:44 +09:00
Nobuyoshi Nakada 6cd600ef69
sync_default_gems.rb: Ignore conflicted files in toplevel more 2020-07-13 00:14:07 +09:00
Nobuyoshi Nakada 162d08b854
sync_default_gems.rb: Added -e option to edit when conflicted 2020-07-12 23:41:06 +09:00
Kazuhiro NISHIYAMA 82489f0242
Show messages around the line when replacing failed in format_changelog 2020-07-10 19:27:11 +09:00
Takashi Kokubun 7fa3c71bec
Make sure vm_call_cfunc uses inlined cc
which is checked by the first guard. When JIT-inlined cc and operand
cd->cc are different, the JIT-ed code might wrongly dispatch cd->cc even
while class check is done with another cc inlined by JIT.

This fixes SEGV on railsbench.
2020-07-10 00:44:02 -07:00
Nobuyoshi Nakada 1aed23c18d
tool/sync_default_gems.rb: Accept multiple commit ranges 2020-07-06 00:48:33 +09:00
Nobuyoshi Nakada 41fef191d1
tool/sync_default_gems.rb: Added bigdecimal 2020-07-05 22:08:04 +09:00
Nobuyoshi Nakada 358f91bf6f
Skip comment and empty lines in gems/bundled_gems file 2020-07-05 18:59:06 +09:00
Koichi Sasada 95f5fd9a55 fix up Primitive.cinit! code
Recent changes break Primitive.cinit!(c_code) so fix it.
2020-07-05 10:44:36 +09:00
Takashi Kokubun e4f7eee009
Check ROBJECT_EMBED on guards-merged ivar access
Fix CI failure like
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3043247
introduced by a69dd699ee
2020-07-04 16:02:46 -07:00
Koichi Sasada 74e1bca79d support all locals for cexpr!, cstmt!
Primitve.cexpr! and .cstmt! can access Ruby's parameter and
*local variables* (note that local parameters are also local
variables). However recent changes only allow to access
parameters. This patch fix it.

For example, the following code can work:

def foo a, b, k: :kw, **kwrest
  c = a + b
  d = k
  e = kwrest
  p Primitive.cstmt!(%q(rb_p(rb_ary_new_from_args(5, a, b, c, d, e));
                        return Qnil;))
end
2020-07-04 17:28:23 +09:00
Takashi Kokubun a69dd699ee
Merge ivar guards on JIT (#3284)
when an ISeq has multiple ivar accesses.
2020-07-03 17:52:52 -07:00
Koichi Sasada a0f12a0258
Use ID instead of GENTRY for gvars. (#3278)
Use ID instead of GENTRY for gvars.

Global variables are compiled into GENTRY (a pointer to struct
rb_global_entry). This patch replace this GENTRY to ID and
make the code simple.

We need to search GENTRY from ID every time (st_lookup), so
additional overhead will be introduced.
However, the performance of accessing global variables is not
important now a day and this simplicity helps Ractor development.
2020-07-03 16:56:44 +09:00
Hiroshi SHIBATA 59ded36c60
Expose `assert_pattern_list` for drb test with test-unit gem. 2020-07-02 20:53:42 +09:00
Samuel Giddins 7cb8904a12 Extract correct processor name for ARM64 Macs 2020-06-30 19:03:50 +09:00
Nobuyoshi Nakada 09b936d89c
Calculate header line count instead of hardcoding 2020-06-28 14:14:29 +09:00
Nobuyoshi Nakada 1020f7e3aa
Replace separators in input file name in header too 2020-06-28 14:12:26 +09:00
Nobuyoshi Nakada 44a659ad97
Replace ALT_SEPARATOR with SEPARATOR also in output file name
To suppress warnings by Visual C.
```
./integer.rb(5) : warning C4129: 'i' : unrecognized character escape sequence
./kernel.rb(21) : warning C4129: 'k' : unrecognized character escape sequence
```
2020-06-28 13:20:40 +09:00
Takashi Kokubun 40b40523dc
Show what's inlined first in "JIT inline" log
and add a debug log
2020-06-25 23:50:19 -07:00
Takashi Kokubun 7982dc1dfd
Decide JIT-ed insn based on cached cfunc
for opt_* insns.

opt_eq handles rb_obj_equal inside opt_eq, and all other cfunc is
handled by opt_send_without_block. Therefore we can't decide which insn
should be generated by checking whether it's cfunc cc or not.

```
$ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark/mjit_opt_cc_insns.yml --repeat-count=4
before --jit: ruby 2.8.0dev (2020-06-26T05:21:43Z master 9dbc2294a6) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-26T06:30:18Z master 75cece1b0b) +JIT [x86_64-linux]
last_commit=Decide JIT-ed insn based on cached cfunc
Calculating -------------------------------------
                     before --jit  after --jit
        mjit_nil?(1)      73.878M      74.021M i/s -     40.000M times in 0.541432s 0.540391s
         mjit_not(1)      72.635M      74.601M i/s -     40.000M times in 0.550702s 0.536187s
     mjit_eq(1, nil)       7.331M       7.445M i/s -      8.000M times in 1.091211s 1.074596s
     mjit_eq(nil, 1)      49.450M      64.711M i/s -      8.000M times in 0.161781s 0.123627s

Comparison:
                     mjit_nil?(1)
         after --jit:  74020528.4 i/s
        before --jit:  73878185.9 i/s - 1.00x  slower

                      mjit_not(1)
         after --jit:  74600882.0 i/s
        before --jit:  72634507.6 i/s - 1.03x  slower

                  mjit_eq(1, nil)
         after --jit:   7444657.4 i/s
        before --jit:   7331304.3 i/s - 1.02x  slower

                  mjit_eq(nil, 1)
         after --jit:  64710790.6 i/s
        before --jit:  49449507.4 i/s - 1.31x  slower
```
2020-06-25 23:33:08 -07:00
Takashi Kokubun 37a2e48d76
Avoid generating opt_send with cfunc cc with JIT
only for opt_nil_p and opt_not.

While vm_method_cfunc_is is used for opt_eq too, many fast paths of it
don't call it. So if it's populated, it should generate opt_send,
regardless of cfunc or not. And again, opt_neq isn't relevant due to the
difference in operands.
So opt_nil_p and opt_not are the only variants using vm_method_cfunc_is
like they use.

```
$ benchmark-driver -v --rbenv 'before2 --jit::ruby --jit;before --jit;after --jit' benchmark/mjit_opt_cc_insns.yml --repeat-count=4
before2 --jit: ruby 2.8.0dev (2020-06-22T08:37:37Z master 3238641750) +JIT [x86_64-linux]
before --jit: ruby 2.8.0dev (2020-06-23T01:01:24Z master 9ce2066209) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-23T06:58:37Z master 17e9df3157) +JIT [x86_64-linux]
last_commit=Avoid generating opt_send with cfunc cc with JIT
Calculating -------------------------------------
                     before2 --jit  before --jit  after --jit
        mjit_nil?(1)       54.204M       75.536M      75.031M i/s -     40.000M times in 0.737947s 0.529548s 0.533110s
         mjit_not(1)       53.822M       70.921M      71.920M i/s -     40.000M times in 0.743195s 0.564007s 0.556171s
     mjit_eq(1, nil)        7.367M        6.496M       7.331M i/s -      8.000M times in 1.085882s 1.231470s 1.091327s

Comparison:
                     mjit_nil?(1)
        before --jit:  75536059.3 i/s
         after --jit:  75031409.4 i/s - 1.01x  slower
       before2 --jit:  54204431.6 i/s - 1.39x  slower

                      mjit_not(1)
         after --jit:  71920324.1 i/s
        before --jit:  70921063.1 i/s - 1.01x  slower
       before2 --jit:  53821697.6 i/s - 1.34x  slower

                  mjit_eq(1, nil)
       before2 --jit:   7367280.0 i/s
         after --jit:   7330527.4 i/s - 1.01x  slower
        before --jit:   6496302.8 i/s - 1.13x  slower
```
2020-06-23 00:09:54 -07:00
Takashi Kokubun 78352fb52e
Compile opt_send for opt_* only when cc has ISeq
because opt_nil/opt_not/opt_eq populates cc even when it doesn't
fallback to opt_send_without_block because of vm_method_cfunc_is.

```
$ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark/mjit_opt_cc_insns.yml --repeat-count=4
before --jit: ruby 2.8.0dev (2020-06-22T08:11:24Z master d231b8f95b) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-22T08:53:27Z master e1125879ed) +JIT [x86_64-linux]
last_commit=Compile opt_send for opt_* only when cc has ISeq
Calculating -------------------------------------
                     before --jit  after --jit
        mjit_nil?(1)      54.106M      73.693M i/s -     40.000M times in 0.739288s 0.542795s
         mjit_not(1)      53.398M      74.477M i/s -     40.000M times in 0.749090s 0.537075s
     mjit_eq(1, nil)       7.427M       6.497M i/s -      8.000M times in 1.077136s 1.231326s

Comparison:
                     mjit_nil?(1)
         after --jit:  73692594.3 i/s
        before --jit:  54106108.4 i/s - 1.36x  slower

                      mjit_not(1)
         after --jit:  74477487.9 i/s
        before --jit:  53398125.0 i/s - 1.39x  slower

                  mjit_eq(1, nil)
        before --jit:   7427105.9 i/s
         after --jit:   6497063.0 i/s - 1.14x  slower
```

Actually opt_eq becomes slower by this. Maybe it's indeed using
opt_send_without_block, but I'll approach that one in another commit.
2020-06-22 02:08:21 -07:00
Takashi Kokubun d9f608b686
Verify builtin inline annotation with VM_CHECK_MODE (#3244)
* Verify builtin inline annotation with VM_CHECK_MODE

* Remove static to fix the link issue on MJIT
2020-06-21 10:27:04 -07:00
Nobuyoshi Nakada 838d695c16
Prefer ruby_install_name as runner
`Gem::Commands::EnvironmentCommand` expects that `Gem.ruby` has
the transformed basename.
2020-06-21 10:34:07 +09:00
Takashi Kokubun 7561db8c00
Introduce Primitive.attr! to annotate 'inline' (#3242)
[Feature #15589]
2020-06-20 17:13:03 -07:00
Nobuyoshi Nakada 49f0fd21e4 [Feature #16254] Allow `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada c8703a17ce [Feature #16254] Allow `__builtin.func` style 2020-06-19 18:46:55 +09:00
Hiroshi SHIBATA 16854c95c2 Removed sdbm entries from toolchanins 2020-06-19 08:26:47 +09:00
Takashi Kokubun e544a3a23c
Remove obsoleted opt_call_c_function insn (#3232)
* Remove obsoleted opt_call_c_function insn

* Keep opt_call_c_function with DEFINE_INSN_IF
2020-06-17 09:16:01 -07:00
Nobuyoshi Nakada 2a20c17982
Prefer String#each_byte when using a block 2020-06-15 16:20:56 +09:00
Yusuke Endoh 8f99bfa26d tool/lib/minitest/unit.rb: Reproducible shuffle of test suites
... based on CRC32 of names of the test suites.

Formerly, `make test-all` randomized the order of the test suites by
using `Array#shuffle`.  It also shows `--seed N` to reproduce the order,
but it was not reproducible when a suite set is different.

This change sorts the suites by CRC32 hash of the suite names with a
salt generated by the seed.
2020-06-15 13:56:01 +09:00
David Rodríguez f5f6415f26 A help message to `tool/sync_default_gems.rb` 2020-06-15 12:37:37 +09:00
Nobuyoshi Nakada d23917dd85
Support arguments of singleton method 2020-06-14 16:09:00 +09:00
Nobuyoshi Nakada b22bfdaa9a
Fixed up rest, keywords, keyword rest and block arguments 2020-06-14 16:08:33 +09:00
Takashi Kokubun 997133d595
Make __builtin_cexpr! and __builtin_cstmt! work again
with Ripper.

a3e6f52c17 introduced __builtin_cexpr! and
__builtin_cstmt!, but nobody has used them and then they broke on
79292b3088 by undefined `params`.

This patch fixes the undefined `params`, but still we're not using them
yet.
2020-06-13 23:48:34 -07:00
Nobuyoshi Nakada 1f1b62fb7b
Added install-dbg
Scripts to run the interpreter via debugger.
2020-06-13 08:22:06 +09:00
David Rodríguez 1161191a2a [rubygems/rubygems] Test against compact_index 0.13.0
https://github.com/rubygems/rubygems/commit/9f15b595ab
2020-06-05 07:32:42 +09:00