aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix portability of bignum in ISeq Binary FormatNobuyoshi Nakada2023-11-261-2/+6
| | | | | | | - Unless `sizeof(BDIGIT) == 4`, (8-byte integer not available), the size to be loaded was wrong. - Since `BDIGIT`s are dumped as raw binary, the loaded byte order was inverted unless little-endian.
* Embed ibf_dump objectsJean Boussier2023-11-211-5/+2
|
* Get rid of useless dsize functionsJean Boussier2023-11-211-7/+5
| | | | | If we always return 0, we might as well not define the function at all.
* compile.c: make pinned_list embedableJean Boussier2023-11-201-19/+7
| | | | This saves some malloc churn for small pin lists.
* Stabilize outer variable listNobuyoshi Nakada2023-11-111-10/+43
| | | | Sort outer variables by names to make dumped binary data stable.
* Finer granularity IBF dependendencyNobuyoshi Nakada2023-11-091-3/+17
| | | | | It depends on only `VALUE` definition. Check for endianness and word size instead of the platform name.
* Use `uint32_t` instead of `unsigned int` for the exact sizeNobuyoshi Nakada2023-11-091-7/+7
|
* [PRISM] CompileEnsureNodeMatt Valentine-House2023-11-071-2/+2
|
* [PRISM] Implement compilation for MultiWriteNodes, fix MultiTargetNodesJemma Issroff2023-11-061-5/+1
| | | | | | Compilation now works for MultiWriteNodes and MultiTargetNodes, with nesting on MultiWrites. See the tests added in this commit for example behavior.
* Move constant indexing into rb_translate_prismMatt Valentine-House2023-10-301-19/+2
|
* [Prism] Compile ForNodeMatt Valentine-House2023-10-301-1/+7
| | | | Fixes ruby/prism#1648
* Embed `rb_args_info` in `rb_node_args_t`Nobuyoshi Nakada2023-10-301-2/+2
|
* [PRISM] ScopeNode doesn't need void * anymoreJemma Issroff2023-10-251-1/+1
|
* [PRISM] Move scope_node itself to CRuby, create prism_compile.hJemma Issroff2023-10-251-1/+1
|
* Expand OP_ASGN1 nd_args to nd_index and nd_rvalueyui-knk2023-10-201-4/+4
| | | | | | ARGSCAT has been used for nd_args to hold index and rvalue, because there was limitation on the number of members for Node. We can easily change structure of node now, let's expand it.
* Extract a local variableNobuyoshi Nakada2023-10-191-12/+13
|
* Address PR commentsJemma Issroff2023-10-181-3/+3
|
* Remove pm_compile_context_t, move the context onto ScopeNodeJemma Issroff2023-10-181-15/+4
| | | | | | | 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.
* YJIT: Add a live ISeq counter Alan Wu2023-10-181-0/+6
| | | | | | | It's an estimator for application size and could be used as a compilation heuristic later. Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Remove unnecessary and misleading castsNobuyoshi Nakada2023-10-181-3/+3
|
* Adjust indent [ci skip]Nobuyoshi Nakada2023-10-111-77/+77
|
* Extract NODE_FL_NEWLINE access to macroyui-knk2023-10-111-1/+1
|
* Fix cast node typeyui-knk2023-10-091-1/+1
|
* Correctly casting node for accessing nd_value and nd_vid in compile.cyui-knk2023-10-071-3/+34
|
* Remove not used fields from MATCH3yui-knk2023-10-061-1/+1
|
* Remove `NODE_VALUES`Nobuyoshi Nakada2023-10-061-12/+0
| | | | | | This node type was added for the multi-value experiment back in 2004. The feature itself was removed after a few years, but this is its remnant.
* Correctly casting node for accessing COLON node nd_mid in compile.cyui-knk2023-10-051-14/+27
|
* Check the result of get_nd_recv before node type check for safetyYuichiro Kaneko2023-10-021-3/+3
| | | Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Correctly casting node for accessing nd_recv, nd_mid and nd_args in compile.cyui-knk2023-10-021-29/+96
|
* Use reference counting to avoid memory leak in kwargsHParker2023-10-011-0/+4
| | | | | | | | Tracks other callinfo that references the same kwargs and frees them when all references are cleared. [bug #19906] Co-authored-by: Peter Zhu <peter@peterzhu.ca>
* Use rb_node_args_t and rb_node_args_aux_t instead of NODEyui-knk2023-10-011-2/+2
|
* Use rb_node_opt_arg_t and rb_node_kw_arg_t instead of NODEyui-knk2023-10-011-9/+9
|
* Expand pattern_info struct into ARYPTN Node and FNDPTN Nodeyui-knk2023-09-301-19/+17
|
* Remove not used fields from argument nodesyui-knk2023-09-301-2/+0
|
* Merge RNode_OP_ASGN2 and RNode_OP_ASGN22yui-knk2023-09-291-3/+3
|
* Move CRuby-specific prism files to top levelKevin Newton2023-09-281-1/+1
|
* Change RNode structure from union to structyui-knk2023-09-281-456/+462
| | | | | | | | | | | | | | | | | | | | | | | All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members for holding different kind of data. This has two problems. 1. Low flexibility of data structure Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand, NODE_OP_ASGN2 needs more than three union members. However they use same structure definition, need to allocate three union members for NODE_TRUE and need to separate NODE_OP_ASGN2 into another node. This change removes the restriction so make it possible to change data structure by each node type. 2. No compile time check for union member access It’s developer’s responsibility for using correct member for each node type when it’s union. This change clarifies which node has which type of fields and enables compile time check. This commit also changes node_buffer_elem_struct buf management to handle different size data with alignment.
* Use new constant pool layout for prismKevin Newton2023-09-271-6/+3
|
* Rename YARP symbols to prismKevin Newton2023-09-271-11/+11
|
* Don't call malloc with 0Aaron Patterson2023-09-141-3/+14
| | | | | | | | | | It seems not-uncommon for methods to have no IV, ISE, or ICVARC caches. Calling malloc with 0 will actually allocate something, so if there aren't any caches (`ISEQ_IS_SIZE(body) == 0`), then we can avoid allocating memory by not calling malloc. If there are no caches, then theoretically nobody should be reading from the buffer anyway. This saves about 1MB on Lobsters benchmark.
* [Bug #19862] Skip compiled result of never reachable expressionNobuyoshi Nakada2023-09-131-8/+20
|
* Refactor to use same logic with other assignment nodesyui-knk2023-09-101-2/+0
|
* Fix missing write barrier in iseq instruction listPeter Zhu2023-09-061-17/+36
| | | | | | | | | | | | | | | | | | There's a missing write barrier for operands in the iseq instruction list, which can cause crashes. It can be reproduced when Ruby is compiled with `-DRUBY_DEBUG_ENV=1`. Using the following command: ``` RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=0 RUBY_DEBUG=gc_stress ruby -w --disable=gems -Itool/lib -W0 test.rb ``` The following script crashes: ``` require "test/unit" ```
* Revert "Don't reset line coverage for evaled code. (#8330)"Yusuke Endoh2023-09-041-2/+1
| | | | | | This reverts commit 7e0f5df2f99693267d61636d23da47f79924e9d5. https://bugs.ruby-lang.org/issues/19857#note-7
* Don't reset line coverage for evaled code. (#8330)Samuel Williams2023-09-041-1/+2
| | | * Add failing test.
* Update YARP APIs to handle uint8_tKevin Newton2023-08-301-1/+1
|
* [YARP] Compile basic types (#8311)Jemma Issroff2023-08-291-5/+28
| | | | | | | | | | | | | | | | | | | | | * 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
* Add yarp/yarp_compiler.c (#8042)Jemma Issroff2023-08-281-0/+19
| | | | | | | | | | | | * 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.
* Remove nd_entry from NODE_GASGN and NODE_GVARyui-knk2023-08-231-3/+3
| | | | | | | After a0f12a0258e4020bd657ee80b7d8f22bd33ea223 NODE_GASGN and NODE_GVAR hold same value on both nd_vid and nd_entry. This commit stops setting value to nd_entry and makes to use only nd_vid.
* Move the PC regardless of the leaf flag (#8232)Takashi Kokubun2023-08-161-6/+0
| | | Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>