Allow the pool of hipe constants to grow at runtime
Mon Aug 30 13:31:19 CEST 2010
Paul Guyot writes:
> 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
> 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.
More information about the erlang-patches