hg: amber/amber: ldc the result of XXX.format invocations if all argumens are constants
James Laskey
james.laskey at oracle.com
Thu Feb 21 08:46:54 UTC 2019
Sent from my iPhone
> On Feb 20, 2019, at 6:39 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> ----- Mail original -----
>> De: "Jim Laskey" <james.laskey at oracle.com>
>> À: "Vicente Romero" <vicente.romero at oracle.com>
>> Cc: "amber-dev" <amber-dev at openjdk.java.net>
>> Envoyé: Mercredi 20 Février 2019 23:24:47
>> Objet: Re: hg: amber/amber: ldc the result of XXX.format invocations if all argumens are constants
>
>> Think these changes are problematic on two fronts.
>>
>> 1. We really shouldn’t be passing portions of the tree to the Intrinsics API.
>> The API should be 100% JCTree ignorant. If you go this way then you could wrap
>> JCTree.JCMethodInvocation invocation so that it is opaque to the API. My
>> recommendation is you introduce a new return type and process back in javac.
>
> and the fact that argument are constant or not should also be computed before calling the intrinsic API.
>
That could be done, but the condition of whether the folding is done at compile time has to be determined by the intrinsic. Format is such a case, where even though the arguments are constant, the side effect of changing default locale may void folding.
>
>>
>> 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.
>
>>
>> Cheers,
>>
>> — Jim
>
> Rémi
>
>>
>>
>>
>>
>>
>>
>>> On Feb 20, 2019, at 4:39 PM, vicente.romero at oracle.com wrote:
>>>
>>> Changeset: 07dbd5da612f
>>> Author: vromero
>>> Date: 2019-02-20 15:38 -0500
>>> URL: http://hg.openjdk.java.net/amber/amber/rev/07dbd5da612f
>>>
>>> ldc the result of XXX.format invocations if all argumens are constants
>>>
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/IntrinsicsVisitor.java
>>> !
>>> src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/FormatterProcessor.java
>>> !
>>> src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/HashProcessor.java
>>> !
>>> src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/IntrinsicProcessor.java
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/Intrinsics.java
More information about the amber-dev
mailing list