Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Fri, 11 Mar 2022 10:58:23 GMT, Maurizio Cimadamore wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Leave public for the time being > > src/java.base/share/classes/java/lang/runtime/Carrier.java line 48: > >> 46: >> 47: /** >> 48: * This class is used to create anonymous objects that have number and >> types of > > This is a bit ambiguous: anonymous "objects that have number and types of > objects determined at runtime" almost seems like the clients have no control. > I think what you want to say is that the shape is given by the client (e.g. > how many longs, int, objects) - but the underlying implementation can vary. > Maybe something like: > > > A carrier is an anonymous objects that can store component values. > Valid component value types are [...]. Clients can create new carrier > instances by describing a carrier shape, that is, a MethodType whose > parameter types describe the types of the carrier component values. Changed - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Thu, 10 Mar 2022 22:53:39 GMT, Jim Laskey wrote: >> src/java.base/share/classes/java/lang/runtime/Carrier.java line 346: >> >>> 344: * Carrier for longs and integers. >>> 345: */ >>> 346: private final int[] integers; >> >> I believe (@rose00 correct me if I'm wrong) that an `int[]` doesn't >> guarantee proper 64-but alignment of the first element in the array in >> 32-bit platforms. We ran into similar issues with the MemorySegment API, I >> believe. I think using a `long[]` if you want explicit 64-bit alignment is >> the safest choice. > > Makes sense. Easy change. Done - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Fri, 11 Mar 2022 10:42:02 GMT, Maurizio Cimadamore wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Leave public for the time being > > src/java.base/share/classes/java/lang/runtime/Carrier.java line 57: > >> 55: * @since 19 >> 56: */ >> 57: /*non-public*/ > > What does this non-public comment mean? We might switch to package private for String Template preview. I forgot that the test can't locate the class if I make it package private, > src/java.base/share/classes/java/lang/runtime/Carrier.java line 146: > >> 144: * @return constructor with arguments recasted and reordered >> 145: */ >> 146: private static MethodHandle reshapeConstructor(CarrierShape >> carrierShape, > > I like how reshape constructors and components is now shared across both > implementations Refactoring is just another tool for the lazy. ;-) - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Thu, 10 Mar 2022 19:35:16 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: > > Leave public for the time being src/java.base/share/classes/java/lang/runtime/Carrier.java line 48: > 46: > 47: /** > 48: * This class is used to create anonymous objects that have number and > types of This is a bit ambiguous: anonymous "objects that have number and types of objects determined at runtime" almost seems like the clients have no control. I think what you want to say is that the shape is given by the client (e.g. how many longs, int, objects) - but the underlying implementation can vary. Maybe something like: A carrier is an anonymous objects that can store component values. Valid component value types are [...]. Clients can create new carrier instances by describing a carrier shape, that is, a MethodType whose parameter types describe the types of the carrier component values. src/java.base/share/classes/java/lang/runtime/Carrier.java line 57: > 55: * @since 19 > 56: */ > 57: /*non-public*/ What does this non-public comment mean? src/java.base/share/classes/java/lang/runtime/Carrier.java line 146: > 144: * @return constructor with arguments recasted and reordered > 145: */ > 146: private static MethodHandle reshapeConstructor(CarrierShape > carrierShape, I like how reshape constructors and components is now shared across both implementations - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Thu, 10 Mar 2022 22:29:48 GMT, Maurizio Cimadamore wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Leave public for the time being > > src/java.base/share/classes/java/lang/runtime/Carrier.java line 346: > >> 344: * Carrier for longs and integers. >> 345: */ >> 346: private final int[] integers; > > I believe (@rose00 correct me if I'm wrong) that an `int[]` doesn't guarantee > proper 64-but alignment of the first element in the array in 32-bit > platforms. We ran into similar issues with the MemorySegment API, I believe. > I think using a `long[]` if you want explicit 64-bit alignment is the safest > choice. Makes sense. Easy change. - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
On Thu, 10 Mar 2022 19:35:16 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: > > Leave public for the time being src/java.base/share/classes/java/lang/runtime/Carrier.java line 346: > 344: * Carrier for longs and integers. > 345: */ > 346: private final int[] integers; I believe (@rose00 correct me if I'm wrong) that an `int[]` doesn't guarantee proper 64-but alignment of the first element in the array in 32-bit platforms. We ran into similar issues with the MemorySegment API, I believe. I think using a `long[]` if you want explicit 64-bit alignment is the safest choice. - PR: https://git.openjdk.java.net/jdk/pull/7744
Re: RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
> 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: Leave public for the time being - Changes: - all: https://git.openjdk.java.net/jdk/pull/7744/files - new: https://git.openjdk.java.net/jdk/pull/7744/files/4c68ea0d..0849c65d Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=7744=03 - incr: https://webrevs.openjdk.java.net/?repo=jdk=7744=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 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