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

349 Коммитов

Автор SHA1 Сообщение Дата
nobu 55148a2501 * vm_eval.c (check_funcall): try respond_to? first if redefined.
[Bug #5158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-05 03:18:25 +00:00
nobu d93746490d * array.c (rb_ary_set_len): new function to set array length.
* vm_eval.c (method_missing): set the length of argv array, to mark
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29 14:53:51 +00:00
nobu 0d6329343a * vm_eval.c (rb_apply): get rid of too large alloca.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29 14:53:47 +00:00
kosaki 74b339e938 * thread_pthread.c (rb_thread_create_timer_thread): removed
rb_disable_interrupt()/rb_enable_interrupt().
* vm_core.h: ditto.
* process.c (static void before_exec): ditto.
* process.c (static void after_exec): ditto.
  [Bug #4765] [ruby-dev:43571]

* eval_intern.h: removed rb_trap_restore_mask().
* vm_eval.c (rb_throw_obj): ditto.
* eval.c (setup_exception): ditto.

* signal.c: removed trap_last_mask.
* signal.c (trap_restore_mask): removed.
* signal.c (init_sigchld): comment clarification why signal block
  is needed. and removed trap_last_mask operation.
* signal.c (trap_ensure): removed trap_last_mask operation.

* signal.c (rb_disable_interrupt, rb_enable_interrupt): made
  static and removed sigdelset(SIGVTALARM) and sigdelset(SIGSEGV).

* process.c (rb_syswait): removed implicit signal handler change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 17:04:40 +00:00
akr 7da3ea811e * method.h, internal.h iseq.h: declare internal functions.
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
  thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
  declare internal functions.

  Note that rb_method_entry_eq() is defined in vm_method.c but
  there was a declaration in proc.c with different const-ness.
  Now it is declared in method.h with same const-ness to the
  definition.

* object.c (rb_mod_module_exec): don't declare functions declared in
  include/ruby/intern.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:49:33 +00:00
matz 1df42597d1 cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:44:45 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
naruse 18f4f08885 * class.c: fix camelCase to snake_case in documentation code examples.
patched by Andrew Grimm. fixes Bug #4469

* marshal.c: ditto.

* proc.c: ditto.

* sample/biorhythm.rb: ditto.

* vm_eval.c: ditto.

* vm_method.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-05 20:25:08 +00:00
nobu e7c0a6e1d7 * prevent temporary objects from GC, and should not use
RSTRING_PTR() for function calls since it evaluates the argument
  a couple of times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20 07:23:55 +00:00
nagachika ab083dc640 * vm_eval.c (rb_throw_obj): add GC guard to prevent intermediate
variable from GC. [Bug #4322] [ruby-dev:43108]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-26 13:34:20 +00:00
mame e20d736467 * vm_eval.c (rb_funcall): ensure va_end after va_init_list. Coverity
Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 13:48:37 +00:00
nobu f5b0cb07e2 * string.c (sym_call), vm.c (invoke_block_from_c),
vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
  [ruby-core:32075]

* vm_eval.c (rb_funcall_passing_block): new function to call
  method with passing given block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 14:45:19 +00:00
nobu fd0485acf7 * vm_eval.c (vm_call0): fix for VM_METHOD_TYPE_NOTIMPLEMENTED.
[ruby-dev:41953]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-07 04:33:33 +00:00
nobu 0f36e8fc03 * eval.c (frame_func_id), vm_eval.c (rb_iterate),
vm_insnhelper.c (vm_yield_with_cfunc): as the name of a C-level
  block, use the current method ID at the creation point.
  [ruby-dev:41852]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-14 11:23:10 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
mame 948185248c * vm_eval.c (rb_f_caller): update rdoc. a patch from Nobuhiro IMAI
<nov at yo.rim.or.jp> in [ruby-dev:41387].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-24 16:48:00 +00:00
nobu b32e8a5911 * vm.c (vm_backtrace_each), vm_eval.c (rb_catch_obj): suppress
warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 03:57:11 +00:00
mame 5c94d2d423 * vm_eval.c (rb_f_caller): update rdoc. a patch from Nobuhiro IMAI
<nov at yo.rim.or.jp> in [ruby-dev:41348].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-20 13:09:28 +00:00
mame 9219029d3c * vm.c (vm_backtrace_each): now takes an init function to distinguish
an empty stack from out of stack.  [ruby-dev:41366]

* vm_eval.c (print_backtrace, rb_thread_backtrace): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-20 13:07:58 +00:00
mame 56036e3514 * vm_eval.c (rb_f_caller): return [] instead of nil when the function
is called on toplevel.  [ruby-dev:41348]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 11:18:12 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
mame 7e7420cc85 * proc.c (proc_binding): don't propagative filename and line_no of
binding that is created from C level.  [ruby-dev:41322]

* vm_eval.c (eval_string_with_cref): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-16 08:18:49 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
mame b8571b4285 * vm_eval.c (eval_string_with_cref): propagative filename and line_no
of binding.  [ruby-dev:38767] [ruby-core:28307]

* vm_core.h (rb_binding_t), proc.c: add filename and line_no fields to
  preserve them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-09 18:41:51 +00:00
nobu 584829aa81 * vm.c (vm_backtrace_each): get rid of use of malloc from signal
handler by using ruby_engine_name.  [ruby-core:29497]

* vm_eval.c (print_backtrace): file may be nil when segfaulted in
  very early stage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-15 05:38:07 +00:00
wanabe c46f71399a * proc.c (rb_method_location): return attr's location if it is setup.
[Feature #2084]

* NEWS: follow above.

* vm_method.c (rb_add_method): save attr's location.

* gc.c (mark_method_entry): mark attr's location.

* method.h (rb_method_definition_t): add member to save attr's location.

* vm_eval.c (vm_call0): follow above.

* vm_insnhelper.c (vm_call_method): ditto.

* vm_method.c (rb_method_definition_eq): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 11:44:01 +00:00
mame 6ff75042db * compile.c, iseq.c, ruby.c, vm.c, vm_core.h, vm_eval.c: add absolute
path field into rb_iseq_t.  The field contains a string representing
  a path to corresponding source file. or nil when the iseq is created
  from -e, stdin, eval, etc.  This field is used for require_relative.
  [ruby-dev:40004]

* load.c (rb_f_require_relative): add C implementation of
  require_relative.

* prelude.rb (require_relative): get rid of Ruby implementation of
  require_relative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16 17:40:00 +00:00
nobu 50c8982ea8 * vm_insnhelper.c (vm_call_cfunc): removed unused variable.
* vm.c (vm_frametype_name): define only when VMDEBUG.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-17 08:05:42 +00:00
mame 69eb602b02 * vm_eval.c (rb_backtrace): "circular require" warning was output to
stdout except the first line.  All line is output to stderr now.
  [ruby-dev:40147]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-27 13:29:01 +00:00
ko1 618445576f * eval.c, vm.c, vm_eval.c, vm_insnhelper.c: fix issues about
return and c-return trace.  This issue skips (c-)return event
  with global jump such as break or return.  This fix make vm invoke
  hooks at stack rewind timing.  fix [ruby-core:27606] [Bug #2610].
* test/ruby/test_settracefunc.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-24 13:52:32 +00:00
mame 052f7f27f2 * vm_eval.c (rb_iterate): remove SEGV (retry).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 17:47:02 +00:00
mame c8b20d0877 * vm_eval.c (rb_iterate): remove SEGV (use the original patch).
[ruby-dev:39874]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 14:20:46 +00:00
mame ae8dc9b722 * vm_eval.c (rb_iterate): pass current block when the argument bl_proc
is NULL.  This behavior can be used to make enumerator faster
  [ruby-dev:39874]

* enumerator.c (enumerator_each): pass current block directly instead
  of trampoline block (enumerator_each_i).

* io.c (argf_each_line, argf_each_byte, argf_each_char): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 12:31:26 +00:00
nobu 93278f2387 * vm_eval.c (check_funcall): reset method_missing_reason before
trying the call.  based on a patch from Yehuda Katz in
  [ruby-core:27219].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-19 00:58:13 +00:00
shugo 9071538179 * vm_eval.c (yield_under): yields self the same as 1.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 08:24:11 +00:00
shugo 78b2714b60 avoid SEGV in instance_eval without block.
instance_eval does not yield self.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 07:09:17 +00:00
shugo 7dbfe89630 * compile.c (compile_cpath, iseq_compile_each): reverted
constant/class variable lookup in instance_eval etc. to the
  behavior of 1.8.
* eval.c (rb_mod_nesting): ditto.
* insns.def (putspecialobject, defineclass): ditto.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL): ditto.
* vm_core.h (VM_SPECIAL_OBJECT_CONST_BASE): ditto.
* vm_eval.c (yield_under, eval_under): ditto.
* vm_insnhelper.c (vm_cref_push, vm_get_const_base,
  vm_get_ev_const, vm_get_cvar_base): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-03 18:25:57 +00:00
nobu dd7264ac69 * vm_eval.c (check_funcall_failed): pass ID. [ruby-core:26934]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-29 07:56:25 +00:00
matz be21eb5d0f * vm_eval.c (check_funcall_failed): should rescue user raised
NoMethodError.  rescue all NoMethodError if receiver does not
  respond to the method name.  [ruby-dev:39796]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-28 00:26:27 +00:00
akr fe97646743 * vm_eval.c (rb_search_method_entry): refine error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-25 11:47:19 +00:00
akr 5181fa2a55 * vm_eval.c (rb_search_method_entry): show flags and klass value in
not implemented error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-21 09:49:30 +00:00
akr 0089bfe4dd * vm_eval.c (rb_search_method_entry): avoid trigraph.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-20 12:17:29 +00:00
akr 2038c0f360 * vm_eval.c (rb_search_method_entry): show the type of the hidden
object.
  (rb_type_str): new function for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 17:52:12 +00:00
shugo 3dc8a69df7 * vm_insnhelper.c (vm_call_method): protected singleton methods of
an object should not be able to called from other instances of the
  class of the object.  [ruby-core:26761]
* vm_eval.c (rb_method_call_status): ditto.
* test/ruby/test_module.rb (test_protected_singleton_method): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-16 07:01:44 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
matz c0a0aa0c47 * enum.c (enum_count): remove optimization using #size.
revert r25560.

* vm_eval.c (rb_funcall_no_recursive): remove method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 16:14:38 +00:00
matz ab32fe26d9 * vm_eval.c (check_funcall): logic updated according to
[ruby-dev:39594].  search method entry, call if it exists;
  otherwise check method_missing, call if it was overridden,
  protecting exceptions; if NoMethodError happens, check method
  name.

* vm_eval.c (vm_call0): use idMethodMissing.

* vm_eval.c (rb_search_method_entry): typo fixed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 15:32:22 +00:00
nobu 1932c59097 * vm_eval.c (enum call_type): get rid of last comma.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 08:01:48 +00:00
nobu 166a53c560 * vm_eval.c (vm_call0, vm_call_super, rb_f_send, rb_f_public_send):
fixed call_type.  [ruby-dev:39581]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 07:57:21 +00:00
nobu 35b88be02b * vm_eval.c (rb_search_method_emtry, rb_method_call_status): split
from rb_call0().

* vm_eval.c (rb_check_funcall): get rid of raising exceptions and
  hiding further exceptions.  [ruby-dev:39584]

* vm_eval.c (rb_funcall_no_recursive): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 07:42:04 +00:00
matz 7f2ef1a96e * enum.c (enum_count): call #size using rb_funcall_no_recursive()
to prevent infinite recursive calls.  [ruby-core:24794]

* vm_eval.c (rb_funcall_no_recursive): utility function to check
  direct recursive call.

* vm_eval.c (rb_check_funcall): move from eval.c. [refactoring]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 17:16:05 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
marcandre b97494f3cb * vm_eval.c (eval_string): rdoc fix [ruby-core:26086]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-14 14:08:26 +00:00
matz 102918a3ee git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e 2009-09-28 03:09:16 +00:00
nobu fe1ce93f52 * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
  vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
  tool/instruction.rb: fixed types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 20:58:26 +00:00
marcandre 6a54d4b6fe * vm_eval.c (rb_catch_obj, rb_catch, rb_f_catch): No longer use the obsolete function rb_iterate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-15 21:18:04 +00:00
ko1 d2d0d733c1 * vm_eval.c (eval_string_with_cref): fix to check local_table_size.
[ruby-dev:39205] [Bug #2024]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-01 10:58:31 +00:00
yugui ebabbc6cb9 Doxygen comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-29 13:39:44 +00:00
yugui 3c65e0262b * vm_eval.c (rb_call0): gets rid of checking method cache twice.
* method.h (rb_get_method_entry): added a prototype of the function.
  (rb_method_entry_without_cache): more friendly name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-29 11:42:53 +00:00
nobu fcf88c1b8d * method.h (rb_method_definition_t): split from rb_method_entry_t
to deal aliases.  [ruby-dev:39165]

* proc.c (struct METHOD): contains rb_method_entry_t copy.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-28 02:45:41 +00:00
nobu cd48eb8fd5 * vm.c (vm_backtrace_each, vm_backtrace_push),
vm_eval.c (print_backtrace), vm_dump.c (bugreport_backtrace):
  rb_backtrace_iter_func now takes VALUE as file and method names.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 01:38:32 +00:00
nobu 34f8c6becd * vm_eval.c: adjusted indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 00:38:07 +00:00
ko1 c330876d7c * method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
method management.  This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto.  and make some
  refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
  VM_CALL_SEND_BIT.  use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
  rb_define_notimplement_method_id().  nobody can use it
  because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 14:59:41 +00:00
akr 5aac65484e * vm_eval.c (rb_call0): refine exception message for hidden objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-15 16:52:00 +00:00
ko1 63bd8a74e8 * thread.c, vm_eval.c: add Thread.backtrace.
* test/ruby/test_thread.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-14 05:59:23 +00:00
nobu 4150c2c05d * vm_eval.c (rb_f_local_variables): now returns symbols. a patch from
Run Paint Run Run at [ruby-core:23828].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-12 22:08:46 +00:00
nobu 6e678a2d9f * vm_eval.c (rb_f_catch): updated rdoc about generalized argument,
and the case without arguments.  [ruby-core:23827]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-12 22:06:59 +00:00
nobu 6d781384c5 * vm_eval.c (rb_f_throw): fixed rdoc about execption.
[ruby-core:23824]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-12 21:45:52 +00:00
nobu 060f433f48 * include/ruby/ruby.h (rb_long2int, RARRAY_LENINT): check long to
cast to int.  [ruby-dev:38508]

* struct.c, vm_eval.c, vm_insnhelper.c: use RARRAY_LENINT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 16:43:41 +00:00
nobu 53812198da * vm_eval.c, vm_insnhelper.c: argument number is restricted to
int, and fixed overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 09:58:29 +00:00
nobu 8864383839 * vm_eval.c (rb_f_catch): gets rid of issue with gcc 4.4. a patch
from Alexey Froloff in [ruby-core:23398].  [ruby-core:22924]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09 02:14:52 +00:00
nobu c11f63669a * vm_eval.c (eval_string_with_cref): replaces the message if
frozen.  [ruby-dev:38208]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-30 03:12:48 +00:00
nobu bc34d16363 * vm_eval.c (rb_throw_obj): inverted call flow. [ruby-core:22872]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 09:10:07 +00:00
akr 3888bfecf2 * vm_eval.c (rb_iterate): use volatile to suppress warnings.
* eval.c (ruby_cleanup): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 12:56:10 +00:00
akr cfe9dcb886 * eval_error.c (error_print): use volatile to suppress warnings.
* vm_eval.c (eval_string_with_cref): ditto.

* thread.c (rb_exec_recursive): ditto.

* eval_jump.c (rb_exec_end_proc): ditto.

* eval.c (ruby_exec_node): ditto.
  (rb_longjmp): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 11:12:36 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu 19bbab6140 * vm_eval.c (method_missing): should not pop cfp if missing method
is method_missing.  [ruby-core:22298]

* vm_eval.c (rb_raise_method_missing): new function to directly
  raise NoMethodError.

* vm_insnhelper.c (vm_call_method): fixed the case method_missing
  is missing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 01:43:59 +00:00
ko1 0cb68b619e * vm_eval.c (eval_string_with_cref): use rb_vm_get_ruby_level_next_cfp()
instead of vm_get_ruby_level_caller_cfp().  checking a upper frame
  is not enough.  [ruby-dev:37984]
* proc.c, vm_core.h: declare rb_vm_get_ruby_level_next_cfp()
  on vm_core.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 06:25:59 +00:00
nobu a7b5c603b4 * vm.c (vm_backtrace_each): now takes an iterator function.
* vm_core.h (rb_make_backtrace, rb_backtrace_each): added
  prototypes.

* vm_dump.c (rb_vm_bugreport), vm_eval.c (rb_backtrace): gets rid
  of allocating objects.

* vm_eval.c (rb_backtrace_each): new function which iterates over
  each backtrace info.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-01 22:36:15 +00:00
ko1 9b520ddcec * vm_eval.c, eval.c (rb_f_block_given_p): move definition of
"iterator?" and "block_given?" to make static.
* vm.c (vm_get_ruby_level_caller_cfp): make it static.
* eval_intern.h, vm_insnhelper.c: move decl. of
  vm_get_ruby_level_caller_cfp()
  from eval_intern.h to vm_insnhelper.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 03:03:09 +00:00
ko1 cf23d0f0f0 * vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
  vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
  vm_get_sourceline(), vm_cref(), vm_localjump_error(),
  vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
  This changes may affect only core because most of renamed functions
  require a pointer of not-exposed struct such as rb_thread_t or NODE.
  In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
  vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 02:38:11 +00:00
ko1 c4c3f238d7 * iseq.c:
rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn().
  rename ruby_iseq_disasm() -> rb_iseq_disasm().
* compile.c:
  rename ruby_iseq_compile() -> rb_iseq_compile_node().
  rename ruby_iseq_translate_threaded_code() ->
  rb_iseq_translate_threaded_code().
  rename ruby_insns_name_array() -> rb_insns_name_array().
  rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary().
* iseq.c, compile.c: remove ruby_insn_make_insn_table() and make
  static function insn_make_insn_table().
* iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c,
  blockinlining.c: ditto.
  Rename strange "ruby_" prefix to "rb_" prefix.
  This changes may affect only core because renamed functions
  require a pointer of rb_iseq_t which is not exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 01:06:56 +00:00
ko1 4316e4d99b * eval.c, vm_eval.c (rb_f_local_variables): move definition from eval.c
to vm_eval.c because vm_collect_local_variables_in_heap() should
  be static function.
* vm.c (vm_collect_local_variables_in_heap): make it static.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 00:13:44 +00:00
matz 10af217ff3 * vm_eval.c (rb_f_loop): return enumerator if no block given.
[ruby-list:45747]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 09:28:26 +00:00
ko1 b30b998966 * vm_insnhelper.c (vm_call_method, vm_call_cfunc): use original id instead of
calling id when NODE_CFUNC or NODE_BMETHOD.
  fixes Bug #632 [ruby-core:19282].
* vm_eval.c (vm_call0, vm_call_super): ditto.
* vm_method.c (rb_add_method, rb_alias): store original id
  in nd_file field of NODE_METHOD.
* test/stringio/test_stringio.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 03:57:21 +00:00
ko1 f0da2e1657 * vm_insnhelper.c (vm_call_method): use class of method defined
instead of receiver's class on bmethod.  fixes [ruby-core:20786]
* bootstraptest/test_method.rb: add a test for above.
* vm_insnhelper.c (vm_setup_method): remove unused parameter klass.
* vm_insnhelper.h (CALL_METHOD): ditto.
* insns.def, vm_eval.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 11:47:00 +00:00
nobu f6147010c7 * vm_eval.c (vm_call0): NODE_ZSUPER supported. [ruby-core:20480]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 05:39:39 +00:00
nobu d5b7e69032 * vm_eval.c (vm_call_super): uses method_missing().
* vm_eval.c (method_missing): get rid of too large alloca.

* vm_eval.c (rb_call0, method_missing): uses idMethodMissing.

* vm_method.c (rb_add_method, remove_method, rb_undef): uses
  id__send__.

* vm_method.c (Init_eval_method): removed IDs which are defined as
  immediate values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 05:15:26 +00:00
nobu 541915b239 * compile.c (iseq_compile_each), gc.c (assign_heap_slot),
(gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add),
  proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all),
  (thread_start_func_2, blocking_region_begin, blocking_region_end),
  (rb_thread_kill), thread_pthread.c (native_thread_create),
  (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c
  (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state),
  (vm_call0): use void pointer for %p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:33:55 +00:00
akr 4efc3f78b0 * vm_eval.c (Init_vm_eval): define module_eval, class_eval and eval
here for rdoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 18:04:34 +00:00
ko1 8cd252ac6f * common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
  - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
  - make VM_CORE_H_INCLUDES variable (vm_core.h)
  - simplify rules.
  - make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
  remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
  - rename vm_eval() to vm_exec_core().
  - rename vm_eval_body() to vm_exec().
  - cleanup include order.
* vm_method.c: fix comment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 00:20:28 +00:00
nobu bcf9324e68 * vm_eval.c (vm_call_super): fixed typo, and get rid of too large
alloca.  [ruby-core:17922]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 08:37:48 +00:00
mame 5874de95e8 * Add coverage measurement constant COVERAGE__. This constant is not
for casual use.  Usage: (1) assign {} to COVERAGE__, (2) require or
  load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will
  return an array whose elements represent number of executions per
  line of source code.

* vm_core.h: add field of coverage array to iseq.

* iseq.c (prepare_iseq_build): ditto.

* insns.def (trace): update coverage array.

* parse.y (coverage): create and initialize coverage array.

* compile.h (ADD_TRACE): add trace instruction to update covearge
  array.

* thread.c (clear_coverage): delete coverage array when forking.
  Otherwise, double count of coverage may occur.

* lib/coverage.rb: sample coverage measurement tool.

* error.c: distinguish explicitly between parse_in_eval and
  mild_compile_error.

* load.c: ditto.

* vm_eval.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 16:55:30 +00:00
ko1 d4cddaaa4c * vm_eval.c (vm_call_super): fix to call method_missing.
[ruby-core:15719], [ruby-core:17340]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-26 21:52:44 +00:00
mame f32f40cc49 * vm_eval.c (eval_string_with_cref): preserve parse_in_eval even if
exception raised.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-24 13:16:44 +00:00
ko1 9e324fdd3e * vm.c, eval_intern.h (PASS_PASSED_BLOCK):
set a VM_FRAME_FLAG_PASSED flag to skip this frame when
  searching ruby-level-cfp.
* eval.c, eval_intern.h, proc.c: fix to check cfp.  if there is
  no valid ruby-level-cfp, cause RuntimeError exception.
  [ruby-dev:34128]
* vm_core.h, vm_evalbody.c, vm.c, vm_dump.c, vm_insnhelper.c,
  insns.def: rename FRAME_MAGIC_* to VM_FRAME_MAGIC_*.
* KNOWNBUGS.rb, bootstraptest/test*.rb: move solved bugs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 21:46:43 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
nobu 74ae098a5d * vm_eval.c: set properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-25 01:12:12 +00:00
ko1 ed68367f9e * vm_eval.c: added. Some codes are moved from "eval.c"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 18:25:26 +00:00