Repository navigation
Avoid combining a regular type bound with a ClassObject location in VP - #6208
Conversation
This logic was repeated for both VPResolvedClass and VPFixedClass, and conspicuously missing from VPUnresolvedClass.
Any value known to satisfy the VPClassType constraint is an object, so it must be a reflective object rather than a VM-internal representation.
...as the intersection of the two constraints. If the type is not already known to be a ClassObject, then bundling it into a VPClass with a ClassObject location will incorrectly change the meaning of the type constraint.
|
Jenkins build all |
| if (!location) return NULL; | ||
| } | ||
|
|
||
| if (location->isClassObject() == TR_yes && classObject != TR_yes) |
There was a problem hiding this comment.
Maybe I just need to study more of the surrounding code to better understand how a case such as location->isClassObject() == TR_yes ought to be intersected with classObject == TR_no. Naively speaking, it seems like such an intersection ought to return NULL but it won't in this code. Could you please comment on why returning location is the right answer is every case here ?
There was a problem hiding this comment.
If classObject != TR_maybe, then location has been replaced in the intersection just above, so (if we reach this point) location->isClassObject() == classObject. In particular, when classObject == TR_no, we'll have location->isClassObject() == TR_no as well
So the only way to enter this conditional is with classObject == TR_maybe, which means that we have a pretty non-specific type bound, and location will be more specific. I can add an assertion for TR_maybe if you like. Or I could narrow the condition, but I'd prefer not to because it's currently written to make it obvious that we're catching every case where the interpretation of the type bound would change, i.e. every case where the VPClass below would be incorrect
There was a problem hiding this comment.
Thanks, I see the logic now for returning location exactly in cases that we have more specific information
|
I have reviewed both the refactoring and the logical changes and they look okay to me. @0xdaryl are you okay with this change ? |
...as the intersection of the two constraints. If the type is not already known to be a
ClassObject, then bundling it into aVPClasswith aClassObjectlocation will incorrectly change the meaning of the type constraint.There is also one preparatory refactoring commit, and another commit making a minor improvement to the affected logic
Fixes eclipse-openj9/openj9#13167