On Fri, 11 Mar 2022 15:17:30 GMT, Jim Laskey <[email protected]> wrote:
>> We propose to provide a runtime anonymous carrier class object generator;
>> java.lang.runtime.Carrier. This generator class is designed to share
>> anonymous classes when shapes are similar. For example, if several clients
>> require objects containing two integer fields, then Carrier will ensure that
>> each client generates carrier objects using the same underlying anonymous
>> class.
>>
>> See JBS for details.
>
> Jim Laskey has updated the pull request incrementally with two additional
> commits since the last revision:
>
> - Use long array for primitives
> - Use long arrays for primitives
Marked as reviewed by mcimadamore (Reviewer).
src/java.base/share/classes/java/lang/runtime/Carrier.java line 51:
> 49: * while avoiding primitive boxing associated with collection objects.
> Component values
> 50: * can be primitive or Object. Clients can create new carrier instances
> by describing a
> 51: * carrier <em>shape</em>, that is, a MethodType whose parameter types
> describe the
Suggestion:
* carrier <em>shape</em>, that is, a {@linkplain MethodType method type} whose
parameter types describe the
src/java.base/share/classes/java/lang/runtime/Carrier.java line 380:
> 378: }
> 379:
> 380: return Unsafe.ARRAY_LONG_BASE_OFFSET +
Shouldn't you add the offset of the first `int` value in the array to the
resulting expression? E.g. I'm assuming we're storing `long`s first and `int`s
after? If so, `int` values will be located at an offset from the start of the
array.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7744