RFR: 8272131: PhaseMacroExpand::generate_slow_arraycopy crash when clone null CallProjections.fallthrough_ioproj

Tobias Hartmann thartmann at openjdk.java.net
Tue Aug 10 06:32:32 UTC 2021


On Mon, 9 Aug 2021 14:06:47 GMT, Hui Shi <hshi at openjdk.org> wrote:

> This fix a crash in PhaseMacroExpand::generate_slow_arraycopy in following case, because arraycopy node's fallthrough_ioproj is NULL.
> - arraycopy has ArrayIndexOutOfBoundsException exception
> - arraycopy is before an infinite loop
> 
> Fix is not cloning and replacing fallthrough_ioproj when it is NULL.
> 
> 
>     static void foo() {
>         try {
>             Arrays.copyOfRange(src, -1, 128);
>             do {
>             } while (true);
>         } catch (ArrayIndexOutOfBoundsException ex) {
>             count++;
>         }
>     }
> 
> 
> New test is added.
> Test: Linux X64 tier1/tier2/tier3 release/fastdebug passed.

src/hotspot/share/opto/macroArrayCopy.cpp line 1101:

> 1099: 
> 1100:   // When src is negative and arraycopy is before an infinite loop,_callprojs.fallthrough_ioproj
> 1101:   // could be NULL. Not clone and update NULL fallthrough_ioproj.

Maybe replace "Not clone" by "Skip clone".

test/hotspot/jtreg/compiler/arraycopy/TestIllegalArrayCopyBeforeInfiniteLoop.java line 28:

> 26:  * @bug 8272131
> 27:  * @requires vm.compiler2.enabled
> 28:  * @summary ArrayCopy with negative index before infinit loop

Typo `infinit` -> `infinite`

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

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


More information about the hotspot-compiler-dev mailing list