Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v16]

2022-03-29 Thread Jim Laskey
On Mon, 28 Mar 2022 20:32:02 GMT, ExE Boss  wrote:

>> Jim Laskey has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Clean up @return
>
> src/java.base/share/classes/java/lang/runtime/Carrier.java line 330:
> 
>> 328:  * Constructor.
>> 329:  *
>> 330:  * @param primitiveCount  slot count required for primitives
> 
> This isn’t the slot count, but the `long[]` array length, which is half the 
> slot count for `long`s.

Thanks for pointing this out. It is the slot count, but I was over-allocating 
the long array.


diff --git a/src/java.base/share/classes/java/lang/runtime/Carrier.java 
b/src/java.base/share/classes/java/lang/runtime/Carrier.java
index 50a32346417..775df6cb4c3 100644
--- a/src/java.base/share/classes/java/lang/runtime/Carrier.java
+++ b/src/java.base/share/classes/java/lang/runtime/Carrier.java
@@ -331,7 +331,7 @@ public final class Carrier {
  * @param objectCount slot count required for objects
  */
 CarrierArray(int primitiveCount, int objectCount) {
-this.primitives = new long[primitiveCount];
+this.primitives = new long[(primitiveCount + 1) / 2];
 this.objects = new Object[objectCount];
 }
 
@@ -432,10 +432,10 @@ public final class Carrier {
 int longCount = carrierShape.longCount();
 int intCount = carrierShape.intCount();
 int objectCount = carrierShape.objectCount();
-int primitiveSlots = longCount * LONG_SLOTS + intCount;
+int primitiveCount = longCount * LONG_SLOTS + intCount;
 
 MethodHandle constructor = 
MethodHandles.insertArguments(CONSTRUCTOR,
-0, primitiveSlots, objectCount);
+0, primitiveCount, objectCount);
 
 // long array index
 int index = 0;

-

PR: https://git.openjdk.java.net/jdk/pull/7744


Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v16]

2022-03-28 Thread ExE Boss
On Mon, 28 Mar 2022 18:09:29 GMT, Jim Laskey  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 one additional 
> commit since the last revision:
> 
>   Clean up @return

src/java.base/share/classes/java/lang/runtime/Carrier.java line 330:

> 328:  * Constructor.
> 329:  *
> 330:  * @param primitiveCount  slot count required for primitives

This isn’t the slot count, but the `long[]` array length, which is half the 
slot count for `long`s.

-

PR: https://git.openjdk.java.net/jdk/pull/7744


Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v16]

2022-03-28 Thread Jim Laskey
> 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 one additional 
commit since the last revision:

  Clean up @return

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7744/files
  - new: https://git.openjdk.java.net/jdk/pull/7744/files/024d24cb..e577e16a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=7744=15
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=7744=14-15

  Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7744.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7744/head:pull/7744

PR: https://git.openjdk.java.net/jdk/pull/7744