[External] : Re: ObjectVector

forax at univ-mlv.fr forax at univ-mlv.fr
Thu May 8 17:02:08 UTC 2025


> From: "Chen Liang" <chen.l.liang at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "panama-dev" <panama-dev at openjdk.org>
> Sent: Thursday, May 8, 2025 5:48:19 PM
> Subject: Re: [External] : Re: ObjectVector

> I think the problem is that when valhalla arrives, we can no longer ensure the
> array of objects we pass to create such a vector has an all-reference layout;

Valhalla change several things, for example, we will also want to access an array of Integer! using an IntVector. 

> in addition, we don't want to expose the size and layout of reference pointers
> to Java code.

The JDK API exposes Runtime.freeMemory() (and System.gc()), that's enough to find the size of references. 

> Maybe a dedicated method in java.util.Arrays is better for this purpose.

This solution seems too restrictive to me, it only answers to the example, i have given. 
what about (on top of my head) fromArray/fromList, intoArray/intoList, eq/ne/same, blend/selectFrom/rearrange ? 

regards, 
Rémi 

> From: forax at univ-mlv.fr <forax at univ-mlv.fr>
> Sent: Thursday, May 8, 2025 10:43 AM
> To: Chen Liang <chen.l.liang at oracle.com>
> Cc: panama-dev <panama-dev at openjdk.org>
> Subject: [External] : Re: ObjectVector

>> From: "Chen Liang" <chen.l.liang at oracle.com>
>> To: "Remi Forax" <forax at univ-mlv.fr>, "panama-dev" <panama-dev at openjdk.org>
>> Sent: Thursday, May 8, 2025 5:37:14 PM
>> Subject: Re: ObjectVector

>> Hi Remi, where do you plan to use such a vector? Reading from an array of
>> references?

> yes, read/write,
> as an example, if we have something like ObjectVector, ArrayList.contains(null)
> can be implemented by reading the array of elements into a vector register and
> then use eq(null) to get a VectorMask.

>> Regards, Chen

> regards,
> Rémi

>> From: panama-dev <panama-dev-retn at openjdk.org> on behalf of Remi Forax
>> <forax at univ-mlv.fr>
>> Sent: Thursday, May 8, 2025 10:31 AM
>> To: panama-dev at openjdk.org <panama-dev at openjdk.org>
>> Subject: ObjectVector
>> Hello,
>> in java, unlike in C, references are opaque so a lot of operations on the value
>> of the reference are not allowed,
>> but some still exist like checking if the value is null or not.

>> Is there a way to create an ObjectVector that would only implement those simple
>> operations ?

>> Or is it a stupid idea given that both ZGC and shenandoah use read-barrier ?

>> regards,
>> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20250508/fbe113db/attachment-0001.htm>


More information about the panama-dev mailing list