* 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 (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 (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 (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
* 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
* 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
* 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
* 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
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
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
* 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
* 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
* 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
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
"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
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