Project

General

Profile

Feature #11614

[RFC] use id_table for constant tables

Added by normalperson (Eric Wong) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:71164]

Description

ref: [ruby-core:71142] [ruby-core:71151]

I'm not sure if using rb_class_name in object.c is enough to prevent
breaking all existing code. Until this is sufficiently reviewed,
I have no plans to commit this patch at the moment.

valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage
when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit

before: HEAP SUMMARY:
in use at exit: 2,913,448 bytes in 27,394 blocks
total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc

after: HEAP SUMMARY:
in use at exit: 2,880,056 bytes in 26,712 blocks
total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc

  • class.c (struct clone_const_arg): adjust for id_table (clone_const): ditto (clone_const_i): ditto (rb_mod_init_copy): ditto (rb_singleton_class_clone_and_attach): ditto (rb_include_class_new): ditto (include_modules_at): ditto
  • constant.h (rb_free_const_table): ditto
  • gc.c (free_const_entry_i): ditto (rb_free_const_table): ditto (obj_memsize_of): ditto (mark_const_entry_i): ditto (mark_const_tbl): ditto
  • internal.h (struct rb_classext_struct): ditto
  • object.c (rb_mod_const_set): resolve class name on assignment
  • variable.c (const_update): replace with const_tbl_update (const_tbl_update): new function (fc_i): adjust for id_table (find_class_path): ditto (autoload_const_set): st_update => const_tbl_update (rb_const_remove): adjust for id_table (sv_i): ditto (rb_local_constants_i): ditto (rb_local_constants): ditto (rb_mod_const_at): ditto (rb_mod_const_set): ditto (rb_const_lookup): ditto

Files

0001-use-id_table-for-constant-tables.patch (18.3 KB) 0001-use-id_table-for-constant-tables.patch normalperson (Eric Wong), 10/22/2015 08:54 PM

Associated revisions

Revision 7e85d487
Added by normal almost 4 years ago

ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

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

Revision 53377
Added by normalperson (Eric Wong) almost 4 years ago

ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

Revision 53377
Added by normal almost 4 years ago

ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

Revision 53377
Added by normal almost 4 years ago

ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

Revision 53377
Added by normal almost 4 years ago

ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

History

Updated by normalperson (Eric Wong) almost 4 years ago

normalperson@yhbt.net wrote:

Feature #11614: [RFC] use id_table for constant tables
https://bugs.ruby-lang.org/issues/11614

Any comment? I'm pretty sure this was alright,
but maybe it's 2.4 material. Thanks.

Also related: [ruby-core:71455]
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/71455
http://80x24.org/spew/20151111201126.22805-1-e%4080x24.org/raw
for iv_index_tbl, but that's more likely for 2.4.
ID_TABLE_USE_ID_SERIAL limits the flexibility of id_table greatly :/

#2

Updated by Anonymous almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset r53377.


ChangeLog: add entry for r53376

Oops :x
[ruby-core:72112] [Feature #11614]

Also available in: Atom PDF