Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8348606: [lworld] Substitutability test may perform heap allocations #1364

Draft
wants to merge 2 commits into
base: lworld
Choose a base branch
from

Conversation

liach
Copy link
Member

@liach liach commented Feb 13, 2025

Update substitutability test to use MethodHandles that access independent primitive/pointer instead heap reallocated copies of inlined values with an object header. Need long-term solution for user MethodHandle that accesses nested values in the future; hope the intrinsics can help in the future.

Testing: test/jdk/valhalla and test/hotspot/jtreg/*/valhalla, tier 1-3 tests running.


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8348606: [lworld] Substitutability test may perform heap allocations (Bug - P3)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1364

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1364.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 13, 2025

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

@openjdk
Copy link

openjdk bot commented Feb 13, 2025

@liach This change is no longer ready for integration - check the PR body for details.

@mlbridge
Copy link

mlbridge bot commented Feb 13, 2025

Webrevs

@liach liach marked this pull request as draft February 13, 2025 06:14
@merykitty
Copy link
Member

The reason you are seeing the failures is that you are using Unsafe incorrectly. Note this paragraph:

 * The results are undefined unless one of the following cases is true:
 * <ul>
 * <li>The offset was obtained from {@link #objectFieldOffset} on
 * the {@link java.lang.reflect.Field} of some Java field and the object
 * referred to by {@code o} is of a class compatible with that
 * field's class.
 *
 * <li>The offset and object reference {@code o} (either null or
 * non-null) were both obtained via {@link #staticFieldOffset}
 * and {@link #staticFieldBase} (respectively) from the
 * reflective {@link Field} representation of some Java field.
 *
 * <li>The object referred to by {@code o} is an array, and the offset
 * is an integer of the form {@code B+N*S}, where {@code N} is
 * a valid index into the array, and {@code B} and {@code S} are
 * the values obtained by {@link #arrayBaseOffset} and {@link
 * #arrayIndexScale} (respectively) from the array's class.  The value
 * referred to is the {@code N}<em>th</em> element of the array.
 *
 * </ul>

The wording here is albeit bad, it is not only the result that is undefined, the behaviour itself is undefined.

@liach
Copy link
Member Author

liach commented Feb 13, 2025

Hmm, @fparain recommends this access pattern for me...

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

Successfully merging this pull request may close these issues.

2 participants