hg: amber/amber: ldc the result of XXX.format invocations if all argumens are constants

Hannes Wallnöfer hannes.wallnoefer at oracle.com
Thu Feb 21 16:57:57 UTC 2019


I think for simpler feature sets it might be ok to do this kind of optimisation. But the formatting feature is already quite complicated - it covers over a dozen methods, where each combination of conversion and parameter type may require different handling and sometimes depends on runtime state. 

I think the testing method I came up with is quite ok where I now send all the basic tests through both intrinsics implementations using both explicit and default locales, and also make sure specific tests are run with intrinsics in addition to normal code. 

Adding further optimisation shortcuts makes it quite difficult to say whether they are covered by tests, or whether they prevent other code to be tested. 

Hannes


> Am 21.02.2019 um 09:46 schrieb James Laskey <james.laskey at oracle.com>:
> 
>> 
>>> 
>>> 2. It is not sufficient to rely on the default locale to assume a result.The
>>> user can change the default locale out from underneath you.  That is, you can
>>> only rely on constance for specific format specifiers.
>> 
>> the runtime API (the factory class containing the BSM that does a valueOf) should provide a method that recognize such format, no ?
> 
> Yes and that optimization is done, but for the runtime. 
> 





More information about the amber-dev mailing list