On Thu, 2 Mar 2023 20:54:39 GMT, Paul Sandoz <psan...@openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   StackMapFrameInfo extracted to top level from StackMapTableAttribute
>
> src/java.base/share/classes/jdk/internal/classfile/instruction/LoadInstruction.java
>  line 66:
> 
>> 64:      * @param slot the local varaible slot to load from
>> 65:      */
>> 66:     static LoadInstruction of(Opcode op, int slot) {
> 
> Should you validate that `slot` is compatible with `op`? (same for the 
> StoreInstruction?)

There are three aspects of this kind of validation:
1. similar to `arrayType` there was an architectural decision to less validate 
so to perform faster
2. static instruction factory does not have the information necessary to 
validate local variable slot, it could theoretically be validated in the 
`CodeBuilder`
3. incompatible slot would most probably prevent stack map generation and such 
code will fail in the later phase, or at least when verification is explicitly 
called on the generated code

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

PR: https://git.openjdk.org/jdk/pull/10982

Reply via email to