Commit graph

637 commits

Author SHA1 Message Date
Nobuyoshi Nakada
f4c6479eea
Fix xfree
Pointers allocated with `ruby_xmalloc` (`ALLOC` macro) must be freed
with `ruby_xfree`.
2024-05-01 22:01:36 +09:00
Kevin Newton
d75bbba255 [PRISM] Remove false positive compile warnings for branch coverage 2024-04-29 13:28:15 -04:00
Kevin Newton
46480e3042 [PRISM] Use redundant return flag 2024-04-26 15:16:58 -04:00
Kevin Newton
9aecff2530 [PRISM] Fix up if condition branch coverage location 2024-04-26 12:25:45 -04:00
Kevin Newton
c46e32e342 [PRISM] Fix up branch coverage for &. with block 2024-04-26 12:25:45 -04:00
Kevin Newton
d06bbafd3f [PRISM] Enable branch coverage for if/unless conditionals 2024-04-26 12:25:45 -04:00
Kevin Newton
881c450135 [PRISM] Enable branch coverage for while/until loops 2024-04-26 12:25:45 -04:00
Kevin Newton
43076bf9d1 [PRISM] Enable branch coverage for case pattern matching 2024-04-26 12:25:45 -04:00
Kevin Newton
e5bd4c78b2 [PRISM] Enable branch coverage for case 2024-04-26 12:25:45 -04:00
Kevin Newton
235a3f3b7c [PRISM] Enable branch coverage for &. 2024-04-26 12:25:45 -04:00
Kevin Newton
af24ba4034 [PRISM] Raise LoadError when file cannot be read 2024-04-25 14:59:48 -04:00
Kevin Newton
7baecc2e36 [PRISM] Emit parse warnings before raising syntax errors 2024-04-12 17:46:31 -04:00
Takashi Kokubun
971b552735 [PRISM] Suppress compiler warnings
../prism_compile.c: In function ‘pm_compile_node’:
../compile.c:583:24: warning: ‘retry_end_l’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  583 |     anchor->last->next = elem;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from ../compile.c:14256:
../prism_compile.c:5796:16: note: ‘retry_end_l’ was declared here
 5796 |         LABEL *retry_end_l;
      |                ^~~~~~~~~~~
../compile.c:255:42: warning: ‘retry_label’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  255 | #define LABEL_REF(label) ((label)->refcnt++)
      |                                          ^~
In file included from ../compile.c:14256:
../prism_compile.c:5795:16: note: ‘retry_label’ was declared here
 5795 |         LABEL *retry_label;
      |                ^~~~~~~~~~~
../prism_compile.c:5919:52: warning: ‘previous_block’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 5919 |             ISEQ_COMPILE_DATA(iseq)->current_block = previous_block;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
2024-04-11 17:31:28 -07:00
Kevin Newton
842f151d79 [PRISM] Enable more passing tests 2024-04-11 15:47:30 -04:00
Kevin Newton
58f93eec18 [PRISM] Fix break in super block 2024-04-11 14:39:04 -04:00
Kevin Newton
bb5ed8b3df [PRISM] Fix flags on local variable operator write nodes 2024-04-11 12:18:51 -04:00
Jean Boussier
db0cf1aef9 prism_compile.c: use rb_enc_interned_str to reduce allocations
The `rb_fstring(rb_enc_str_new())` pattern is inefficient because:

- It passes a mutable string to `rb_fstring` so if it has to be interned it will first be duped.
- It an equivalent interned string already exists, we allocated the string for nothing.

With `rb_enc_interned_str` we either directly get the pre-existing string with 0 allocations,
or efficiently directly intern the one we create without first duping it.
2024-04-11 14:48:30 +02:00
Jean Boussier
9183101aa7 prism_compile.c: X_STRING should be frozen
The backtick method recieves a frozen string unless it is interpolated.

