Project

General

Profile

« Previous | Next » 

Revision 37e6c836

Added by alanwu (Alan Wu) over 5 years ago

Lazily insert origins on prepend to save memory

98286e9850936e27e8ae5e4f20858cc9c13d2dde made it so that
Module#include allocates an origin iclass on each use. Since include
is widely used, the extra allocation can contribute significantly to
memory usage.

Instead of always allocating in anticipation of prepend, this change
takes a different approach. The new setup inserts a origin iclass into
the super chains of all the children of the module when prepend happens
for the first time.

rb_ensure_origin is made static again since now that adding an origin
now means walking over all usages, we want to limit the number of places
where we do it.