<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Chen Liang" <chen.l.liang@oracle.com><br><b>To: </b>"Remi Forax" <forax@univ-mlv.fr><br><b>Cc: </b>"panama-dev" <panama-dev@openjdk.org><br><b>Sent: </b>Thursday, May 8, 2025 5:48:19 PM<br><b>Subject: </b>Re: [External] : Re: ObjectVector<br></blockquote></div><div><style style="display:none;"> P {margin-top:0;margin-bottom:0;} </style></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">


<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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;</div></blockquote><div><br></div><div>Valhalla change several things, for example, we will also want to access an array of Integer! using an IntVector.</div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> in addition, we don't want to expose the size and layout of reference pointers to Java code. </div></blockquote><div><br></div><div>The JDK API exposes Runtime.freeMemory() (and System.gc()), that's enough to find the size of references.</div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Maybe a
 dedicated method in java.util.Arrays is better for this purpose.</div></blockquote><div><br></div><div>This solution seems too restrictive to me, it only answers to the example, i have given.</div><div>what about (on top of my head) fromArray/fromList, intoArray/intoList, eq/ne/same, blend/selectFrom/rearrange ?</div><div><br data-mce-bogus="1"></div><div>regards,</div><div>Rémi</div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">

<hr style="display:inline-block;width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> forax@univ-mlv.fr <forax@univ-mlv.fr><br><b>Sent:</b> Thursday, May 8, 2025 10:43 AM<br><b>To:</b> Chen Liang <chen.l.liang@oracle.com><br><b>Cc:</b> panama-dev <panama-dev@openjdk.org><br><b>Subject:</b> [External] : Re: ObjectVector</font>
<div> </div>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif; font-size:12pt; color:#000000">
<div><br>
</div>
<div><br>
</div>
<hr id="x_zwchr">
<div>
<blockquote style="border-left:2px solid #1010FF; margin-left:5px; padding-left:5px; color:#000; font-weight:normal; font-style:normal; text-decoration:none; font-family:Helvetica,Arial,sans-serif; font-size:12pt">
<b>From: </b>"Chen Liang" <chen.l.liang@oracle.com><br>
<b>To: </b>"Remi Forax" <forax@univ-mlv.fr>, "panama-dev" <panama-dev@openjdk.org><br>
<b>Sent: </b>Thursday, May 8, 2025 5:37:14 PM<br>
<b>Subject: </b>Re: ObjectVector<br>
</blockquote>
</div>
<div><style style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style></div>
<div>
<blockquote style="border-left:2px solid #1010FF; margin-left:5px; padding-left:5px; color:#000; font-weight:normal; font-style:normal; text-decoration:none; font-family:Helvetica,Arial,sans-serif; font-size:12pt">
<div class="x_elementToProof" style="font-family:"Calibri Light","Helvetica Light",sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Remi, where do you plan to use such a vector? Reading from an array of references?</div>
</blockquote>
<div><br>
</div>
<div>yes, read/write,</div>
<div>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.
<br>
</div>
<div><br>
</div>
<blockquote style="border-left:2px solid #1010FF; margin-left:5px; padding-left:5px; color:#000; font-weight:normal; font-style:normal; text-decoration:none; font-family:Helvetica,Arial,sans-serif; font-size:12pt">
<div class="x_elementToProof" style="font-family:"Calibri Light","Helvetica Light",sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:"Calibri Light","Helvetica Light",sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards, Chen</div>
</blockquote>
<div><br>
</div>
<div>regards,</div>
<div>Rémi</div>
<div><br>
</div>
<blockquote style="border-left:2px solid #1010FF; margin-left:5px; padding-left:5px; color:#000; font-weight:normal; font-style:normal; text-decoration:none; font-family:Helvetica,Arial,sans-serif; font-size:12pt">
<hr style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> panama-dev <panama-dev-retn@openjdk.org> on behalf of Remi Forax <forax@univ-mlv.fr><br><b>Sent:</b> Thursday, May 8, 2025 10:31 AM<br><b>To:</b> panama-dev@openjdk.org <panama-dev@openjdk.org><br><b>Subject:</b> ObjectVector</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt"><div class="x_PlainText">Hello,<br>
in java, unlike in C, references are opaque so a lot of operations on the value of the reference are not allowed,<br>
but some still exist like checking if the value is null or not.<br>
<br>
Is there a way to create an ObjectVector that would only implement those simple operations ?<br>
<br>
Or is it a stupid idea given that both ZGC and shenandoah use read-barrier ?<br>
<br>
regards,<br>
Rémi<br>
</div></span></font></div>
<br>
</blockquote>
</div>
</div>
</div><br></blockquote></div></div></body></html>