ruby / prism

Prism Ruby parser
https://ruby.github.io/prism/
MIT License
839 stars 139 forks source link

CRuby test failure: TestAllocation #2994

Closed kddnewton closed 2 months ago

kddnewton commented 2 months ago

We need to implement all of the same recent optimizations to setup_args that were added in 3.4. This largely involves avoiding array and hash allocations. This is done through checking for specific patterns and using a combination of flags and instructions like pushtoarray and concattoarray.

In order to test changes, you will need to apply to following diff to ruby/ruby (copy into a file like prism.patch and run git apply prism.patch):

diff --git a/internal/parse.h b/internal/parse.h
index fdf2a10183..88230fd177 100644
--- a/internal/parse.h
+++ b/internal/parse.h
@@ -16,7 +16,7 @@
 // 0: parse.y
 // 1: Prism
 #ifndef RB_DEFAULT_PARSER
-#define RB_DEFAULT_PARSER 0
+#define RB_DEFAULT_PARSER 1
 #endif

 #ifdef UNIVERSAL_PARSER

Then, to run the individual tests, run:

make -j
make test-all TESTS=test/ruby/test_allocation.rb TESTOPTS='-n /test_no_parameters/'
kddnewton commented 2 months ago

@eileencodes assigning you only to make it clear that you're working on these, not to indicate that you're responsible for all of them