summaryrefslogtreecommitdiff
path: root/object.c
AgeCommit message (Collapse)Author
2014-11-08* object.c (Module#const_defined?): [DOC] Revise the documentation.eregon
Patch by Xavier Noria. [Fixes GH-754] https://github.com/ruby/ruby/pull/754 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-04* object.c: fix document of Kernel.Stirng by @suzukazehsbt
[fix GH-743][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14* error.c: [DOC] Fix case of type in exception message by @tricknoteszzak
[Fixes GH-740] https://github.com/ruby/ruby/pull/740 * object.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-25object.c (rb_class_real): do not dereference 0 VALUEnormal
* test/ruby/test_module.rb (test_inspect_segfault): Test case and bug report by Thomas Stratmann. [ruby-core:65214] [Bug #10282] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* include/ruby/ruby.h: freeze nil/true/false.ko1
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE. * object.c (rb_obj_taint): check OBJ_TAINTABLE(obj). * object.c (rb_obj_freeze): remove immediate_frozen_tbl because all of immediate values are frozen. YAY! * object.c (rb_obj_frozen_p): ditto. * test/ruby/test_eval.rb: skip instance_variable_set for frozen objects. * test/ruby/test_weakmap.rb: check ArgumentError instead of RuntimeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08* gc.c: add incremental GC algorithm. [Feature #10137]ko1
Please refer this ticket for details. This change also introduces the following changes. * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3). Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in RBasic::flags (2 bit). Age == 3 objects become old objects. * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap. * LONG_LIVED bitmap to represent living objects while minor GCs It specifies (1) Old objects and (2) remembered shady objects. * Introduce rb_objspace_t::marked_objects which counts marked objects in current marking phase. marking count is needed to introduce incremental marking. * rename mark related function and sweep related function to gc_(marks|sweep)_(start|finish|step|rest|continue). * rename rgengc_report() to gc_report(). * Add obj_info() function to get cstr of object details. * Add MEASURE_LINE() macro to measure execution time of specific line. * and many small fixes. * include/ruby/ruby.h: add flag USE_RINCGC. Now USE_RINCGC can be set only with USE_RGENGC. * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1 to count object age. * include/ruby/ruby.h: rewrite write barriers for incremental marking. * debug.c: catch up flag name changes. * internal.h: add rb_gc_writebarrier_remember() instead of rb_gc_writebarrier_remember_promoted(). * array.c (ary_memcpy0): use rb_gc_writebarrier_remember(). * array.c (rb_ary_modify): ditto. * hash.c (rb_hash_keys): ditto. * hash.c (rb_hash_values): ditto. * object.c (init_copy): use rb_copy_wb_protected_attribute() because FL_WB_PROTECTED is moved from RBasic::flags. * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03object.c: fix memory leaknobu
* object.c (rb_obj_copy_ivar): allocate no memory for empty instance variables. [ruby-core:64700] [Bug #10191] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-02object.c: Object#itsefnobu
* object.c (rb_obj_itself): new method Object#itsef. based on the patch by Rafael França in [ruby-core:64156]. [EXPERIMENTAL] this method may be renamed due to compatibilities. [ruby-core:44704] [Feature #6373] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28add some documents [ci skip]nobu
* bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION. * complex.c (Init_Complex): [DOC] ignore an internal class. * dir.c (Init_Dir): [DOC] File::FNM_SYSCASE. * file.c (rb_file_exists_p): [DOC] File.exists? is deprecated. * object.c (rb_mod_initialize_clone): [DOC] ignore implementation detail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 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-23object.c: rb_obj_copy_ivarnobu
* object.c (rb_obj_copy_ivar): extract function to copy instance variables only for T_OBJECT from init_copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-07* object.c (rb_mod_initialize_clone): Override Kernel#initialize_cloneakr
to avoid an exception on Class.new.freeze.clone.to_s. Reported by Andrew Grimm. [ruby-core:41858] [Bug #5828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-20id.def: predefine to_inobu
* defs/id.def: predefine `to_i` as well as `to_int`. * numeric.c (id_to_i): use predefined `idTo_i`. * object.c (conv_method_names): add `to_i` ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-20id.def: predefine conversion method IDsnobu
* defs/id.def: predefine conversion method name IDs. * object.c (conv_method_names): consitify with predefined IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-08object.c: no longer copy tables of classes/modulesnobu
* object.c (init_copy): no longer copy tables of classes/modules, since r45874 rb_mod_init_copy() does it instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-14object.c: rb_class_search_ancestornobu
* object.c (rb_class_search_ancestor): return ancestor class or iclass if inherited. * object.c (rb_obj_is_kind_of, rb_class_inherited_p): share function to search the ancestor. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45584 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-21* complax.c: [DOC] Document number conversion of `nil` by @skade [fix ↵hsbt
GH-570] [ci skip] * object.c, rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-20* include/ruby/intern.h (rb_obj_call_init, rb_class_new_instance):ko1
constify a parameter (VALUE *). I believe this incompatibility doesn't break any code. However, if you have trouble, please tell us. * eval.c, object.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-15object.c: [DOC] merge rdocnobu
* gc.c (rb_obj_id): remove unused rdoc. * object.c (rb_obj_hash): [DOC] merge unused rdoc from rb_obj_id() in gc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-30object.c: error message encodingnobu
* object.c (convert_type, rb_convert_type, rb_check_convert_type), (rb_to_integer): preserve class name encoding error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09* object.c: Add rdoc for classes frozen by defaultmarcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09* hash.c (rb_objid_hash): should return `long'. brushup r44534.usa
* object.c (rb_obj_hash): follow above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-08object.c: hash value from objid with saltnobu
* hash.c (rb_objid_hash): return hash value from object ID with a salt, extract from rb_any_hash(). * object.c (rb_obj_hash): return same value as rb_any_hash(). fix r44125. [ruby-core:59638] [Bug #9381] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-28* object.c (Kernel#<=>) surround Comparable operators with <code> tags.eregon
The #== method was hidden in ri/rdoc's output and was highlighting the line instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20ruby.h: swap iv_index_tbl and super for struct RClasstmm1
* include/ruby/ruby.h (struct RClass): add super, remove iv_index_tbl. since RCLASS_SUPER() is commonly used inside while loops, we move it back inside struct RClass to improve cache hits. this provides a small improvement (1%) in hotspots like rb_obj_is_kind_of() * internal.h (struct rb_classext_struct): remove super, add iv_index_table * internal.h (RCLASS_SUPER): update for new location * internal.h (RCLASS_SET_SUPER): ditto * internal.h (RCLASS_IV_INDEX_TBL): ditto * object.c (rb_class_get_superclass): ditto * include/ruby/backward/classext.h (RCLASS_SUPER): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: check const namesnobu
* object.c (rb_mod_const_get, rb_mod_const_defined): check constant names more strictly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: nested path const_defined?nobu
* object.c (rb_mod_const_defined): support nested class path as well as const_get. [Feature #7414] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: remove unnecessary assignmentnobu
* object.c (rb_mod_const_get): remove unnecessary assignment and set path together. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: fix typonobu
* object.c (rb_mod_const_get): fix typo. should use SYM2ID() not ID2SYM(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: fix r44189nobu
* object.c (rb_mod_const_get): already interned junk name may be valid nested class path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14object.c: optimize rb_mod_const_get for symbolnobu
* object.c (rb_mod_const_get): Symbol must be the entire name, not a nested constant path, so achieve by its ID directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-12object.c: use RCLASS_M_TBL_WRAPPER for equality checkstmm1
* class.c (include_modules_at): use RCLASS_M_TBL_WRAPPER for equality checks. this avoids an unnecessary deference inside a tight loop, fixing a performance regression from r43973. * object.c (rb_obj_is_kind_of): ditto. * object.c (rb_class_inherited_p): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08* object.c: [DOC] document Module#singleton_class?.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03* object.c (rb_obj_clone): don't copy FL_WB_PROTECTED of anari
original object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03* object.c (rb_obj_clone): Protect FL_PROMOTED and FL_WB_PROTECTEDnari
flags of a destination object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* object.c: [DOC] Clarify Object#dup vs #clone [Bug #9128]zzak
Moving existing doc for this comparison to separate section of #dup Adding examples to document behavior of #dup with Module#extend. Based on a patch by stevegoobermanhill git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-04* include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.ko1
This flag represents that "this object is promoted at least once." * gc.c, debug.c, object.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-24* object.c: [DOC] Document first argument also takes string for:zzak
rb_mod_const_get, rb_mod_const_set, rb_mod_const_defined Also added note about NameError exception for invalid constant name git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43412 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-08-25* object.c: [DOC] remove comment about trust/untrust.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18* error.c, object.c, ext/readline/README.ja: [DOC] $SAFE=4 is obsolete.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-13object.c: undef Module#prepend_features on Classnobu
* object.c (Init_Object): undef Module#prepend_features on Class, as well as Module#append_features. [Fixes GH-376] * test_class.rb: Added test for above. And ensure type checking on similar methods as module_function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08object.c: Module#singleton_class?nobu
* object.c (rb_mod_singleton_p): new method Module#singleton_class? to return whether the receiver is a singleton class or not. [ruby-core:51087] [Feature #7609] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-05* object.c (rb_class_inherited_p): allow iclasses to be tested forcharliesome
inheritance. [Bug #8686] [ruby-core:56174] * test/ruby/test_method.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09* object.c (rb_obj_cmp): Improve doc for Kernel#<=>eregon
to clarify #equal? is not called. [See GH-352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09Module extended doc by @PragTob [fixes GH-335]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09* object.c: Fix rdoc for Kernel#<=>. [Fix GH-352]knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-04* object.c (rb_obj_equal): Fixed an rb_obj_equal documentation typocharliesome
where "a" was used instead of "obj". Fixes GH-349. Patch by @adnandoric git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41775 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