[code-reflection] RFR: Model verifier

Paul Sandoz psandoz at openjdk.org
Thu Oct 10 22:54:47 UTC 2024


On Wed, 2 Oct 2024 15:09:05 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> This patch starts work on model `Verifier` and implements following verifications:
>  - operands declaration dominance
>  - `BranchOp` reference arguments matching target block parameters (simple matching by `TypeKind` with erased `int` sub-types)
>  - `ArithmeticOperation`, `TestOperation` and `ConvOp` verified presence of relevant method handler in `InvokableLeafOps`
>  
> `TestSmallCorpus` is improved to verify code model.
> 
> Fixes of bugs newly discovered by the `TestSmallCorpus`:
>  - missing methods in `InvokableLeafOps`
>  - `Interpreter` use of provided lookup for `resolveToMethodType`
>  - `Interpreter` erase  sub-`int` types for `InvokeOp` execution + added `TestLiftCustomBytecode::testEraseInts`
> -  Removed complex sub-`int` types calculation from `BytecodeLift` and `LocalsToVarMapper` 
> - `BytecodeLift` fixed to avoid production of some obsolete block parameters

src/java.base/share/classes/java/lang/reflect/code/interpreter/Verifier.java line 41:

> 39: 
> 40:     @SuppressWarnings("serial")
> 41:     public final class VerifyError extends Error {

I would avoid extending `Error` as it signals some serious abnormal condition when thrown, and these are not intended to be thrown.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/247#discussion_r1796177686


More information about the babylon-dev mailing list