[code-reflection] RFR: Assertion Interpreter Implementation
Hannes Greule
hgreule at openjdk.org
Fri Mar 8 07:14:13 UTC 2024
On Fri, 8 Mar 2024 05:01:34 GMT, Ian Graves <igraves at openjdk.org> wrote:
> The interpreter side of the assertion work.
src/java.base/share/classes/java/lang/reflect/code/interpreter/Interpreter.java line 617:
> 615: if (_assert.bodies.size() > 1) {
> 616: Body messageBlock = _assert.bodies.get(1);
> 617: String message = (String) invokeBody(l, messageBlock, oc, List.of());
Seeing this, I think there's a problem coming from the initial work on `assert`. The `detail` part of the assert can have any non-void type. Consider something like
@CodeReflection
static void a(int a) {
assert false : 5 + a;
}
the current model for that is
func @"a" (%0 : int)void -> {
%1 : Var<int> = var %0 @"a";
assert
()boolean -> {
%2 : boolean = constant @"false";
yield %2;
}
()java.lang.String -> {
%3 : int = constant @"5";
%4 : int = var.load %1;
%5 : int = add %3 %4;
yield %5;
};
return;
};
currently resulting in a CCE when using the Interpreter to run it.
----
It also seems like `args` of `invokeBody` is always `List.of()` at the moment, will that change?
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/36#discussion_r1517268126
More information about the babylon-dev
mailing list