aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
Commit message (Collapse)AuthorAgeFilesLines
* avoid overflow in integer multiplication卜部昌平2019-10-091-3/+8
| | | | | | | This changeset basically replaces `ruby_xmalloc(x * y)` into `ruby_xmalloc2(x, y)`. Some convenient functions are also provided for instance `rb_xmalloc_mul_add(x, y, z)` which allocates x * y + z byes.
* Adjusted spaces [ci skip]Nobuyoshi Nakada2019-09-271-43/+43
|
* Add compaction support to `rb_ast_t`Aaron Patterson2019-09-261-4/+53
| | | | This commit adds compaction support to `rb_ast_t`.
* `NODE_MATCH` needs to be marked / allocated from marking bucketAaron Patterson2019-09-101-1/+3
| | | | Fixes a test in RubySpec
* Revert "Reverting node marking until I can fix GC problem."Aaron Patterson2019-09-091-17/+140
| | | | This reverts commit 092f31e7e23c0ee04df987f0c0f979d036971804.
* Rename NODE_ARRAY to NODE_LIST to reflect its actual use casesYusuke Endoh2019-09-071-5/+5
| | | | | | | | | | and NODE_ZARRAY to NODE_ZLIST. NODE_ARRAY is used not only by an Array literal, but also the contents of Hash literals, method call arguments, dynamic string literals, etc. In addition, the structure of NODE_ARRAY is a linked list, not an array. This is very confusing, so I believe `NODE_LIST` is a better name.
* Reverting node marking until I can fix GC problem.Aaron Patterson2019-09-051-140/+17
| | | | | Looks like we're getting WB misses during stressful GC on startup. I am investigating.
* I forgot to add `break` in my case statementsAaron Patterson2019-09-051-0/+2
| | | | Give me a break.
* Stash tmpbuffer inside internal structsAaron Patterson2019-09-051-2/+10
| | | | | | I guess those AST node were actually used for something, so we'd better not touch them. Instead this commit just puts the tmpbuffer inside a different internal struct so that we can mark them.
* add debugging code to the mark functionAaron Patterson2019-09-051-0/+2
|
* lazily allocate the mark arrayAaron Patterson2019-09-051-3/+4
|
* Create two buckets for allocating NODE structsAaron Patterson2019-09-051-16/+65
| | | | | | | | | This commit adds two buckets for allocating NODE structs, then allocates "markable" NODE objects from one bucket. The reason to do this is so when the AST mark function scans nodes for VALUE objects to mark, we only scan NODE objects that we know to reference VALUE objects. If we *did not* divide the objects, then the mark function spends too much time scanning objects that don't contain any references.
* Stash the imemo buf at the end of the ID listAaron Patterson2019-09-051-1/+9
| | | | | | | Now we can reach the ID table buffer from the id table itself, so when SCOPE nodes are marked we can keep the buffers alive. This eliminates the need for the "mark array" during normal parse / compile (IOW *not* Ripper).
* Mark some tmpbufs via node objectsAaron Patterson2019-09-051-0/+3
| | | | This way we don't need to add the tmpbufs to a Ruby array for marking
* Directly mark node objects instead of using a mark arrayAaron Patterson2019-09-051-0/+50
| | | | | | | | This patch changes the AST mark function so that it will walk through nodes in the NODE buffer marking Ruby objects rather than using a mark array to guarantee liveness. The reason I want to do this is so that when compaction happens on major GCs, node objects will have their references pinned (or possibly we can update them correctly).
* Make pattern matching support **nil syntaxKazuki Tsujimoto2019-09-011-1/+6
|
* Directly mark compile options from the AST objectAaron Patterson2019-08-271-0/+1
| | | | | | | `rb_ast_t` holds a reference to this object, so it should mark the object. Currently it is relying on the `mark_ary` on `node_buffer` to ensure that the object stays alive. But since the array internals can move, this could cause a segv if compaction impacts the array.
* Let memory sizes of the various IMEMO object types be reflected correctlyLourens Naudé2019-07-231-2/+21
| | | | | | [Feature #15805] Closes: https://github.com/ruby/ruby/pull/2140
* Fix grammar of macro name: ECCESSED -> ECCESSIVEMartin Dürst2019-06-051-1/+1
| | | | | Fix the name of the macro variable introduced in 0872ea5330 from NODE_SPECIAL_EXCESSED_COMMA to NODE_SPECIAL_EXCESSIVE_COMMA.
* * expand tabs.git2019-06-041-6/+6
|
* node.h: Avoid a magic number to represent excessed commaYusuke Endoh2019-06-041-1/+8
| | | | | | `(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`. This change removes the magic number by introducing an explicit macro variable for it: NODE_SPECIAL_EXCESSED_COMMA.
* * expand tabs.git2019-06-041-1/+1
|
* node.c: Show the ID of internal variableYusuke Endoh2019-06-041-1/+1
|
* Fix description of NODE_INKazuki Tsujimoto2019-04-271-1/+1
|
* Avoid usage of the dummy empty BEGIN nodektsj2019-04-201-1/+6
| | | | | | Use NODE_SPECIAL_NO_NAME_REST instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix the format of NODE_IN nodeyui-knk2019-04-171-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Introduce pattern matching [EXPERIMENTAL]ktsj2019-04-171-0/+37
| | | | | | [ruby-core:87945] [Feature #14912] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2019-03-151-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h: introduce nd_brace to determine if a hash literal is a keywordmame2019-03-151-3/+3
| | | | | | | | | NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for `foo(k: 1)`. nd_alen had been abused for the flag (and the implementation is completely the same), but an explicit name is better to read. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-12-311-7/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Method reference operatornobu2018-12-311-0/+9
| | | | | | | | Introduce the new operator for method reference, `.:`. [Feature #12125] [Feature #13581] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed unreachable codenobu2018-10-121-1/+0
| | | | | | | * node.c (rb_ast_dispose): since `ast->node_buffer` is freed in `rb_ast_free()`, it should be always NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Missing write-barriernobu2018-10-121-1/+1
| | | | | | Fix up r64507. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Typo fix. Patch by Shuichi Tamayose. [ci skip] [Fix GH-1880]marcandre2018-09-161-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h (rb_ast_t): move its field mark_ary to node_buffer_tmame2018-08-221-4/+10
| | | | | | | I want to add a new field to rb_ast_t whose size is restricted because it is an imemo. This change makes one room in rb_ast_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use nd_X shorthand for annotationnobu2018-06-281-3/+3
| | | | | | | | [Fix GH-1901] From: hkdnet <satoko.itse@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Fix format of NODE_OP_ASGN1 and NODE_OP_ASGN2yui-knk2018-06-071-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Fix format and example of NODE_OPCALLyui-knk2018-05-101-1/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Fix typosyui-knk2018-05-101-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: predicates for special NODEsnobu2018-03-201-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typos.hsbt2018-01-171-1/+1
| | | | | | | | * node.c: strucutre -> structure * random.c: acquried -> acquired * thread.c: accross -> across git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Separately allocate a struct having flexible arraymame2018-01-161-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* nested flexible array member is a GCCismshyouhei2018-01-161-1/+1
| | | | | | | | This is NG. The ISO C section 6.7.2.1 explicitly states that structs having flexible array members "shall not be a member of a structure or an element of an array." git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Stop double meaning of NODE_FOR by introducing NODE_FOR_MASGNmame2018-01-161-0/+8
| | | | | | | | | NODE_FOR was used both for "for"-statement itself and for multi-assignment of for-statement (for x, y, in...end). This change separates the two purposes, NODE_FOR for the former, and newly introduced NODE_FOR_MASGN for the latter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c (node_buffer_elem_t): Use FLEX_ARY_LENmame2018-01-131-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Rename code_range to code_locationmame2018-01-091-5/+5
| | | | | | | | | | | Because the name "code_range" is ambiguous with encoding's. Abbreviations ("crange", and "cr") are also renamed to "loc". The traditional "code_location" (a pair of lineno and column) is renamed to "code_position". Abbreviations are also renamed (first_loc to beg_pos, and last_loc to end_pos). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Remove special handling of tOROP and tANDOPmame2018-01-091-15/+3
| | | | | | The complexity is no longer considered necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Make consistent with the terms about code ranges and locationsmame2018-01-081-4/+4
| | | | | | | | | | | | | "loc" was ambiguous; it might refer both a location and a code range. This change uses "loc" for a location, and "crange" or "cr" for a code range. A location (abbr. loc) is a point in a program and consists of line number and column number. A code range (abbr. crange and cr) is a range within a program and consists of a pair of locations which is the first and the last. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Remove dispose_stringmame2018-01-081-11/+0
| | | | | | | I think that recycling the delimiter string objects doesn't pay its complexity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: show newline node marknobu2018-01-081-2/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e