Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jul 21, 2015
  1. @ko1

    * make rb_iseq_t T_IMEMO object (type is imemo_iseq).

    ko1 authored
      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
  2. @ko1

    * method.h: constify rb_method_iseq_t::iseqptr.

    ko1 authored
    * 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
Commits on Jul 6, 2015
  1. @ko1

    * method.h, proc.c (rb_method_entry_location): make it static

    ko1 authored
      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
Commits on Jul 3, 2015
  1. @ko1

    * method.h: introduce rb_callable_method_entry_t to remove

    ko1 authored
      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
Commits on Jun 25, 2015
  1. @ko1

    * vm_method.c: make a rb_method_definition_t data (def) *after* making

    ko1 authored
      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
Commits on Jun 18, 2015
  1. @ko1

    * method.h: constify rb_method_alias_struct::original_me and

    ko1 authored
      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
Commits on Jun 11, 2015
  1. @ko1

    * method.h (METHOD_ENTRY_BASIC_SET): fix last commit (unbalanced pare…

    ko1 authored
    …ns).
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  2. @ko1

    * method.h (METHOD_ENTRY_BASIC_SET): should clear last bit.

    ko1 authored
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Jun 10, 2015
  1. @ko1

    * method.h: embed rb_method_entry_t::attr::flags (5 bits) into

    ko1 authored
      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
