RFR: JDK-8282798 java.lang.runtime.Carrier

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Mar 8 17:32:30 UTC 2022


----- Original Message -----
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Jim Laskey" <jlaskey at openjdk.java.net>, "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Sent: Tuesday, March 8, 2022 4:37:41 PM
> Subject: Re: RFR: JDK-8282798 java.lang.runtime.Carrier

> You keep saying “what we need”.  But really, what I think you mean is “what the
> scheme I have in mind needs.”  Can we try and separate these out?  I don’t
> think any of these are *needed*, but maybe you want to make the argument that
> you have a better scheme in mind, and we should choose that scheme, and
> therefore then we might need them.

I'm open to any other schemes, it would be a kind of sad if the carrier API is added to java.lang.runtime to not use it for pattern matching.

So what other scheme you have in mind ?

Rémi

> 
>> On Mar 8, 2022, at 10:04 AM, Remi Forax <forax at univ-mlv.fr> wrote:
>> 
>> Hi Jim,
>> I believe that there is a mismatch about what is needed for the pattern matching
>> and the API you propose.
>> The Carrier API allows to map one tuple of types to one storage representation
>> based on ints, longs and references.
>> 
>> But what we need is to have several shapes for the same storage, mapping is not
>> one to one but many to one, more like how unions are mapped in C.
>> For a switch, if we have several cases, each one need it's own shape to store
>> the bindings but at the same time we also need one field to be the same for all
>> shapes (the field of type int indicating which case match) so one storage but
>> many shapes.
>> 
>> Rémi
>> 
>> ----- Original Message -----
>>> From: "Jim Laskey" <jlaskey at openjdk.java.net>
>>> To: "core-libs-dev" <core-libs-dev at openjdk.java.net>
>>> Sent: Tuesday, March 8, 2022 3:11:39 PM
>>> Subject: RFR: JDK-8282798 java.lang.runtime.Carrier
>> 
>>> 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.
>>> 
>>> -------------
>>> 
>>> Commit messages:
>>> - Introduce java.lang.runtime.Carrier
>>> 
>>> Changes: https://git.openjdk.java.net/jdk/pull/7744/files
>>> Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7744&range=00
>>> Issue: https://bugs.openjdk.java.net/browse/JDK-8282798
>>> Stats: 1085 lines in 2 files changed: 1085 ins; 0 del; 0 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


More information about the core-libs-dev mailing list