aboutsummaryrefslogtreecommitdiffstats
path: root/vm_dump.c
Commit message (Collapse)AuthorAgeFilesLines
* windows-arm64 support (#8995)Pierrick Bouvier2023-11-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [win32] fix compilation for windows-arm64 Credits to MSYS2 Ruby package using this patch. * [win32] nm use full options Fix compilation error when using MSYS2 environment. Credits to MSYS2 Ruby package using this patch. * [win32] detect llvm-windres (used for windows-arm64) When adding preprocessor option for llvm-windres (using clang as parameter), it fails. Thus, do not add this. It's needed to be able to compile windows-arm64 version, because MSYS2 toolchain is LLVM based (instead of GCC/binutils). * [win32] pioinfo detection for windows-arm64 This fixes "unexpected ucrtbase.dll" for native windows-arm64 ruby binary. It does not solve issue with x64 version emulated on this platform. Value of pioinfo pointer can be found in ucrtbase.dll at latest adrp/add sequence before return of _isatty function. This works for both release and debug ucrt. Due to the nature of aarch64 ISA (vs x86 or x64), it's needed to disassemble instructions to retrieve offset value, which is a bit more complicated than matching specific string patterns. Details about adrp/add usage can be found in this blog post: https://devblogs.microsoft.com/oldnewthing/20220809-00/?p=106955 For instruction decoding, the Arm documentation was used as a reference.
* Fix leaked symbols on FreeBSD [ci skip]Nobuyoshi Nakada2023-10-121-0/+3
|
* Dump backtraces to an arbitrary stream when using libprocstatNobuyoshi Nakada2023-09-261-3/+3
|
* Labels cannot at the end of blockNobuyoshi Nakada2023-09-261-0/+1
|
* Add a missing labelNobuyoshi Nakada2023-09-261-0/+1
|
* Abort dumping when output failedNobuyoshi Nakada2023-09-251-106/+155
|
* Dump backtraces to an arbitrary streamNobuyoshi Nakada2023-09-251-127/+137
|
* Clean up OPT_STACK_CACHING (#8132)Takashi Kokubun2023-07-271-14/+1
|
* Remove __bp__ and speed-up bmethod calls (#8060)Alan Wu2023-07-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove rb_control_frame_t::__bp__ and optimize bmethod calls This commit removes the __bp__ field from rb_control_frame_t. It was introduced to help MJIT, but since MJIT was replaced by RJIT, we can use vm_base_ptr() to compute it from the SP of the previous control frame instead. Removing the field avoids needing to set it up when pushing new frames. Simply removing __bp__ would cause crashes since RJIT and YJIT used a slightly different stack layout for bmethod calls than the interpreter. At the moment of the call, the two layouts looked as follows: ┌────────────┐ ┌────────────┐ │ frame_base │ │ frame_base │ ├────────────┤ ├────────────┤ │ ... │ │ ... │ ├────────────┤ ├────────────┤ │ args │ │ args │ ├────────────┤ └────────────┘<─prev_frame_sp │ receiver │ prev_frame_sp─>└────────────┘ RJIT & YJIT interpreter Essentially, vm_base_ptr() needs to compute the address to frame_base given prev_frame_sp in the diagrams. The presence of the receiver created an off-by-one situation. Make the interpreter use the layout the JITs use for iseq-to-iseq bmethod calls. Doing so removes unnecessary argument shifting and vm_exec_core() re-entry from the interpreter, yielding a speed improvement visible through `benchmark/vm_defined_method.yml`: patched: 7578743.1 i/s master: 4796596.3 i/s - 1.58x slower C-to-iseq bmethod calls now store one more VALUE than before, but that should have negligible impact on overall performance. Note that re-entering vm_exec_core() used to be necessary for firing TracePoint events, but that's no longer the case since 9121e57a5f50bc91bae48b3b91edb283bf96cb6b. Closes ruby/ruby#6428
* Add thread and ractor counts to bug reportsAlan Wu2023-03-161-0/+8
| | | | | | | | | | | | | | This is useful for crash triaging. It also helps to hint extension developers about the misuse of `rb_thread_call_without_gvl()`. Example: $ ./miniruby -e 'Ractor.new{Ractor.receive}; Thread.new{sleep}; Process.kill:SEGV,Process.pid' <snip> -- Threading information --------------------------------------------------- Total ractor count: 2 Ruby thread count for this ractor: 2
* Move `dump_machine_register` definitionsNobuyoshi Nakada2023-02-231-19/+10
|
* Add support for LoongArch (#7343)小MAO钓鱼2023-02-221-2/+24
| | | | | | | | | * vm_dump.c: Dump machine registers on loongarch64 Linux. * coroutines: Support for native loongarch64 coroutines. --------- Co-authored-by: zangruochen <zangruochen@loongson.cn>
* Merge gc.h and internal/gc.hMatt Valentine-House2023-02-091-1/+1
| | | | [Feature #19425]
* Fix backtrace beyond _singtramp on macOS arm64 (#7015)NARUSE, Yui2022-12-241-2/+17
| | | | * move ptrauth_strip logic into vm_dump.c * don't use _sigtramp special logic on arm64
* push dummy frame for loading processKoichi Sasada2022-10-201-6/+14
| | | | | | | | | | | | | This patch pushes dummy frames when loading code for the profiling purpose. The following methods push a dummy frame: * `Kernel#require` * `Kernel#load` * `RubyVM::InstructionSequence.compile_file` * `RubyVM::InstructionSequence.load_from_binary` https://bugs.ruby-lang.org/issues/18559
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-486/+486
| | | | [Misc #18891]
* Prevent printing crash report in a loopAlan Wu2022-06-031-0/+11
| | | | | | | | | | | In the event that we are crashing due to a corrupt Ruby stack, we might re-enter rb_vm_bugreport() due to failed assertions in rb_backtrace_print_as_bugreport() or SDR(). In these cases we were printing the bug report ad infinitum with unbounded recusion. I seem to run into this every once in a while and the amount of log it prints out is pretty distracting. On CI environments it makes the log output unnecessarily big. Let's fix this.
* remove `NON_SCALAR_THREAD_ID` supportKoichi Sasada2022-05-241-7/+1
| | | | | | | | | `NON_SCALAR_THREAD_ID` shows `pthread_t` is non-scalar (non-pointer) and only s390x is known platform. However, the supporting code is very complex and it is only used for deubg print information. So this patch removes the support of `NON_SCALAR_THREAD_ID` and make the code simple.
* introduce struct `rb_native_thread`Koichi Sasada2022-04-231-2/+2
| | | | | | | | | `rb_thread_t` contained `native_thread_data_t` to represent thread implementation dependent data. This patch separates them and rename it `rb_native_thread` and point it from `rb_thraed_t`. Now, 1 Ruby thread (`rb_thread_t`) has 1 native thread (`rb_native_thread`).
* Enable C backtraces on Apple silicon (#5770)Jean byroot Boussier2022-04-201-1/+4
| | | Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
* [DOC]Some link prefix replaceS-H-GAMELINKS2022-04-091-2/+2
|
* Prefix ccan headers (#4568)Nobuyoshi Nakada2022-03-301-1/+1
| | | | | | | | | | | | | * Prefixed ccan headers * Remove unprefixed names in ccan/build_assert * Remove unprefixed names in ccan/check_type * Remove unprefixed names in ccan/container_of * Remove unprefixed names in ccan/list Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
* Add ISEQ_BODY macroPeter Zhu2022-03-241-12/+12
| | | | | | Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using this macro will make it easier for us to change the allocation strategy of rb_iseq_constant_body when using Variable Width Allocation.
* enable `RUBY_ON_BUG` on release buildKoichi Sasada2022-01-251-2/+0
| | | | [Feature #18483]
* Shorten register names on arm64-darwin not to be truncatedNobuyoshi Nakada2021-10-101-23/+27
|
* Crash more nicely when the VM isn't fully set upAaron Patterson2021-06-101-30/+32
| | | | If we crash but the VM isn't fully alive, we can get an infinite loop.
* Don't create objects during GCAaron Patterson2021-06-071-1/+1
| | | | | | 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
* Do not expect ec on rb_vm_bugreportTakashi Kokubun2021-06-021-1/+1
| | | | | 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.
* vm_dump.c: rename HAVE_BACKTRACE to USE_BACKTRACEBenoit Daloze2021-05-041-7/+8
| | | | | | | * 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>
* Unify code by word sizesNobuyoshi Nakada2021-04-041-5/+2
|
* vm dump display return address in the abscence of X30 in Mac ARM64.David CARLIER2021-03-221-0/+1
|
* vm_dump.c: Dump machine registers on RISC-V LinuxYusuke Endoh2021-02-101-2/+24
| | | | | | Fixes [Bug #17615] Co-Authored-By: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
* Revert "vm_dump.c: Do not show C backtrace on riscv"Yusuke Endoh2021-02-041-1/+1
| | | | | | This reverts commit 6985bfb72c8d7e7d94f1aad1f0902b602bbfa6da. Now it should work on riscv by the previous commit. [Bug #17609]
* vm_dump: dump registers for Mac M1David CARLIER2021-01-311-1/+23
|
* Removed excess stringizations on regstr [Bug #17532]Nobuyoshi Nakada2021-01-131-1/+1
|
* vm debug: dump registers on ARM too. (#3900)David CARLIER2020-12-161-2/+43
| | | * vm debug: dump registers on ARM too.
* Allow an MJIT worker to show a backtrace on SEGVTakashi Kokubun2020-12-101-1/+2
| | | | | 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.
* Loaded script is unset yet when crashed in the initialization phaseNobuyoshi Nakada2020-12-021-3/+5
|
* fix public interfaceKoichi Sasada2020-11-181-1/+1
| | | | | | | | | | | | | | | | | | 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)
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-3/+5
| | | | | | | | | | | | | | | | 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.
* Prefer configured printf format for mingw gcc 10Nobuyoshi Nakada2020-05-261-1/+1
|
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* vm_dump.c: Do not show C backtrace on riscvYusuke Endoh2020-04-201-1/+1
| | | | | Currently, objdump -W miniruby emits some errors on riscv, so I guess that DWARF is corrupted.
* Removed useless VMDEBUG definition [ci skip]Nobuyoshi Nakada2020-04-191-6/+0
| | | | VMDEBUG is always defined as defaulted to 0 in vm_core.h.
* Update VMDEBUG reference doc [ci skip]Nguyễn Quang Minh2020-04-191-1/+1
| | | Since this commit (https://github.com/ruby/ruby/commit/9e1b06e17d27fb4ddf51e9244f205417e9c4dd5c), 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.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-2/+2
| | | Split ruby.h
* Introduce disposable call-cache.Koichi Sasada2020-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* support RUBY_ON_BUG envval on assert failure.Koichi Sasada2020-01-061-0/+12
| | | | Check RUBY_ON_BUG env val also on rb_assert_failure().
* Get rid of LIST_HEAD conflict with a system header on macOSNobuyoshi Nakada2019-12-271-0/+3
|