On Mon, 30 Sep 2024 12:38:47 GMT, Shaojin Wen wrote:
>> The new API loadConstant(int) can shorten the calling path and can replace
>> ldc when the parameter is of int/Integer type.
>
> I think loadConstant should be renamed to ldc
@wenshao You can integrate this patch early even though it's muc
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
I'm in favor of removing `ldc(ConstantDesc)`, keeping the
`ldc(LoadableConstantEntry)` for advanced uses. It's easi
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
I think to address these, we will leave the specification of `loadConstant`
open so we can always flexibly adjust i
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
I consider this a bug in the API, too. Perhaps we could assert against usage
that would have been better expressed
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
I was also curious about a few other seemingly "obvious" small optimizations,
like loading `-1L` as `iconst_m1; i2l
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
I think loadConstant should be renamed to ldc
-
PR Comment: https://git.openjdk.org/jdk/pull/21259#iss
On Mon, 30 Sep 2024 11:17:20 GMT, Chen Liang wrote:
> This can also avoid cp entries for small values and use 2-byte bipush or
> 1-byte constants, both smaller in size.
Yikes, I was unaware `ldc` wouldn't optimize the emitted bytecode but reading
through the code and docs it's pretty obvious.
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
Marked as reviewed by redestad (Reviewer).
-
PR Review: https://git.openjdk.org/jdk/pull/21259#pullreq
On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen wrote:
> The new API loadConstant(int) can shorten the calling path and can replace
> ldc when the parameter is of int/Integer type.
Indeed, loadConstant was invented to be more optimized than ldc. This can also
avoid cp entries for small values an