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

222 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada ef352c5865
Shorten register names on arm64-darwin not to be truncated 2021-10-10 21:58:56 +09:00
Aaron Patterson d74e5d5b4f
Crash more nicely when the VM isn't fully set up
If we crash but the VM isn't fully alive, we can get an infinite loop.
2021-06-10 16:31:29 -07:00
Aaron Patterson 459a9f82c9
Don't create objects during GC
If we crash during GC, allocating new objects in the segv handler can
cause an infinite loop.  This commit is to avoid creating new objects in
the crash handler
2021-06-07 11:47:16 -07:00
Takashi Kokubun 007e439fe9
Do not expect ec on rb_vm_bugreport
because a SEGV might happen on an MJIT worker. As you can clearly see
from `if (vm && ec) {`, ec is not guaranteed to exist here.
2021-06-02 21:50:40 -07:00
Benoit Daloze 9e2483ee0b vm_dump.c: rename HAVE_BACKTRACE to USE_BACKTRACE
* HAVE_ macros should only be defined or undefined, not used for their value.
* See [Feature #17752]

Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
2021-05-04 14:56:55 +02:00
Nobuyoshi Nakada 3cd3d25dde
Unify code by word sizes 2021-04-04 23:29:16 +09:00
David CARLIER 35d30c6ac5 vm dump display return address in the abscence of X30 in Mac ARM64. 2021-03-22 23:32:07 +09:00
Yusuke Endoh 66394aec98 vm_dump.c: Dump machine registers on RISC-V Linux
Fixes [Bug #17615]

Co-Authored-By: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
2021-02-10 04:39:41 +09:00
Yusuke Endoh f71659d47b Revert "vm_dump.c: Do not show C backtrace on riscv"
This reverts commit 6985bfb72c.

Now it should work on riscv by the previous commit. [Bug #17609]
2021-02-04 17:47:12 +09:00
David CARLIER 3813bb4152 vm_dump: dump registers for Mac M1 2021-01-31 09:53:03 +09:00
Nobuyoshi Nakada d8fb0bca54
Removed excess stringizations on regstr [Bug #17532] 2021-01-13 12:47:42 +09:00
David CARLIER 19157a3c00
vm debug: dump registers on ARM too. (#3900)
* vm debug: dump registers on ARM too.
2020-12-16 15:32:11 +09:00
Takashi Kokubun 885135f84c
Allow an MJIT worker to show a backtrace on SEGV
An MJIT worker thread doesn't have ec, and it's required for SDR() and
rb_backtrace_print_as_bugreport(). Therefore it must be checked.
2020-12-10 21:56:49 -08:00
Nobuyoshi Nakada 30ded41fc3
Loaded script is unset yet when crashed in the initialization phase 2020-12-02 16:16:48 +09:00
Koichi Sasada 5e3259ea74 fix public interface
To make some kind of Ractor related extensions, some functions
should be exposed.

* include/ruby/thread_native.h
  * rb_native_mutex_*
  * rb_native_cond_*
* include/ruby/ractor.h
  * RB_OBJ_SHAREABLE_P(obj)
  * rb_ractor_shareable_p(obj)
  * rb_ractor_std*()
  * rb_cRactor

and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
    (to avoid conflict with include/ruby/ractor.h)
2020-11-18 03:52:41 +09:00
Koichi Sasada 79df14c04b Introduce Ractor mechanism for parallel execution
This commit introduces Ractor mechanism to run Ruby program in
parallel. See doc/ractor.md for more details about Ractor.
See ticket [Feature #17100] to see the implementation details
and discussions.

[Feature #17100]

This commit does not complete the implementation. You can find
many bugs on using Ractor. Also the specification will be changed
so that this feature is experimental. You will see a warning when
you make the first Ractor with `Ractor.new`.

I hope this feature can help programmers from thread-safety issues.
2020-09-03 21:11:06 +09:00
Nobuyoshi Nakada 04eb05a8e0
Prefer configured printf format for mingw gcc 10 2020-05-26 16:58:28 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Yusuke Endoh 6985bfb72c vm_dump.c: Do not show C backtrace on riscv
Currently, objdump -W miniruby emits some errors on riscv, so I guess
that DWARF is corrupted.
2020-04-20 23:59:05 +09:00
Nobuyoshi Nakada e92f3e1216
Removed useless VMDEBUG definition [ci skip]
VMDEBUG is always defined as defaulted to 0 in vm_core.h.
2020-04-19 23:41:52 +09:00
Nguyễn Quang Minh 73bd2b70e2
Update VMDEBUG reference doc [ci skip]
Since this commit (9e1b06e17d), the VM Debug Level constant is moved from `vm_insnhelper.h` to `vm_core.h`. This PR is a super tiny update to reflect that change so that people won't waste time on searching in a wrong file.
2020-04-19 23:38:25 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Koichi Sasada b9007b6c54 Introduce disposable call-cache.
This patch contains several ideas:

(1) Disposable inline method cache (IMC) for race-free inline method cache
    * Making call-cache (CC) as a RVALUE (GC target object) and allocate new
      CC on cache miss.
    * This technique allows race-free access from parallel processing
      elements like RCU.
(2) Introduce per-Class method cache (pCMC)
    * Instead of fixed-size global method cache (GMC), pCMC allows flexible
      cache size.
    * Caching CCs reduces CC allocation and allow sharing CC's fast-path
      between same call-info (CI) call-sites.
(3) Invalidate an inline method cache by invalidating corresponding method
    entries (MEs)
    * Instead of using class serials, we set "invalidated" flag for method
      entry itself to represent cache invalidation.
    * Compare with using class serials, the impact of method modification
      (add/overwrite/delete) is small.
    * Updating class serials invalidate all method caches of the class and
      sub-classes.
    * Proposed approach only invalidate the method cache of only one ME.

See [Feature #16614] for more details.
2020-02-22 09:58:59 +09:00
Koichi Sasada 33d866558b support RUBY_ON_BUG envval on assert failure.
Check RUBY_ON_BUG env val also on rb_assert_failure().
2020-01-06 15:06:03 +09:00
Nobuyoshi Nakada baf37a5f9c
Get rid of LIST_HEAD conflict with a system header on macOS 2019-12-27 00:46:59 +09:00
卜部昌平 5e22f873ed decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
2019-12-26 20:45:12 +09:00
Nobuyoshi Nakada db16629008
Fixed misspellings
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
2019-12-20 09:32:42 +09:00
Koichi Sasada 54e089df9e show self on control frame dump.
control frame detailed info on RUBY_DEBUG=ci should also show
self information.
2019-12-12 17:03:47 +09:00
Koichi Sasada edb80dfe3e add additional CF info for CI env
Introduce new RUBY_DEBUG option 'ci' to inform Ruby interpreter
that an interpreter is running on CI environment.

With this option, `rb_bug()` shows more information includes
method entry information, local variables information for each
control frame.
2019-12-05 14:47:31 +09:00
Nobuyoshi Nakada 0c6f36668a
Adjusted spaces [ci skip] 2019-09-27 10:20:56 +09:00
David CARLIER 6dd9736c3a crash report on mac little update
displaying vm info as Linux and FreeBSD.
checking libproc as it is present only from 10.5 version.

https://github.com/ruby/ruby/pull/2384
2019-08-19 17:36:28 +09:00
Nobuyoshi Nakada 314b50d7c0
#include <> for system headers 2019-08-09 23:10:06 +09:00
Samuel Williams d17344cfc5 Remove IA64 support. 2019-06-19 23:30:04 +12:00
nobu a67788b2f3 Split procstat_vm.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:13 +00:00
svn fc14c408aa * expand tabs. [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 12:48:39 +00:00
nobu d99d8cc868 Add cast to suppress warnings on Solaris [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 12:48:36 +00:00
naruse 595056135f Support Mach-O on backtrace with DWARF
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 06:35:25 +00:00
nobu 55c7b8541a Fix for old names of mcontext registers
c.f. https://github.com/mistydemeo/tigerbrew/issues/473

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-22 20:13:08 +00:00
ktsj a343f6609e vm_core.h, vm_dump.c: fix cast
Revert r63968 and cast at caller side to prevent unintentional casting.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-15 11:42:15 +00:00
ktsj 99b6ef932f vm_dump.c: fix warning about constness
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-15 09:47:12 +00:00
shyouhei 96d19b6cbc delete extra #undef [ci skip]
Sorry, this was a garbage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-03 01:43:17 +00:00
shyouhei 76091d4388 "%z" printf format specifier is a C99ism
PRIxSIZE is also.  But shimmed in ruby.h

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:43 +00:00
shyouhei b6a2d63eb3 explicit cast to void* required for %p
These functions take variadic arguments so no automatic type
promotion is expected.  You have to do it by hand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:40 +00:00
stomar 995fd6d720 vm_dump.c: [DOC] fix grammar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 20:11:44 +00:00
ko1 d51de2bd61 * vm_dump.c (vm_stack_dump_each): accepts `ec`.
* vm_dump.c (vm_base_ptr): constify.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 16:12:06 +00:00
ko1 b0d79e1072 use `GET_VM()` directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:33:23 +00:00
ko1 8702a33dd2 `th` -> `ec` for VM dump related functions.
* vm_dump.c: `th` -> `ec` (and constify) for:
  * control_frame_dump
  * rb_vmdebug_stack_dump_raw
  * rb_vmdebug_debug_print_register
  * rb_vmdebug_debug_print_pre
  * rb_vmdebug_debug_print_post


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:31:01 +00:00
ko1 837fd5e494 Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038]

* vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer.
  There are many code using `th` to represent execution context
  (such as cfp, VM stack and so on). To access `ec`, they need to
  use `th->ec->...` (adding one indirection) so that we need to
  replace them by passing `ec` instead of `th`.

* vm_core.h (GET_EC()): introduced to access current ec. Also
  remove `ruby_current_thread` global variable.

* cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of
  rb_context_t::thread_value.

* cont.c (ec_set_vm_stack): added to update vm_stack explicitly.

* cont.c (ec_switch): added to switch ec explicitly.

* cont.c (rb_fiber_close): added to terminate fibers explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:32:49 +00:00
kazu 743ab3c783 Fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15 12:03:42 +00:00