Thanks John.
Can you expand on why "int.class.isPrimary() == false"? Does this depend on being able to retroactively make Integer the box of the int.class value type?
> + * Value type mirrors are never primaries; their corresponding
> + * box reference types are primaries.
Is this an MVT statement or a longer term statement? With the goal of moving away from MVT's box first model, I would have thought eventually the value type would be the primary and the box would be the secondary. Is that correct?
> + * <em>TBD:</em>An array type returns the primary class
> + * of its component type.
This is definitely a useful addition! We have an equivalent VM-level api for this that makes certain kinds of code easier to write.
> + * A primitive type returns the
> + * corresponding wrapper type.
Same as above - does this depend on making Integer <--> int a valuetype relationship?
> + * The user is expected to perform relevant interning,
What action should the VM take if the user doesn't perform interning? Does the VM need to do any validation of the name / userData pair? Can the same name be used with different data?
makeSecondaryClass(Foo.class, "Foo_A", new Object());
makeSecondaryClass(Foo.class, "Foo_A", new Object());
What's the expected behaviour in this case?
From a VM perspective, this api returns new j.l.Class objects with different names and userData, but exactly the same bytecodes, methods, & fields?
What name is expected to be printed in a stacktrace? I don't know about Hotspot but in J9, we record PCs when creating the stacktrace and only decode to names when necessary which would print the Foo.class name, not the user-supplied name.
--Dan
----- Original message -----
From: John Rose <john.r.r...@oracle.com>
To: Daniel Heidinga <daniel_heidi...@ca.ibm.com>
Cc: Karen Kinnear <karen.kinn...@oracle.com>, valhalla-spec-experts@openjdk.java.net
Subject: Re: minutes Valhalla EG June 07, 2017
Date: Wed, Jun 21, 2017 11:51 AM
On Jun 21, 2017, at 6:55 AM, Daniel Heidinga <daniel_heidi...@ca.ibm.com> wrote:> AI: John - send out javadoc to EG
> derived class := Class.derivedClassFactory(Class mainClass, T userData, String name)In the spirit of the usual "5 min before the meeting" ritual action item panic, I'm trying to review the javadoc for this and can't seem to find it. Can it be sent again?Apologies; here it is, 10 min before the meeting.diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java--- a/src/java.base/share/classes/java/lang/Class.java+++ b/src/java.base/share/classes/java/lang/Class.java@@ -681,6 +681,65 @@public native boolean isPrimitive();/**+ * Determines if the specified {@code Class} object is the+ * primary representative of an underlying class file.+ * Array and primitive classes are never primaries.+ * Other reference type constants of the form {@code X.class}+ * are always primaries.+ * Value type mirrors are never primaries; their corresponding+ * box reference types are primaries.+ *+ * @return true if and only if this class is the primary+ * representative of its underlying class file+ */+ @HotSpotIntrinsicCandidate+ public native boolean isPrimary();++ /**+ * Obtains the primary class corresponding to the specified+ * {@code Class} object, if this class is a secondary class+ * derived from a primary class+ * If this class object is a primary class, it returns the+ * same class object.+ * <em>TBD:</em>An array type returns the primary class+ * of its component type. A primitive type returns the+ * corresponding wrapper type. A value type returns the+ * primary class of its box type. A specialized generic+ * returns the primary class of its template type.+ * <em>OR, an non-total version:</em>Primitive and array classes+ * do not have associated primary classes; they return+ * {@code null} for this query.+ *+ * @return the primary representative of the underlying class file+ */+ @HotSpotIntrinsicCandidate+ public native Class<?> getPrimaryClass();++ /**+ * Creates a new non-primary class for the given primary.+ * This is an internal factory for non-primary classes.+ * The user is expected to perform relevant interning,+ * and manage the type of the user-data component.+ * @param primary the primary class for the new secondary+ * @param name arbitrary name string, to be the name of the new secondary+ * @param userData arbitrary reference to associate with the new secondary+ * @return a fresh secondary class+ * @throws IllegalArgumentException if the first argument is not a primary class+ */+ /*non-public*/+ @HotSpotIntrinsicCandidate+ static native Class<?> makeSecondaryClass(Class<?> primary, String name, Object userData);++ /**+ * Extract the user-data provided when the given secondary class+ * was created by the {@code makeSecondaryClass} factory.+ * Returns {@code null} if it was not created by that factory.+ */+ /*non-public*/+ @HotSpotIntrinsicCandidate+ native Object getSecondaryUserData();++ /*** Returns true if this {@code Class} object represents an annotation* type. Note that if this method returns true, {@link #isInterface()}* would also return true, as all annotation types are also interfaces.