Commits on Jun 6, 2015
  1. @ko1

    * method.h: back to share rb_method_definition_t by

    ko1 authored
      rb_method_entry_t.
      r50728 changed sharing `def's to isolating `def's
      on alias and so on. However, this change conflicts
      future improvement plan. So I change back to sharing approach.
    * method.h: move rb_method_definition_t::flags to
      rb_method_entry_t::attr::flags.
      rb_method_entry_t::attr is union with VALUE because this field
      should have same size of VALUE. rb_method_entry_t is T_IMEMO).
      And also add the following access macros to it's fileds.
      * METHOD_ENTRY_VISI(me)
      * METHOD_ENTRY_BASIC(me)
      * METHOD_ENTRY_SAFE(me)
    * vm_method.c (rb_method_definition_addref): added instead of
      rb_method_definition_clone().
      Do not create new definition, but increment alias_count.
    * class.c (clone_method): catch up this fix.
    * class.c (method_entry_i): ditto.
    * proc.c (mnew_internal): ditto.
    * proc.c (mnew_missing): ditto.
    * vm_eval.c: ditto.
    * vm_insnhelper.c: ditto.
    * vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Jun 5, 2015
  1. @ko1

    * internal.h: move definition of rb_cref_t to method.h.

    ko1 authored
    * eval_intern.h: move definition of rb_scope_visibility_t
      to method.h.
    * method.h: change rb_cref_t::scope_visi from VALUE to
      rb_scope_visibility_t.
      [Bug #11219]
    * vm.c (vm_cref_new): accept rb_method_visibility_t directly.
    * vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0,
      but METHOD_VISI_UNDEF.
    * vm_method.c (rb_scope_visibility_set): don't need to use cast.
    * vm_method.c (rb_scope_module_func_set): ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Jun 4, 2015
  1. @ko1

    * vm_method.c (rb_add_method_iseq): use intermediate struct to

    ko1 authored
      avoid initializing struct with variables.
      [Bug #11217]
    * method.h: add a comment about it.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  2. @ko1

    * method.h: constify rb_method_refined_t::orig_me.

    ko1 authored
      Also constify the following functions.
      * rb_resolve_refined_method()
      * rb_method_entry_with_refinements()
      * rb_method_entry_without_refinements()
      * rb_method_entry_copy()'s parameter.
    * class.c: catch up this fix.
    * vm_insnhelper.c: ditto.
    * vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Jun 3, 2015
  1. @ko1

    * method.h: introduce rb_method_refined_t for refined method entry.

    ko1 authored
    * class.c (move_refined_method): catch up this fix.
    * gc.c (mark_method_entry): ditto.
    * vm_eval.c (vm_call0_body): ditto.
    * vm_insnhelper.c (vm_call_method): ditto.
    * vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  2. @ko1

    * vm_method.c: rename `rb_frame_...' to `rb_scope_...'.

    ko1 authored
    * eval_intern.h: move decl. of rb_scope_visibility_set() to method.h.
    * load.c: catch up this fix.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  3. @ko1

    * method.h: change fileds order to gather frequent acces fields.

    ko1 authored
    * vm_insnhelper.c (vm_call_method): add LIKELY().
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  4. @ko1

    * method.h: split rb_method_definition_t::flag to several flags.

    ko1 authored
      `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
Commits on Jun 2, 2015
  1. @ko1

    * method.h: remove rb_method_iseq_t::iseqval.

    ko1 authored
      While making a r50728, iseqval is needed (to mark correctly),
      but now just iseqptr is enough.
    * class.c: catch up this fix.
    * gc.c: ditto.
    * proc.c: ditto.
    * vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  2. @ko1

    * method.h: make rb_method_entry_t a VALUE.

    ko1 authored
      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
Commits on May 30, 2015
  1. @ko1

    * method.h: fix typo of comments.

    ko1 authored
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  2. @ko1

    * method.h: add VM_METHOD_TYPE_ALIAS rb_method_definition_t::type

    ko1 authored
      to fix [Bug #11173].
      Now, inter class/method alias creates new method entry
      VM_METHOD_TYPE_ALIAS, which has an original method entry.
    * vm_insnhelper.c (find_defiend_class_by_owner): added.
      Search corresponding defined_class from owner class/module.
    * vm_method.c (rb_method_entry_get_without_cache): return me->klass
      directly for defined_class.
      Now, no need to check me->klass any more.
    * vm_method.c (method_entry_set0): separated from method_entry_set().
    * vm_method.c (rb_alias): make method entry has VM_METHOD_TYPE_ALIAS.
    * vm_method.c (release_method_definition): support VM_METHOD_TYPE_ALIAS.
    * vm_method.c (rb_hash_method_definition): ditto.
    * vm_method.c (rb_method_definition_eq): ditto.
    * vm_method.c (release_method_definition): ditto.
    * vm_insnhelper.c (vm_call_method): ditto.
    * vm_insnhelper.c (vm_method_cfunc_entry): ditto.
    * vm_eval.c (vm_call0_body): ditto.
    * gc.c (mark_method_entry): ditto.
    * proc.c (method_def_iseq): ditto.
    * proc.c (method_cref): ditto.
    * proc.c (rb_method_entry_min_max_arity): ditto.
    * test/ruby/test_alias.rb: add tests.
    * test/ruby/test_module.rb: fix a test to catch up current behavior.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  3. @ko1

    * method.h, vm_method.c (rb_free_method_entry): constify a parameter.

    ko1 authored
    * vm_method.c (rb_unlink_method_entry): constify a parameter.
    * vm_core.h: remove useless declaration about rb_unlink_method_entry().
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on May 21, 2015
  1. @ko1

    * iseq.c: constify.

    ko1 authored
    * iseq.h: ditto.
    * method.h: ditto.
    * proc.c: ditto.
    * vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on May 12, 2015
  1. @ko1

    * method.h: remove unused declaration.

    ko1 authored
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Mar 11, 2015
  1. @ko1

    * load.c: removed unused header file "node.h".

    ko1 authored
    * method.h: ditto.
    * symbol.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Mar 8, 2015
  1. @ko1

    * internal.h: define rb_cref_t and change to use it.

    ko1 authored
      rb_cref_t is data type of CREF. Now, the body is still NODE.
      It is easy to understand what is CREF and what is pure NODE.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Mar 6, 2015
  1. @ko1

    * fix namespace issue on singleton class expressions. [Bug #10943]

    ko1 authored
    * 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
Commits on Mar 5, 2015
  1. @ko1

    * internal.h: remove struct method_table_wrapper.

    ko1 authored
      struct method_table_wrapper was introduced to avoid duplicate marking
      for method tables.
      For example, `module M1; def foo; end; end` make one method table
      (mtbl) contains a method `foo`. M1 (T_MODULE) points mtbl.
      Classes C1 and C2 includes M1, then two T_ICLASS objects are created
      and they points mtbl too. In this case, three objects (one T_MODULE
      and two T_ICLASS objects) points same mtbl. On marking phase, these
      three objects mark same mtbl. To avoid such duplication, struct
      method_table_wrapper was introduced.
      However, created two T_ICLASS objects have same or shorter lifetime
      than M1 (T_MODULE) object. So that we only need to mark mtbl from M1,
      not from T_ICLASS objects. This patch tries marking only from M1.
      Note that one `Module#prepend` call creates two T_ICLASS objects.
      One for refering to a prepending Module object, same as
      `Module#include`. We don't nedd to care this T_ICLASS.
      One for moving original mtbl from a prepending class. We need to
      mark such mtbl from this T_ICLASS object. To mark the mtbl,
      we need to use `RCLASS_ORIGIN(klass)` on marking from a prepended
      class `klass`.
    * class.c: ditto.
    * eval.c (rb_using_refinement): ditto.
    * gc.c: ditto.
    * include/ruby/ruby.h: define m_tbl directly. The definition of
      struct RClass should be moved to (srcdir)/internal.h.
    * method.h: remove decl of rb_free_m_tbl_wrapper().
    * object.c: use RCLASS_M_TBL() directly.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Jun 14, 2013
  1. @ko1

    * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,

    ko1 authored
      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
Commits on Dec 17, 2012
  1. @ko1

    * method.h: remove `VM_METHOD_TYPE_CFUNC_FRAMELESS' method type.

    ko1 authored
      This method type is for optimized CFUNC such as Fixnum#+ and so on.
      This feature is half-baked and no way to use them.
      [Background]
      Now, VM has opt_plus instructions to optimize `+' methods for
      some Classes (such as Fixnum, Float (flonum)). We call this
      type of instructions as `specialized instructions'.
      This simple technique improve simple program dramatically.
      However, we can make specialized instructions for only several
      types (classes) and selectors (method names) because a large
      instruction will be slow. In other words, this technique has no
      extensibility.
      To overcome this problem, VM_METHOD_TYPE_CFUNC_FRAMELESS was
      introduced (r37198). This type is a variant of CFUNC, but called
      their functiions directly without building a method frame.
      Any CFUNC method can be defined as frameless methods if a method
      is not needed to make method frame. Frameless methods are faster
      as specialized instructions (a bit slower, but no need to care).
      No problem described at
      http://charlie.bz/blog/why-do-singleton-methods-make-ruby-slow
      because this technique doesn't see class, but see method body
      itself. Alias is also no problem.
      [Problem]
      However, we can't set frameless method type for polymorphic methods
      such as Array#[]. Necessity for method frame depends on which
      parameter type. For example, Fixnum#+ needs method frame if
      coerce is needed. Current VM_METHOD_TYPE_CFUNC_FRAMELESS is not
      flexible and need more tuning to introduce it.
      Expected behavior of frameless method type may be:
      result = optimized_cfunc(params); /* call optimized cfunc */
      if (result == Qundef) { result = normal_cfunc(); }
      This is why I say this feature is half-baked.
      We need to learn primitive method in Smalltalk more.
      (I heard this name at RubyConf Taiwan this month. Thanks!)
      [Conclusion]
      Nobody may use this feature and there is no compatibility issue.
      This feature goes to next minor (2.1?).
    * proc.c (rb_method_entry_arity): ditto.
    * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Dec 13, 2012
  1. @ko1

    * method.h: remove "VM_METHOD_TYPE__MAX" from rb_method_type_t.

    ko1 authored
      rb_method_type_t is not a number and "_MAX" causes misunderstanding.
    * proc.c (rb_method_entry_arity): ditto.
    * vm_eval.c (vm_call0_body): ditto.
    * vm_insnhelper.c (vm_call_method): ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Nov 13, 2012
  1. @ko1

    * vm_insnhelper.c (vm_call_cfunc_with_frame): don't use ci after

    ko1 authored
      EXEC_EVENT_HOOK because ci can be overridden.
    * vm_eval.c: ditto.
    * method.h: change invoker's parameters types.
    * vm_method.c (call_cfunc_invoker_func): ditto.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Oct 25, 2012
  1. @ko1

    * include/ruby/ruby.h, class.c: remove (revert)

    ko1 authored
      `rb_add_method_cfunc_frameless()' API.
      This API is not mature to become an offical API.
      For example, we can not use this API with
      `rb_define_private_method()'.
    * method.h, vm_method.c (rb_add_method_cfunc_frameless): removed.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Oct 23, 2012
  1. @ko1

    * vm_core.h, vm_insnhelper.c, vm_eval.c (OPT_CALL_CFUNC_WITHOUT_FRAME):

    ko1 authored
      add a new otpimization and its macro `OPT_CALL_CFUNC_WITHOUT_FRAME'.
      This optimization makes all cfunc method calls `frameless', which
      is fster than ordinal cfunc method call.
      If `frame' is needed (for example, it calls another method with
      `rb_funcall()'), then build a frame. In other words, this
      optimization delays frame building.
      However, to delay the frame building, we need additional overheads:
      (1) Store the last call information.
      (2) Check the delayed frame buidling before the frame is needed.
      (3) Overhead to build a delayed frame.
      rb_thread_t::passed_ci is storage of delayed cfunc call information.
      (1) is lightweight because it is only 1 assignment to `passed_ci'.
      To achieve (2), we modify GET_THREAD() to check `passed_ci' every
      time. It causes 10% overhead on my envrionment.
      This optimization only works for cfunc methods which do not need
      their `frame'.
      After evaluation on my environment, this optimization does not
      effective every time. Because of this evaluation results, this
      optimization is disabled at default.
    * vm_insnhelper.c, vm.c: add VM_PROFILE* macros to measure behaviour
      of VM internals. I will extend this feature.
    * vm_method.c, method.h: change parameters of the `invoker' function.
      Receive `func' pointer as the first parameter.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Commits on Oct 19, 2012
  1. @ko1

    * method.h (rb_method_cfunc_t::invoker): add new field (func ptr)

    ko1 authored
      `invoker'. `invoker' function invoke cfunc body
      (rb_method_cfunc_t::func).
      `invoker' is set at method definition timing.
      With this change, the big `switch' (branch) in `call_cfunc()'
      is no longer needed.
      However, the performance benefit is only a bit.
    * vm_core.h (rb_call_info_t::aux::func): add a new field to store
      cfunc body function pointer.
    * vm_method.c (call_cfunc_invoker_func): add a new function which
      returns a suitable invoke function.
    * vm_method.c (setup_method_cfunc_struct): added.
    * vm_method.c (rb_add_method): fix to set `invoker'.
    * vm_eval.c (vm_call0_body): catch up above changes.
    * vm_insnhelper.c (call_cfunc): removed.
    * vm_insnhelper.c (vm_call_cfunc): fix to call cfunc body
      with `invoker' function.
    
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Something went wrong with that request. Please try again.