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

63545 commits

Author SHA1 Message Date
Maxime Chevalier-Boisvert
68a5ace0c2 Fix compiler warnings 2020-10-23 16:49:59 -04:00
Maxime Chevalier-Boisvert
d4fd0f709e Merge branch 'microjit' of https://github.com/Shopify/ruby into microjit 2020-10-23 10:59:38 -04:00
Maxime Chevalier-Boisvert
b2987b7d95 Implemented mechanism for rel32 call 2020-10-23 10:59:22 -04:00
Alan Wu
55f4c8c75a lldb script: Print flags of method entries 2020-10-22 19:16:31 -04:00
Alan Wu
9586d204c0 Move MicroJIT compilation threshold into MicroJIT's header 2020-10-22 14:17:13 -04:00
Maxime Chevalier-Boisvert
1b24f382bb Fixed two CFUNC call bugs thanks to Alan & Aaron! 2020-10-22 12:11:29 -04:00
Alan Wu
8c5c786769 MicroJIT: Read pointer to call cache from call data
The call cache changes when the call site becomes polymophic and can
result in the generated code falsely assuming cd->cc->cme is not NULL.

Here is a crasher:

    def body(thing)
      thing.strip
    end

    str = ""
    10.times { body(str) }
    body(0) rescue p 'not found'
    body(str)
