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

372 Коммитов

Автор SHA1 Сообщение Дата
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 e3cc834486 * vm_insnhelper.c (vm_check_if_namespace): guard temporary object
from GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-19 13:41:19 +00:00
mame 5b74e4f09e * vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
private constant has been prohibited incorrectly.

* test/ruby/test_module.rb (test_toplevel_private_constant): add a
  test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-29 02:01:19 +00:00
mame f0483c494f * constant.h, variable.c: to ensure compatibility, rb_const_get_* must
not raise an exception even when the constant is private.  Instead,
  rb_public_const_get_* and rb_public_const_defined_* are introduced,
  which raise an exception when the referring constant is private.
  see [ruby-core:32912].

* vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead
  of rb_const_get_* to follow the constant visibility when user code
  refers a constant.

* test/ruby/test_marshal.rb (test_marshal_private_class): add a test.
  This test had failed because of incompatibility of rb_const_get.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28 17:57:27 +00:00
akr def8c8c347 * vm_insnhelper.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 11:49:54 +00:00
nobu f4db8aedc8 * compile.c (setup_args), vm.c (invoke_block_from_c),
vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243
  except for the test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 21:10:24 +00:00
nobu cd3f980ea2 * compile.c (setup_args), vm.c (invoke_block_from_c),
vm_insnhelper.c (caller_setup_args): fix of r30241. lambda block
  shoud check argument number.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-18 07:02:35 +00:00
