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

118 Коммитов

Автор SHA1 Сообщение Дата
mrkn 242ce4b1d3 Revert "Symbol refinements"
Due to assertion failures when VM_CHECK_MODE >= 2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 04:22:08 +00:00
mrkn 01b20daa86 Symbol refinements
* vm_args.c (refine_sym_proc_call): enalbe accidentally disabled
  refinements in Symbol#to_proc.   [Bug #15114]

From: osyo (manga osyo) <manga.osyo@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 04:22:06 +00:00
nobu 4d1e32eac6 Revert "Symbol refinements"
Due to assertion failures when VM_CHECK_MODE >= 2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 08:51:29 +00:00
nobu b94e344b9d Symbol refinements
* vm_args.c (refine_sym_proc_call): enalbe accidentally disabled
  refinements in Symbol#to_proc.   [Bug #15114]

From: osyo (manga osyo) <manga.osyo@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 04:44:34 +00:00
nobu 1a1dd5ccf4 Revert "Symbol refinements [Bug #15114]"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 04:44:33 +00:00
nobu cd5b309575 Symbol refinements [Bug #15114]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 04:34:27 +00:00
ko1 96990203b7 Support targetting TracePoint [Feature #15289]
* vm_trace.c (rb_tracepoint_enable_for_target): support targetting
  TracePoint. [Feature #15289]

  Tragetting TracePoint is only enabled on specified method, proc
  and so on, example: `tp.enable(target: code)`.

  `code` should be consisted of InstructionSeuqnece (iseq)
  (RubyVM::InstructionSeuqnece.of(code) should not return nil)
  If code is a tree of iseq, TracePoint is enabled on all of
  iseqs in a tree.

  Enabled tragetting TracePoints can not enabled again with
  and without target.

* vm_core.h (rb_iseq_t): introduce `rb_iseq_t::local_hooks`
  to store local hooks.
  `rb_iseq_t::aux::trace_events` is renamed to
  `global_trace_events` to contrast with `local_hooks`.

* vm_core.h (rb_hook_list_t): add `rb_hook_list_t::running`
  to represent how many Threads/Fibers are used this list.
  If this field is 0, nobody using this hooks and we can
  delete it.

  This is why we can remove code from cont.c.

* vm_core.h (rb_vm_t): because of above change, we can eliminate
  `rb_vm_t::trace_running` field.
  Also renamed from `rb_vm_t::event_hooks` to `global_hooks`.

* vm_core.h, vm.c (ruby_vm_event_enabled_global_flags): renamed
  from `ruby_vm_event_enabled_flags.

* vm_core.h, vm.c (ruby_vm_event_local_num): added to count
  enabled targetting TracePoints.

* vm_core.h, vm_trace.c (rb_exec_event_hooks): accepts
  hook list.

* vm_core.h (rb_vm_global_hooks): added for convinience.

* method.h (rb_method_bmethod_t): added to maintain Proc
  and `rb_hook_list_t` for bmethod (defined by define_method).

* prelude.rb (TracePoint#enable): extracet a keyword parameter
  (because it is easy than writing in C).
  It calls `TracePoint#__enable` internal method written in C.

* vm_insnhelper.c (vm_trace): check also iseq->local_hooks.

* vm.c (invoke_bmethod): check def->body.bmethod.hooks.

* vm.c (hook_before_rewind): check iseq->local_hooks
  and def->body.bmethod.hooks before rewind by exception.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 18:16:39 +00:00
kazu 84fd997fe6 Avoid compiler depend error
ref r64492

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-22 04:04:06 +00:00
mame cd0fec3728 Add TracePoint#parameters
It can be used to get the parameters' information of method and block.
There was no way to get block parameters.
It was possible but ineffective to get method parameters via Method
object: `tp.defined_class.method(tp.method_id).parameters`
TracePoint#parameters allows us to get the information easily.
[Feature #14694]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-03 05:10:41 +00:00
nobu 2e12695929 method.h: VM_METHOD_TYPE_MINIMUM_BITS
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-28 14:16:48 +00:00
nobu e47da4ddf3 method.h: BITFIELD in rb_method_definition_t
* method.h (rb_method_definition_struct): use BITFIELD for
  rb_method_type_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-28 10:35:28 +00:00
normal 46bfa65fcc internal.h: add BITFIELD macro to aid C99 users
I plan to use this macro to pack other enums in the VM.

* internal.h: add BITFIELD macro
* method.h: use BITFIELD for rb_method_visibility_t
  [ruby-core:85074] [Misc #14395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-27 21:04:42 +00:00
ko1 7fd1183467 Speedup `block.call` [Feature #14330]
* insns.def (getblockparamproxy): introduce new instruction to return
  the `rb_block_param_proxy` object if possible. This object responds
  to `call` method and invoke given block (completely similar to `yield`).

* method.h (OPTIMIZED_METHOD_TYPE_BLOCK_CALL): add new optimized call type
  which is for `rb_block_param_proxy.cal`.

* vm_insnhelper.c (vm_call_method_each_type): ditto.

* vm_insnhelper.c (vm_call_opt_block_call): ditto.

* vm_core.h (BOP_CALL, PROC_REDEFINED_OP_FLAG): add check for `Proc#call`
  redefinition.

* compile.c (iseq_compile_each0): compile to use new insn
  `getblockparamproxy` for method call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07 19:18:49 +00:00
shyouhei db5d556f9b bit-fields other than int is a C99ism
To be precise C90 says "A bit-field may have type int, unsigned
int, or signed int". It is clear that char or enum are NG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:50 +00:00
mame a5e02f249d vm_core.h (rb_iseq_locatoin_t): add a field `code_range`
This change makes each ISeq keep NODE's code range.  This information is
needed for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 08:56:50 +00:00
mame 0a6816ecd7 Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting
`trace2` instruction to the head of method iseq.  So, it just measured
methods defined by `def` keyword.

This commit drastically changes the measuring mechanism of method
coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t*
to runs (i.e., it counts the runs per method entry), and at
`Coverage.result`, it creates the result hash by enumerating all
`rb_method_entry_t*` objects (by `ObjectSpace.each_object`).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 07:16:42 +00:00
ko1 b453fc2cb9 make a func static.
* vm_method.c (rb_resolve_refined_method_callable): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:53:49 +00:00
ko1 8184cb2bc7 remove unused function.
* vm_method.c (rb_method_entry_with_refinements): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:46:05 +00:00
sonots 47dd9bf7d8 Add doxygen comments
* include/ruby/ruby.h (enum ruby_value_type): add doxygen comments
* internal.h (enum imemo_type, struct vm_svar): add doxygen comments
* method.h (rb_method_type_t, rb_method_iseq_t): add doxygen comments

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:31:21 +00:00
nobu a15028bc38 proc.c: super_method of included method
* proc.c (method_super_method): search the next super method along
  the included ancestor chain.  [ruby-core:83114] [Bug #13973]

* vm_method.c (rb_callable_method_entry_without_refinements):
  return the defined class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-06 05:55:11 +00:00
nobu 5c28ff6c41 Revert r59612
* method.h (rb_method_definition_t): rb_method_type_t should be
  unsigned as it needs 5bits at least for signed extension.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-17 23:31:41 +00:00
nobu 3fa2183614 method.h: enum rb_method_definition_t::type
* method.h (rb_method_definition_t): define type as an enum for
  debugging.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-17 14:36:57 +00:00
ko1 37da94857a specify unsigned (fix r58784).
* method.h (rb_method_definition_t#type): specify unsigned explicitly.
 Some compilers (includes VC) returns negative value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 07:54:04 +00:00
normal f82a930490 method.h: pack rb_method_definition_t struct
We only have 12 method types, so 4 bits is enough for
rb_method_type_t.

Size reductions:

- x86-64     48 => 40 bytes
- x86        28 => 24 bytes

* method.h (enum method_optimized_type): split out for CPP
  (struct rb_method_definition struct): pack on unaligned systems
  (rb_method_definition_t): split typedef to help ctags
  [ruby-core:81236] [Feature #13494]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 06:00:53 +00:00
ktsj 8004ad33bc * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
TracePoint#method_id should return method_id, not callee_id.
  [ruby-core:77241] [Feature #12747]

* test/ruby/test_settracefunc.rb: change accordingly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:15:26 +00:00
ko1 3f7c0e9fd5 * method.h: introduce the folliwing field and macros.
* rb_method_definition_t::complemented_count to count shared method
    entries because of complemented method entries and separate from
    alias_count.

    Shared `def' only by complemented method entries should not prevent
    method re-definition warning.

  * METHOD_ENTRY_COMPLEMENTED(me) to represent complemented method entry.
  * METHOD_ENTRY_COMPLEMENTED_SET(me) to check it as  complemented me.

* vm_insnhelper.c (aliased_callable_method_entry): should also
  check me->def->complemented_count.

* vm_method.c (method_definition_addref_complement): add to count
  complemented method entries number.

* vm_method.c (rb_method_definition_release): release `def' iff
  alias_count == 0 and complemented_count == 0.

* test/ruby/test_module.rb: add a test.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18 08:15:51 +00:00
ko1 6a533a3ecc revert r52614, r52615, r52617 because they cause serious errors
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 13:18:19 +00:00
ko1 551ae37ba3 * method.h (METHOD_ENTRY_COMPLEMENTED(_SET)): introduced to recognize
complemented method entries or not. There are some cases that callabe
  method entries do not have defined_class.

* vm_method.c (rb_method_entry_complement_defined_class):
  use METHOD_ENTRY_COMPLEMENTED_SET().




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 10:39:30 +00:00
ko1 fa4e516db9 * method.h: introduce rb_method_definition_t::complemented_count.
* vm_method.c (method_definition_addref_complement): introduced.

  def->alias_count is used to decide warn or do not warn at method
  redefinition. Complented methods should not prevent redefiniton
  warnings.

* vm_method.c (rb_method_definition_release): release def iff
  alias_count == 0 && complemented_count == 0.

* test/ruby/test_module.rb: add a test.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 09:42:39 +00:00
ko1 dd4cec36ca * method.h: constify rb_cref_t::scope_visi;
* eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.

* vm_method.c: ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 17:20:11 +00:00
nobu 0d65138c81 method.h: suppress warnings
* method.h (METHOD_ENTRY_{VISI,BASIC,FLAGS}_SET): suppress
  shift-op-parentheses warnings.  [Fix GH-1082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-08 05:24:45 +00:00
hsbt 825c891b4e * method.h: fix typo. Patch by @davydovanton
[fix GH-1076][ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04 06:40:54 +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 2d855b08d0 * method.h: IMEMO_FL_USER3 and IMEMO_FL_USER4 is not needed any more.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 09:52:50 +00:00
ko1 72cf24c813 * method.h: remove METHOD_ENTRY_SAFE(me) and related code
because $SAFE = 3 and 4 is not available.
  Now, $SAFE is not checked on method dispatch at all.
* vm_eval.c, vm_insnhelper.c, vm_method.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 09:49:53 +00:00
hsbt 4b80f53265 * method.h: typo fix. Patch by @davydovanton [fix GH-1032][ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 04:48:10 +00:00
nobu b026a71750 iseq.h: rb_iseq_t
* iseq.h (rb_iseq_t): also should be defined here for prototype
  declarations arguments.

* method.h (rb_iseq_t): get rid of redefinition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-19 01:53:34 +00:00
nobu 4f46dd034f iseq.h, method.h: fix include guards [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-19 01:48:48 +00:00
nobu 24da2db3e1 vm_method.c: reuse method entry
* vm_method.c (rb_obj_respond_to): reuse found method entry
  instead of searching same entry repeatedly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-19 23:53:12 +00:00
normal 260a7d2c83 method.h: cast checks to int for >= 0 checks
Setting VM_CHECK_MODE to 1 in vm_core.h makes noisy warnings
otherwise.  AFAIK, the signedness of enums is
implementation-dependent, and GCC considers them unsigned and
warns.

Tested on gcc 4.7.2 (Debian 4.7.2-5)

* method.h (METHOD_ENTRY_VISI_SET): cast visi to int
  (METHOD_ENTRY_FLAGS_SET): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-14 09:51:50 +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
ko1 c5618920ed * method.h: constify rb_method_iseq_t::iseqptr.
* proc.c (rb_method_entry_min_max_arity): catch up this fix.
* vm_insnhelper.c (def_iseq_ptr): constify.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 21:19:02 +00:00
ko1 b07e78fa32 * method.h, proc.c (rb_method_entry_location): make it static
and remoev prefix `rb_' because it is used only in proc.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-06 08:35:22 +00:00
ko1 5e8a147480 * method.h: introduce rb_callable_method_entry_t to remove
rb_control_frame_t::klass.
  [Bug #11278], [Bug #11279]
  rb_method_entry_t data belong to modules/classes.
  rb_method_entry_t::owner points defined module or class.
    module M
      def foo; end
    end
  In this case, owner is M.
  rb_callable_method_entry_t data belong to only classes.
  For modules, MRI creates corresponding T_ICLASS internally.
  rb_callable_method_entry_t can also belong to T_ICLASS.
  rb_callable_method_entry_t::defined_class points T_CLASS or
  T_ICLASS.
  rb_method_entry_t data for classes (not for modules) are also
  rb_callable_method_entry_t data because it is completely same data.
  In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class.
  For example, there are classes C and D, and incldues M,
    class C; include M; end
    class D; include M; end
  then, two T_ICLASS objects for C's super class and D's super class
  will be created.
  When C.new.foo is called, then M#foo is searcheed and
  rb_callable_method_t data is used by VM to invoke M#foo.
  rb_method_entry_t data is only one for M#foo.
  However, rb_callable_method_entry_t data are two (and can be more).
  It is proportional to the number of including (and prepending)
  classes (the number of T_ICLASS which point to the module).
  Now, created rb_callable_method_entry_t are collected when
  the original module M was modified. We can think it is a cache.
  We need to select what kind of method entry data is needed.
  To operate definition, then you need to use rb_method_entry_t.
  You can access them by the following functions.
  * rb_method_entry(VALUE klass, ID id);
  * rb_method_entry_with_refinements(VALUE klass, ID id);
  * rb_method_entry_without_refinements(VALUE klass, ID id);
  * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
  To invoke methods, then you need to use rb_callable_method_entry_t
  which you can get by the following APIs corresponding to the
  above listed functions.
  * rb_callable_method_entry(VALUE klass, ID id);
  * rb_callable_method_entry_with_refinements(VALUE klass, ID id);
  * rb_callable_method_entry_without_refinements(VALUE klass, ID id);
  * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
  VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry()
  returns rb_callable_method_entry_t.
  You can check a super class of current method by
  rb_callable_method_entry_t::defined_class.
* method.h: renamed from rb_method_entry_t::klass to
  rb_method_entry_t::owner.
* internal.h: add rb_classext_struct::callable_m_tbl to cache
  rb_callable_method_entry_t data.
  We need to consider abotu this field again because it is only
  active for T_ICLASS.
* class.c (method_entry_i): ditto.
* class.c (rb_define_attr): rb_method_entry() does not takes
  defiend_class_ptr.
* gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS.
* cont.c (fiber_init): rb_control_frame_t::klass is removed.
* proc.c: fix `struct METHOD' data structure because
  rb_callable_method_t has all information.
* vm_core.h: remove several fields.
  * rb_control_frame_t::klass.
  * rb_block_t::klass.
  And catch up changes.
* eval.c: catch up changes.
* gc.c: ditto.
* insns.def: ditto.
* vm.c: ditto.
* vm_args.c: ditto.
* vm_backtrace.c: ditto.
* vm_dump.c: ditto.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
* vm_method.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03 11:24:50 +00:00
nobu 8aee7f7e6a method.h: update argument checks
* method.h (METHOD_ENTRY_VISI_SET, METHOD_ENTRY_BASIC_SET),
  (METHOD_ENTRY_SAFE_SET, METHOD_ENTRY_FLAGS_SET): get rid of
  negative arguments, and safe leve is restricted to 1 now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01 08:18:03 +00:00
ko1 f4d71ad509 * vm_method.c: make a rb_method_definition_t data (def) *after* making
a rb_method_entry_t data (me).
  Normally, `me' points `def'. Some Ruby objects pointed from `def'
  and objects are marked by `me' (mark_method_entry() in gc.c).
  However, `def' is built before making a `me', then nobody can mark
  objects pointed from `def' before making (and pointing from) `me'.
  I hope this patch solve #11244.
* vm_method.c: remove `rb_' prefix from some static functions.
* method.h (rb_method_entry_create): constify
* gc.c (mark_method_entry): add checking `def' and
  `def->body.iseq.iseqptr' availability because they can be NULL.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 07:59:23 +00:00
ko1 c8590d60f1 * method.h: constify rb_method_alias_struct::original_me and
rb_method_refined_struct::orig_me.
* class.c (move_refined_method): use RB_OBJ_WRITE() for
  me->def->body.refined.orig_me.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 08:01:13 +00:00
ko1 0991d0a8ee * method.h (METHOD_ENTRY_BASIC_SET): fix last commit (unbalanced parens).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-11 07:25:38 +00:00
ko1 5421cea252 * method.h (METHOD_ENTRY_BASIC_SET): should clear last bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-11 06:54:49 +00:00
ko1 a5fa5f34b0 * method.h: embed rb_method_entry_t::attr::flags (5 bits) into
rb_method_entry_t::flags to make one word spare space.
  Add some macros to access these flags.
* vm_method.c: use these macros.
* internal.h: define IMEMO_FL_USHIFT and IMEMO_FL_USER[0-4]
  for T_IMEMO local flags.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-10 23:55:33 +00:00