68 Commits

Author SHA1 Message Date
Aaron Patterson
4ccaf6285f
fix lldb scripts on older lldb python 2022-07-06 13:21:37 -07:00
Jemma Issroff
87a560a057 Add T_STRUCT to lldb inspect helper 2022-06-21 18:16:10 -07:00
Matt Valentine-House
721e012d42 [ci skip][lldb] Fix array length representation with USING_RVARGC
This commit makes `rp` report the correct array length in lldb.

When USING_RVARGC is set we use 7 bits of the flags to store the array
len rather than the usual 2, so they need to be part of the mask when
calculating the length in lldb.

When calculating whether rvargc is enabled I've used the same approach
that's used by `GC.using_rvargc?` which is to detect whether there is
more than one size pool in the current objspace.
2022-06-17 09:15:22 -04:00
Matt Valentine-House
9eabc57584 [ci skip] [lldb] Ensure rbbt has loaded the globals
rb_backtrace relies on the existend of RUBY_T_MASK. This is set up by
the global loading code in lldb_init()

rb_backtrace does not call lldb_init previously, and therefore would
only work if called after another lldb function that _did_ load the
globals.
2022-06-15 13:46:23 -07:00
Matt Valentine-House
acee714ce0 [ci skip] Print the rb_classext_t for a class, using an offset
Now that classes are using VWA, the RCLASS_PTR uses an offset to get the
rb_classext_t object. Doing this all the time in lldb is boring. So
script lldb to do it for us
2022-06-15 10:59:29 -07:00
Jemma Issroff
d154d5d281 Add imemo types to global namespace in lldb helpers 2022-06-15 09:04:11 -07:00
Jemma Issroff
ac405dc214 Add more information to lldb dump_page helper 2022-05-27 13:45:33 -07:00
Peter Zhu
c482ee4025 Make heap page sizes 64KiB by default
Commit dde164e968e382d50b07ad4559468885cbff33ef decoupled incremental
marking from page sizes. This commit changes Ruby heap page sizes to
64KiB. Doing so will have several benefits:

1. We can use compaction on systems with 64KiB system page sizes (e.g.
   PowerPC).
2. Larger page sizes will allow Variable Width Allocation to increase
   slot sizes and embed larger objects.
3. Since commit 002fa2859962f22de8afdbeece04966ea57b7da9, macOS has 64
   KiB pages. Making page sizes 64 KiB will bring these systems to
   parity.

I have attached some bechmark results below.

Discourse:
    On Discourse, we saw much better p99 performance (e.g. for "categories"
    it went from 214ms on master to 134ms on branch, for "home" it went
    from 265ms to 251ms). We don’t see much change in p60, p75, and p90
    performance. We also see a slight decrease in memory usage by 1.04x.

    Branch RSS: 354.9MB
    Master RSS: 368.2MB

railsbench:
    On rails bench, we don’t see a big change in RPS or p99
    performance. We don’t see a big difference in memory usage.

    Branch RPS: 826.27
    Master RPS: 824.85

    Branch p99: 1.67
    Master p99: 1.72

    Branch RSS: 88.72MB
    Master RSS: 88.48MB

liquid:
    We don’t see a significant change in liquid performance.

    Branch parse & render: 28.653 I/s
    Master parse & render: 28.563 i/s
