Project

General

Profile

« Previous | Next » 

Revision 9d9aea7f

Added by normal almost 9 years ago

variable.c: use indices for generic ivars

This reduces memory overhead of ivars for common types such as
T_DATA the same way T_OBJECT does it.

For 9992 accepted clients on an OpenSSL server, this reduces
memory from 77160K to 69248K with the script in
https://bugs.ruby-lang.org/issues/11170

  • variable.c (static int special_generic_ivar): move
    (rb_generic_ivar_table): rewrite for compatibility
    (gen_ivtbl_bytes): new function
    (generic_ivar_get): update to use ivar index
    (generic_ivar_update): ditto
    (generic_ivar_set): ditto
    (generic_ivar_defined): ditto
    (generic_ivar_remove): ditto
    (rb_mark_generic_ivar): ditto
    (givar_i): ditto
    (rb_free_generic_ivar): ditto
    (rb_mark_generic_ivar_tbl): ditto
    (rb_generic_ivar_memsize): ditto
    (rb_copy_generic_ivar): ditto
    (rb_ivar_set): ditto
    (rb_ivar_foreach): ditto
    (rb_ivar_count): ditto
    (givar_mark_i): remove
    (gen_ivtbl_mark): new function
    (gen_ivar_each): ditto
    (iv_index_tbl_extend): update for struct ivar_update
    (iv_index_tbl_newsize): ditto
    [ruby-core:69323] [Feature #11170]

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