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

225 Коммитов

Автор SHA1 Сообщение Дата
marcandre 9777547817 Struct#to_h: Add doc for block form.
Patch by Shuji Kobayashi [doc] [ci skip] [#15454]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 03:43:45 +00:00
svn 62ebf35592 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 08:02:31 +00:00
ko1 05711c45af use `RSTRUCT_CONST_PTR` carefully.
* struct.c: should not use `RSTRUCT_CONST_PTR` with method dispatch
  because pointers can be obsolete after method dispatch. `rb_equal()`
  and so on can dispatch Ruby's methods.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 08:02:29 +00:00
stomar 6928faa6ab struct.c: [DOC] add docs for Struct#filter
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-04 11:44:13 +00:00
ko1 c39797e872 introduce USE_TRANSIENT_HEAP to enable/disable theap.
* include/ruby/ruby.h: intrdocue `USE_TRANSIENT_HEAP` macro
  to enable/disable transient heap.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-01 08:53:44 +00:00
ko1 198ff42258 support theap for T_STRUCT.
* struct.c: members memory can use theap.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30 22:03:42 +00:00
svn 708142cabd * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-29 18:00:14 +00:00
ko1 d3edfdc7d9 use RARRAY_AREF() instead of RARRAY_CONST_PTR().
* class.c (rb_keyword_error_new): use RARRAY_AREF() because
  RARRAY_CONST_PTR() can introduce additional overhead in a futre.
  Same fixes for other files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-29 18:00:02 +00:00
svn 4484390f9b * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-04 23:33:05 +00:00
ko1 f8f77d8423 use RARRAY_AREF().
* struct.c (setup_struct): no need to use Array raw ptr here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-04 23:33:03 +00:00
nobu abe75149d1 Enumerable#to_h with block and so on
[Feature #15143]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-20 15:06:56 +00:00
marcandre c22b853737 Alias Struct#select as Struct#filter. Patch by Kenichi Kamiya.
[Fix GH-#1862] [#1784]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-16 04:00:14 +00:00
nobu 97e05dad7f UNREACHABLE_RETURN
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
  of non-void functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 05:38:07 +00:00
k0kubun 26df9588d6 marshal.c: allow marshalling keyword_init struct
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
2018-01-05 11:44:31 +00:00
stomar 4a8aa278b5 struct.c: [DOC] improve docs for Struct.new
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 10:25:17 +00:00
k0kubun 2406207cbb struct.c: don't explain implementation details
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-12 15:12:05 +00:00
k0kubun 8411f58ed7 struct.c: show `keyword_init: true` on inspect
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-12 15:03:45 +00:00
k0kubun 02015974a3 struct.c: add keyword_init option to Struct.new
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-12-12 08:12:43 +00:00
ko1 baa849443f `th` -> `ec` for `rb_insn_func_t`.
* 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-27 19:08:31 +00:00
glass f5740d18bf Revert "vm_eval.c: add rb_yield_assoc_or_values()"
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-02 07:51:27 +00:00
glass 7ae65b24c2 vm_eval.c: add rb_yield_assoc_or_values()
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-02 05:29:11 +00:00
glass 8875e0ca4a use rb_hash_new_with_size()
* 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-10-01 04:26:25 +00:00
stomar 745f4dd5b8 struct.c: improve rdoc for Struct
* 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-03-01 19:59:03 +00:00
stomar 6b82ba9e26 Fix doc for Hash#dig and Struct#dig
* 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-27 18:07:11 +00:00
nobu 556a1352e4 backward.h: 2.2 deprecated features
* 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-21 05:17:41 +00:00
normal 02887a56e5 doc: restore class documentation for Struct
* 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
2017-02-03 23:58:18 +00:00
akr 577de1e93d replace fixnum by integer in documents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 04:57:49 +00:00
shyouhei 26f59b09fe hide struct internal [Feature #9916]
* 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-08-01 07:23:56 +00:00
nobu da2e0721b1 struct.c: unique members
* 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-16 01:00:13 +00:00
nobu c746d5027d struct.c: struct_make_members_list
* 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
2016-04-16 00:59:42 +00:00
marcandre cb3b463a50 * array.c: Improve and fix documentation for Array#dig
[#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-12-08 05:21:11 +00:00
nobu 0701e5ff46 update rdoc of dig methods [ci skip]
* 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-17 02:25:28 +00:00
nobu 20690026a7 struct.c: dig
* 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 09:21:56 +00:00
hsbt c9baf1fabf * struct.c: Standardize a method signature of Struct#[]=.
[ci skip][fix GH-1095]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16 06:58:43 +00:00
nobu 9044b126e5 struct.c: fix index in message
* 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-11-16 05:46:50 +00:00
nobu 72ff61f4a8 NameError#receiver of uninitialized constant
* 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-10-28 06:24:12 +00:00
ko1 e4198a73d4 * make rb_iseq_t T_IMEMO object (type is imemo_iseq).
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-21 22:52:59 +00:00
nobu 5f745b8313 struct.c: AREF_HASH_UNIT enum
* 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-01 08:17:02 +00:00
nobu f524211ee8 struct.c: AREF_HASH_THRESHOLD enum
* 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-01 08:16:48 +00:00
nobu a672fd8be3 struct.c: hide internal objects
* 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-01 00:30:38 +00:00
nobu e4984cf2d3 struct.c: fix implicit conversions
* 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-07-01 00:28:49 +00:00
naruse f91a556340 * struct.c (struct_member_pos): avoid implicit conversion loses
integer precision: 'long' to 'int'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 23:48:21 +00:00
normal b49075cdf1 move RB_GC_GUARD responsibility to rb_add_method_iseq
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-30 21:07:18 +00:00
normal cef8325e18 struct.c: speedup for big structs
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-30 20:45:44 +00:00
normal 099e6e7817 struct.c: cache member definition in a subclass
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-22 21:50:31 +00:00
ko1 18bbd05709 * method.h: split rb_method_definition_t::flag to several flags.
`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-03 01:39:16 +00:00
ko1 57b817f4c5 * method.h: make rb_method_entry_t a VALUE.
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-02 04:20:30 +00:00
ko1 cd909b553f * class.c: remove needless include pragmra for method.h.
* 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-06-01 06:44:16 +00:00
ko1 d84f9b1694 * fix namespace issue on singleton class expressions. [Bug #10943]
* 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
2015-03-06 12:24:58 +00:00
nobu e4717eaa4c iseq.c: struct accessors
* 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-16 06:18:25 +00:00