2022-04-04 09:27:14 -04:00
Matt Valentine-House
d3d888b986 [lldb] Handle MacOS 64Kb heap pages in the lldb helpers 2022-01-26 15:28:09 -05:00
Nobuyoshi Nakada
1a0e0e8996
lldb_cruby.py: support RVARGC on T_CLASS [ci skip] 2022-01-17 19:43:52 +09:00
Peter Zhu
ee4784c06e Update lldb_cruby.py for VWA strings 2022-01-06 14:33:35 -05:00
Nobuyoshi Nakada
b74bf8dd88
Follow up the RString change [ci skip]
Since 46b66eb9e8e6de2d5750591e532310e8f8599d90, already `ary` has
been enclosed in `embed`.
2021-10-28 08:58:59 +09:00
Peter Zhu
a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Nobuyoshi Nakada
bbf98b572e
lldb: Get rid of error at unpreserved encodings [ci skip] 2021-09-29 22:31:24 +09:00
Nobuyoshi Nakada
545e01645f
lldb: Show encoding of String [ci skip] 2021-09-28 20:03:54 +09:00
Peter Zhu
62bc4a9420 [Feature #18045] Implement size classes for GC
This commits implements size classes in the GC for the Variable Width
Allocation feature. Unless `USE_RVARGC` compile flag is set, only a
single size class is created, maintaining current behaviour. See the
redmine ticket for more details.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Peter Zhu
c08d4067be [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Peter Zhu
eddd369e73 Revert "[Feature #18045] Implement size classes for GC"
This reverts commits 48ff7a9f3e47bffb3e4d067a12ba9b936261caa0
and b2e2cf2dedd104acad8610721db5e4d341f135ef because it is causing
crashes in SPARC solaris and i386 debian.
2021-08-23 10:54:53 -04:00
Peter Zhu
b2e2cf2ded [Feature #18045] Implement size classes for GC
This commits implements size classes in the GC for the Variable Width
Allocation feature. Unless `USE_RVARGC` compile flag is set, only a
single size class is created, maintaining current behaviour. See the
redmine ticket for more details.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Peter Zhu
48ff7a9f3e [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Nobuyoshi Nakada
91c542ad05
lldb_cruby.py: push non-flonum float to history [ci skip] 2021-06-04 09:24:57 +09:00
Nobuyoshi Nakada
3c57c087ec
lldb_cruby.py: fix non-flonum float inspection [ci skip] 2021-06-04 09:12:34 +09:00
Aaron Patterson
45ddefb14a
add rb_id2str to lldb debugging scripts 2021-05-24 16:02:42 -07:00
Peter Zhu
578e6416e7 lldb: convert heap_page_obj_limit from a float to int 2021-05-06 12:54:43 -04:00
Matt Valentine-House
b0b7751f3b lldb: teach rp about T_PAYLOAD 2021-05-06 09:18:17 -04:00
Matt Valentine-House
5a451c4b1f lldb: Warn when attempting to dump invalid pages 2021-04-29 15:13:34 -04:00
Matt Valentine-House
1c1c91535c lldb: highlight the slot when using dump_page_rvalue 2021-04-27 10:58:49 -04:00
Matt Valentine-House
f64bb9fc84 lldb: dump_page_rvalue - dump a heap page containing an RVALUE
rather than having to do this in a two step process:

1. heap_page obj
2. dump_page $2 (or whatever lldb variable heap_page set)

we can now just

dump_page_rvalue obj
2021-04-27 10:58:49 -04:00
Matt Valentine-House
c752a35816 lldb: Add Freelist Index to dump_page output 2021-04-27 10:58:49 -04:00
Matt Valentine-House
a47697aa44 LLDB: Introduce dump_page helper
This dumps out object type information for every object on a page in the
form:

bits [LM R ] T_CLASS    [389]: Addr: 0x1007ebcf0 (flags: 0x100000062)
2021-03-16 08:19:37 -07:00
Matt Valentine-House
1dca333599 LLDB: Extract a dump_bits function from rp
that dumps the heap page bitmaps for a slot
2021-03-16 08:19:37 -07:00
Aaron Patterson
8a06af5f88
Mostly recover a Ruby stack trace from a core file
Update the lldb script so it can mostly recover a Ruby stack trace from
a core file.  It's still missing line numbers and dealing with CFUNCs,
but you use it like this:

```
(lldb) rbbt ec
rb_control_frame_t TYPE
0x7f6fd6555fa0     EVAL   ./bootstraptest/runner.rb error!!
0x7f6fd6555f68     METHOD ./bootstraptest/runner.rb main
0x7f6fd6555f30     METHOD ./bootstraptest/runner.rb in_temporary_working_directory
0x7f6fd6555ef8     METHOD /home/aaron/git/ruby/lib/tmpdir.rb mktmpdir
0x7f6fd6555ec0     BLOCK  ./bootstraptest/runner.rb block in in_temporary_working_directory
0x7f6fd6555e88     CFUNC
0x7f6fd6555e50     BLOCK  ./bootstraptest/runner.rb block (2 levels) in in_temporary_working_directory
0x7f6fd6555e18     BLOCK  ./bootstraptest/runner.rb block in main
0x7f6fd6555de0     METHOD ./bootstraptest/runner.rb exec_test
0x7f6fd6555da8     CFUNC
0x7f6fd6555d70     BLOCK  ./bootstraptest/runner.rb block in exec_test
0x7f6fd6555d38     CFUNC
0x7f6fd6555d00     TOP    /home/aaron/git/ruby/bootstraptest/test_insns.rb error!!
0x7f6fd6555cc8     CFUNC
0x7f6fd6555c90     BLOCK  /home/aaron/git/ruby/bootstraptest/test_insns.rb block in <top (required)>
0x7f6fd6555c58     METHOD ./bootstraptest/runner.rb assert_equal
0x7f6fd6555c20     METHOD ./bootstraptest/runner.rb assert_check
0x7f6fd6555be8     METHOD ./bootstraptest/runner.rb show_progress
0x7f6fd6555bb0     METHOD ./bootstraptest/runner.rb with_stderr
0x7f6fd6555b78     BLOCK  ./bootstraptest/runner.rb block in show_progress
0x7f6fd6555b40     BLOCK  ./bootstraptest/runner.rb block in assert_check
0x7f6fd6555b08     METHOD ./bootstraptest/runner.rb get_result_string
0x7f6fd6555ad0     METHOD ./bootstraptest/runner.rb make_srcfile
0x7f6fd6555a98     CFUNC
0x7f6fd6555a60     BLOCK  ./bootstraptest/runner.rb block in make_srcfile
```

Getting the main execution context is difficult (it is stored in a
thread local) so for now you must supply an ec and this will make a
backtrace
2020-10-14 16:43:53 -07:00
Aaron Patterson
0a3099ae40
bit table information when printing an object 2020-09-28 16:45:19 -07:00
Aaron Patterson
3fb255625b
add lldb functions for getting the heap page / heap page body 2020-09-02 16:45:54 -07:00
Aaron Patterson
933035d303
support T_MATCH in lldb 2020-09-02 16:45:13 -07:00
Aaron Patterson
5483bf8fa4
add T_ZOMBIE support to lldb scripts 2020-08-27 09:00:19 -07:00
Nobuyoshi Nakada
6aa3aaac05
lldb_cruby.py: show the sign of Bignum [ci skip] 2020-06-23 15:56:59 +09:00
Aaron Patterson
7574b836a9
Add T_IMEMO support to lldb
I'm trying to find why a reference to an IMEMO object isn't being
updated
2020-05-07 15:54:00 -07:00
Aaron Patterson
56c6d520a0
Add T_MOVED support to lldb 2020-05-07 14:19:45 -07:00
Nobuyoshi Nakada
b5174beae6
lldb_cruby.py: fixed empty string dump [ci skip] 2020-04-26 12:53:11 +09:00
Nobuyoshi Nakada
86461fc28c
lldb_cruby.py: improved dump of Symbol
[ci skip]
2019-11-25 16:53:27 +09:00
Nobuyoshi Nakada
9af52c0d09
lldb_cruby.py: fixed dump of embedded RArray
[ci skip]
2019-11-25 09:21:27 +09:00
Nobuyoshi Nakada
8439caab0a
Refined rp output [ci skip]
So that the result structure can be accessed as `$number`
variables, not a mere `VALUE`.
2019-10-24 23:38:27 +09:00
Nobuyoshi Nakada
e078352a78
lldb_cruby.py: fixed inspecting string [ci skip]
Show the size of String.

To see the whole contents even after NUL char:

```
(lldb) rp str
(const char [5]) $1 = "x"
(lldb) memory read -s1 --format x --count `sizeof($1)` -- &$1                                                                                          0x1010457a8: 0x78 0x00 0x61 0x61 0x61
```
2019-10-09 09:08:21 +09:00
Nobuyoshi Nakada
98131f148f
lldb_cruby.py: fixed embedded string ptr [ci skip]
Use GetLocation to get the address of embedded array.
2019-10-09 09:08:09 +09:00
Romain Tartière
1c999952e7 Resolve unused local variable reported by LGTM
LGTM reports that the value assigned to local variable 'shared' is never
used:
f319a5d064/files/misc/lldb_cruby.py (x6512c0281581a470):1

This problem was introduced in by the refactoring that took place in
7c496b6624f720d539e3c0b40f122a9422a13b99.
2019-10-03 13:44:52 +09:00
Nobuyoshi Nakada
112c9f1430
lldb_inspect: removed unnecessary newline and end option 2019-09-25 16:58:24 +09:00
Nobuyoshi Nakada
c5a97d995a
misc/lldb_cruby.py: update for python3 [ci skip]
lldb module bundled with Xcode is for Python 3 now.
2019-09-24 21:05:29 +09:00
Nobuyoshi Nakada
0526366033
misc/lldb_cruby.py: removed unused module commands [ci skip] 2019-09-24 20:59:47 +09:00
Aaron Patterson
bdc36094e3
Add some NODE information for lldb
Just adds a conditional in the lldb scripts so we can more easily debug
NODE objects.
2019-08-29 14:51:34 -07:00