Otherwise the string held in the ISeq could be mutated by a custom
backtick method.
2024-04-11 08:08:30 -04:00
Kevin Newton
0aa1d61ab9 [PRISM] Ensure unfrozen when interpolation is present in string literal 2024-04-04 15:27:51 -04:00
Kevin Newton
3efc1c36f2 [PRISM] Add CLASS and END tracepoint events 2024-04-04 15:27:51 -04:00
Kevin Newton
6748526edd [PRISM] Fix location of ensure iseqs 2024-04-04 15:27:51 -04:00
Kevin Newton
0f742a33fb [PRISM] Remove trailing spaces 2024-04-04 14:14:55 -04:00
Kevin Newton
ed99f03a38 [PRISM] Consistent style in prism_compile.c 2024-04-04 14:14:55 -04:00
Kevin Newton
457abb2c47 [PRISM] Remove pm_line_node_t, consolidate all line number handling 2024-04-04 14:14:55 -04:00
Kevin Newton
338d10f9df [PRISM] Finish removing dummy_line_node usage in pm_compile_node 2024-04-04 14:14:55 -04:00
Kevin Newton
895e777227 [PRISM] Remove dummy_line_node creation in pm_compile_node 2024-04-04 14:14:55 -04:00
Kevin Newton
0cf00ca7aa [PRISM] Remove specialized macros that used dummy_line_node 2024-04-04 14:14:55 -04:00
Kevin Newton
b360b4ce3e [PRISM] Remove dummy_line_node usage from get/set local instructions 2024-04-04 14:14:55 -04:00
Kevin Newton
cb5dbca82e [PRISM] Remove dummy_line_node usage from remaining nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
8bf368d183 [PRISM] Remove dummy_line_node usage from ensure and flip flop nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
cc248706dd [PRISM] Remove dummy_line_node usage from false and else node 2024-04-04 14:14:55 -04:00
Kevin Newton
829ca8c4e3 [PRISM] Remove dummy_line_node usage from embedded nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
ca5ad4dac7 [PRISM] Remove dummy_line_node usage from class nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
2e408d3077 [PRISM] Remove dummy_line_node usage from case nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
2d523c27cf [PRISM] Remove dummy_line_node usage from defined expressions 2024-04-04 14:14:55 -04:00
Kevin Newton
3410387096 [PRISM] Remove dummy_line_node usage from constant nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
3cc61dc9ba [PRISM] Remove dummy_line_node usage from class variable nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
116a332c3a [PRISM] Remove dummy_line_node usage from global variable nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
bc5a520eca [PRISM] Remove dummy_line_node usage from index nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
6bec2a5333 [PRISM] Remove dummy_line_node usage from instance variable nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
5be0357847 [PRISM] Remove dummy_line_node usage from keyword hash and lambda nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
98823b5091 [PRISM] Remove dummy_line_node usage from local variable nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
0782fc4a2a [PRISM] Remove dummy_line_node usage from match predicate node 2024-04-04 14:14:55 -04:00
Kevin Newton
95ad2b0a62 [PRISM] Remove dummy_line_node usage from match required node 2024-04-04 14:14:55 -04:00
Kevin Newton
c9f80021e2 [PRISM] Simplify match write node compilation 2024-04-04 14:14:55 -04:00
Kevin Newton
69ec4990d8 [PRISM] Remove dummy_line_node usage from module and match write node 2024-04-04 14:14:55 -04:00
Kevin Newton
449384f337 [PRISM] Remove dummy_line_node usage for multi write node 2024-04-04 14:14:55 -04:00
Kevin Newton
5e8546e8a9 [PRISM] Remove dummy_line_node usage for next node 2024-04-04 14:14:55 -04:00
Kevin Newton
24f9faf67c [PRISM] Remove dummy_line_node usage for call operator write node 2024-04-04 14:14:55 -04:00
Kevin Newton
4d347a0a55 [PRISM] Remove dummy_line_node usage for call and/or write node 2024-04-04 14:14:55 -04:00