Allow the pool of hipe constants to grow at runtime

Paul Guyot pguyot@REDACTED
Sun Aug 29 21:58:07 CEST 2010


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.

Regards,

Paul
-- 
Semiocast                    http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris



More information about the erlang-patches mailing list