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

63 Коммитов

Автор SHA1 Сообщение Дата
nobu fbe5ce6ca7 * eval_intern.h (rb_vm_get_sourceline): add prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-11 00:57:09 +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
ko1 b4d7d616d9 * method.h, vm_method.c: rename some internal functions related to
rb_method_entry_t.
  rb_add_method_me()        -> rb_method_entry_set().
  rb_get_method_entry()     -> rb_method_entry_without_cache().
  rb_gc_mark_method_entry() -> rb_mark_method_entry().
* class.c, proc.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 20:25:09 +00:00
mame 3728ec6ea3 * vm_method.c (rb_add_method_def): decrement alias count of
rb_method_definition_t to prevent memory leak.  see
  [ruby-dev:41021].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 15:15:44 +00:00
naruse 61e5cf84ff * vm_method.c (rb_add_method_def): workarond fix for redefinition
of methods. This is because cfp->me uses the rb_method_entry
  which is freed by redefinition of remove_method. Note that
  reusing may cause another problem when the usage is changed.
  [ruby-core:27320] [ruby-core:29464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 17:59:56 +00:00
wanabe 7d73136d06 * vm_method.c (rb_add_method): clear attr.location before rb_ary_new3.
a patch from Masaya TARUI in [Bug #3108]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-09 22:38:46 +00:00
nobu e3888976d0 * vm_method.c (rb_add_method): prototype of rb_vm_get_sourceline.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-24 06:08:47 +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
shyouhei 0d3de66006 * common.mk (compile.$(OBJEXT)): dependencies lacking.
* vm_method.c (rb_add_method_cfunc): invalid initializer for C89

	* compile.c (iseq_insns_unification): int might be smaller than int*


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-20 07:12:16 +00:00
mame 479a3c4c8b * vm_method.c (rb_alias): skip ZSUPER method when searching body of
source method.  [ruby-dev:39760]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-08 14:10:58 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
shugo 63c3b2d283 * vm_method.c (rb_undef): should raise TypeError if klass is nil.
1.instance_eval { undef to_s } causes SEGV before this fix.
* test/ruby/test_undef.rb: new tests for undef.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 01:13:54 +00:00
shugo 86d46b5459 * vm_method.c (rb_alias): should raise TypeError if klass is nil.
1.instance_eval { alias to_string to_s } causes SEGV before this
  fix.
* test/ruby/test_alias.rb (test_special_const_alias): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 14:53:32 +00:00
matz eccb700286 * vm_method.c (basic_obj_respond_to): call #respond_to_missing?
always with two arguments.  [ruby-core:26090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-17 05:34:51 +00:00
matz 4631523baf * vm_method.c (rb_method_boundp): should exclude NOEX_RESPONDS.
based on the patch from Nikolai Lugovoi.  [ruby-core:25949]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-09 14:52:02 +00:00
matz e3fc29a71b * vm_method.c (basic_obj_respond_to): should not call
#respond_to_missing? for not implemented methods.
  [ruby-core:25909]

* vm_method.c (rb_method_boundp): returns exceptional value 2 for
  not-implemented methods when called from #respond_to? (specifies
  by new contant NOEX_RESPONDS).

* method.h (enum): new constant NOEX_RESPONDS added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-04 17:05:59 +00:00
nobu 9603cd2f62 * vm_method.c (rb_add_method_def): no redefinition warning on
undef.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 12:19:19 +00:00
nobu a71d47a380 * vm_method.c (rb_add_method_def): show the location where
overwritten method was defined.  [ruby-dev:39400]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-30 04:15:46 +00:00
nobu 16969412b3 * vm_method.c (rb_method_definition_eq): non-null definition is
not equal to null definition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 04:49:00 +00:00
nobu 1fe57a4b5d * vm_method.c (rb_add_method_def): nothing to do if old method had
same definition.  [ruby-dev:39397]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 04:37:52 +00:00
nobu 5e4d04c36e * vm_method.c (rb_method_entry_eq): fixed a message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 04:33:17 +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 6bf6f3d4c4 * vm_method.c (rb_method_entry_eq): suppressed a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 00:17:48 +00:00
matz 3ca245a54c * vm_method.c (rb_method_entry_eq): method defined from same
block/proc should be equal.  [ruby-core:25755] [ruby-core:24791]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 14:59:09 +00:00
nobu 8be423f51d * vm_method.c (check_definition): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 03:36:26 +00:00
nobu 44f7a34031 * vm_method.c (obj_respond_to_missing): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 03:33:26 +00:00
nobu 2c549ad5d3 * vm_method.c (rb_mod_method_defined): should return true or false.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 02:56:52 +00:00
nobu bc7123e434 * vm_method.c (rb_mod_method_defined): should return true or false.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 02:51:36 +00:00
matz 945f4df6a8 * vm_method.c (basic_obj_respond_to): new function to fundamental
behavior for #respond_to?

* vm_method.c (basic_obj_respond_to): calls #respond_to_missing
  method if overridden, to check responsiveness of methods
  implemented by #method_missing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 08:46:44 +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
nobu 63b231cea0 * vm_method.c (rb_add_method_def): no warning for inherited
method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 00:34:11 +00:00
nobu 97c3bad478 * vm_method.c (CALL_METHOD_HOOK): refined with macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 15:46:42 +00:00
nobu a5971a1282 * vm_method.c (remove_method): typo fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 15:31:43 +00:00
nobu 2fcdd7e080 * vm_method.c (rb_remove_method_id): no definition body is
undefined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 15:27:59 +00:00
nobu efa4ed8cce * vm_method.c (rb_alias): hooks are called from rb_add_method_def.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 15:21:03 +00:00
nobu d7feab06cc * vm_method.c (rb_add_method, rb_add_method_me): call method added
hook after definition.  [ruby-core:25536]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 15:03:02 +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 84255e0485 * vm_method.c (rb_remove_method_id): exported.
* numeric.c (num_sadded): fix for non-ascii method name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 09:31:11 +00:00
nobu efb9097352 * vm_method.c (rb_method_entry_eq): deals with optimized method
properly.  [ruby-core:24789]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 06:44:10 +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
nobu 33fc55acef * vm_method.c (me_opts): fixed optimized method aliasing.
[ruby-dev:38824]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 02:00:27 +00:00
ko1 b5dd85f049 * vm_method.c (rb_alias): fix a case which try non-existing method alias.
* test/ruby/test_alias.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 08:44:23 +00:00
ko1 d4628c0bcd * vm_method.c: separate clearing cache entry code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 23:59:15 +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
nobu fd4d1dde2f * vm_method.c (rb_add_method, remove_method, rb_undef): fixed
minor grammatical errors in warnings.  a patch from Run Paint
  Run Run at [ruby-core:24141].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-04 23:14:43 +00:00
nobu ba0ac946e9 * vm_method.c (Init_eval_method): registers notimplement_body as a
mark-object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-04 23:12:04 +00:00
matz 9553911f29 * vm_method.c (rb_attr): should preserve encoding info.
[ruby-dev:38498]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 15:07:45 +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
akr a69b87e80e update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 18:41:07 +00:00
akr 8e8ae2a9c5 * node.h (rb_notimplement_body_p): declared.
* vm_method.c (Init_eval_method): suppress a warning.

* io.c (rb_io_fsync): use rb_f_notimplement if not implemented.
  (rb_io_close_on_exec_p): ditto.
  (rb_io_set_close_on_exec): ditto.
  (rb_io_fcntl): ditto.
  (rb_f_syscall): ditto.

* dir.c (dir_tell): ditto.
  (dir_seek): ditto.
  (dir_s_chroot): ditto.

* process.c (proc_getpgrp): ditto.
  (proc_setpgrp): ditto.
  (proc_getpgid): ditto.
  (proc_setpgid): ditto.
  (proc_setsid): ditto.
  (proc_getpriority): ditto.
  (proc_setpriority): ditto.
  (proc_getrlimit): ditto.
  (proc_setrlimit): ditto.
  (p_sys_setuid): ditto.
  (p_sys_setruid): ditto.
  (p_sys_seteuid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresuid): ditto.
  (p_sys_setgid): ditto.
  (p_sys_setrgid): ditto.
  (p_sys_setegid): ditto.
  (p_sys_setregid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresgid): ditto.
  (p_sys_issetugid): ditto.
  (proc_getgroups): ditto.
  (proc_setgroups): ditto.
  (proc_initgroups): ditto.
  (proc_daemon): ditto.
  (rb_proc_times): ditto.

* file.c (rb_file_s_lchown): ditto.
  (rb_file_s_link): ditto.
  (rb_file_s_symlink): ditto.
  (rb_file_s_readlink): ditto.
  (rb_file_s_truncate): ditto.
  (rb_file_truncate): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16 16:58:06 +00:00