nobu 202cb99c86 * iseq.c (set_relation), vm_insnhelper.c (vm_cref_push): nd_file
is always zero-cleared.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-15 22:51:51 +00:00
nobu b942e7891a * vm_insnhelper.c (vm_call_method): revert r30064 and r30071,
because of [ruby-core:26761]. Bug#4106 rejected.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03 23:25:19 +00:00
nobu 7b0b9df60e * vm_insnhelper.c (vm_call_method): protected methods should be
checked against the real class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03 13:36:49 +00:00
nobu adc978adc3 * vm_insnhelper.c (vm_call_method): protected singleton methods should
be visible from same real class methods.  [ruby-core:33506]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03 03:17:22 +00:00
mame 6cba0f0663 * vm_insnhelper.c (vm_throw): remove fear of undefined behavior :-)
Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-16 13:32:30 +00:00
mame a115768161 * class.c, constant.h, gc.c, method.h, object.c, variable.c,
vm_insnhelper.c: use struct rb_constant_entry_t as entry of
  RCLASS_CONST_TBL.  RCLASS_CONST_TBL has contained VALUE of constant
  directly.  Now instead rb_const_entry_t is contained in
  RCLASS_CONST_TBL,  rb_const_entry_t is managed by malloc, and
  have not only the value itself but also visibility flag.
  This is another preparation for private constant (see
  [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:32 +00:00
mame 2285a8d813 * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL.
  RCLASS_IV_TBL has contained not only instance variable table but
  also constant table.  Now the two table are separated to
  RCLASS_CONST_TBL and RCLASS_IV_TBL.  This is a preparation for
  private constant (see [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:21 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
ko1 559fd3e439 * insns.def, iseq.c, vm_insnhelper.c: rename variable name
(ip -> iseq).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-14 13:19:30 +00:00
nobu d410639a6d * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
  thread.c (rb_thread_local_aref),
  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
  ext/iconv/iconv.c (map_charset): use st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:47:23 +00:00
ko1 86a8b820d6 * insns.def (opt_case_dispatch), vm_insnhelper.c:
execute the procedures of "when" clauses by bytecode
  instead of st_foreach() when the object does not hit
  prepared hash.  [ruby-dev:42304]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-27 14:47:30 +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 d1a4b54218 * vm_insnhelper.c (vm_get_cref0): cref is stacked only in normal
iseqs, so check if it is the case first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-23 14:09:22 +00:00
nobu 9ccd4fe127 * vm_insnhelper.c (vm_cref_push): no outer cref is needed for proc
from method.  Bug #3786, Bug #3860, [ruby-core:32501]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-23 00:01:40 +00:00
nobu eba16d7444 * vm_insnhelper.c (vm_push_frame): initialize block_iseq. a patch
from Peter Weldon at [ruby-core:31757].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-18 21:03:32 +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 b18fcd6a7c * insns.def (invokesuper): check consistency between class of self and
class of method being invoked by super.  This is temporary measure
  for YARV.  See [ruby-core:30313] in detail.  See [ruby-dev:40959]
  [ruby-dev:39772] [ruby-core:27000] [ruby-core:27230]

* vm_insnhelper.c (vm_search_superclass): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 15:39:34 +00:00
nobu 483ef372b1 * vm_insnhelper.c (vm_invoke_block): iseq_t.type is VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 07:19:59 +00:00
mame 80f7f8d07e * compile.c (iseq_compile_each), vm_insnhelper.c (vm_invoke_block,
vm_throw): allow "return" and "yield" even in singleton class
  definition.  based on a patch from wanabe <s.wanabe AT gmail.com>
  for "return".  [ruby-core:21379] [ruby-dev:40975]

* insns.def (defineclass): ditto (straightforwardly push block ptr,
  instead of dfp ptr with special flag).

* vm_core.h (RUBY_VM_CLASS_SPECIAL_P): ditto (no longer needed).

* proc.c (proc_new): ditto (remove handling for special flag).

* bootstraptest/test_jump.rb: add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-09 18:21:39 +00:00
nobu 69a0084541 * vm_insnhelper.c (vm_call_bmethod): removed unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 16:22:33 +00:00
ko1 833cade2dc * vm_method.c (rb_unlink_method_entry, rb_sweep_method_entry):
added.  Unlinked method entries are collected to
  vm->unlinked_method_entry_list.  On the GC timing, mark all method
  entries which are on all living threads.  Only non-marked method
  entries are collected.  This hack prevents releasing living method
  entry.
  [Performance Consideration] Since this Method Entry GC (MEGC)
  doesn't occuer frequently, MEGC will not be a performance bottleneck.
  However, to traverse living method entries, every control frame push
  needs to clear cfp->me field.  This will be a performance issue
  (because pushing control frame is occurred frequently).
  Bug #2777 [ruby-dev:40457]
* cont.c (fiber_init): init cfp->me.
* gc.c (garbage_collect): kick rb_sweep_method_entry().
* method.h (rb_method_entry_t): add a mark field.
* vm.c (invoke_block_from_c): set passed me.
* vm.c (rb_thread_mark): mark cfp->me.
* vm_core.h (rb_thread_t): add a field passed_me.
* vm_core.h (rb_vm_t): add a field unlinked_method_entry_list.
* vm_insnhelper.c (vm_push_frame): clear cfp->me at all times.
* vm_insnhelper.c (vm_call_bmethod): pass me.
* bootstraptest/test_method.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-05 17:51:21 +00:00
nobu 89435793bc * vm_insnhelper.c (argument_error): removed unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 04:27:19 +00:00
nobu 843d4f328a * vm_insnhelper.c (argument_error): never return.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 04:00:20 +00:00
ko1 8ed1f43392 * vm_insnhelper.c (argument_error): push correct backtrace.
Bug #2281 [ruby-core:26333]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 03:50:39 +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
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 3a9ce187de * vm_insnhelper.c (vm_throw): fixed infinite loop. [ruby-core:27969]
(re-commit of r26522 since forgot to add a change, sorry)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 12:41:47 +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
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 9e68d0dc03 * insns.def (opt_case_dispatch): runtime value cannot be used as
an element initializer.

* vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning
  calls.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 07:26:26 +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
nobu 52ebc24487 * vm_insnhelper.c (vm_push_frame): get rid of out-of-bounds
access.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-07 11:59:16 +00:00
matz ddc4143af0 * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521.
[ruby-core:26427] [ruby-core:26447]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-07 03:51:39 +00:00
matz 1e2dcdbd19 * vm_insnhelper.c (vm_push_frame): add CHECK_STACK_OVERFLOW.
[ruby-dev:39592]

* eval.c (rb_longjmp): add 1 level backtrace for sysstack_error
  without calling any method to prevent further stack overflow.

* eval.c (make_exception): don't call #exception for
  sysstack_error to prevent stack overflow.

* proc.c (Init_Proc): don't freeze sysstack_error.

* eval.c (rb_longjmp): move reentrant check after exception
  preparation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-07 02:45:08 +00:00
matz 2e868a3442 * vm_insnhelper.c (vm_setup_method): should push call frame before
raising exception, to put the Ruby-defined method name in the
  error message.  [ruby-core:26333]

* vm_insnhelper.c (VM_CALLEE_SETUP_ARG): macro modified.

* vm_insnhelper.c (vm_yield_setup_args): modified for new
  VM_CALLEE_SETUP_ARG macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:20:35 +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
ko1 6f817b6dd2 * vm_core.h: change members of iseq_inline_cache_entry.
make cache value members to one union member "ic_value".
* insns.def: ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 17:16:27 +00:00
ko1 3463db3068 * vm_insnhelper.c: rename macro name ENABLE_IC_FOR_IVAR
to USE_IC_FOR_IVAR.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 20:08:00 +00:00
ko1 bd8da69e9b * insns.def (setinstancevariable), vm_insnhelper.c (vm_setivar):
fix to use inline cache (trivial optimization).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 07:40:24 +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
wanabe 38a22404db * vm_insnhelper.c (vm_call_cfunc): ensure hook c-return.
[Bug #1588]

* test/ruby/test_settracefunc.rb (TestSetTraceFunc#test_raise):
  follow above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-18 02:44:10 +00:00
ko1 a174dbcd4f * vm_insnhelper.c (opt_eq_func): fix optimization bug. This issue
was found out and debugged with Takuto Hayashi at Security and
  Programming camp 2009.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-15 18:18:07 +00:00
nobu 72072e6343 * insns.def (opt_case_dispatch): suppressed a warning.
* vm_insnhelper.c (opt_case_dispatch_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-13 07:31:23 +00:00
ko1 8e8e34319b * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
definition of (classes)#=== for case/when optimization.
  Fix Bug #1376 [ruby-core:23190].
* string.c (Init_String), bignum.c (Init_Bignum),
  numeric.c (Init_Numeric): define String#===, Symbol#===,
  Bignum#===, Fixnum#===, Float#=== as same as (classes)#==.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 05:55:06 +00:00
nari de5f15bbe4 * gc.c: reject unused longlife gc.
* debug.c: ditto.

* include/ruby/intern.h: ditto.

* include/ruby/ruby.h: ditto.

* iseq.c: ditto.

* node.h: ditto.

* vm_insnhelper.c: ditto.

* vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-10 02:40:34 +00:00
mame 447df19520 * vm_insnhelper.c (vm_call_cfunc): let set_trace_func use called_id
instead of original_id.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 15:34:56 +00:00
ko1 07de51fc4f * vm_core.h, vm_insnhelper.c (vm_call_method): revive
VM_CALL_OPT_SEND_BIT and use it to recognize "send" method.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-28 18:38:59 +00:00
nobu 00d61f1fe5 * vm_insnhelper.c (vm_call_method): __send__ can call protected
methods.  [ruby-core:24500]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-26 09:30:08 +00:00
nobu 34df0e5c9f * vm_insnhelper.c (vm_call_method): fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-26 09:27:45 +00:00
shyouhei 506a9821ce * method.h : Commas at end of enum list not allowed as of C89
* vm_method.c (rb_add_method): avoid C++ comment

	* vm_insnhelper.c (vm_call_cfunc): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 13:27:26 +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
ko1 20d9aefccb * vm_core.h, compile.c: declare struct iseq_inline_cache_entry.
Inline cache (IC) entries are no longer GC managed object.
  IC entries are freed when ISeq is freed.
* iseq.c: fix mark, free, memsize functions for above change.
* insns.def: remove rb_gc_write_barrier().
* vm_insnhelper.c (vm_method_search): ditto.
* tool/instruction.rb, template/insns_info.inc.tmpl (insn_iclen):
  added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 09:30:23 +00:00
ko1 0ac93a1a40 * insns.def, vm_insnhelper.c (getinstancevariable):
fix to use inline cache.
* compile.c: fix to skip inline cache entry (IC).  IC is added
  automatically by compiler.
* insns.def, vm_insnhelper.h: fix IC positions.
* iseq.c: increment minor_version of ISeq because of above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 04:44:20 +00:00
nobu bee49b3494 * vm_insnhelper.c (vm_search_superclass): checks for implicit
argument passing before method search.  [ruby-core:24244]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 01:25:26 +00:00
nobu 918fefb7f7 * vm_insnhelper.c (vm_yield_setup_block_args): restores the first
arg where is overwritten at funcall.  [ruby-core:24139]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-04 23:08:32 +00:00
nobu 516487dee0 * vm_insnhelper.c (vm_setup_method): fixed format spec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 00:54:31 +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
nari 832d5a8329 * iseq.c (rb_iseq_clone): use longlife object and insert write barrier.
* vm_insnhelper.c (vm_cref_push): ditto.

* vm_insnhelper.h (COPY_CREF): insert write barrier.
			


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-16 08:27:36 +00:00
nari 57b83a5191 * gc.c: add longlife garbage collection. [ruby-dev:38423]
(NORMAL_HEAPS_USED): new macro.
  (LONGLIFE_ALLOCATE_HEAPS_MIN): ditto.
  (add_longlife_heaps_slot): new function.
  (rb_newobj_from_longlife_heap): ditto.
  (rb_newobj_longlife): ditto.
  (rb_node_newnode_longlife): ditto.
  (rb_gc_write_barrier): ditto.
  (remembered_set_recycle): ditto.
  (rb_gc_mark_remembered_set): ditto.
  (clear_mark_longlife_heaps): ditto.
  (gc_sweep_for_longlife): ditto.
  (assign_heap_slot): new argumnent to longlife heaps slot.
  (add_freelist): ditto.
  (gc_sweep): avoid lonlife heap slot. set longlife_collection
   flag at add heap.
  (rb_gc_force_recycle): avoid mark object and remembered_set
   object.
  (garbage_collect): add longlife collection.
  (rb_gc_start): invoke longlife collection.
  (gc_profile_record_get): for longlife collction profile.
  (gc_profile_result): ditto.

* include/ruby/intern.h (rb_gc_write_barrier): declared.

* include/ruby/ruby.h (FL_REMEMBERED_SET): renamed from FL_RESERVED.

* debug.c (FL_REMEMBERED_SET): ditto.

* insns.def (setinlinecache): insert write barrier.

* vm_insnhelper.c (vm_method_search): ditto.

* set_relation (set_relation): use longlife object.

* vm.c (vm_define_method): ditto.

* vm_core.h (NEW_INLINE_CACHE_ENTRY): ditto.

* vm_method.c (rb_add_method): ditto.

* class.c (rb_add_method): ditto.

* node.h (NEW_NODE_LONGLIFE): new macro.
  (rb_node_newnode_longlife): declared.
					    


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-13 14:08:26 +00:00
nobu 1c6ca1eec5 * vm.c (rb_vm_get_sourceline), vm_insnhelper.c (vm_throw): use
rb_num_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:02:06 +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
nobu 132d0624ec * variable.c (rb_const_get_0), vm_insnhelper.c (vm_get_ev_const):
avoids infinite self recursion autoload.  [ruby-core:21696]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-31 20:19:44 +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 1f8620ca22 * vm_insnhelper.c (vm_yield_with_cfunc): rename parameter name
"blockptr" to "blockargptr".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 06:26:48 +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 1f2d804e5e * vm_insnhelper.c (vm_method_search): fix control flow bug.
(commited at r20981)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 05:41:47 +00:00
ko1 a71fb38d47 * vm_insnhelper.c (vm_method_search): return rb_cObject if there is no
super class.  [ruby-dev:37587]
* bootstraptest/test_method.rb: add tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 04:19:33 +00:00
ko1 f6e435fe87 * vm_insnhelper.c (vm_yield_with_cfunc): check block has Proc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 03:49:09 +00:00
ko1 f23e8d87c0 * vm.c (invoke_block_from_c): fix to point right cfp.
* vm.c (vm_make_proc, vm_make_proc_from_block), vm_core.h:
  remove unused parameter cfp.
* vm_insnhelper.c, proc.c (proc_new): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 12:56:58 +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 8c8d666467 * vm_insnhelper.c (vm_callee_setup_arg_complex): uses cfp from
blockptr instead of the current cfp.  [ruby-core:20544]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 07:26:48 +00:00
nobu 47c2b02f2b * vm_insnhelper.c (check_cfunc): use function pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:23:20 +00:00
mame e1a2fec2bb * README.EXT, README.EXT.ja, vm_exec.c, vm_insnhelper.c: update
filenames.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-14 11:31:10 +00:00
yugui a1645803bb * vm_insnhelper.c (vm_yield_setup_args): supports optional parameters.
Fixed [ruby-core:19503].

* vm_insnhelper.c (vm_yield_setup_block_args): a new function. extracted
  from vm_yield_setup_args.

* vm_insnhelper.c (vm_yield_setup_block_args_complex): ditto.

* test/ruby/test_proc.rb: added tests for arguments on a Proc from
  Kernel#proc called.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-27 13:35:46 +00:00
nobu 5c0515f2e2 * vm_insnhelper.c (vm_yield_setup_args): should not drop arguments
corresponding to default paramters.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 07:28:00 +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
usa 03e778757b * vm_insnhelper.c (vm_method_missing): C99.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 10:28:48 +00:00
mame 095ae8fd84 * vm_insnhelper.c (vm_method_missing): copy arguments to allocated
memory from machine stack.  [ruby-dev:36064]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-02 15:23:49 +00:00
ko1 100d0a568e * vm_insnhelper.c (vm_call_method): copy arguments to allocated
memory from machine stack.  [ruby-dev:36028]
* KNOWNBUGS.rb, bootstraptest/test_method.rb: move fixed test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 08:24:51 +00:00
matz f7f0784270 * vm_insnhelper.c (vm_yield_setup_args): object with to_ary should
behave like array.  a patch from Yusuke Endoh  <mame at tsg.ne.jp>
  in [ruby-dev:35988].  [ruby-dev:35977]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-28 11:29:57 +00:00
nobu 9286180079 * proc.c (proc_new): use the given class.
* vm.c (vm_make_proc): added an argument for the class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 13:28:18 +00:00
matz e0889dbf38 * vm_insnhelper.c (caller_setup_args): should ensure if the value
from to_proc is a real Proc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 08:32:53 +00:00
ko1 596eecd76d * vm.c, vm_insnhelper.c (vm_define_method): move
function place.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 09:59:06 +00:00
nobu 6a852b7c2b * vm_insnhelper.c (opt_eq_func): large function to make inline.
* bcc32/Makefile.sub (config.h): cannot compile a big inline function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-08 13:47:48 +00:00
ko1 c3e619c83d * vm_insnhelper.c (vm_throw): fix "return" process from "lambda".
* bootstraptest/test_proc.rb: add a test.
* bootstraptest/pending.rb: add a pending bug.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 02:46:02 +00:00
ko1 00e4fd42f3 * vm.c, vm_insnhelper.c: fix escape process with "braek" and "return"
syntax in "lambda".  [ ruby-Bugs-19304 ], [ruby-core:17164]
* KNOWNBUGS.rb, bootstraptest/test_proc.rb: add/move solved test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-17 19:27:24 +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
ko1 ed4139e39b * include/ruby/intern.h, proc.c: revert rb_proc_call() and
create rb_proc_call_with_block() instaed.
* include/ruby/ruby.h, eval_jump.c, thread.c, vm_insnhelper.c:
  rb_blockptr should not be exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:33:51 +00:00
mame f2400eca0b * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.
* vm_insnhelper.c (vm_yield_with_cfunc): vm_yield_with_cfunc receives
  blockptr and passes it to iterating block.

* proc.c (rb_proc_call), include/ruby/intern.h: rb_proc_call receives
  blockptr.  "rb_proc_call(self, args, blockptr)" in C corresponds to
  "self.call(*args, &block)" in Ruby.

* proc.c (proc_call): pass blockptr to block that is written in C.

* proc.c (curry): receive blockptr and pass it to original proc.
  [ruby-core:15551]

* vm.c (invoke_block_from_c): fix for change of vm_yield_with_cfunc.

* thread.c (call_trace_proc), eval_jump.c (rb_call_end_proc): fix for
  change of rb_proc_call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 15:52:51 +00:00
wanabe ddf83922a2 * vm_insnhelper.c, vm.c, proc.c : revert r17021. [ruby-dev:34997]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 23:16:46 +00:00
wanabe a5fdfa5884 * vm_insnhelper.c, vm.c, proc.c (proc_call): allow call method with
block that both is written in C. [ruby-dev:34273] [ruby-core:15551]

*  proc.c (curry): use proc_call instead of rb_proc_call.
  [ruby-dev:34273] [ruby-core:15551]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 13:24:13 +00:00
wanabe 9393cc45c2 * vm_insnhelper.c (vm_throw): regard break as return in lambda.
[ruby-dev:34646]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 11:18:54 +00:00
ko1 bf4626ed72 * vm_insnhelper.c (vm_callee_setup_arg): check simple flag before
calling setup_arg function().  this change reduce function call.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-06 14:48:07 +00:00
ko1 59c061235f * eval_method.c: renamed from vm_method.c. "vm_method.c" is included
by "vm.c".
* vm_eval.c: added.  Some codes are moved from "eval.c"
* common.mk: fix for above changes.
* compile.c: make a vm_eval(0)
* eval.c, eval_error.c, eval_intern.h, eval_jump.c, proc.c, vm.c,
  id.c, id.h, vm_core.h, vm_dump.c, vm_evalbody.c, vm_insnhelper.c,
  blockinlining.c: fix for above changes.  and do some refactoring.
  this changes improve rb_yield() performance.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 17:50:17 +00:00
mame 956dead480 * compile.c (iseq_set_exception_table, NODE_WHILE, NODE_NEXT): remove
special handling that decrements sp in CATCH_TYPE_NEXT for NODE_WHILE.

* vm.c (vm_eval_body), vm_insnhelper.c (vm_throw): remove unused code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 06:29:48 +00:00
ko1 a45cd8a01c * eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c, vm_core.h, vm_insnhelper.c: remove pointless "const".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 16:19:14 +00:00
ko1 559d021d20 * eval.c, vm.c, vm_core.h, vm_insnhelper.c: specify "const".
* vm_opts.h: add a OPT_TOKEN_THREADED_CODE macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 04:28:13 +00:00
ko1 4c094940aa * insns.def, vm_insnhelper.c: specify "const".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 15:18:15 +00:00
ko1 d457fdad2d * eval.c, vm_insnhelper.c: fix cref in instance_eval
and cvar_base search protocol.
* bootstraptest/test_knownbug.rb, test_eval.rb: move soleved test
  and add new tests.
* test/ruby/test_eval.rb: fix tests for spec.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 18:47:56 +00:00
ko1 385f0e8af6 * vm.c, insns.def, eval.c, vm_insnhelper.c: fix CREF handling.
VM value stack frame of block contains cref information.
  (dfp[-1] points CREF)
* compile.c, eval_intern.h, eval_method.c, load.c, proc.c,
  vm_dump.h, vm_core.h: ditto.
* include/ruby/ruby.h, gc.c: remove T_VALUES because of above
  changes.
* bootstraptest/test_eval.rb, test_knownbug.rb: move solved test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 03:08:50 +00:00
matz a823fc5d8b * compile.c (compile_cpath): use Qundef to denote cbase lookup.
* insns.def (defineclass): Qudef is passed for cbase.

* insns.def (setconstant): ditto.

* vm_insnhelper.c (vm_check_if_namespace): use rb_inspect()
  instead of rb_obj_as_string() for better description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 02:27:29 +00:00
nobu a0f487921e * vm_insnhelper.c (vm_get_ev_const): search from the base klass if it
is given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 03:03:51 +00:00
nobu ccf20a6d3f * insns.def (defineclass): check if cbase is a class or a module.
[ruby-core:16118]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-03 10:59:44 +00:00
nobu b6dff84acc * vm_insnhelper.c: math.h for isnan.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 17:06:51 +00:00
nobu 08c319ee2a * vm_insnhelper.c (vm_call_method): check argument number to
attr_reader.  [ruby-core:15120]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 16:48:18 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 730374e56e * vm_insnhelper.c (vm_callee_setup_arg): it is not inlinable because
alloca is used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 12:49:01 +00:00
ko1 c334a09f7a * common.mk, *.ci: renamed to *.c.
* eval_laod.c: renamed to load.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 09:29:46 +00:00