Граф коммитов

209 Коммитов

Автор SHA1 Сообщение Дата
nobu 3eac78dd88 iseq.c: fix values for true
* iseq.c (make_compile_option): fill with 1 of int, not char if opt is true.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15 08:07:35 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
ko1 cff2b2b666 * vm_backtrace.c, include/ruby/debug.h: add new APIs
* VALUE rb_profile_frame_method_name(VALUE frame)
* VALUE rb_profile_frame_qualified_method_name(VALUE frame)
* iseq.c (rb_iseq_klass), internal.h: add new internal function
  rb_iseq_method_name().
* ext/-test-/debug/profile_frames.c (profile_frames),
  test/-ext-/debug/test_profile_frames.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08 12:08:20 +00:00
ko1 774bff0adb * include/ruby/debug.h: add backtrace collecting APIs for profiler.
* int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
  Collect information of frame information.
* VALUE rb_profile_frame_path(VALUE frame);
* VALUE rb_profile_frame_absolute_path(VALUE frame);
* VALUE rb_profile_frame_label(VALUE frame);
* VALUE rb_profile_frame_base_label(VALUE frame);
* VALUE rb_profile_frame_first_lineno(VALUE frame);
* VALUE rb_profile_frame_classpath(VALUE frame);
* VALUE rb_profile_frame_singleton_method_p(VALUE frame);
  Get information about each frame.
  These APIs are designed for profilers, for example, no objectallocation,
  and enough information for profilers.
  In this version, this API collects only collect Ruby level frames.
  This issue will be fixed after Ruby 2.1.
* vm_backtrace.c: implement above APIs.
* iseq.c (rb_iseq_klass): return local_iseq's class.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 07:21:11 +00:00
ko1 12f368d6a4 * iseq.c, internal.h: change to public (but internal) functions
* VALUE rb_iseq_path(VALUE iseqval);
* VALUE rb_iseq_absolute_path(VALUE iseqval);
* VALUE rb_iseq_label(VALUE iseqval);
* VALUE rb_iseq_base_label(VALUE iseqval);
* VALUE rb_iseq_first_lineno(VALUE iseqval);
  And new (temporary) function:
* VALUE rb_iseq_klass(VALUE iseqval);
* iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
  function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
  Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
