summaryrefslogtreecommitdiff
path: root/vm_method.c
AgeCommit message (Collapse)Author
2014-11-25vm_method.c: preserve encodingsnobu
* vm_method.c (rb_mod_remove_method): preserve encodings of method name and class name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25vm_method.c: preserve encodingsnobu
* vm_method.c (rb_method_entry_make): preserve encodings of constant names in warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-05intern.h: deprecate disable and enable supernobu
* include/ruby/intern.h (rb_disable_super, rb_enable_super): warn as deprecated at build time, instead of ignoring silently or warning at runtime only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23vm_method.c: get rid of cachenobu
* vm_method.c (rb_method_entry_make): get rid of storing method cache, so that the added method will be called later. [ruby-dev:48691] [Bug #10421] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23vm_method.c: no redefinition warnings for undefined methodsnobu
* vm_method.c (rb_method_entry_make): warn redefinition only for already defined methods, but not for undefined methods. [ruby-dev:48691] [Bug #10421] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-18vm_method.c: configurable global method cache sizenobu
* vm_method.c (Init_Method): make global method cache size configurable by environment variable "RUBY_GLOBAL_METHOD_CACHE_SIZE" [Fix GH-719] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-17vm_method.c: single expressionnobu
* vm_method.c (GLOBAL_METHOD_CACHE): make a single expression. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-12vm_method.c: should not modify frozen objectsnobu
* vm_method.c (rb_method_entry_make, remove_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-12vm_method.c (release_method_definition): use rb_free_method_entrynormal
We are not currently avoiding recursion by calling release_method_definition, so use rb_free_method_entry directly to make changing code easier in case we change the way rb_method_entry_t is allocated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30thread.c, vm_method.c: avoid inadvertent pin-downnobu
* thread.c (rb_thread_variable_set): get rid of inadvertent dynamic symbol pin-down. * vm_method.c (obj_respond_to): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09* parse.y: change Symbol <-> ID relationship to avoidko1
exposing IDs from collectable symbols. [Bug #10014] Now, rb_check_id() returns 0 if corresponding symbol is pinned dynamic symbol. There is remaining intern_cstr_without_pindown(), it can return IDs from collectable symbols. We must be careful to use it (only used in parse.y). I think it should be removed if it does not have impact for performance. * parse.y: add: * STATIC_SYM2ID() * STATIC_ID2SYM() rename: * rb_pin_dynamic_symbol() -> dsymbol_pindown() * internal.h: remove: * rb_check_id_without_pindown() * rb_sym2id_without_pindown() add: * rb_check_symbol() * rb_check_symbol_cstr() * load.c: use rb_check_id() or rb_check_id_cstr(). * object.c: ditto. * struct.c: ditto. * thread.c: ditto. * vm_method.c: ditto. * string.c (sym_find): use only rb_check_symbol(). * sprintf.c (rb_str_format): use rb_check_symbol_cstr(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16vm_method.c: no RTEST on mere flagnobu
* vm_method.c (basic_obj_respond_to): `priv` is not a VALUE but a mere flag, so cannot call RTEST() on it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-15vm_method.c: separate ID selectionnobu
* vm_method.c (rb_method_entry_make): separate selection of IDs to be private from condition of method to be defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31variable.c, vm_method.c: pin downnobu
* variable.c (rb_alias_variable): ensure pinned down. * vm_method.c (rb_method_entry_make): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y: support Symbol GC. [ruby-trunk Feature #9634]nari
See this ticket about Symbol GC. * include/ruby/ruby.h: Declare few functions. * rb_sym2id: almost same as old SYM2ID but support dynamic symbols. * rb_id2sym: almost same as old ID2SYM but support dynamic symbols. * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not pin down a dynamic symbol. Declare a new struct. * struct RSymbol: represents a dynamic symbol as object in Ruby's heaps. Add few macros. * STATIC_SYM_P: check a static symbol. * DYNAMIC_SYM_P: check a dynamic symbol. * RSYMBOL: cast to RSymbol * gc.c: declare RSymbol. support T_SYMBOL. * internal.h: Declare few functions. * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this function at a sweep phase. * rb_str_dynamic_intern: convert a string to a dynamic symbol. * rb_check_id_without_pindown: not pinning function. * rb_sym2id_without_pindown: ditto. * rb_check_id_cstr_without_pindown: ditto. * string.c (Init_String): String#intern and String#to_sym use rb_str_dynamic_intern. * template/id.h.tmpl: use LSB of ID as a flag for determining a static symbol, so we shift left other ruby_id_types. * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to avoid pinning. * load.c: use xx_without_pindown function at creating temporary ID to avoid pinning. * object.c: ditto. * sprintf.c: ditto. * struct.c: ditto. * thread.c: ditto. * variable.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-23vm_method.c fix commit missnobu
* vm_method.c (rb_method_entry_get_without_cache): fix commit miss. remove extra !. [Bug #9663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-23vm_method.c: check if klass is 0nobu
* vm_method.c (rb_method_entry_get_without_cache): me->klass is 0 for a method aliased in a module. [ruby-core:61636] [Bug #9663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-20vm_method.c: fix infinite recursionnobu
* vm_method.c (rb_method_entry_get_without_cache): get rid of infinite recursion at aliases in a subclass and a superclass. return actually defined class for other than singleton class. [ruby-core:60431] [Bug #9475] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-15vm_method.c: cast via VALUEnobu
* vm_method.c (rb_add_method, rb_attr): cast between pointer and ID via VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-02vm_method.c: disable GMC writing if GMC is disablednormal
* vm_method.c (rb_method_entry_get_without_cache): disable GMC writing if GMC is disabled [ruby-core:61218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13* vm_insnhelper.c (vm_call_method): should check ci->me->flag ofshugo
a refining method in case the method is private. [ruby-core:60111] [Bug #9452] * vm_method.c (make_method_entry_refined): set me->flag of a refined method entry to NOEX_PUBLIC in case the original method is private and it is refined as a public method. The original flag is stored in me->def->body.orig_me, so it's OK to make a refined method entry public. [ruby-core:60111] [Bug #9452] * test/ruby/test_refinement.rb: related tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20vm_method.c: use RCLASS_SERIAL macro instead of direct accesstmm1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20fix typo: s/POWOR/POWER/tmm1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20vm_method: set automaticallynobu
* vm_method.c (GLOBAL_METHOD_CACHE_MASK): set from GLOBAL_METHOD_CACHE_SIZE automatically. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20* vm_method.c: check definition ofko1
GLOBAL_METHOD_CACHE_SIZE and GLOBAL_METHOD_CACHE_MASK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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