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

345 Коммитов

Автор SHA1 Сообщение Дата
normal 4b0987a629 variable.c: generic_iv_tbl is unavoidable
Even miniruby creates one generic ivar (plain "ruby" creates 9),
so there's no point in lazily allocating the table.

I dumped generic ivar counts with the following trivial patch:

  --- a/variable.c
  +++ b/variable.c
  @@ -24,6 +24,10 @@ static void check_before_mod_set(VALUE, ID, VALUE, const char *);
   static void setup_const_entry(rb_const_entry_t *, VALUE, VALUE, rb_const_flag_t);
   static int const_update(st_data_t *, st_data_t *, st_data_t, int);
   static st_table *generic_iv_tbl;
  +__attribute__((destructor)) static void count_genivar(void)
  +{
  +    fprintf(stderr, "genivars: %zu\n", (size_t)generic_iv_tbl->num_entries);
  +}

   void
   Init_var_tables(void)

* variable.c (Init_var_tables): init generic_iv_tbl
  (rb_generic_ivar_table, generic_ivar_get, generic_ivar_set,
   generic_ivar_defined, generic_ivar_remove,
   rb_mark_generic_ivar, givar_i, rb_mark_generic_ivar_tbl,
   rb_free_generic_ivar, rb_copy_generic_ivar, rb_ivar_foreach,
   rb_ivar_count): remove checks for uninitialize generic_iv_tbl
  [ruby-core:69155] [Feature #11146]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-21 00:15:00 +00:00
nobu 6fb9349d85 allocate structs with wrapper
* parse.y (rb_parser_new, ripper_s_allocate): allocate structs
  with making new wrapper objects and get rid of potential memory
  leak.

* variable.c (rb_autoload): ditto.

* ext/digest/digest.c (rb_digest_base_alloc): ditto.

* ext/strscan/strscan.c (strscan_s_allocate): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16 12:56:48 +00:00
tenderlove cd465d552c * variable.c: Change autoload to call `require` through Ruby rather
than directly calling `rb_require_safe`.  This allows things like
  RubyGems to intercept file loading done though `autoload`.
  [Feature #11140]

* test/ruby/test_autoload.rb: Test for change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-14 21:57:33 +00:00
nobu 6fefba37d0 variable.c: no intermediate IDs
* variable.c (rb_set_class_path_string, rb_set_class_path): get
  rid of creating intermediate IDs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-13 22:01:33 +00:00
nobu 8d6fbbe862 variable.c: const_update
* variable.c (autoload_delete): no longer delete const entry
  itself.

* variable.c (autoload_const_set, rb_const_set): update const
  entry instead of adding after removal.

* variable.c (const_update): extract from rb_const_set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-13 07:54:59 +00:00
nobu 3124d55a3c variable.c: setup_const_entry
* variable.c (setup_const_entry): extract rb_const_entry_t setup
  from rb_const_set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-13 07:54:52 +00:00
nobu 938910492c variable.c: ensure
* variable.c (rb_autoload_load): prefer rb_ensure than rb_protect
  for rollback.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-13 07:54:39 +00:00
nobu 74768415d8 variable.c: escape erred name
* variable.c (rb_path_to_class): escape erred name.  as precision
  delimits the formatted result only, not region of an argument
  string, need to make a substring for the particular region.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-22 14:31:53 +00:00
ko1 724012a23d * internal.h, node.h: move a definition of `struct rb_global_entry'
and related functions from node.h to internal.h.
* variable.c: remove unused include pragma.
* common.mk: remove unused dependency.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-12 01:55:58 +00:00
nobu badb4de72a variable.c: rb_search_class_path
* variable.c (rb_tmp_class_path): defer making temporary class
  path string.
* variable.c (rb_search_class_path): search class path or return
  Qnil or Qfalse if unnamed, not creating a temporary path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-28 06:42:29 +00:00
nobu 1ef1a0c602 variable.c: preserve name encoding of subclass
* variable.c (rb_tmp_class_path): preserve name encoding of an
  anonymous instance of module/class subclass.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-28 06:02:06 +00:00
nobu 4194ca02fb revert r45487
* variable.c (rb_alias_variable): IDs are always immportal now, no
  pin down is needed.

* vm_method.c (rb_method_entry_make): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06 02:33:47 +00:00
nobu e98b307036 variable.c: ignore mortal classid
* variable.c (classname): ignore classid if it is a mortal symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06 02:33:41 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu 8eb0c810b2 get rid of inadvertent ID creation
* object.c (rb_mod_const_get, rb_mod_const_defined): ditto.
* variable.c (rb_const_missing, rb_mod_const_missing): call
  const_missing without new ID to get rid of inadvertent ID
  creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-21 16:11:55 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 6e21b611aa variable.c, vm_insnhelper.c: improve performance
* variable.c (rb_ivar_get), vm_insnhelper.c (vm_getivar): improve
  instance variable retrieval performance by checking ruby_verbose
  before call of rb_warning and evaluation of its argument.
  [ruby-core:65786] [Feature #10396]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-19 17:23:31 +00:00
nobu 26a29ffbed variable.c: use st_update
* variable.c (generic_ivar_set): use st_update to insert object
  which does not have generic instance variables yet.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-08 14:49:49 +00:00
nobu c8d7d587ac variable.c: use st_update
* variable.c (sv_i, cv_i): use st_update to insert non-existing
  entries.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-08 08:27:54 +00:00
nobu 02fe713b46 constant.h: constant visibilities
* constant.h (RB_CONST_PRIVATE_P, RB_CONST_PUBLIC_P): macros to
  predicate constant visibilities.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-08 08:27:51 +00:00
normal d2e3c03409 simplify some trivial rb_data_type_t callbacks
* process.c (free_exec_arg): remove
  (memsize_exec_arg): ptr is never NULL
  (exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE

* variable.c (autoload_i_free): remove
  (autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE
  (autoload_memsize): ptr is never NULL

* vm_backtrace.c (location_free): remove
  (location_mark): ptr is never NULL
  (location_data_type): use RUBY_TYPED_DEFAULT_FREE
  (backtrace_mark): ditto
  (backtrace_free): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-13 05:14:51 +00:00
normal 02dade3b9e variable.c (rb_ivar_set): remove unnecessary check
r47512 contains the proper fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 09:00:06 +00:00
nobu ddf6eb40c7 variable.c: check index overflow
* variable.c (rb_ivar_set), vm_insnhelper.c (vm_setivar): check
  instance variable index overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 08:05:12 +00:00
normal b3a4367ce4 rb_call_info_t: shrink to 96 bytes from 104 bytes on 64-bit
This keeps ci->flag and ci->aux.index consistent across 32-bit
and 64-bit platforms.

ci->flag: VM_CALL_* flags only use 9 bits, currently
ci->aux.index: 2 billion ivars per class should be enough for anybody

This saves around 50K allocations on "valgrind ruby -e exit" on x86-64
before:
  total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated
after:
  total heap usage: 48,069 allocs, 19,214 frees, 8,047,266 bytes allocated

* vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int
  ci->index becomes a 32-bit signed int (from signed long).
  Reorder for better packing on 64-bit, giving an 8 byte reduction
  from 104 to 96 bytes for each ci.

* compile.c (new_callinfo, setup_args, iseq_compile_each,
  iseq_build_from_ary_body): adjust for type changes

* vm_insnhelper.c (vm_getivar): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 06:32:44 +00:00
normal 4938045735 variable: cleanup to use rb_const_lookup
* variable.c: cleanup to use rb_const_lookup
* vm_insnshelper.c: ditto

This reduces casting and long lines.  This should make it easier to
switch to alternatives to st for constant storage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-04 01:12:53 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
ko1 76a929a7fc * parse.y: change Symbol <-> ID relationship to avoid
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-07-09 06:14:41 +00:00
nobu 876bfc6b4e Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-03 03:38:10 +00:00
nobu e99ee55abc constify parameters
* 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-18 06:16:39 +00:00
nobu 6b9b85318a variable.c, vm_method.c: pin down
* 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-31 14:38:38 +00:00
nari 90b7073842 * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
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-26 04:57:47 +00:00
normal 3e6fe414d8 variable.c: avoid memory leak on const redefinition
* variable.c (rb_const_set): delete existing entry on redefinition
  [Bug #9645]
* test/ruby/test_const.rb (test_redefinition): test for leak

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 01:24:06 +00:00
normal eb227b25fa variable.c (struct global_variable): shrink by 8 bytes on 64-bit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 21:44:24 +00:00
hsbt 689755a1ad * gc.c: fix typo by @windwiny [fix GH-506]
*  proc.c: ditto
*  variable.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 05:43:28 +00:00
ko1 c2e72fb343 * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.
The patch base by drkaes (Stefan Kaes).
  [Bug #9321]
* variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
  instead of rb_frame_pop().
* vm_eval.c (raise_method_missing): ditto.
* vm_eval.c (rb_iterate): ditto.
* internal.h (rb_vm_pop_cfunc_frame): add decl.
* test/ruby/test_settracefunc.rb: add tests.
  provided by drkaes (Stefan Kaes).
* vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):
  move definition of rb_frame_pop() and deprecate it.
  It doesn't care about `return' events.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 10:12:59 +00:00
ayumin ff529cdc25 * variable.c: Adding extra example in docs. [Bug #9210]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-30 14:39:35 +00:00
ko1 c702005a7b * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
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-20 08:07:47 +00:00
ko1 3477670963 * array.c: fix comment to remove the word "shady".
* variable.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 02:53:27 +00:00
nobu b4ab650e1a variable.c: rb_class_path_cached
* variable.c (rb_class_path_cached): returns cached class path
  only, without searching and allocating new class path string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 03:25:38 +00:00
nobu 6def265d79 variable.c: frozen class name
* variable.c (fc_path, classname): return ID strings without
  unnecessary copying.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 11:38:34 +00:00
charliesome 39a8519a56 * variable.c (rb_mod_constants): when calling Module#constants with
inherit=false, there is no need to use a hashtable to deduplicate
  constant names. [Feature #9196] [ruby-core:58786]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-02 08:26:29 +00:00
ko1 d1674ef67b * gc.c: add support to estimate increase of oldspace memory usage.
This is another approach to solve an issue discussed at r43530.
  This feature is diabled as default.
  This feature measures an increment of memory consuption by oldgen
  objects. It measures memory consumption for each objects when
  the object is promoted. However, measurement of memory consumption
  is not accurate now. So that this measurement is `estimation'.
  To implement this feature, move memsize_of() function from
  ext/objspace/objspace.c and expose rb_obj_memsize_of().
  Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
  measure memory size, so that we ignores T_DATA objects now.
  For example, some functions skip NULL check for pointer.
  The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
  and turned off as default.
  We need to compare 3gen GC and this feature carefully.
  (it is possible to enable both feature)
  We need a help to compare them.
* internal.h: expose rb_obj_memsize_of().
* ext/objspace/objspace.c: use rb_obj_memsize_of() function.
* cont.c (fiber_memsize): fix to check NULL.
* variable.c (autoload_memsize): ditto.
* vm.c (vm_memsize): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05 04:51:01 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
charliesome 7fafa8f376 * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
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-29 00:52:38 +00:00
nobu 347e748bdd variable.c: real class name
* variable.c (rb_class2name): should return real class name, not
  singleton class or iclass.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19 20:24:30 +00:00
tmm1 3a90444c55 * variable.c (rb_class2name): call rb_tmp_class_path() directly to avoid extra rb_str_dup() from rb_class_name().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19 19:21:05 +00:00
ko1 52c1331763 * class.c, variable.c, gc.c (rb_class_tbl): removed.
* vm.c, vm_core.h (rb_vm_add_root_module): added to register as a
  defined root module or class.
  This guard helps mark miss from defined classes/modules they are
  only refered from C's global variables in C-exts.
  Basically, it is extension's bug.
  Register to hash object VM has.
  Marking a hash objects allows generational GC supports.
* gc.c (RGENGC_PRINT_TICK): disable (revert).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11 18:27:18 +00:00
ko1 9d70a17541 revert r43259 because it is possible to mark miss classes defined in C-exts. Thanks charliesome.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11 18:03:43 +00:00
ko1 7aecb95637 * class.c, variable.c, gc.c (rb_class_tbl): removed.
rb_class_tbl is no longer used.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11 17:33:44 +00:00
ktsj 113b1c76fc * variable.c (classname): the name of class that has
non class id should not be nil. This bug was introduced
  in r36577.

* test/thread/test_cv.rb: test for change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-07 04:58:38 +00:00