summaryrefslogtreecommitdiff
path: root/object.c
AgeCommit message (Collapse)Author
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
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-04* object.c (rb_Hash): fix docs. patched by Stefan Schüßler.ayumin
[ruby-core:55299] [Bug #8487] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31* object.c, proc.c: s/call_seq/call-seq in rdoc. [Fix GH-322]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23* object.c (rb_obj_clone): should not propagate OLDGEN status.ko1
This propagation had caused WB miss for class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18* object.c (rb_inspect): fix typo and error messageeregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* object.c (rb_obj_setup): added.ko1
* include/ruby/ruby.h (OBJSETUP): ues rb_obj_setup() instead of a macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02object.c: skip prepending modulesnobu
* object.c (rb_obj_is_kind_of): skip prepending modules. [ruby-core:54742] [Bug #8357] * object.c (rb_class_inherited_p): ditto. [ruby-core:54736] [Bug #8357] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40561 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-28* object.c: With feedback from Steve Klabnik, reverted a change tozzak
#untrusted? and #tainted?. Also adjusted grammar for $SAFE levels git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-28* object.c: Documentation for taint and trust [Bug #8162]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08object.c: extract common codenobu
* object.c (id_for_setter): extract common code from const, class variable, instance variable setters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08* object.c (rb_obj_ivar_set): call to_str for string only once.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-07* object.c (rb_mod_const_set): call to_str for string only once.naruse
to_str was called from rb_is_const_name and rb_to_id before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-07* object.c (rb_mod_cvar_set): call to_str for string only once.naruse
to_str was called from rb_is_class_name and rb_to_id before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04object.c: avoid inadvertent symbol creationnobu
* object.c (rb_mod_cvar_set): fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04* object.c (rb_mod_cvar_set): Reverted "avoid inadvertentakr
symbol creation" to avoid SEGV by Class.new.class_variable_set(1, 2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04object.c: avoid inadvertent symbol creationnobu
* object.c (rb_mod_const_set): fix symbol name check. (rb_obj_ivar_set): ditto. (rb_mod_cvar_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04object.c: avoid inadvertent symbol creationnobu
* object.c (rb_mod_const_set): avoid inadvertent symbol creation. (rb_obj_ivar_set): ditto. (rb_mod_cvar_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03bignum.c: hide intermediate Bignumsnobu
* bignum.c (rb_big_eq): hide intermediate Bignums not just freeing memory. [ruby-core:53893] [Bug #8204] * object.c (rb_obj_hide): hide an object by clearing klass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-13* object.c (Init_Object): remove Module#used, which has beenshugo
introduced in Ruby 2.0 by mistake. [Bug #7916] [ruby-core:52719] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39739 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-23* array.c: Document #<=> return values and formattingzzak
* bignum.c: ditto * file.c: ditto * object.c: ditto * numeric.c: ditto * rational.c: ditto * string.c: ditto * time.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* object.c (rb_obj_comp): Documenting Object#<=> return valueszzak
Patch by Stefan Rusterholz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22* object.c: Add doc for Module.prependedmarcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-20* object.c: Document Data class [Bug #7890] [ruby-core:52549]zzak
Patch by Matthew Mongeau git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-19* object.c: rdoc formatting for Kernel#Array()zzak
* array.c: Add rdoc for Array() method to Creating Arrays section git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29* object.c: Improve error for failed implicit conversions [Bug #7539]marcandre
* error.c: Adapt rdoc * test/ruby/test_object.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29* object.c: Fix rdoc typo, patch by Narsimham Chelluri [#7753].marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-17* object.c: Typo in Kernel#hash documentation.eregon
Patch by zed_0xff [Github Fixes #237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15object.c: CLASS_OR_MODULE_Pnobu
* object.c (rb_mod_to_s, rb_class_inherited_p, rb_mod_ge, rb_mod_cmp): use BUILTIN_TYPE() instead of TYPE() for optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15object.c: two literalsnobu
* object.c (rb_mod_to_s): concatenate two literals. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29object.c: singleton class clonenobu
* object.c (rb_obj_clone): attach clone to its singleton class during cloning singleton class so that singleton_method_added will be called on it. based on the patch by shiba (satoshi shiba)[Bug #5283] in [ruby-dev:44477]. [Bug #5283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38648 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-22object.c: no nested symbolnobu
* object.c (rb_mod_const_get): symbol cannot be nested constant name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22object.c: defer creating stringnobu
* object.c (rb_mod_const_get): defer creating partinal name string until needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22object.c: check more strictlynobu
* object.c (rb_mod_const_get): check more strictly. [ruby-dev:46748] [Bug #7573] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21* object.c (rb_obj_hash): shouldn't assume object_id can be long.usa
based on a patch by Heesob Park at [ruby-core:51060]. cf. [Backport #7454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19object.c: nul in const namenobu
* object.c (rb_mod_const_get): nul byte is invalid as constant name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13* object.c (Init_Object): no needs to override with same method.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 * object.c (Init_Object): use rb_mod_init_copy for Class#initialize_copycharliesome
* class.c (rb_class_init_copy): rename to class_init_copy_check, performs type checks on arguments to prevent reinitialization of initialized class [ruby-core:50869] [Bug #7557] * class.c (rb_mod_init_copy): use class_init_copy_check if receiver is T_CLASS * test/ruby/test_class.rb (class TestClass): related test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-06* revised r37993 to avoid SEGV/ILL in tests. In r37993, a methodshugo
entry with VM_METHOD_TYPE_REFINED holds only the original method definition, so ci->me is set to a method entry allocated in the stack, and it causes SEGV/ILL. In this commit, a method entry with VM_METHOD_TYPE_REFINED holds the whole original method entry. Furthermore, rb_thread_mark() is changed to mark cfp->klass to avoid GC for iclasses created by copy_refinement_iclass(). * vm_method.c (rb_method_entry_make): add a method entry with VM_METHOD_TYPE_REFINED to the class refined by the refinement if the target module is a refinement. When a method entry with VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with the same name is searched in refinements. If such a method is found, the method is invoked. Otherwise, the original method in the refined class (rb_method_definition_t::body.orig_me) is invoked. This change is made to simplify the normal method lookup and to improve the performance of normal method calls. * vm_method.c (EXPR1, search_method, rb_method_entry), vm_eval.c (rb_call0, rb_search_method_entry): do not use refinements for method lookup. * vm_insnhelper.c (vm_call_method): search methods in refinements if ci->me is VM_METHOD_TYPE_REFINED. If the method is called by super (i.e., ci->call == vm_call_super_method), skip the same method entry as the current method to avoid infinite call of the same method. * class.c (include_modules_at): add a refined method entry for each method defined in a module included in a refinement. * class.c (rb_prepend_module): set an empty table to RCLASS_M_TBL(klass) to add refined method entries, because refinements should have priority over prepended modules. * proc.c (mnew): use rb_method_entry_with_refinements() to get a refined method. * vm.c (rb_thread_mark): mark cfp->klass for iclasses created by copy_refinement_iclass(). * vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass. * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip the test because it should pass successfully. * test/ruby/test_refinement.rb (test_redefine_refined_method): new test for the case a refined method is redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-03object.c: test bits at oncenobu
* object.c (rb_obj_clone): test TAINT and UNTRUSTED bits at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01object.c: make remove_instance_variable publicnobu
* object.c (Init_Object): make remove_instance_variable public. [Feature #6539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e