* proc.c. vm_insnhelper.c, vm_method.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 05:12:08 +00:00
ko1 30b1947df2 * insns.def: fix regexp's once option behavior.
fix [ruby-trunk - Bug #6701]
* insns.def: remove `onceinlinecache' and introduce `once' instruction.
  `once' doesn't use `setinlinecache' insn any more.
* vm_core.h: `union iseq_inline_storage_entry' to store once data.
* compile.c: catch up above changes.
* iseq.c: ditto.
* vm.c, vm_insnhelper.c: ditto. fix `m_core_set_postexe()' which
  is depend on `onceinlinecache' insn.
* test/ruby/test_regexp.rb: add tests.
* iseq.c: ISEQ_MINOR_VERSION to 1 (should increment major?)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-20 17:41:13 +00:00
nobu aa2a845168 parse.y, vm_eval.c: file encoding in eval
* parse.y (yycompile): store file name as String to keep the encoding.

* parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path):
  new functions to pass file name as a String.

* parse.y (gettable_gen): return a copy of the original file name, not
  a copy in filesystem encoding.

* vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29 08:00:34 +00:00
ko1 4223f00713 * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
  vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 19:52:40 +00:00
ko1 9b47ec04a8 * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: add
rb_data_type_struct::flags. Now, this flags is passed
  at T_DATA object creation. You can specify FL_WB_PROTECTED
  on this flag.
* iseq.c: making non-shady iseq objects.
* class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
* vm_core.h, iseq.h: constify fields to detect WB insertion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19 06:26:01 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
ko1 f1eadb0fb4 * iseq.c (prepare_iseq_build): remove additional line braek.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 11:11:53 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
tmm1 cbd8b09920 iseq: reduce array allocations for simple sequences
* compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().

* insns.def (setinlinecache): Ditto.

* iseq.c (rb_iseq_add_mark_object): New function to allocate
  iseq->mark_ary on demand. [Bug #8142]

* iseq.h (rb_iseq_add_mark_object): Ditto.

* iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.

* iseq.c (rb_iseq_build_for_ruby2cext): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-17 11:20:23 +00:00
tmm1 cef6a377fc iseq.c: remove duplicated strings for file paths
* iseq.c (iseq_location_setup): re-use existing string when iseq has
  the same path and absolute_path. [Bug #8149]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-17 10:55:29 +00:00
nobu 4c276d0c8b * iseq.c (iseq_load): get rid of SEGV.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26 06:24:26 +00:00
nobu 34a95669da required keyword arguments
* compile.c (iseq_set_arguments, iseq_compile_each): support required
  keyword arguments.   [ruby-core:51454] [Feature #7701]
* iseq.c (rb_iseq_parameters): ditto.
* parse.y (f_kw, f_block_kw): ditto.  this syntax is still
  experimental, the notation may change.
* vm_core.h (rb_iseq_struct): ditto.
* vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-12 13:20:50 +00:00
nobu 94daa860e5 iseq.c: keyword arguments
* iseq.c (rb_iseq_disasm): fix keyword arguments index.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-07 04:38:45 +00:00
nobu 5f5d915512 iseq.c: keyword arguments
* iseq.c (rb_iseq_disasm): show keyword arguments info, in format
  "keyword: NUM@LIDX".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06 13:24:06 +00:00
nobu 2d1c94a18d prefix global symbols
* iseq.c (rb_insn_operand_intern): prefix global symbols.

* numeric.c (ruby_num_interval_step_size): ditto.

* vm_backtrace.c (rb_vm_backtrace_str_ary),
  (rb_vm_backtrace_location_ary, rb_vm_thread_backtrace),
  (rb_vm_thread_backtrace_locations): ditto.

* vm_trace.c (rb_vm_trace_mark_event_hooks): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06 06:30:03 +00:00
ko1 b0690af9a4 * iseq.c (iseq_data_to_ary): fix condition.
r34303 introduces a bug to avoid all line information from
  a result of ISeq#to_a. This is a regression problem from 2.0.0p0.
* test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-28 11:26:23 +00:00
nobu be7bf5aa0c adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:04 +00:00
zzak fd636ef99b * iseq.c (RubyVM::InstructionSequence): rdoc formatting
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 07:44:54 +00:00
zzak 1ddf183353 * iseq.c (RubyVM::InstructionSequence): Add rdoc for new iseq features
added from r38085, this includes ::of, #path, #absolute_path,
  #label, #base_label, #first_lineno, and #inspect


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 06:29:47 +00:00
zzak 4706171d27 * iseq.c (rb_iseq_line_trace_all, rb_iseq_line_trace_specify): Add
rdoc for experimental C level api of iseq, from r38076


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 05:09:18 +00:00
ko1 17ac783541 * iseq.c (Init_ISeq): remove definition of the following methods:
ISeq#line_trace_all and ISeq#line_trace_specify because they are
  half baked.
  C APIs are remained as experimental. These functions will be
  renamed, removed their parameters may be changed.
  You can use these methods by C exts. Please give us your comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 11:44:09 +00:00
eregon 0314f93ef4 * iseq.c (rb_iseq_parameters): fix limit for optional arguments.
* test/ruby/test_keyword.rb: tests for above.
* vm_core.h (struct rb_iseq_struct): update documentation
  with keyword arguments. [Bug #7540] [ruby-core:50735]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 21:44:49 +00:00
nobu c9b4b78085 compile.c, vm_insnhelper.c: flip-flop without hidden string key
* compile.c (iseq_compile_each): count flip-flop state in local iseq
  not in each iseqs, so that the keys can be other than hidden
  strings.  [ruby-core:47253] [Bug #6899]
* vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store
  flip-flop states in an array instead of a hash.
* iseq.c (set_relation): main iseq also can has local scope.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-10 06:11:16 +00:00
ko1 5bdd03936c * iseq.c (rb_iseq_line_trace_each): iterate `line' event only.
* test/ruby/test_iseq.rb: add a test for this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 20:07:58 +00:00
nobu 9c1b3161f2 complex.c, time.c: make marshal methods private
* complex.c (Init_Complex), time.c (Init_Time): make marshal methods
  private.  [Feature #6539]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:17:02 +00:00
ko1 5697f69baa * iseq.c: add RubyVM::InstructionSequence (ISeq) inspection methods.
* ISeq#path returns path of this ISeq written.
* ISeq#absolute_path returns absolute path.
* ISeq#label returns label (method name and so on).
* ISeq#base_label returns base label (see Thread::Backtrace::Location).
* ISeq#first_lineno returns first line number of this ISeq.
* ISeq.of(obj) returns ISeq object which obj (Proc or Method)
  is contains.
* test/ruby/test_iseq.rb: add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 18:02:43 +00:00
ko1 12f2f7371f [EXPERIMENTAL]
* iseq.c: add following two methods.
* ISeq#line_trace_all returns all line traces (line numbers)
* ISeq#line_trace_specify(pos, set) set `pos'th line event to
  specified_line event (if set is true).
  These features are introduced for debuggers (mainly to make
  breakpoint).
* iseq.h: add decl. of C APIs.
* test/ruby/test_iseq.rb: add tests.
* vm_trace.c: add `specified_line' event.
* include/ruby/ruby.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 17:00:30 +00:00
ko1 8c6ad2b0ae * iseq.c (make_compile_option_value): add trace_instruction option.
a patch by davidbalbert (David Albert).
  [Bug #6786]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26 10:46:01 +00:00
nobu 0c4a27a5a2 iseq.c: fix r37397
* iseq.c (set_relation): parent_iseq need to be set regardless iseq
  type.  fix r37397.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-01 12:20:00 +00:00
nobu 130bb41d0a iseq.c: simplify
* iseq.c (set_relation): simplify and merge same conditions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-01 04:17:01 +00:00
shyouhei d090f17f21 * iseq.c (rb_iseq_compile_with_option): Instead of testing
respond_to, just check if the argument is actually a file,
  because by calling user-defined gets something weired can
  happen.  Patch by Glass_saga. [ruby-dev:40202] [Bug #2861]

* parse.y (ripper_initialize): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-27 01:16:25 +00:00
ko1 a91e91c537 * vm_core.h (VM_CALL_*): rename VM_CALL_*_BIT
to VM_CALL_* (remove `_BIT' suffix).
  Add comments on each macros.
  Remove unused macro VM_CALL_TAILRECURSION_BIT.
* compile.c, iseq.c, insns.def, vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-15 17:22:57 +00:00
ko1 cbd597e9bc * insns.def (send, invokesuper, invokeblock, opt_*), vm_core.h:
use only a `ci' (rb_call_info_t) parameter instead of using
  parameters such as `op_id', 'op_argc', `blockiseq' and flag.
  These information are stored in rb_call_info_t at the compile
  time.
  This technique simplifies parameter passings at related
  function calls (~10% speedups for simple mehtod invocation at
  my machine).
  `rb_call_info_t' also has new function pointer variable `call'.
  This `call' variable enables to customize method (block)
  invocation process for each place. However, it always call
  `vm_call_general()' at this changes.
  `rb_call_info_t' also has temporary variables for method
  (block) invocation.
* vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP
  VM_CALL macro.  This flag indicates that this call can skip
  caller_setup (block arg and splat arg).
* compile.c: catch up above changes.
* iseq.c: catch up above changes (especially for TS_CALLINFO).
* tool/instruction.rb: catch up above chagnes.
* vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions
  parameters are changed.
* vm_eval.c (vm_call0): ditto (it will be rewriten soon).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-14 16:59:05 +00:00
naruse 34996e23ef Suppress warning: 'iseqval' may be used uninitialized in this function
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-11 00:50:29 +00:00
naruse b5ff6f11b5 * iseq.c (insn_operand_intern): cast op to rb_call_info_t* before
compare with iseq->callinfo_entries whose type is rb_call_info_t*.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-10 22:43:51 +00:00
ko1 6990c7f9cd * iseq.c (insn_operand_intern): add support disasm TS_CALLINFO
operands.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-10 17:52:24 +00:00
ko1 62ad069c3a * iseq.c (iseq_free): fix memory leak.
rb_iseq_t::callinfo_entries should be freed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-09 05:37:43 +00:00
shugo e028d3d905 * eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,
vm_method.c: rename omod and overlaid modules to refinements.

* eval.c (hidden_identity_hash_new): renamed from identity_hash_new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-08 14:02:46 +00:00
ko1 08c8605de9 * insns.def (getlocal, setlocal): remove old getlocal/setlocal
instructions and rename getdaynmic/setdynamic instructions
  to getlocal/setlocal.
* compile.c: ditto.
* iseq.c: remove TS_DINDEX.
* vm_exec.h (dindex_t): remove type definition of `dindex_t'.
* tool/instruction.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 13:52:20 +00:00
ko1 23dc0dbc4a * vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysis
hooks (old macro name is COLLECT_USAGE_ANALYSIS).
  This feature is only for VM developers.  (I'm not sure I can use
  `VM developers' (the plural form) in this sentence).
  If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
  usage collection features:
  (1) insntruction: collect intruction usages.
  (2) operand: collect operand usages.
  (3) register: collect register usages.
  The results are stored in
  RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
  RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
  RubyVM::USAGE_ANALYSIS_REGS for (3).
  You can stop collecting usages with
  RubyVM::USAGE_ANALYSIS_INSN_STOP(),
  RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
  RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
  for (1), (2), (3) respectively.
  You can also change the hook functions by setting
  C level global variables
  `ruby_vm_collect_usage_func_(insn|operand|register)'
  for (1), (2), (3) respectively.
  See codes for more details.
* tool/instruction.rb: fix macro names.
* iseq.c (insn_operand_intern): make it export (used in vm.c).
  fix to skip several processes if not needed (pointer is 0).
* vm_dump.c: move codes for collection features to vm.c.
* vm_exec.h: rename macro and function names.
* vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 12:31:05 +00:00
naruse 2eadff346a * iseq.c (rb_iseq_defined_string): the index of defined_strings must
be the value of type - 1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 23:17:59 +00:00
nobu 2314b80d4c Feature #7035
* compile.c (defined_expr), insns.def (defined): share single frozen
  strings.  [EXPERIMENTAL] [ruby-core:47558][Feature #7035]
* iseq.c (rb_iseq_defined_string): make expression strings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 08:36:53 +00:00
ko1 93b6f8d619 * compile.c, insns.def (checkmatch):
remove checkincludearray instruction and
  add new instruction checkmatch.
  This change is to solve
  [Bug #4438] "rescue args type check omitted".
* iseq.c: increment ISEQ_MAJOR_VERSION because removal of
  checkincludearray instruction.
* vm_core.h: add several definitions for
  the checkmatch instruction.
* vm_insnhelper.c (check_match): added.
* bootstraptest/test_exception.rb: add a test.
* test/ruby/test_exception.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-08 07:52:19 +00:00
shugo 19ddfc2483 * eval.c (rb_mod_using): new method Module#using. [experimental]
* eval.c (rb_mod_refine): new method Module#refine. [experimental]

* eval.c (f_using): new method Kernel#using. [experimental]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 11:34:19 +00:00