Skip to content

[JVM] Resolve conditional clone receivers before runtime type lookup - #563

Open
CaelmBleidd wants to merge 1 commit into
mainfrom
caelmbleidd/jvm-conditional-clone
Open

CaelmBleidd wants to merge 1 commit into
mainfrom
caelmbleidd/jvm-conditional-clone

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

Cloning a receiver read from an object array at a symbolic index can produce a conditional heap reference. The clone approximation currently passes that entire ITE into getTypeStream and throws Unexpected ref, affecting both array and ordinary object clones.

Resolve each feasible receiver alternative with a guarded fork before querying its runtime type. The current model selects which alternative continues now; the other alternative remains scheduled at the same call. Check null before the type query, then run the existing copy and invocation completion once for that receiver.

Validation on JDK11: three normal Java source regressions reproduce the exact getTypeStream/approximateObjectClone failure on unchanged main. After the fix, all five focused tests pass (0 failures/skips): both symbolic-index aliases retain their results, array mutation leaves the original intact, object copies retain shallow payload aliases, and the null alternative throws NullPointerException. Existing array-clone and enum checks pass. Regressions collect ALL terminals and disable coverage stopping so aliases sharing the same instructions are both checked. Module detekt tasks complete; existing nonfatal JVM lint findings remain outside the changed lines. Full CI and the six original Java50 cases have not been rerun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant