Commit graph

18546 commits

Author SHA1 Message Date
Kevin Newton
4b5f516f2e [ruby/prism] Split comment
We were previously holding a type field on Comment to tell what
kind of comment it was. Instead, let's just use actual classes for
this.

e76830ca6e
2023-11-03 14:35:08 +00:00
Kevin Newton
d7d3243364
[ruby/prism] Properly support the start line option
33cc75a4b7
2023-11-03 10:13:50 -04:00
Kevin Newton
05f5c545d2
[ruby/prism] Wire up options through the FFI API
f0aa8ad93b
2023-11-03 10:13:49 -04:00
Kevin Newton
ca7297efd3
[ruby/prism] Wire up options through the Ruby API
8582d372a3
2023-11-03 10:13:49 -04:00
Jean Boussier
35da6f864a rb_ivar_defined: handle complex modules
It was assuming only objects can be complex.
2023-11-03 11:52:17 +01:00
Jun Aruga
1f1b9b0942 [ruby/rdoc] test/rdoc/test_rdoc_generator_json_index.rb: pend in test_generate in ppc64le.
We observed that this test randomly fails in the ruby/ruby Travis ppc64le case.
This commit is to pend the test_generate if the assertion for the generated
file's modified time fails in a ppc64le environment.

Note that I didn't use the word "Travis CI" or Travis CI specific environment variables
such as `TRAVIS` and `TRAVIS_CPU_ARCH`[1] in the code. Because I wanted to prioritize the
rdoc's independence from the ruby/ruby.

[1] https://docs.travis-ci.com/user/environment-variables/#default-environment-variables

42cdad1cf2
2023-11-03 10:30:28 +00:00
Matt Valentine-House
dcb9ded6c9 [PRISM] Fix CallNode with arguments when popped
Previously emitting a call node with an argument followed by another
node would cause the argument to be mistakenly omitted from the argument
list causing a stack underflow.

```
PRISM: **************************************************
-- raw disasm--------
   0000 putself                                                          (   0)
   0001 send                 <calldata:puts, 1>, nil                     (   0)
*  0004 pop                                                              (   0)
   0005 putobject            1                                           (   0)
   0007 leave                                                            (   0)
---------------------
```
2023-11-03 07:28:05 +00:00
Nobuyoshi Nakada
8b02de8f41
Fix thread leakage
Wait for the worker thread to finish.
2023-11-03 09:32:32 +09:00
Jean Boussier
ac8ec004e5 Make String.new size pools aware.
If the required capacity would fit in an embded string,
returns one.

This can reduce malloc churn for code that use string buffers.
2023-11-02 23:34:58 +01:00
Jemma Issroff
c6f5c64639 [PRISM] Fix popped for ForNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
7f18448a8e [PRISM] Fix popped for CallOperatorWriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
d8bdb15a8b [PRISM] Fix popped for Call{And,Or}WriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
5acced49c2 [PRISM] Fix popped for SingletonClassNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
33f18b3d2f [PRISM] Fix popped for CaseNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
62baf723b6 [PRISM] Fix popped for AssocSplatNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
8b4b3b1d38 [PRISM] Fix popped for MatchWriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
0359f9ca67 [PRISM] Fix popped for ConstantPathOperatorWriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
ddf12e8a3b [PRISM] Fix popped for ConstantPathOrWriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
ca24136da6 [PRISM] Fix popped on DefinedNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
698654ca84 [PRISM] Fixed popped for ConstantPathAndWriteNode 2023-11-02 17:46:43 -03:00
Jemma Issroff
00407894b5 [PRISM] Fix test infrastucture, comment out failing tests
Unfortunately, 84dfa0fa5e introduced
a bug where we were no longer testing the "popped" case because the
"; 1" meant to be appended to the source was no longer functioning
as intended.

