summaryrefslogtreecommitdiff
path: root/struct.c
AgeCommit message (Collapse)Author
2018-01-05marshal.c: allow marshalling keyword_init structk0kubun
struct.c: define rb_struct_s_keyword_init to shared with marshal.c internal.h: add the declaration to be used by marshal.c test/ruby/test_marshal.rb: add test for Bug#14314 [Feature #14314] [ruby-core:84629] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14struct.c: [DOC] improve docs for Struct.newstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12struct.c: don't explain implementation detailsk0kubun
of keyword_init option. [DOC] [ci skip] It's implemented to take Hash, but it's just implementation detail and it's intended to behave in the same way as keyword arguments (for :keyword_init option too). Also I unified coding style of r61137 with other places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12struct.c: show `keyword_init: true` on inspectk0kubun
for debugging if it's specified for the Struct class. This follows up r61137. We don't provide a method to check it because I don't think of any use case, but showing this to inspect would be helpful for debugging if someone is debugging whether keyword_init is properly enabled or not. In this commit, I didn't show `keyword_init: false` because of backward compatibility. Ideally any application should not depend on the behavior of inspect, but I don't have strong motivation to break it too. [close GH-1773] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12struct.c: add keyword_init option to Struct.newk0kubun
to initialize struct with keyword arguments. [Feature #11925] [close GH-1771] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27`th` -> `ec` for `rb_insn_func_t`.ko1
* vm_core.h (rb_insn_func_t): accepts `ec` instead of `th`. * vm_insnhelper.c (rb_vm_opt_struct_aref): ditto. * vm_insnhelper.c (rb_vm_opt_struct_aset): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-02Revert "vm_eval.c: add rb_yield_assoc_or_values()"glass
This reverts commit r60095 to prevent performance degradation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-02vm_eval.c: add rb_yield_assoc_or_values()glass
The new function rb_yield_assoc_or_values() will reduce branching. * vm_eval.c: add rb_yield_assoc_or_values() * internal.h: ditto * hash.c: use rb_yield_assoc_or_values() * struct.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-01use rb_hash_new_with_size()glass
* hash.c: use rb_hash_new_with_size(). * marshal.c: ditto * struct.c: ditto * vm_args.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-01struct.c: improve rdoc for Structstomar
* struct.c: [DOC] improve examples for ::new, improve #dig example, simplify #select example, use consistent style for return values, fix typos and example code style, remove duplicate cross reference. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-27Fix doc for Hash#dig and Struct#digstomar
* hash.c (rb_hash_dig): [DOC] correct argument name in method description; fix formatting in examples. * struct.c (rb_struct_dig): ditto. [ruby-core:79221] [Bug #13148] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21backward.h: 2.2 deprecated featuresnobu
* include/ruby/backward.h (DECLARE_DEPRECATED_FEATURE): move features deprecated at 2.2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-03doc: restore class documentation for Structnormal
* struct.c: restore class documentation for Struct that disappeared with r46663. Due to r46663, the class documentation for Struct disappeared. (The revision inserted the definition of `InitVM_Struct` between the rdoc and the definition of `Init_Struct`.) The docs are rendered for 2.1: <https://docs.ruby-lang.org/en/2.1.0/Struct.html>, but not for later versions, see: <https://docs.ruby-lang.org/en/2.2.0/Struct.html> (Same for `ri` pages). [ruby-core:79416] [Bug #13189] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08replace fixnum by integer in documents.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01hide struct internal [Feature #9916]shyouhei
* include/ruby/ruby.h (struct RStruct): no longer. * internal.h (struct RStruct): moved here. * struct.c (rb_struct_ptr): a compensation function for the lack of RSTRUCT_PTR. But now that we have RSTRUCT_GET/SET, that must not be used anyway. I mark this deprecated. Dont use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-16struct.c: unique membersnobu
* struct.c (struct_make_members_list, rb_struct_s_def): member names should be unique. [ruby-core:74971] [Bug #12291] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-16struct.c: struct_make_members_listnobu
* struct.c (struct_make_members_list): extract making member name list from char* va_list, with creating symbols without intermediate IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08* array.c: Improve and fix documentation for Array#digmarcandre
[#11776] * hash.c: ditto * struct.c: ditto * test_hash.rb: Add basic test for user defined `dig`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17update rdoc of dig methods [ci skip]nobu
* array.c (rb_ary_dig), hash.c (rb_hash_dig): [DOC] Update comments describing dig methods. [Fix GH-1103] * struct.c (rb_struct_dig): [DOC] add rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16struct.c: dignobu
* object.c (rb_obj_dig): dig in nested structs too. * struct.c (rb_struct_dig): new method Struct#dig. [Feature #11688] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16* struct.c: Standardize a method signature of Struct#[]=.hsbt
[ci skip][fix GH-1095] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16struct.c: fix index in messagenobu
* struct.c (rb_struct_aref, rb_struct_aset): show the given index, not offset index, in the error messages when the offset is out of the range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28NameError#receiver of uninitialized constantnobu
* error.c (name_err_mesg_to_str): quote the name if unprintable. * object.c (check_setter_id): use rb_check_id to convert names. * variable.c (uninitialized_constant): use NameError::message to keep the receiver of uninitialized constant. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21* make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko1
All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: AREF_HASH_UNIT enumnobu
* struct.c (AREF_HASH_UNIT): name a magic number, which is shared by struct_member_pos_probe and struct_set_members. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: AREF_HASH_THRESHOLD enumnobu
* struct.c (AREF_HASH_THRESHOLD): make an enum not to exceed the int range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: hide internal objectsnobu
* struct.c (struct_set_members): hide internal back_members object, and members object does not need to be duped as it should be frozen and hidden. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: fix implicit conversionsnobu
* struct.c (struct_member_pos): revert r51080 to fix other implicit conversions but cast the return value to fix the previous implicit conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* struct.c (struct_member_pos): avoid implicit conversion losesnaruse
integer precision: 'long' to 'int'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30move RB_GC_GUARD responsibility to rb_add_method_iseqnormal
This simplifies all the callers and makes code easier to use and review. I was confused about the need for RB_GC_GUARD in define_{aset,aref}_method of struct.c without reading rb_add_method_iseq. Likewise, do the same for rb_iseq_clone, where the GC guard only seems neccesary iff RGenGC is disabled. * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD * class.c (clone_method): remove RB_GC_GUARD * struct.c (define_aref_method): ditto (define_aset_method): ditto * vm.c (vm_define_method): * iseq.c (rb_iseq_clone): add RB_GC_GUARD git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30struct.c: speedup for big structsnormal
use simple custom open-addressing hash for big structs. Original-patch-by: Sokolov Yura aka funny_falcon <funny.falcon@gmail.com> in https://bugs.ruby-lang.org/issues/10585 * struct.c (AREF_HASH_THRESHOLD): new macro (id_back_members): new ID (struct_member_pos_ideal): new function (struct_member_pos_probe): ditto (struct_set_members): ditto (struct_member_pos): ditto (rb_struct_getmember): use struct_member_pos for O(1) access (rb_struct_aref_sym): ditto (rb_struct_aset_sym): ditto (setup_struct): call struct_set_members (struct_define_without_accessor): ditto (Init_Struct): initialize __members_back__ [ruby-core:66851] [ruby-core:69705] [ruby-core:69821] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-22struct.c: cache member definition in a subclassnormal
Since getting Qnil is already error, it is safe to use rb_attr_get. * struct.c (struct_ivar_get): cache member definition in a subclass Thanks to Sokolov Yura aka funny_falcon <funny.falcon@gmail.com> in https://bugs.ruby-lang.org/issues/10585 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* method.h: split rb_method_definition_t::flag to several flags.ko1
`flag' contains several categories of attributes and it makes us confusion (at least, I had confused). * rb_method_visibility_t (flags::visi) * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0 * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1 * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2 * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3 * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits) * NOEX_BASIC -> basic (flags::basic, 1 bit) * NOEX_MODFUNC -> rb_scope_visibility_t in CREF * NOEX_SUPER -> MISSING_SUPER (enum missing_reason) * NOEX_VCALL -> MISSING_VCALL (enum missing_reason) * NOEX_RESPONDS -> BOUND_RESPONDS (macro) Now, NOEX_NOREDEF is not supported (I'm not sure it is needed). Background: I did not know what "NOEX" stands for. I asked Matz (who made this name) and his answer was "Nothing". "At first, it meant NO EXport (private), but the original meaning was gone." This is why I remove the mysterious word "NOEX" from MRI. * vm_core.h: introduce `enum missing_reason' to represent method_missing (NoMethodError) reason. * eval_intern.h: introduce rb_scope_visibility_t to represent scope visibility. It has 3 method visibilities (public/private/protected) and `module_function`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02* method.h: make rb_method_entry_t a VALUE.ko1
Motivation and new data structure are described in [Bug #11203]. This patch also solve the following issues. * [Bug #11200] Memory leak of method entries * [Bug #11046] __callee__ returns incorrect method name in orphan proc * test/ruby/test_method.rb: add a test for [Bug #11046]. * vm_core.h: remvoe rb_control_frame_t::me. me is located at value stack. * vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes because method entries are simple VALUEs. * method.h: Now, all method entries has own independent method definititons. Strictly speaking, this change is not essential, but for future changes. * rb_method_entry_t::flag is move to rb_method_definition_t::flag. * rb_method_definition_t::alias_count is now rb_method_definition_t::alias_count_ptr, a pointer to the counter. * vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to search the current method entry from value stack. * vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-01* class.c: remove needless include pragmra for method.h.ko1
* struct.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-06* fix namespace issue on singleton class expressions. [Bug #10943]ko1
* vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored to rb_method_definition_t::body.iseq_body.cref. * vm_insnhelper.c: modify SVAR usage. When calling ISEQ type method, push CREF information onto method frame, SVAR located place. Before this fix, SVAR is simply nil. After this patch, CREF (or NULL == Qfalse for not iseq methods) is stored at the method invocation. When SVAR is requierd, then put NODE_IF onto SVAR location, and NDOE_IF::nd_reserved points CREF itself. * vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added. * vm_insnhelper.c (vm_push_frame): accept CREF. * method.h, vm_method.c (rb_add_method_iseq): added. This function accepts iseq and CREF. * class.c (clone_method): use rb_add_method_iseq(). * gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref. * iseq.c: remove CREF related codes. * insns.def (getinlinecache/setinlinecache): CREF should be cache key because a different CREF has a different namespace. * node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR. * proc.c: catch up changes. * struct.c: ditto. * insns.def: ditto. * vm_args.c (raise_argument_error): ditto. * vm_eval.c: ditto. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16iseq.c: struct accessorsnobu
* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): call accessor functions directly, not to be affected by [] and []= methods. [ruby-core:66846] [Bug #10601] * struct.c (define_aref_method, define_aset_method): ditto. * vm_insnhelper.c (rb_vm_opt_struct_aref, rb_vm_opt_struct_aset): direct accessors of Struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10struct.c: use iseqvalnobu
* struct.c (define_aref_method, define_aset_method): use iseq VALUE instead of rb_iseq_t to prevent from GC, as RB_GC_GUARD makes sense only for local variables. [Feature #10575] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-09struct: avoid all O(n) behavior on accessnormal
This avoids O(n) on lookups with structs over 10 members. This also avoids O(n) behavior on all assignments on Struct members. Members 0..9 still use existing C methods to read in O(1) time Benchmark results: vm2_struct_big_aref_hi* 1.305 vm2_struct_big_aref_lo* 1.157 vm2_struct_big_aset* 3.306 vm2_struct_small_aref* 1.015 vm2_struct_small_aset* 3.273 Note: I chose use loading instructions from an array instead of writing directly to linked-lists in compile.c for ease-of-maintainability. We may move the method definitions to prelude.rb-like files in the future. I have also tested this patch with the following patch to disable the C ref_func methods and ensured the test suite and rubyspec works --- a/struct.c +++ b/struct.c @@ -209,7 +209,7 @@ setup_struct(VALUE nstr, VALUE members) ID id = SYM2ID(ptr_members[i]); VALUE off = LONG2NUM(i); - if (i < N_REF_FUNC) { + if (0 && i < N_REF_FUNC) { rb_define_method_id(nstr, id, ref_func[i], 0); } else { * iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): new methods to generate bytecode for struct.c [Feature #10575] * struct.c (rb_struct_ref, rb_struct_set): remove (define_aref_method, define_aset_method): new functions (setup_struct): use new functions * test/ruby/test_struct.rb: add test for struct >10 members * benchmark/bm_vm2_struct_big_aref_hi.rb: new benchmark * benchmark/bm_vm2_struct_big_aref_lo.rb: ditto * benchmark/bm_vm2_struct_big_aset.rb: ditto * benchmark/bm_vm2_struct_small_aref.rb: ditto * benchmark/bm_vm2_struct_small_aset.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-08struct.c: trivial optimizationnobu
* struct.c (rb_struct_set): get rid of calling rb_frame_this_func twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48740 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-08-21struct.c: no rb_class_real twicenobu
* struct.c (inspect_struct): as rb_obj_class() returns real class name, so rb_class_name is not needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47238 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-03-28struct.c: avoid pinning downnobu
* struct.c (rb_struct_set, rb_struct_aref, rb_struct_aset): get rid of pinning down dynamic symbols by SYM2ID. * struct.c (rb_struct_aref_sym, rb_struct_aset_sym): use Symbol instead of ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28struct.c: encoding of member namenobu
* struct.c (not_a_member): preserve encoding of member name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28struct.c: not_a_member messagenobu
* struct.c (not_a_member): extract name error and use same error messages. based on the patch by Marcus Stollsteimer <sto.mar AT web.de> at [ruby-core:61721]. [Bug #9684] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45462 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-20* struct.c (rb_struct_alloc): use RARRAY_CONST_PTR() instead ofko1
RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14[DOC] add links to `Object#hash`nobu
add links to `Object#hash` to each #`hash` methods rdocs. [Fixes GH-567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e