-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueTypes: Add support for reference projection arrays #14858
Comments
@gacholio any thoughts on how to approach this? We need to make a distinction in the constant pool between Also we need generate a two ramClass'es for the |
FYI @DanHeidinga |
We could generate a companion class for primitive Objects, similar to how we have The alternative, is to start using signatures instead of simple names internally in the classtables, that way we can name |
I don't have enough context for a useful answer. At a glance this seems like another in a long line of hacks to shoehorn this arguably unnecessary feature into a language that's clearly not designed for it. |
We will need 2 ramClasses for primitive value types, one for the L type and one for the Q type. They could have a pointer pointing to each other. Likely we won't need 2 rom classes. For the Q type ramClass, it can be keyed on |
Currently we dont put signatures in classtables so that would be a new change. Also note that |
The problem we are facing is that with a single definition of a class, This problem is made worse due to the fact that there isnt a consistent way to refer to the type in the constant pool. When creating an instance of the primitive object one uses a classref with the simple name It is illegal to instantiate the reference projection, however it is possible to create an array with it, and that is done with the simple name So the questions are:
|
Noticed the following in the current JEP:
|
That wording is inconsistent with the current behaviour of the RI prototype. In any case, if that is true, we still need to update the internal representation in constant pools and classTables. |
Given the comments above, would it make sense to add a flag to class table queries to indicate which version of the type is requested?
My suggestion would be to leave ROM classes alone, and not put two classes in the table (i.e. what we have today). The query flags can be used to determine how to match the class in the table (knowing only fully-qualified Does this make sense? |
Unlike other GC policies that iterate over both class table and class segments when unloading classes, I remember balanced GC only iterate over the class table (As a result, hidden classes (keyed on rom address) are put into the class table even though class table queries won't find them). I guess we still need to add both ram classes here into the class table to avoid causing problems for balanced GC. |
Or, follow the |
You mean change GC to follow the Q pointer when unloading classes ? |
Right (technically, when marking classes). |
Assuming we don't change the ROM class format, and that the ROM classes are shared between the two RAM classes, we could still put both classes in the table (provided the It still makes sense to me to update the API to specify the input format and desired output with a bit field where value 0 is the current behaviour. Possibly change the implementation to forward the correct bit value onto a new function which would be called from the new cases. |
The class table is peeked by exception backtrace decode based on the ROM class of the PC in the walkback array, so whichever solution we go with, we need to make sure the "real" class is found by that peek. |
1. There are 2 ram classes generated from a primitive value type. One is the L type ram class and the other is the Q type ram class. Add fields Ltype and Qtype into J9Class. No non-primitive value classes, these 2 fields points to the J9Class itself. 2. For primitive VT, only the Q type can be instanciated. Embed the L type J9Class header in the Q type. The different behaviours of L type and Q type can be controlled by J9Class->classFlags. 3. Add new flag J9_FINDCLASS_FLAG_QTYPE to indicate if it is a Q type that is to be found or generated. issue eclipse-openj9#14858 Signed-off-by: Hang Shao <[email protected]>
This is from an older version of the spec. It can be closed. |
Issue Number: 14858 |
In the current model, a given primitive type can have two types, the primary type and the reference projection (AKA the box).
Using
Point
as an example:As a result there are two types of arrays,
Point[]
(the primary type array) andPoint.ref[]
(the reference projection) they are allocated with classrefs"QPoint;"
andPoint
respectively. Note that the first one is a signature and the second is a simple name.It is possible to instantiate
new Point.ref[size]
but notnew Point.ref(...)
This will require updates to our classfile parsers and potentially romclass builders
See http://cr.openjdk.java.net/~dlsmith/jep401/jep401-20211220/specs/primitive-classes-jvms.html#jvms-4.4.1 for java class file encoding
In the JVM we will need two J9Class'es, one for the primitive type, and the other for the value reference projection. I'm not sure that we will need two ROM classes, but thats something we will need to think about.
The text was updated successfully, but these errors were encountered: