jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8324809: compiler can crash with SOE while proving if two recursive types are disjoint

Open vicente-romero-oracle opened this issue 9 months ago • 4 comments

javac is crashing with SOE while compiling code like:

class Criteria<B extends Builder<? extends Criteria>> {
    public <D extends Builder<E>, E extends Criteria<D>> D builder() {
        return (D) new Builder<>();
    }

}

class Builder<C extends Criteria<? extends Builder<C>>> {}

here while attributing: return (D)new Builder<>(); the compiler is trying to prove that: Builder<C> is castable to D, then as the upper bound of D is Builder<E>, we need to check if Builder<C> is castable to Builder<E>. Then the next step is to try to check if type variables C and E are disjoint. During this process is when the compiler gets out of resources given that

E <: Criteria<D> D <: Builder<E> here we have E again and we start over in an infinite loop,

Here the proposal is to detect cycles in the type arguments graph and accept these type of casts if we find a cycle and thus can't prove if two types are disjoint,

TIA


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Warning

 ⚠️ Found leading lowercase letter in issue title for 8324809: compiler can crash with SOE while proving if two recursive types are disjoint

Issue

  • JDK-8324809: compiler can crash with SOE while proving if two recursive types are disjoint (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19194/head:pull/19194
$ git checkout pull/19194

Update a local copy of the PR:
$ git checkout pull/19194
$ git pull https://git.openjdk.org/jdk.git pull/19194/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19194

View PR using the GUI difftool:
$ git pr show -t 19194

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19194.diff

Webrev

Link to Webrev Comment

vicente-romero-oracle avatar May 11 '24 22:05 vicente-romero-oracle

:wave: Welcome back vromero! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar May 11 '24 22:05 bridgekeeper[bot]

@vicente-romero-oracle This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8324809: compiler can crash with SOE while proving if two recursive types are disjoint

Reviewed-by: mcimadamore

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 402 new commits pushed to the master branch:

  • da9c23ace9bdf398d811a88ed137217dd3167231: 8325384: sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java failing intermittently when main thread is a virtual thread
  • dc184f1099e09cef095cd8438d88dd8a1e6f5522: 8324649: Shenandoah: replace implementation of free set
  • 259915168d6656b1b8ddad03c377082d6a5224e5: 8331202: Support for Duration until another Instant
  • 6f7ddbec7d0bc459d44b6518fe1d982eaba7f37b: 8260633: [macos] java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.html test failed
  • fa3e94d30f11bdccbe290041ae19490ce4940bb1: 8332393: Problemlist compiler/rangechecks/TestArrayAccessAboveRCAfterRCCastIIEliminated.java
  • a33cb9045b2c0cae7d894715d1484e77b7607de6: 8332098: Add missing @ since tags to jdk.jdi
  • 910d77becd15580296687b00fed085ab106cb2eb: 8331953: ubsan: metaspaceShared.cpp:1305:57: runtime error: applying non-zero offset 12849152 to null pointer
  • f9f8d0b48057a02923e36c8e11286b57cc72279e: 8332101: Add an @since to StandardOperation:REMOVE in jdk.dynalink
  • f398cd225012694a586e528936159b6df7b1586c: 8331575: C2: crash when ConvL2I is split thru phi at LongCountedLoop
  • 96c5c3fe75103dc45bc1c3ccce0ab36303121a60: 8329998: Remove double initialization for parts of small TypeArrays in ZObjArrayAllocator
  • ... and 392 more: https://git.openjdk.org/jdk/compare/76cbe4883b5f53843e5140eee2145011fec67e4c...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar May 11 '24 22:05 openjdk[bot]

@vicente-romero-oracle The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar May 11 '24 22:05 openjdk[bot]

Webrevs

mlbridge[bot] avatar May 11 '24 22:05 mlbridge[bot]

/integrate

vicente-romero-oracle avatar May 17 '24 14:05 vicente-romero-oracle

Going to push as commit 39a55e97799b5328da85aaa66c8d23175b305691. Since your change was applied there have been 419 commits pushed to the master branch:

  • b7ae0ae1d7481e66a07f40bf01c5614fdf44c2ed: 8328572: JFR: Use Class.forPrimitiveName(String)
  • e611151796d71c40a9395cb6fbe734f36d4c1b55: 8331281: RISC-V: C2: Support vector-scalar and vector-immediate bitwise logic instructions
  • 44bdf9964eb2dd0eb4034576e1f903a27c410286: 8332239: Improve CSS for block tags
  • 9bb6169a1cba900fa79d63119696efe265762083: 8317621: --add-script should support JavaScript modules
  • 4eb1eaf04477b9a8947a57655cf36380b5b88b5c: 8329617: Update stylesheet for specs and tool documentation
  • d4c2edf2c91a790874c80f1a7bea5bfd4f438bde: 8331855: Convert jdk.jdeps jdeprscan and jdeps to use the Classfile API
  • beeffd4671649e5d8f9c96f0455ac90a82917234: 8332109: Convert remaining tests using com.sun.tools.classfile to ClassFile API
  • e0d1c4b38c7ad2dc67f3d14b0b179b313c85fc0a: 8321428: Deprecate for removal the package java.beans.beancontext
  • 0b0445be2833286b4eace698b91a658de3e7608b: 8331724: Refactor j.l.constant implementation to internal package
  • d84a8fd8762fe9448e73d75ec9dc8c4876b1a709: 8332327: Return _methods_jmethod_ids field back in VMStructs
  • ... and 409 more: https://git.openjdk.org/jdk/compare/76cbe4883b5f53843e5140eee2145011fec67e4c...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar May 17 '24 14:05 openjdk[bot]

@vicente-romero-oracle Pushed as commit 39a55e97799b5328da85aaa66c8d23175b305691.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar May 17 '24 14:05 openjdk[bot]