summaryrefslogtreecommitdiff
path: root/vm_method.c
AgeCommit message (Collapse)Author
2013-12-20* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko1
RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16* vm_method.c (rb_method_entry_make): fix WB miss.ko1
Note that rb_method_entry_t::klass is not constified. We may constify this field. * test/ruby/test_alias.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13proc.c, vm_method.c: fix super and aliasnobu
* proc.c (method_owner): return the class where alias is defined, not the class original method is defined. * vm_method.c (rb_method_entry_make, rb_alias): store the originally defined class in me. [Bug #7993] [Bug #7842] [Bug #9236] * vm_method.c (rb_method_entry_get_without_cache): cache included module but not iclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13vm.c: reduce clearing method cachenobu
* vm_method.c (rb_add_method, rb_alias): rb_method_entry_set() already clears method cache. * vm_method.c (rb_export_method): ditto by rb_add_method(). * vm_method.c (set_method_visibility): ditto by rb_export_method(). * vm.c (vm_define_method): ditto by rb_add_method(). * vm.c (m_core_undef_method): ditto by rb_add_method() in rb_undef(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09vm_method.c: add new ruby::method-cache-clear dtrace probetmm1
* vm_method.c (rb_clear_method_cache_by_class): fire ruby::method-cache-clear probe on global or klass-level method cache clear [Bug #9190] * probes.d (provider ruby): new dtrace probe * doc/dtrace_probes.rdoc: docs for new probe * test/dtrace/test_method_cache.rb: test for new probe git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09* internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a conveniencecharliesome
accessor for RCLASS_EXT(klass)->class_serial. * class.c, vm_insnhelper.c, vm_method.c: Use RCLASS_SERIAL git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09* compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,charliesome
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial to global_method_state and constant_serial to global_constant_state after discussion with ko1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09* class.c: unify names of vm state version counters to 'serial'.charliesome
This includes renaming 'vm_state_version_t' to 'rb_serial_t', 'method_state' to 'method_serial', 'seq' to 'class_serial', 'vmstat' to 'constant_serial', etc. * insns.def: ditto * internal.h: ditto * vm.c: ditto * vm_core.h: ditto * vm_insnhelper.c: ditto * vm_insnhelper.h: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-31* vm_method.c (rb_method_entry_make): fix to pass an ISeq value.ko1
OBJ_WRITTEN() accepts only VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: splitcharliesome
ruby_vm_global_state_version into two separate counters - one for the global method state and one for the global constant state. This means changes to constants do not affect method caches, and changes to methods do not affect constant caches. In particular, this means inclusions of modules containing constants no longer globally invalidate the method cache. * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c: rename rb_clear_cache_by_class to rb_clear_method_cache_by_class * class.c, include/ruby/intern.h, variable.c, vm_method.c: add rb_clear_constant_cache * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in rb_call_info_struct to method_state * vm_method.c: rename vmstat field in struct cache_entry to method_state git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17* vm_insnhelper.c (vm_call_method): set ci->me to 0 when theshugo
original method of a refined method is undef to avoid SEGV. * vm_method.c (rb_method_entry_without_refinements): return 0 when the original method of a refined method is undef to avoid SEGV. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11* vm_method.c (rb_gc_mark_unlinked_live_method_entries):ko1
revert last commit to introduce debug prints. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11revert r43259 because it is possible to mark miss classes defined in C-exts. ↵ko1
Thanks charliesome. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09object.c: avoid inadvertent symbol creationnobu
* object.c (id_for_attr): avoid inadvertent symbol creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09vm_method.c: preserve encodingnobu
* vm_method.c (rb_attr): preserve encoding of the attribute ID in error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07* proc.c: catch up last commit.ko1
Type of return value of rb_iseq_first_lineno() is now VALUE. * vm_insnhelper.c (argument_error): ditto. * vm_method.c (rb_method_entry_make): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07* iseq.c, internal.h: change to public (but internal) functionsko1
* VALUE rb_iseq_path(VALUE iseqval); * VALUE rb_iseq_absolute_path(VALUE iseqval); * VALUE rb_iseq_label(VALUE iseqval); * VALUE rb_iseq_base_label(VALUE iseqval); * VALUE rb_iseq_first_lineno(VALUE iseqval); And new (temporary) function: * VALUE rb_iseq_klass(VALUE iseqval); * iseq.c. vm_core.h (int rb_iseq_first_lineno): remove function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'. Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead. * proc.c. vm_insnhelper.c, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30* vm_method.c (rb_undef): raise a NameError if the original methodshugo
of a refined method is not defined. * vm_insnhelper.c (rb_method_entry_eq): added NULL check to avoid SEGV. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24* gc.c (free_method_cache_entry_i): unused functioncharliesome
* gc.c (rb_free_mc_table): ditto * internal.h (method_cache_entry_t): unused struct * vm_method.c (verify_method_cache): remove unused variable * vm_method.c (rb_method_entry): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24* class.c (class_alloc): remove mc_tblcharliesome
* gc.c (obj_free): ditto * internal.h (struct rb_classext_struct): ditto * method.h (rb_method_entry): remove ent param * vm_method.c: restore the global method cache. Per class cache tables turned out to be far too slow. [ruby-core:57289] [Bug #8930] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-10vm_method.c: constifynobu
* vm_method.c (rb_resolve_refined_method): constify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09vm_method.c: clear cache after refine methodnobu
* vm_method.c (rb_add_refined_method_entry): clear cache in the refined class since refining a method entry is modifying the class. [ruby-core:57079] [Bug #8880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04vm.c: prototypenobu
* vm.c (rb_next_class_sequence): use ANSI style definition and prorotype declaration, instead of old-K&R style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04* class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,charliesome
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature #8426] [GH-387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-31vm_method.c: [DOC] example of respond_to_missing?nobu
* vm_method.c (obj_respond_to_missing): [DOC] respond_to_missing? is used in the example of BasicObject. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18* variable.c, vm_method.c: remove dead code.ktsj
* test/ruby/test_fiber.rb, test/ruby/test_thread.rb: change accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* class.c (rb_include_class_new), eval.c (rb_using_refinement):ko1
make classes/modules (who share method table) shady. If module `a' and `b' shares method table m_tbl and new method with iseq is added, then write barrier is applied only `a' or `b'. To avoid this issue, shade such classes/modules. * vm_method.c (rb_method_entry_make): add write barriers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for secondko1
parameter `slot'. You don't need to write a cast (VALUE *) any more. * class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c, vm.c, vm_method.c: remove cast expressions for OBJ_WRITE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14* class.c, include/ruby/ruby.h: add write barriers for T_CLASS,ko1
T_MODULE, T_ICLASS. * constant.h: constify rb_const_entry_t::value and file to detect assignment. * variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy): added. update table with write barrier. * method.h: constify some variables to detect assignment. * object.c (init_copy): add WBs. * variable.c: ditto. * vm_method.c (rb_add_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06vm_method.c: change argument of set_visibilitynobu
* vm_method.c (set_visibility): use rb_method_flag_t as well as set_method_visibility() and rename argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06vm_method.c: top_private rdocnobu
* vm_method.c (top_private): copy rdoc from top_public. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31vm_method.c: extract set_visibilitynobu
* vm_method.c (set_visibility): extract from rb_mod_public(), rb_mod_protected() and rb_mod_private(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25no clearing method cachenobu
* variable.c (set_const_visibility): return without clearing method cache if no arguments. * vm_method.c (set_method_visibility): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25vm_method.c: quote method namenobu
* vm_method.c (set_method_visibility): quote unprintable method name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13vm_method.c: rb_method_entry_atnobu
* vm_method.c (rb_method_entry_at): return the method entry for id at klass, without ancestors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02id.def: predefined IDsnobu
* defs/id.def: add more predefined IDs used in core. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18vm_method.c: fix visibility on anonymous modulenobu
* vm_method.c (rb_mod_public_method): fix visibility on anonymous module. set visibility of singleton method, not method in base class. [ruby-core:54404] [Bug #8284] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24* vm_method.c (rb_sweep_method_entry): simplify code to unlink.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-13vm_method.c: overrid flag of prepending methodnobu
* vm_method.c (rb_export_method): directly override the flag of method defined in prepending class too, not adding zsuper entry. [ruby-core:53106] [Bug #8005] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24* object.c: Document methods receiving string and convert to symbolzzak
Patch by Stefan Rusterholz * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-14vm_method.c: fix method_removednobu
* vm_method.c: call method_removed hook on called class, not on prepending iclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-06vm_method.c: show respond_to locationnobu
* proc.c (rb_method_entry_location, rb_{mod,obj}_method_location): new functions to obtain source location of method definition. * vm_method.c (rb_obj_respond_to): show the location of old style respond_to? method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05vm_method.c: drop include_all flagnobu
* vm_method.c (rb_obj_respond_to): drop optional include_all flag if respond_to? method is defined in old style. [Bug #7722] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-16vm_method.c: suppress warningsnobu
* vm_method.c (call_cfunc_invoker_func): suppress wrong warnings "C4550: expression evaluates to a function which is missing an argument list." by VC6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-07* vm_method.c (Init_eval_method): main.public and main.privateshugo
should be private. * proc.c (Init_Proc): main.define_method should be private. * test/ruby/test_module.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-30vm_method.c: idRespond_to_missingnobu
* vm_method.c (respond_to_missing): use idRespond_to_missing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22internal.h: quote unprintablenobu
* internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and IDs. [Bug #7574] [ruby-dev:46749] * string.c (rb_str_quote_unprintable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-17* method.h: remove `VM_METHOD_TYPE_CFUNC_FRAMELESS' method type.ko1
This method type is for optimized CFUNC such as Fixnum#+ and so on. This feature is half-baked and no way to use them. [Background] Now, VM has opt_plus instructions to optimize `+' methods for some Classes (such as Fixnum, Float (flonum)). We call this type of instructions as `specialized instructions'. This simple technique improve simple program dramatically. However, we can make specialized instructions for only several types (classes) and selectors (method names) because a large instruction will be slow. In other words, this technique has no extensibility. To overcome this problem, VM_METHOD_TYPE_CFUNC_FRAMELESS was introduced (r37198). This type is a variant of CFUNC, but called their functiions directly without building a method frame. Any CFUNC method can be defined as frameless methods if a method is not needed to make method frame. Frameless methods are faster as specialized instructions (a bit slower, but no need to care). No problem described at http://charlie.bz/blog/why-do-singleton-methods-make-ruby-slow because this technique doesn't see class, but see method body itself. Alias is also no problem. [Problem] However, we can't set frameless method type for polymorphic methods such as Array#[]. Necessity for method frame depends on which parameter type. For example, Fixnum#+ needs method frame if coerce is needed. Current VM_METHOD_TYPE_CFUNC_FRAMELESS is not flexible and need more tuning to introduce it. Expected behavior of frameless method type may be: result = optimized_cfunc(params); /* call optimized cfunc */ if (result == Qundef) { result = normal_cfunc(); } This is why I say this feature is half-baked. We need to learn primitive method in Smalltalk more. (I heard this name at RubyConf Taiwan this month. Thanks!) [Conclusion] Nobody may use this feature and there is no compatibility issue. This feature goes to next minor (2.1?). * proc.c (rb_method_entry_arity): ditto. * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e