Граф коммитов

116 Коммитов

Автор SHA1 Сообщение Дата
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
Kevin Newton 717fb5bb0b [prism] Use a pointer for optional node list 2023-11-01 10:36:21 -04:00
Jemma Issroff b7a3e2e71d
[PRISM] Remove unnecessary variable 2023-10-31 15:57:25 -03: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
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
Matt Valentine-House 962c62057f Fix warning in Prism compile For Node 2023-10-31 09:01:56 +00:00
Jemma Issroff f0b7895637 [PRISM] Implement all argument types for CallNodes 2023-10-30 18:07:04 -03:00
Matt Valentine-House b17b0336b6 Document TEMP_CONSTANT_IDENTIFIER 2023-10-30 19:44:42 +00:00
Matt Valentine-House 9249b8622b Move constant indexing into rb_translate_prism 2023-10-30 19:44:42 +00:00
Matt Valentine-House 5dfba84cff [Prism] Compile ForNode
Fixes ruby/prism#1648
2023-10-30 19:44:42 +00:00
Matt Valentine-House b0f715fa3b More accurate functions documentation 2023-10-30 19:44:42 +00:00
Kevin Newton e3258dd627
Integrate new prism multi target names 2023-10-26 15:03:33 -04:00
eileencodes a082e560bb [PRISM] Implement regex encoding flags
Added the  correct encoding to the allocated regex. This required making
a new method to set the encoding and pass that to `rb_enc_reg_new`
instead of `rb_reg_new`. The former `rb_reg_new` would set the encoding
to ASCII8BIT regardless of encoding flag.
2023-10-26 11:11:52 -07:00
Jemma Issroff 4f8a33eb05 [PRISM] Cleanup macro usage for common ADD_INSN 2023-10-26 12:47:28 -03:00
HParker 8f4a8cd05b teach prism define to compile basic types 2023-10-26 11:54:26 -03:00
Jemma Issroff 9570a88bb3 [PRISM] Implement compilation for ConstantPathAndWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff ec2878c11b [PRISM] Implement compilation for ConstantPathOrWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff b5f61750b9 [PRISM] Implemented ConstantPathOperatorWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff bfb9b5e699 [PRISM] Implement compilation for CaseNode 2023-10-26 08:45:43 -03:00
Jemma Issroff 8e5744588f [PRISM] Implement CallOperatorWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff 68a81b44e3 [PRISM] Implement compilation for CallOrWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff e28a033035 [PRISM] Extract helper to use for CallOrWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff 2a8dbb1323 [PRISM] Implemented compilation for CallAndWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff b5f6e2a7c4 [PRISM] ScopeNode doesn't need void * anymore 2023-10-25 18:18:35 -03:00
Jemma Issroff 0abf2d86b9 [PRISM] Move pm_scope_node_init to prism_compile.c
pm_scope_node_init is only used for CRuby, so should not live in the
ruby/prism repo. We will merge the changes here first so they're
not breaking, and will then remove from ruby/prism
2023-10-25 18:18:35 -03:00
Jemma Issroff f87c31f3e0 [PRISM] Add PM_POP macro, cleanup missing macro usage 2023-10-25 17:27:00 -03:00
Jemma Issroff 8197bbb0a9 [PRISM] Toggled accepts_no_kwarg to true on NoKeywordsParameterNode 2023-10-25 13:02:44 -03:00
Jemma Issroff fb0a30166d [PRISM] Add tests for ParametersNode 2023-10-25 13:02:44 -03:00
Jemma Issroff fe0827013b [PRISM] Implement NoKeywordsParameterNode 2023-10-25 13:02:44 -03:00
Jemma Issroff 39207b496e [PRISM] Implement compilation for PreExecutionNodes 2023-10-23 13:22:55 -07:00
Jemma Issroff 5abff9dbff [PRISM] Add PM_PUTNIL macro 2023-10-23 13:22:55 -07:00
Jemma Issroff 7c4e3ca27b [PRISM] Fix AssocSplat node
This commit emits the correct instructions for hashes which have
both AssocSplat and Assoc nodes contained within them
2023-10-23 13:15:52 -07:00
Jemma Issroff 60196b4780 [PRISM] Fix __LINE__ to be 1-indexed by default 2023-10-23 13:59:48 -03:00
Jemma Issroff 62c674f98c [PRISM] Fix compilation for IfNode, UnlessNode
This properly implements the branch condition for FlipFlopNodes on
If / UnlessNodes, and also fixes the bug in UnlessNodes
2023-10-23 12:37:50 -03:00
Jemma Issroff 01787d53bf [PRISM] Setup encodings in prism compiler 2023-10-20 16:29:06 -03:00
Jemma Issroff a426a230de [PRISM] Fixed StringConcatNode, uncommented tests 2023-10-20 11:49:53 -03:00
Nobuyoshi Nakada 9d1940ba3c [Bug #19966] [PRISM] Fix singleton method definition 2023-10-20 15:16:34 +09:00
Jemma Issroff 10c5063704 Address PR comments 2023-10-18 17:16:11 -07:00
Jemma Issroff 5408ce8c17 Fixed mistyping 2023-10-18 17:16:11 -07:00
Jemma Issroff ba3a99acaf Remove pm_compile_context_t, move the context onto ScopeNode
We changed ScopeNodes to point to their parent (previous) ScopeNodes.
Accordingly, we can remove pm_compile_context_t, and store all
necessary context in ScopeNodes, allowing us to access locals from
outer scopes.
2023-10-18 17:16:11 -07:00
Jemma Issroff 10d88ec9c3
[PRISM] Compile AliasGlobalVariableNode (#8675) 2023-10-16 12:00:01 -07:00
Jemma Issroff 728286d0e8
[PRISM] Fix more bugs in the compiler (#8658)
* Fixed ConstantPathWriteNode
* FIxed FlipFlopNode
2023-10-16 06:31:32 -07:00
Adam Hess 6e88b72d7b
[PRISM] prevent underflow on popped splatarray (#8657)
prevent underflow on popped splatarray

This only emits the splat array node when not popped
2023-10-16 05:22:07 -07:00
Jemma Issroff 34add1e595
[PRISM] Compile fixes (#8644)
* Fix compiling UndefNodes
* Fix compiling super on ClassNode
* Fix compile popped for ModuleNode
* Add checks for NULL nodes
* Only add newhash if not popped
2023-10-13 10:59:37 -07:00
Matt Valentine-House 05b9b58d55 [Prism] Fix IfNode and ElseNode
ElseNode looks to have been implemented at the same time as IfNode, but
was resulting in a stack underflow error.

The following is from the test code

```
if foo
  bar
end
```

```
❯ make run
compiling compile.c
linking miniruby
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
CRUBY: **************************************************
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,19)>
0000 putself                                                          (   2)[Li]
0001 opt_send_without_block                 <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 branchunless                           9
0005 putself
0006 opt_send_without_block                 <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0008 pop
0009 putobject_INT2FIX_1_
0010 leave
PRISM: **************************************************
-- raw disasm--------
   0000 putself                                                          (   2)
   0001 send                 <calldata:foo, 0>, nil                      (   2)
   0004 branchunless         <L001>                                      (   2)
   0006 jump                 <L000>                                      (   2)
 <L000> [sp: 0]
*  0008 pop                                                              (   1)
   0009 putself                                                          (   2)
   0010 send                 <calldata:bar, 0>, nil                      (   2)
   0013 pop                                                              (   2)
   0014 jump                 <L002>                                      (   1)
 <L001> [sp: 0]
 <L002> [sp: -1]
   0016 putobject            1                                           (   2)
   0018 leave                                                            (   1)
---------------------
<compiled>: <compiled>:1: argument stack underflow (-1) (SyntaxError)
make: *** [run] Error 1
```

This commit fixes the stack underflow error for both IfNode and ElseNode
and introduces tests for them.
2023-10-04 13:53:31 -04:00
Benoit Daloze fd984ac869 Adopt prism CallNode#name changes 2023-10-02 09:18:56 -04:00
Kevin Newton 2de5c57dce Move more things through pm_static_literal_value 2023-09-29 09:51:23 -04:00
Kevin Newton 2e25289aee Handle static array nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 38e3cafe62 Compile implicit nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 396042a25c Fix up static hash compilation 2023-09-29 09:51:23 -04:00
Kevin Newton 3ec6be1a4b More documentation for pattern matching compilation 2023-09-28 15:13:09 -04:00
Kevin Newton 9c8ba84675 Support if and unless guards on patterns 2023-09-28 15:13:09 -04:00
Kevin Newton b1a28b05db Support local variable targeting in pattern matching 2023-09-28 15:13:09 -04:00
Kevin Newton 41d3e23582 Support the AlternationPatternNode 2023-09-28 15:13:09 -04:00
Kevin Newton 64da9be3af Fill in other missing pattern matching expression types 2023-09-28 15:13:09 -04:00
Kevin Newton 6e88a56f63 Compile basic pattern matching expressions 2023-09-28 15:13:09 -04:00
Kevin Newton 5a376f0f71 Consolidate regexp options, interpolated match last line 2023-09-28 14:11:34 -04:00
Nobuyoshi Nakada d2c5867357
Fix up indentation [ci skip] 2023-09-29 00:55:43 +09:00
Matt Valentine-House 414c781158 [YARP] Implement MatchWriteNode 2023-09-28 16:51:30 +01:00
Kevin Newton 40b2c8e5e7
Fix up indentation in prism_compile.c 2023-09-28 09:47:46 -04:00
Kevin Newton a213d21448 Move CRuby-specific prism files to top level 2023-09-28 09:44:16 -04:00