RFR: 8311583: tableswitch broken by JDK-8310577

David Holmes dholmes at openjdk.org
Fri Jul 7 04:22:55 UTC 2023


On Thu, 6 Jul 2023 19:53:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> I demoted some types for -Wconversion warnings but they're supposed to be larger types to catch overflow for tableswitch and lookupswitch.  Restored old code (except int64_t not jlong).
> Tested with tier1-4.

Functional fix looks good. A couple of suggestions around the test.

Thanks.

src/hotspot/share/interpreter/bytecodes.cpp line 390:

> 388:       // Promote calculation to 64 bits to do range checks, used by the verifier.
> 389:       int64_t lo = (int)Bytes::get_Java_u4(aligned_bcp + 1*jintSize);
> 390:       int64_t hi = (int)Bytes::get_Java_u4(aligned_bcp + 2*jintSize);

Are the int casts needed?

test/hotspot/jtreg/runtime/verifier/TestTableSwitch.java line 31:

> 29:  * @bug 8311583
> 30:  * @library /test/lib
> 31:  * @compile tableswitchp1.jasm lookupswitchp1.jasm

Nit: the filenames and class names could use normal Java camel-case naming style.

test/hotspot/jtreg/runtime/verifier/lookupswitchp1.jasm line 24:

> 22:  */
> 23: 
> 24: public class lookupswitchp1 version 50:0 {

Please add a comment indicating what rule/condition this handwritten bytecode is breaking.

test/hotspot/jtreg/runtime/verifier/tableswitchp1.jasm line 24:

> 22:  */
> 23: 
> 24: public class tableswitchp1 version 50:0 {

Please add a comment indicating what rule/condition this handwritten bytecode is breaking. I think it is just low > hi

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14788#pullrequestreview-1517758442
PR Review Comment: https://git.openjdk.org/jdk/pull/14788#discussion_r1255224751
PR Review Comment: https://git.openjdk.org/jdk/pull/14788#discussion_r1255226436
PR Review Comment: https://git.openjdk.org/jdk/pull/14788#discussion_r1255229831
PR Review Comment: https://git.openjdk.org/jdk/pull/14788#discussion_r1255229574


More information about the hotspot-runtime-dev mailing list