RFR: 8341277: Validate slot argument for instruction factories

Chen Liang liach at openjdk.org
Wed Oct 2 03:32:45 UTC 2024


On Mon, 30 Sep 2024 23:36:35 GMT, Chen Liang <liach at openjdk.org> wrote:

> Perform validation of local variable slots, multinewarray dimension, iinc value and specify these validations are performed. Specify these exception behaviors for sipush and bipush as well.
> 
> This validation avoids using invalid values that will be lost once class files are written, and avoids invalid value pollution from upstream in chained transformations.
> 
> This changes the exception specs of Class-File API, but does not block the JEP as it does not change the intended functionality of these APIs.
> 
> Unfortunately, I cannot test the DirectCodeBuilder overloads due to it failing to generate stack maps, so the tests are restricted to instruction factories.

I think I can probably add a system property to suppress stack map generation/stack counting to test contracts on `CodeBuilder`, but will do it in a separate patch instead.

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

PR Comment: https://git.openjdk.org/jdk/pull/21275#issuecomment-2387558571


More information about the core-libs-dev mailing list