aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
Commit message (Collapse)AuthorAgeFilesLines
* parse.y: should not warn op method callnobu2017-06-231-0/+1
| | | | | | | * parse.y (void_expr_gen): should warn operator expression style calls only, but not method style calls. [Fix GH-1660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* no mark of u3 in NODE_BLOCK_PASSnobu2017-04-091-1/+1
| | | | | | | * node.c (rb_gc_mark_node): u3 in NODE_BLOCK_PASS is not used and does not need to be marked. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix nd_ainfo->kw_rest_argnobu2017-02-271-1/+1
| | | | | | | [Fix GH-5129] Author: fate0 <fate0@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: fix NODE_OP_ASGN1nobu2017-02-261-3/+9
| | | | | | | | | * node.c (dump_node): fix a typo, index and rvalue. fix NODE_OP_ASGN1 operator to nd_mid. [Fix GH-1528] Author: fate0 <fate0@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove warning about enum and int comparison.ko12017-02-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: compress logop sequencenobu2017-02-081-2/+9
| | | | | | | * node.c (dump_node): compress sequence of same logical binary operators, NODE_AND/NODE_OR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: Fix a typoyui-knk2017-02-051-1/+1
| | | | | | * node.c (dump_node): Fix a typo of || operator example git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: flatten NODE_BLOCK [ci skip]nobu2016-10-051-4/+19
| | | | | | * node.c (dump_node): flatten statements in NODE_BLOCK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c (dump_array): remove duplicate header of NODE_ARRAY/ktsj2016-09-251-1/+0
| | | | | | NODE_VALUES. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: nd_alen only in the headnobu2016-08-151-5/+21
| | | | | | | * node.c (dump_array): show nd_alen field in NODE_ARRAY only in the first node. it is nd_end in the rest nodes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: mark u3 of NODE_MATCH2nobu2016-03-211-1/+1
| | | | | | | * node.c (rb_gc_mark_node): NODE_MATCH2 can have nd_args, u3, since r54100. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optimize named capture assignmentnobu2016-03-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * compile.c (compile_named_capture_assign): optimize named capture assignments, by replacing repeating global variable accesses with `dup`, and by returning the matched result instead of re-getting it from the MatchData. * parse.y (reg_named_capture_assign_gen): build just assignment nodes for the optimization. ex. `/(?<x>.)/ =~ "bar"` - old ``` 0000 putstring "bar" 0002 opt_regexpmatch1 /(?<x>.)/ 0004 pop 0005 getglobal $~ 0007 branchunless 25 0009 getglobal $~ 0011 putobject :x 0013 opt_aref <callinfo!mid:[], argc:1, ARGS_SIMPLE> 0016 setlocal_OP__WC__0 2 0018 getglobal $~ 0020 putobject_OP_INT2FIX_O_0_C_ 0021 opt_send_without_block <callinfo!mid:begin, argc:1, ARGS_SIMPLE> 0024 leave 0025 putobject nil 0027 setlocal_OP__WC__0 2 0029 putobject nil 0031 leave ``` - new ``` 0000 putstring "bar" 0002 opt_regexpmatch1 /(?<x>.)/ 0004 getglobal $~ 0006 dup 0007 branchunless 14 0009 putobject :x 0011 opt_aref <callinfo!mid:[], argc:1, ARGS_SIMPLE> 0014 setlocal_OP__WC__0 2 0016 leave ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: no nd_compile_option unless setnobu2016-03-101-3/+6
| | | | | | * node.c (dump_node): show nd_compile_option only when it is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: stringize before expansionnobu2016-03-101-4/+4
| | | | | | | * node.c (F_NODE, F_OPTION): stringize member names defined as macros before expansion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: hidden options hashnobu2016-03-101-4/+45
| | | | | | | * node.c (dump_option): nd_compile_option is a hidden hash object, cannot call inspect on it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: NODE_QCALLnobu2015-12-051-0/+10
| | | | | | | * node.c (dump_node): dump NODE_QCALL. [Feature #11537] http://twitter.com/watson1978/status/673042429931446272 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Safe navigation operatornobu2015-10-221-1/+4
| | | | | | | | | | | | | * compile.c (iseq_peephole_optimize): peephole optimization for branchnil jumps. * compile.c (iseq_compile_each): generate save navigation operator code. * insns.def (branchnil): new opcode to pop the tos and branch if it is nil. * parse.y (NEW_QCALL, call_op, parser_yylex): parse token '.?'. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: update commentnobu2015-10-121-6/+2
| | | | | | | * node.c (dump_node): update comment for OP_ASGN2 and fix unused field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: no attrset ID in NODEnobu2015-10-121-2/+4
| | | | | | * node.c (dump_node): attrset ID is no longer in NODE_OP_ASGN2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: fix comments [ci skip]nobu2015-10-091-3/+3
| | | | | | | * node.c (dump_node): fix comments of dynamic string literals, nd_next->nd_head is the interpolation but not a literal string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: reduce sizenobu2015-10-081-10/+17
| | | | | | | * node.c (A_FIELD_HEADER): reduce text size by sharing messages with and without comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: move blocknobu2015-10-081-21/+23
| | | | | | * node.c (SIMPLE_FIELD): move block after macro call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: D_FIELD_HEADERnobu2015-10-081-8/+9
| | | | | | * node.c (D_FIELD_HEADER): concatenate sequential strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: indent [ci skipnobu2015-10-081-18/+18
| | | | | | * node.c (dump_node): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fronzen-string-literal pragmanobu2015-09-271-1/+3
| | | | | | | | | | | | | * compile.c (iseq_compile_each): override compile option by option given by pragma. * iseq.c (rb_iseq_make_compile_option): extract a function to overwrite rb_compile_option_t. * parse.y (parser_set_compile_option_flag): introduce pragma to override compile options. * parse.y (magic_comments): new pragma "fronzen-string-literal". [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: move tmp buffer functionsnobu2015-08-061-30/+0
| | | | | | | * gc.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer): move from node.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: check sizenobu2015-08-061-4/+12
| | | | | | | * node.c (rb_alloc_tmp_buffer): round up the size and check the range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_atomic.h: atomic VALUE operationsnobu2015-08-061-4/+2
| | | | | | | * ruby_atomic.h (ATOMIC_VALUE_EXCHANGE, ATOMIC_VALUE_CAS): add atomic operations for VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: NODE_ALLOCA for ALLOCVnobu2015-08-051-0/+24
| | | | | | | * node.c (rb_alloc_tmp_buffer): use NODE_ALLOCA to mark locations like as builtin alloca. [ruby-core:70251] [Bug #11418] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c: use T_IMEMO to create SVAR.ko12015-03-111-1/+0
| | | | | | | | | | | | * internal.h, vm_insnhelper.h: move definition `struct SVAR' from vm_insnhelper.h to internal.h. And rename it to strcut vm_svar. new imemo_type imemo_svar is added. * gc.c (gc_mark_children): mark imemo_svar. * node.c (rb_gc_mark_node): remove useless marking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce new type T_IMEMO.ko12015-03-111-5/+0
| | | | | | | | | | | | | | | | | | | | | T_IMEMO is Internal Memo type, internal use only. T_IMEMO has same purpose of NODE_MEMO. To insert T_IMEMO, type numbers are modified a little. * internal.h: define struct RIMemo. Each RIMemo objects has imemo_type. We can observe it by the imemo_type() function. * gc.c (rb_imemo_new): added. * node.h: remove NODE_CREF and NEW_CREF(). * node.c (rb_gc_mark_node): ditto. * vm.c (vm_cref_new): use rb_imem_new(). * vm_eval.c: ditto. * vm_eval.c (eval_string_with_cref): * vm_eval.c (rb_type_str): * vm_insnhelper.c: use RIMemo objects for CREF. * ext/objspace/objspace.c: support T_IMEMO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: define rb_cref_t and change to use it.ko12015-03-081-4/+4
| | | | | | | | | rb_cref_t is data type of CREF. Now, the body is still NODE. It is easy to understand what is CREF and what is pure NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: define CREF accessor macros.ko12015-03-081-4/+4
| | | | | | | | | | | | | | | | | | * CREF_CLASS(cref) * CREF_NEXT(cref) * CREF_VISI(cref) * CREF_VISI_SET(cref, v) * CREF_REFINEMENTS(cref) * CREF_PUSHED_BY_EVAL(cref) * CREF_PUSHED_BY_EVAL_SET(cref) * CREF_OMOD_SHARED(cref) * CREF_OMOD_SHARED_SET(cref) * CREF_OMOD_SHARED_UNSET(cref) This is process to change CREF data type from NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * fix namespace issue on singleton class expressions. [Bug #10943]ko12015-03-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored to rb_method_definition_t::body.iseq_body.cref. * vm_insnhelper.c: modify SVAR usage. When calling ISEQ type method, push CREF information onto method frame, SVAR located place. Before this fix, SVAR is simply nil. After this patch, CREF (or NULL == Qfalse for not iseq methods) is stored at the method invocation. When SVAR is requierd, then put NODE_IF onto SVAR location, and NDOE_IF::nd_reserved points CREF itself. * vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added. * vm_insnhelper.c (vm_push_frame): accept CREF. * method.h, vm_method.c (rb_add_method_iseq): added. This function accepts iseq and CREF. * class.c (clone_method): use rb_add_method_iseq(). * gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref. * iseq.c: remove CREF related codes. * insns.def (getinlinecache/setinlinecache): CREF should be cache key because a different CREF has a different namespace. * node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR. * proc.c: catch up changes. * struct.c: ditto. * insns.def: ditto. * vm_args.c (raise_argument_error): ditto. * vm_eval.c: ditto. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (numberof): unused. internal.h has same macro.nari2014-09-211-3/+0
| | | | | | * node.c (F_CUSTOM2): unused. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h: extract NODE functions from gc.cnobu2014-08-161-0/+181
| | | | | | | | * node.h (rb_gc_free_node, rb_node_memsize, rb_gc_mark_node): extract functions for NODE from obj_free(), obj_memsize_of(), gc_mark_children() in gc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix --dump=parsetree segfault on required keyword argumentcharliesome2014-07-011-1/+6
| | | | | | | * node.c (dump_node): handle nd_value == (NODE *)-1 to mean this keyword argument is required git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: indentnobu2014-04-251-13/+13
| | | | | | * node.c (dump_node): adjust indent to "ruby-style.el". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/util.h: removed extra semicolon in definition oftadf2012-11-211-2/+2
| | | | | | | | | | | | macro. * compile.c: ditto. * cont.c: ditto. * math.c: ditto. * node.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_set_arguments): keyword rest arg without keyword args.nobu2012-03-131-0/+1
| | | | | | | | | | * node.c (dump_node): dump kw_rest_arg too. * parse.y (block_param, f_arg): more kwrest patterns. [ruby-core:42455][Bug #5989] * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h (rb_args_info): change pre_args_num and post_args_num asnobu2011-12-271-2/+2
| | | | | | | | int, to match with rb_iseq_t. * parse.y (new_args_gen): check overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h, node.c, parse.y: implement a parser part for keyword arguments. ↵mame2011-12-261-0/+11
| | | | | | | | This is a preparation for keyword argument (see [ruby-core:40290]). * gc.c (gc_mark_children): bookkeeping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h, parse.y (new_args_gen), compile.c (iseq_set_arguments): use struct ↵mame2011-12-261-45/+8
| | | | | | | | rb_args_info instead of NODEs. This is a preparation for keyword argument (see [ruby-core:40290]). * node.c (dump_node), gc.c (gc_mark_children, obj_free): bookkeeping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c (dump_node): add today's knowledge. "init arguments (m)" andmame2011-07-211-0/+3
| | | | | | | | | | | | "init arguments (p)" of compile.c indicates a Ruby code that evaluates multiple assignments that is in method or block parameters: def foo((m1,m2), (m3,m4), *r, (p1,p2), (p3,p4)); end The former (init arguments (m)) evaluates the multiple assignments before rest argument, that are (m1,m2) and (m3,m4). The letter (init arguments (p)) does ones after rest argument, that are (p1,p2) and (p3, p4). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c (add_id): remove duplicated rb_id2str() call.nagachika2011-01-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c: parenthesize macro arguments.akr2010-12-201-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_set_stack_location), iseq.c (prepare_iseq_build),nobu2010-05-161-1/+1
| | | | | | | node.c (dump_node): suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c (dump_node): fixed for long members.nobu2009-12-091-6/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.c: node management added. Currently, only pretty-dumper ismame2009-12-091-0/+919
implemented. [ruby-dev:39853] * ruby.c: --dump=parsetree and --dump=parsetree_with_comment options added. This is just for debug or research purpose. Note that the compatibility of these options are not supported at all. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e