Commit graph

18 commits

Author SHA1 Message Date
Jemma Issroff
1d4d9a016a
[YARP] ClassNode and ModuleNode use name_constant (#8384) 2023-09-06 12:19:23 -04:00
Jemma Issroff
ae41bdac1e
[YARP] Use constant_id lookups where possible (#8374)
This commit extracts a `yp_constant_id_lookup` method and uses yp_constant_id_lookup where possible
2023-09-06 10:28:29 -04:00
Jemma Issroff
bdfa885f87
[YARP] Fix aliasing instructions to use INT2FIX (#8373) 2023-09-05 13:58:16 -04:00
Jemma Issroff
e3210177e3
[YARP] Implemented Compiler for Constant(Or/Operator/And)Nodes (#8355) 2023-09-05 10:54:21 -04:00
Jemma Issroff
95308988b6
[YARP] Implement Compiling for And / Or / Operator Write Nodes (#8352) 2023-09-01 14:20:03 -07:00
Jemma Issroff
e8b646fe91
[YARP] Implement BackReferenceReadNode, NumberedReferenceReadNode (#8344) 2023-09-01 11:30:22 -07:00
Jemma Issroff
58e0a3699f
Fix YARP compiled send for popping (#8345)
Prior to this commit, we were incorrectly popping callers and receivers
on CallNodes. We shouldn't pop any of these as they might have
side effects.
2023-09-01 08:02:55 -07:00
Jemma Issroff
4f290bc328
[YARP] Small fixes for existing ConstantNodes (#8346)
Popped was slightly inaccurate for ConstantNodes and leading to issues
if there was content after a ConstantNode. This fix doesn't pop
any ConstantWriteNode values.
2023-09-01 08:02:37 -07:00
Mau Magnaguagno
ace41c556a
[YARP] Avoid if-else in yp_compile_node (#8336)
Move last node case outside for loop.
2023-08-31 10:00:19 -07:00
Jemma Issroff
b90457b210
[YARP] Implement SourceNodes (File, Line, Encoding) (#8328)
* [YARP] Implement SourceNodes (File, Line, Encoding)
2023-08-31 09:56:13 -07:00
Jemma Issroff
36786cc381
[YARP] Compile ProgramNode as ScopeNode (#8327)
* [YARP] Compile ProgramNode as ScopeNode
2023-08-30 14:30:42 -07:00
Jemma Issroff
0ec5021f3d
[YARP] Implement BreakNode, NextNode, RedoNode (#8334) 2023-08-30 14:27:08 -07:00
Jemma Issroff
f1790fa4e7
[YARP] Fix variables in compilation (#8326)
* [YARP] Fixed several popped instructions

* [YARP] Correctly compiling class path
2023-08-30 14:26:22 -07:00
Kevin Newton
49dff732e8
Update YARP APIs to handle uint8_t 2023-08-30 14:41:39 -04:00
Jemma Issroff
3151d7876f
[YARP] Until Node, minor cleanup (#8325)
* Remove conditional from yp_compile_if

* Extracted yp_compile_while, compile UntilNode

* Small checks for body / value that could be empty
2023-08-29 14:17:08 -07:00
Jemma Issroff
80dc570a45
Compile more YARP node types (#8322)
* Add several more node simple types to YARP's compiler:

Nodes include: DefinedNode, EmbeddedStatementsNode,
LocalVariableReadNode, LocalVariableWriteNode, MultiWriteNode,
OptionalParameterNode, SplatNode, YieldNode

* Add AssocSplatNode, RangeNode

* Add RangeNode, other helpers for future nodes

* Add ArrayNode, HashNode, static literal helpers

* Add branch conditionals

* Add IfNode, UnlessNode

* Add ScopeNode

* NEW_ISEQ and NEW_CHILD_ISEQ implemented for YARP

* Add nodes that depend on ScopeNode

* Addressed PR comments
2023-08-29 13:13:15 -07:00
Jemma Issroff
535045ab3b
[YARP] Compile basic types (#8311)
* Add a compile_context arg to yp_compile_node

The compile_context will allow us to pass around the parser, and
the constants and lookup table (to be used in future commits).

* Compile yp_program_node_t and yp_statements_node_t

Add the compilation for program and statements node so that we can
successfully compile an empty program with YARP.

* Helper functions for parsing numbers, strings, and symbols

* Compile basic numeric / boolean node types in YARP

* Compile StringNode and SymbolNodes in YARP

* Compile several basic node types in YARP

* Added error return for missing node
2023-08-29 09:27:00 -07:00
Jemma Issroff
3b815ed7da
Add yarp/yarp_compiler.c (#8042)
* Add yarp/yarp_compiler.c as stencil for compiling YARP

This commit adds yarp/yarp_compiler.c, and changes the sync script
to ensure that yarp/yarp_compiler.c will not get overwritten

* [Misc #119772] Create and expose RubyVM::InstructionSequence.compile_yarp

This commit creates the stencil for a compile_yarp function, which
we will continue to fill out. It allows us to check the output
of compiled YARP code against compiled code without using YARP.
2023-08-28 13:55:58 -07:00