Commit graph

625 commits

Author SHA1 Message Date
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
Kevin Newton
91373bd64d [PRISM] Remove dummy_line_node usage for call nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
eb3bad1a0f [PRISM] Remove dummy_line_node usage for break nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
ffd9402c8d [PRISM] Remove dummy_line_node usage for block argument nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
c15c611ea5 [PRISM] Remove dummy_line_node usage for begin nodes 2024-04-04 14:14:55 -04:00
Kevin Newton
59f931e4f7 [PRISM] Remove dummy_line_node usage for PM_BACK_REFERENCE_READ_NODE 2024-04-04 14:14:55 -04:00
Kevin Newton
6c1cf5232f [PRISM] Remove dummy_line_node usage in pm_interpolated_node_compile 2024-04-04 14:14:55 -04:00
Kevin Newton
ced6aff206 [PRISM] Mark constant path owning expressions as not popped 2024-04-03 17:34:12 -04:00
Kevin Newton
8191735b73 [PRISM] Fix BEGIN{} execution order 2024-03-29 08:51:04 -04:00
Kevin Newton
a8f902ea8e [PRISM] Add debug info for frozen strings 2024-03-28 15:17:29 -04:00
Kevin Newton
86e0d83a32 [PRISM] Simplify raising load errors 2024-03-28 12:04:35 -04:00
Kevin Newton
f7c5e11d89 [PRISM] Use new -x prism API 2024-03-28 12:04:35 -04:00
Kevin Newton
7e12b03c5a [PRISM] Set path on syntax error 2024-03-27 17:19:24 -04:00