RFR: 8254807: Optimize startsWith() for String.substring()

Xin Liu xliu at openjdk.java.net
Thu Nov 12 06:32:56 UTC 2020


On Wed, 11 Nov 2020 22:57:50 GMT, Kelvin Nilsen <github.com+51720475+kdnilsen at openjdk.org> wrote:

>> 8254807: Optimize startsWith() for String.substring()
>
> test/hotspot/jtreg/compiler/c2/TestOptimizeSubstring.java line 77:
> 
>> 75:         String newStringAlloc = /*call ,*/"static  wrapper for: _new_array_nozero_Java";
>> 76:         try {
>> 77:             oa = ProcessTools.executeTestJvm("-XX:+UnlockDiagnosticVMOptions", "-Xbootclasspath/a:.",
> 
> Is this comment identifying a future TODO item?  That's not entirely clear to me.

It's not a TODO.  I try to explain why I remove the opcode call here. it's because x86_32.ad uses the capital opcode CALL, which is different from all other architectures.   Unfortunately, `oa.shouldNotContain` and `oa.shouldContain` don't support case-insensitive comparison. 

Without the opcode,  newStringAlloc is still a unique and portable pattern to check `OptimizeSubstring` takes effect or not.

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

PR: https://git.openjdk.java.net/jdk/pull/704


More information about the hotspot-compiler-dev mailing list