Allow the pool of hipe constants to grow at runtime

Mikael Pettersson mikpe@REDACTED
Mon Aug 30 13:31:19 CEST 2010


Paul Guyot writes:
 > Hello,
 > 
 > The hipe constants pool was previously set to a static, non-growable pool of 1.5 M words. While this works in most setups, an OTP deployment with many natively compiled modules, including modules with a lot of constants, would crash with:
 > 
 > Native code constants pool depleted!
 > 
 > A simple implementation based on a linked-list of pools that maintains the ability to iterate on hipe constant terms (as required by hipe_bifs_show_literals_0) can be found here:
 > 
 > git fetch git://github.com/pguyot/otp.git pg/growable-hipe-constants-pool
 > http://github.com/pguyot/otp/commit/d94f2c6d5d8774eea96e63b0c26e55484cc8bc10
 > 
 > The rationale for not directly using erts_alloc used to be able to quickly tell if a term is constant or not (cf the comment that I removed, since the gc does not refer to the pool anymore, so I guess it is outdated). In the proposed patch, I maintained pools to minimally change the behaviour (indeed, deployments that do not require more than 1.5M words will use a single pool as they previously did, deployments that do will simply, well, not crash) and keep hipe_bifs_show_literals_0.
 > 
 > However, I am wondering if we could simply replace constants_alloc with erts_alloc and either phase out hipe_bifs_show_literals_0, since it's for debugging only, or replace it with an iteration on const_term_table table.

I agree changing this is reasonable.  I haven't seen many bug reports
about the limitation though, certainly none recently.

Please post the patch inline as plain text for review; a quick glance
via github's awful web interface reveals several coding style issues.

/Mikael


More information about the erlang-patches mailing list