This commit re-introduces the popped case, and comments out all
now failing tests.
2023-11-02 17:46:43 -03:00
Jean Boussier
0cb1fc3850 Fix vm_getivar to handle module with TOO_COMPLEX shape 2023-11-02 19:57:14 +01:00
Peter Zhu
38ba040d8b Make every initial size pool shape a root shape
This commit makes every initial size pool shape a root shape and assigns
it a capacity of 0.
2023-11-02 13:42:11 -04:00
Takashi Kokubun
ad4f973ecd
YJIT: Always define method codegen table at boot (#8807) 2023-11-02 09:15:48 -07:00
Jean Boussier
33795931a0 Better handle running out of shapes in remove_shape_recursive 2023-11-02 12:00:42 +01:00
Hiroshi SHIBATA
7149543f24
Added TestRipper namespace to test_call_colon2 2023-11-02 15:13:40 +09:00
lukeg
1925c6d555
test/ripper: nest helper classes under TestRipper module
Generic names like Node and NodeList should be namespaced properly.
2023-11-02 15:10:50 +09:00
Peter Zhu
909afcb4fc Fix SystemStackError in test_run_out_of_shape_for_class_cvar 2023-11-01 13:47:26 -04:00
Kevin Newton
52e127280b [ruby/prism] Disallow assigning to numbered parameters in regexp
ec419422f8
2023-11-01 17:40:16 +00:00
Peter Zhu
bdf8ce807f Fix remove_class_variable for too complex classes 2023-11-01 13:13:51 -04:00
Kevin Newton
8c0eb221b7 [ruby/prism] Forward parameters into arrays
2a11bfee76
2023-11-01 17:03:35 +00:00
Jemma Issroff
e80ca70b9b [ruby/prism] Flip incorrect names of OptionalKeywordParameterNode and RequiredKeywordParameterNode
c31f61e898
2023-11-01 14:40:45 +00:00
Jemma Issroff
d0625099e0 [ruby/prism] Split KeywordParameterNode into Optional and Required
Prior to this commit, KeywordParameterNode included both optional
and required keywords. With this commit, it is split in two, with
`OptionalKeywordParameterNode`s no longer having a value field.

89084d9af4
2023-11-01 14:40:44 +00:00
Jean Boussier
b77148ae9f remove_instance_variable: Handle running out of shapes
`remove_shape_recursive` wasn't considering that if we run out of
shapes, it might have to transition to SHAPE_TOO_COMPLEX.

When this happens, we now return with an error and the caller
initiates the evacuation.
2023-11-01 15:21:55 +01:00
Peter Zhu
9c6dd25093 Fix removing non-existent ivar for too complex 2023-11-01 08:25:09 -04:00
Peter Zhu
c3b7f27561 Fix remove_instance_variable for too complex generic ivar 2023-10-31 17:04:40 -04:00
Peter Zhu
60e207b47f Fix SystemStackError for test_run_out_of_shape_for_class 2023-10-31 17:01:28 -04:00
Peter Zhu
8889992b75 Fix remove_instance_variable for too complex class 2023-10-31 16:38:05 -04:00
Jemma Issroff
b3744c749d [PRISM] Implement compilation for SuperNode 2023-10-31 13:59:40 -03:00
Jemma Issroff
57748ef2a2 [PRISM] Compile forwarding super node 2023-10-31 13:08:09 -03:00
Aaron Patterson
6f5e378057 Fix "too complex" iv sets on generic ivar objects
We weren't taking in to account that objects with generic IV tables
could go "too complex" in the IV set code.  This commit takes that in to
account and also ensures FL_EXIVAR is set when a geniv object
transitions to "too complex"

Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-10-31 12:07:54 -04:00
Jean Boussier
ac7f913ca3 Handle SHAPE_TOO_COMPLEX in generic_ivar_set 2023-10-31 12:07:54 -04:00
Jean Boussier
4aacc559d9 Handle running out of shapes in Object#dup
There is a handful of call sites where we may transition to
OBJ_TOO_COMPLEX_SHAPE if we just ran out of shapes, but that
weren't handling it properly.
2023-10-31 12:07:54 -04:00
Jemma Issroff
85ad102532 [PRISM] Implement compilation for PostExecutionNode
This commit implements compilation for the PostExeuctionNode by
using the ScopeNode to create child iseqs where appropriate.
2023-10-31 12:51:06 -03:00
HParker
d8a9245513 Add defined array node 2023-10-31 07:01:00 -03:00
HParker
b05a7bc512 compile defined with nested constants and stovetop 2023-10-31 07:01:00 -03:00
yui-knk
51149f335e Keep unused literal nodes
For static analysis, it’s better to keep unused literal nodes.
If simply change `block_append` to fall through, both "unused literal ignored"
and "possibly useless use of a literal in void context" warnings
are shown for the same line. But it’s verbose then remove
"unused literal ignored" warning.

This kind of optimization is already implemented on compile.c.
`compile_block` calls `iseq_compile_each0` with `popped = 1` when NODE_BLOCK
has next.
2023-10-31 17:49:12 +09:00
Daisuke Aritomo
4adf418be9 [Feature #10602] Add new API rb_profile_thread_frames()
Add a new API rb_profile_thread_frames(), which is essentialy a
per-thread version of rb_profile_frames().

While the original rb_profile_frames() always returns results about the
current active thread obtained by GET_EC(), this new API takes a Thread
to be profiled as an argument.

This should come in handy when profiling I/O-bound programs such as
webapps, since this new API allows us to learn about Threads performing
I/O (which do not have the GVL).

Profiling worker threads (such as Sidekiq workers) may be another
application.

Implements [Feature #10602]

Co-authored-by: Mike Perham <mike@perham.net>
2023-10-31 11:16:18 +09:00
Matt Valentine-House
91fba0a3d2 [Prism] Add ForNode tests 2023-10-30 19:44:42 +00:00
Stan Lo
85beca6e41 [ruby/irb] Use IRB's own doc for doc dialog tests
(https://github.com/ruby/irb/pull/743)

* Use IRB's own doc for doc dialog tests

* Run doc dialog tests for older Rubies too

* Remove unnecessary CI setups

97a2b86f0a
2023-10-30 18:22:02 +00:00