summaryrefslogtreecommitdiff
path: root/variable.c
AgeCommit message (Collapse)Author
2015-06-24variable.c: remove FL_ABLE check for generic ivarsnormal
Missed this in r50758. * variable.c (generic_ivar_set): remove FL_ABLE check (gen_ivar_copy): ditto [ruby-core:69715] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03variable.c: remove generic ivar support for special constantsnormal
Special constants are all frozen since [Feature #8923] and cannot support ivars. Remove some unused code we had for supporting them. * variable.c (special_generic_ivar): remove flag (givar_i, rb_mark_generic_ivar_tbl): remove functions (rb_free_generic_ivar, rb_ivar_lookup, rb_ivar_delete, generic_ivar_set, rb_ivar_set, rb_ivar_defined, rb_copy_generic_ivar, rb_ivar_foreach, rb_ivar_count, rb_obj_remove_instance_variable): adjust for lack of ivar support in special constants * test/ruby/test_variable.rb: test ivars for special consts * internal.h: remove rb_mark_generic_ivar_tbl decl * gc.c (gc_mark_roots): remove rb_mark_generic_ivar_tbl call git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30variable.c: avoid compatibility table with generic ivarsnormal
This recovers and improves performance of Marshal.dump/load on Time objects compared to when we implemented generic ivars entirely using st_table. This also recovers some performance on other generic ivar objects, but does not bring bring Marshal.dump/load performance up to previous speeds. benchmark results: minimum results in each 10 measurements. Execution time (sec) name trunk geniv after marshal_dump_flo 0.343 0.334 0.335 marshal_dump_load_geniv 0.487 0.527 0.495 marshal_dump_load_time 1.262 1.401 1.257 Speedup ratio: compare with the result of `trunk' (greater is better) name geniv after marshal_dump_flo 1.026 1.023 marshal_dump_load_geniv 0.925 0.985 marshal_dump_load_time 0.901 1.004 * include/ruby/intern.h (rb_generic_ivar_table): deprecate * internal.h (rb_attr_delete): declare * marshal.c (has_ivars): use rb_ivar_foreach (w_ivar): ditto (w_object): update for new interface * time.c (time_mload): use rb_attr_delete * variable.c (generic_ivar_delete): implement (rb_ivar_delete): ditto (rb_attr_delete): ditto [ruby-core:69323] [Feature #11170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-29variable.c: use indices for generic ivarsnormal
This reduces memory overhead of ivars for common types such as T_DATA the same way T_OBJECT does it. For 9992 accepted clients on an OpenSSL server, this reduces memory from 77160K to 69248K with the script in https://bugs.ruby-lang.org/issues/11170 * variable.c (static int special_generic_ivar): move (rb_generic_ivar_table): rewrite for compatibility (gen_ivtbl_bytes): new function (generic_ivar_get): update to use ivar index (generic_ivar_update): ditto (generic_ivar_set): ditto (generic_ivar_defined): ditto (generic_ivar_remove): ditto (rb_mark_generic_ivar): ditto (givar_i): ditto (rb_free_generic_ivar): ditto (rb_mark_generic_ivar_tbl): ditto (rb_generic_ivar_memsize): ditto (rb_copy_generic_ivar): ditto (rb_ivar_set): ditto (rb_ivar_foreach): ditto (rb_ivar_count): ditto (givar_mark_i): remove (gen_ivtbl_mark): new function (gen_ivar_each): ditto (iv_index_tbl_extend): update for struct ivar_update (iv_index_tbl_newsize): ditto [ruby-core:69323] [Feature #11170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-29variable.c: extract common functions for generic ivar indicesnormal
* variable.c (iv_index_tbl_make): extract from rb_ivar_set (iv_index_tbl_extend): ditto (iv_index_tbl_newsize): ditto (rb_ivar_set): use extracted functions [ruby-core:69323] (Part 1) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-21variable.c: generic_iv_tbl is unavoidablenormal
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-16allocate structs with wrappernobu
* 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-14* variable.c: Change autoload to call `require` through Ruby rathertenderlove
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-13variable.c: no intermediate IDsnobu
* 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-04-13variable.c: const_updatenobu
* 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-13variable.c: setup_const_entrynobu
* 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-13variable.c: ensurenobu
* 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-03-22variable.c: escape erred namenobu
* 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-12* internal.h, node.h: move a definition of `struct rb_global_entry'ko1
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-02-28variable.c: rb_search_class_pathnobu
* 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-28variable.c: preserve name encoding of subclassnobu
* 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-06revert r45487nobu
* 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-06variable.c: ignore mortal classidnobu
* 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
2014-12-01use 0 for reservednobu
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-11-21get rid of inadvertent ID creationnobu
* 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-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-19variable.c, vm_insnhelper.c: improve performancenobu
* 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-08variable.c: use st_updatenobu
* 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-08variable.c: use st_updatenobu
* 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-08constant.h: constant visibilitiesnobu
* 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-09-13simplify some trivial rb_data_type_t callbacksnormal
* 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-10variable.c (rb_ivar_set): remove unnecessary checknormal
r47512 contains the proper fix git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10variable.c: check index overflownobu
* 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-10rb_call_info_t: shrink to 96 bytes from 104 bytes on 64-bitnormal
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-08-04variable: cleanup to use rb_const_lookupnormal
* 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-07-25introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO usenormal
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-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-07-03Init functions don't need ID cachesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 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-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-17variable.c: avoid memory leak on const redefinitionnormal
* 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-08variable.c (struct global_variable): shrink by 8 bytes on 64-bitnormal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19* gc.c: fix typo by @windwiny [fix GH-506]hsbt
* 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-09* vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.ko1
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
2013-12-30* variable.c: Adding extra example in docs. [Bug #9210]ayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44463 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-13* array.c: fix comment to remove the word "shady".ko1
* variable.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09variable.c: rb_class_path_cachednobu
* 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-08variable.c: frozen class namenobu
* 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-02* variable.c (rb_mod_constants): when calling Module#constants withcharliesome
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-11-05* gc.c: add support to estimate increase of oldspace memory usage.ko1
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-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
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* 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-19variable.c: real class namenobu
* 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