[code-reflection] RFR: Aggregated work on Verifier and BytecodeLift deconstruction [v2]
Paul Sandoz
psandoz at openjdk.org
Wed Nov 6 17:19:45 UTC 2024
On Wed, 6 Nov 2024 11:41:38 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/reflect/code/Value.java line 152:
>>
>>> 150: * @throws IllegalStateException if the declaring block is partially built
>>> 151: */
>>> 152: public boolean isDominatedBy(Set<? extends Value> doms) {
>>
>> It would be better for now to move this method back into the bytecode area as non-public. Currently it's too specialized and not-well defined.
>>
>> From reading the specification one might expect it to return true if this value is dominated be all given values. But, it returns true if any given value does. If none dominate then it checks if there is path back from this value's block to the entry block of the same parent body. That is not directly related to dominance, but related dominance frontiers which is a different concept. Returning true in the second cases doe not mean dominance.
>
> This method tests if the given set of values represent a dominating set for the actual value. I hope the implementation matches the "Dominating sets in directed graphs" definition.
>
> I've moved it here because there are already two uses of the method:
> - BytecodeGenerator::isDefinitelyAssigned needs to test for the dominance of VarStoreOps set to decide if the VarOp can be deferred
> - SlotToVarTransformer::isDominatedByTheSameVar needs to test dominance of set of SlotOp predecessors to identify initial SlotStoreOps.
I understand the motivation, and the documentation is appreciated, but for i now i still think it better to let it soak within the bytecode package. I don't think it is ready to have such prominence in the core API, maybe it never will. That's not imply it is not useful for your purposes, but i am skeptical at the moment of its broad use.
The existing `isDominatedBy` methods on code items have quite a precise meaning with regards to nested hierarchy and block dominance. This method is very different and merges the concept of is-dominated-by-any-value with a dominance-like frontier approach, where values are substituted for their blocks (presumably within the same body, otherwise it does not make much sense) and there is some implicit relation between the values in those blocks. Splitting it in two concepts may make more sense.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/258#discussion_r1831435166
More information about the babylon-dev
mailing list