summaryrefslogtreecommitdiff
path: root/compile.c
AgeCommit message (Collapse)Author
2023-12-02Pin instruction storagePeter Zhu
The operands in each instruction needs to be pinned because if auto-compaction runs in iseq_set_sequence, then the objects could exist on the generated_iseq buffer, which would not be reference updated which can lead to T_MOVED (and subsequently T_NONE) objects on the iseq.
2023-12-02[Bug #20033] Dynamic regexp should not assign capturesNobuyoshi Nakada
2023-11-29GC guard catch_table_ary in iseq_set_exception_tablePeter Zhu
The function iseq_set_exception_table allocates memory which can cause a GC compaction to run. Since catch_table_ary is not on the stack, it can be moved, which would make tptr incorrect.
2023-11-26Fix portability of bignum in ISeq Binary FormatNobuyoshi Nakada
- 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.
2023-11-21Embed ibf_dump objectsJean Boussier
2023-11-21Get rid of useless dsize functionsJean Boussier
If we always return 0, we might as well not define the function at all.
2023-11-20compile.c: make pinned_list embedableJean Boussier
This saves some malloc churn for small pin lists.
2023-11-11Stabilize outer variable listNobuyoshi Nakada
Sort outer variables by names to make dumped binary data stable.
2023-11-09Finer granularity IBF dependendencyNobuyoshi Nakada
It depends on only `VALUE` definition. Check for endianness and word size instead of the platform name.
2023-11-09Use `uint32_t` instead of `unsigned int` for the exact sizeNobuyoshi Nakada
2023-11-07[PRISM] CompileEnsureNodeMatt Valentine-House
2023-11-06[PRISM] Implement compilation for MultiWriteNodes, fix MultiTargetNodesJemma Issroff
Compilation now works for MultiWriteNodes and MultiTargetNodes, with nesting on MultiWrites. See the tests added in this commit for example behavior.
2023-10-30Move constant indexing into rb_translate_prismMatt Valentine-House
2023-10-30[Prism] Compile ForNodeMatt Valentine-House
Fixes ruby/prism#1648
2023-10-30Embed `rb_args_info` in `rb_node_args_t`Nobuyoshi Nakada
2023-10-25[PRISM] ScopeNode doesn't need void * anymoreJemma Issroff
2023-10-25[PRISM] Move scope_node itself to CRuby, create prism_compile.hJemma Issroff
2023-10-20Expand OP_ASGN1 nd_args to nd_index and nd_rvalueyui-knk
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.
2023-10-19Extract a local variableNobuyoshi Nakada
2023-10-18Address PR commentsJemma Issroff
2023-10-18Remove pm_compile_context_t, move the context onto ScopeNodeJemma Issroff
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-18YJIT: Add a live ISeq counter Alan Wu
It's an estimator for application size and could be used as a compilation heuristic later. Co-authored-by: Maxime Chevalier-Boisvert <[email protected]> Co-authored-by: Takashi Kokubun <[email protected]>
2023-10-18Remove unnecessary and misleading castsNobuyoshi Nakada
2023-10-11Adjust indent [ci skip]Nobuyoshi Nakada
2023-10-11Extract NODE_FL_NEWLINE access to macroyui-knk
2023-10-09Fix cast node typeyui-knk
2023-10-07Correctly casting node for accessing nd_value and nd_vid in compile.cyui-knk
2023-10-06Remove not used fields from MATCH3yui-knk
2023-10-06Remove `NODE_VALUES`Nobuyoshi Nakada
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.
2023-10-05Correctly casting node for accessing COLON node nd_mid in compile.cyui-knk
2023-10-02Check the result of get_nd_recv before node type check for safetyYuichiro Kaneko
Co-authored-by: Nobuyoshi Nakada <[email protected]>
2023-10-02Correctly casting node for accessing nd_recv, nd_mid and nd_args in compile.cyui-knk
2023-10-01Use reference counting to avoid memory leak in kwargsHParker
Tracks other callinfo that references the same kwargs and frees them when all references are cleared. [bug #19906] Co-authored-by: Peter Zhu <[email protected]>
2023-10-01Use rb_node_args_t and rb_node_args_aux_t instead of NODEyui-knk
2023-10-01Use rb_node_opt_arg_t and rb_node_kw_arg_t instead of NODEyui-knk
2023-09-30Expand pattern_info struct into ARYPTN Node and FNDPTN Nodeyui-knk
2023-09-30Remove not used fields from argument nodesyui-knk
2023-09-29Merge RNode_OP_ASGN2 and RNode_OP_ASGN22yui-knk
2023-09-28Move CRuby-specific prism files to top levelKevin Newton
2023-09-28Change RNode structure from union to structyui-knk
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.
2023-09-27Use new constant pool layout for prismKevin Newton
2023-09-27Rename YARP symbols to prismKevin Newton
2023-09-14Don't call malloc with 0Aaron Patterson
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. Notes: Merged: https://github.com/ruby/ruby/pull/8442
2023-09-13[Bug #19862] Skip compiled result of never reachable expressionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8381
2023-09-10Refactor to use same logic with other assignment nodesyui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/8400
2023-09-06Fix missing write barrier in iseq instruction listPeter Zhu
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" ``` Notes: Merged: https://github.com/ruby/ruby/pull/8385
2023-09-04Revert "Don't reset line coverage for evaled code. (#8330)"Yusuke Endoh
This reverts commit 7e0f5df2f99693267d61636d23da47f79924e9d5. https://bugs.ruby-lang.org/issues/19857#note-7
2023-09-04Don't reset line coverage for evaled code. (#8330)Samuel Williams
* Add failing test. Notes: Merged-By: ioquatix <[email protected]>
2023-08-30Update YARP APIs to handle uint8_tKevin Newton
2023-08-29[YARP] Compile basic types (#8311)Jemma Issroff
* 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 Notes: Merged-By: jemmaissroff