2020-10-21 21:09:21 -04:00
Maxime Chevalier-Boisvert
127b58450e Fix MicroJIT argument copying for CFUNC calls 2020-10-21 16:10:19 -04:00
Maxime Chevalier-Boisvert
4c2bed88d1 Fixed two issues with MicroJIT CFUNC calls 2020-10-20 16:55:49 -04:00
Maxime Chevalier-Boisvert
20b882218f First pass at CFUNC calls complete. Not yet functional. 2020-10-20 15:03:06 -04:00
Maxime Chevalier-Boisvert
8e4d1ee6d3 Refactor ujit, define named register constants, code cleanup 2020-10-20 11:11:47 -04:00
Maxime Chevalier-Boisvert
c90732da0a Merge branch 'microjit' of https://github.com/Shopify/ruby into microjit 2020-10-20 10:37:58 -04:00
Maxime Chevalier-Boisvert
bac922121f Commit before merge. 2020-10-20 10:37:47 -04:00
Alan Wu
1b15d8f6e2 MicroJIT: switch to example that passes ec as second argument
opt_send_without_block needs it. Ideally we would use this example
only when an instruction in the compiled sequence needs `ec`. We can
worry about that later.
2020-10-19 20:31:11 -04:00
Alan Wu
bf862017d0 MicroJIT: Use R9 in generated code for Ruby stack pointer 2020-10-19 18:04:16 -04:00
Alan Wu
de57ccf0ef Add to the MicroJIT scraper an example that passes ec 2020-10-19 17:45:43 -04:00
Alan Wu
feec8ba013 Merge branch 'microjit-call-counter' into microjit 2020-10-19 17:08:50 -04:00
Maxime Chevalier-Boisvert
f6a3b8b8cc Updated C function call sketch 2020-10-19 16:31:15 -04:00
Maxime Chevalier-Boisvert
57434be46c Merge branch 'master' into microjit 2020-10-19 12:29:13 -04:00
Maxime Chevalier-Boisvert
2c0c8dca49 Remove comment. Commit before rebase. 2020-10-19 11:56:58 -04:00
Alan Wu
8ddc632852 Fix MicroJIT logic in MJIT exec 2020-10-19 11:42:05 -04:00
Alan Wu
7866b9a356 Never compile with MicroJIT when MJIT is enabled
There is a crash in there that we don't want to worry about for now.
2020-10-19 10:41:26 -04:00
Alan Wu
ca00952afd Declare extern with RUBY_EXTERN for MJIT 2020-10-19 10:27:16 -04:00
Alan Wu
5eb1dab364 Update dependencies 2020-10-19 10:26:38 -04:00
Alan Wu
6219097169 MicroJIT: Don't compile trace instructions 2020-10-19 09:47:39 -04:00
Alan Wu
c6ed9b8596 Don't call MicroJIT from MJIT output 2020-10-19 09:08:18 -04:00
Alan Wu
4aa37bd9e3 Export MicroJIT global used in MJIT 2020-10-19 09:08:14 -04:00
Hiroshi SHIBATA
3f97940252
Followed up with 708413807a
* Added sync task for digest
  * Update doc/* for default gems
  * Update the latest version of gemspec
2020-10-19 18:56:19 +09:00
Hiroshi SHIBATA
708413807a
Revisit to promote digest to default gems.
This reverts commit f39021be7e.
2020-10-19 18:38:09 +09:00
Koichi Sasada
de17e2dea1 reduce lock for encoding
To reduce the number of locking for encoding manipulation,
enc_table::list is splited to ::default_list and ::additional_list.
::default_list is pre-allocated and no need locking to access to
the ::default_list. If additional encoding space is needed, use
::additional_list and this list need to use locking.
However, most of case, ::default_list is enough.
2020-10-19 14:06:40 +09:00
git
f1f8f38079 * 2020-10-19 [ci skip] 2020-10-19 13:21:08 +09:00
Kazuhiro NISHIYAMA
ce62850334
Fix typos [ci skip] 2020-10-19 13:20:34 +09:00
Yusuke Endoh
09dd9d8e5d Revert "test/rinda/test_rinda.rb: try debugging TestRingServer#test_do_reply"
This reverts commit de5e8d0e3b.

Remove the debugging code that is no longer needed
2020-10-17 15:32:40 +09:00
Yusuke Endoh
6a9e09824b Revert "test/rinda/test_rinda.rb: Add more debugging code"
This reverts commit ac803ab55d.

Remove debugging code that is no longer needed
2020-10-17 15:32:19 +09:00
Yusuke Endoh
5c003b4bcd test/rinda/test_rinda.rb: Prevent a callback Proc from being GC'ed
According to the log of ac803ab55d, I
found that a thread terminates silently due to "recycled object" of
id2ref:

```
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/lib/drb/drb.rb:366:in `_id2ref'"
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/lib/drb/drb.rb:366:in `to_obj'"
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/lib/drb/drb.rb:1528:in `to_obj'"
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/lib/drb/drb.rb:1847:in `to_obj'"
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/lib/drb/drb.rb:1136:in `method_missing'"
"/home/chkbuild/chkbuild/tmp/build/20201017T033002Z/ruby/test/rinda/test_rinda.rb:652:in `block in do_reply'"
```
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201017T033002Z.log.html.gz

I believe that this unintentional thread termination has caused
intermittent timeout failure of `TestRingServer#test_do_reply`.

The root cause of the "recycled object" issue is a bug of
`TestRingServer#test_do_reply`.  It creates a callback Proc object but
does not hold the reference to the object:

```
callback = DRb::DRbObject.new callback
```

The original "callback" object is GC'ed unintentionally.
I could consistently reproduce this issue on my machine by adding
`GC.stress = true` at the first of `_test_do_reply` method body.

This change uses another local variable name, "callback_orig", to keep
the original Proc object.
2020-10-17 15:17:55 +09:00
Koichi Sasada
f6661f5085 sync RClass::ext::iv_index_tbl
iv_index_tbl manages instance variable indexes (ID -> index).
This data structure should be synchronized with other ractors
so introduce some VM locks.

This patch also introduced atomic ivar cache used by
set/getinlinecache instructions. To make updating ivar cache (IVC),
we changed iv_index_tbl data structure to manage (ID -> entry)
and an entry points serial and index. IVC points to this entry so
that cache update becomes atomically.
2020-10-17 08:18:04 +09:00
Koichi Sasada
91ec5f9e39 remove rb_obj_iv_index_tbl
(1) nobody uses it (gem-codesearch)
(2) the data strucuture will be changed.
2020-10-17 08:18:04 +09:00
Maxime Chevalier-Boisvert
d4ed319fdf Fixed is-object check in opt_send_without_block 2020-10-16 16:57:56 -04:00
Maxime Chevalier-Boisvert
cc228fd87a Check receiver type and klass in MicroJIT 2020-10-16 14:46:46 -04:00
Aaron Patterson
ff9dc10966
keep proc on the stack so it does not move 2020-10-16 11:28:52 -07:00
Maxime Chevalier-Boisvert
f533898079 Merge branch 'microjit-call-counter' into microjit 2020-10-16 13:50:39 -04:00
Maxime Chevalier-Boisvert
8be3444a49 Commit before merge 2020-10-16 13:42:14 -04:00
git
26e8db6b93 * 2020-10-17 [ci skip] 2020-10-17 00:08:33 +09:00
Yusuke Endoh
ac803ab55d test/rinda/test_rinda.rb: Add more debugging code
in addition to de5e8d0e3b
2020-10-17 00:07:35 +09:00
Alan Wu
0d17cdd0ac Abort on system stack overflow during GC
Buggy native extensions could have mark functions that cause stack
overflow. When a stack overflow happens during GC, Ruby used to recover
by raising an exception, which runs the interpreter. It's not safe to
run the interpreter during GC since the GC is in an inconsistent state.
This could cause object allocation during GC, for example.

Instead of running the interpreter and potentially causing a crash down
the line, fail fast and abort.
2020-10-16 10:24:12 -04:00
Yusuke Endoh
de5e8d0e3b test/rinda/test_rinda.rb: try debugging TestRingServer#test_do_reply
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201016T063003Z.fail.html.gz
```
  1) Error:
Rinda::TestRingServer#test_do_reply:
Timeout::Error: timeout
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:837:in `sleep'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:837:in `wait_for'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:659:in `_test_do_reply'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:643:in `block in test_do_reply'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:807:in `with_timeout'
    /home/chkbuild/chkbuild/tmp/build/20201016T063003Z/ruby/test/rinda/test_rinda.rb:643:in `test_do_reply'
```
2020-10-16 16:51:33 +09:00
Yusuke Endoh
1cbb1f1720 test/ruby/test_syntax.rb: avoid "warning: assigned but unused variable" 2020-10-16 11:10:58 +09:00
git
c34539d049 * 2020-10-16 [ci skip] 2020-10-16 08:37:33 +09:00
wanabe
65ae7f347a Adjust sp for if true or .../if false and ... 2020-10-16 08:37:04 +09:00
wanabe
ce7a053475 Adjust sp for x = false; y = (return until x unless x) [Bug ] 2020-10-16 08:37:04 +09:00