[code-reflection] RFR: Assert code modeling [v2]

Paul Sandoz psandoz at openjdk.org
Fri Mar 1 21:44:59 UTC 2024


On Fri, 1 Mar 2024 18:32:17 GMT, Ian Graves <igraves at openjdk.org> wrote:

>> Initial work on the code model for supporting assertions. This PR contains the code model. A subsequent PR will include interpreter updates to execute assertions in IR form.
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Additional assert test for one body

Very good, nearly there, just a few tweaks required.

src/java.base/share/classes/java/lang/reflect/code/op/CoreOps.java line 816:

> 814:         public AssertOp(List<Body.Builder> bodies) {
> 815:             super(new OpDefinition(AssertOp.NAME,
> 816:                     List.of(), List.of(), JavaType.VOID, Map.of(),bodies));

Suggestion:

            super(NAME, List.of());

src/java.base/share/classes/java/lang/reflect/code/op/CoreOps.java line 823:

> 821:         public AssertOp(AssertOp that, CopyContext cc) {
> 822:             super(that, cc);
> 823:             this.bodies = that.bodies;

The copy constructor need to transform the body of the copied operation:

            this.bodies = that.bodies.stream()
                    .map(b -> b.transform(cc, ot).build(this)).toList();

-------------

PR Review: https://git.openjdk.org/babylon/pull/32#pullrequestreview-1912081762
PR Review Comment: https://git.openjdk.org/babylon/pull/32#discussion_r1509576938
PR Review Comment: https://git.openjdk.org/babylon/pull/32#discussion_r1509574069


More information about the babylon-dev mailing list