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

8282953: Drop MemoryLayout::map #667

Closed

Conversation

mcimadamore
Copy link
Collaborator

@mcimadamore mcimadamore commented Mar 10, 2022

This patch removes the MemoryLayout::map method. This method was introduced to add some support for VLA (back when we had unbounded sequence layouts).

This method is quite limited when it comes to define transformations, as it can only alter one layout per call. As such, it is not useful to define global transformations to e.g. flip the endianness of all value layouts nested in a given layout.

We believe we can do much better than this (and have few ideas floating around) - but for the time being we'd like not to take the "good" name for a method that just doesn't seem all that useful.

When removing the method, I realized that the LayoutPath class had a lot of unneeded complexity:

  • the size function is no longer needed, given that all layouts have a size
  • keeping track of selected indices while navigating layout was only useful for the map operation, so I removed it
  • we had two static methods addStride and addScaledOffset which did same thing; I dropped the first - the duplication was introduced when we dropped workarounds for "small" segments, in fact the leading MemorySegment parameter in the first method is now unused;
  • I have greatly simplified the logic to create var handles from layouts; there is no need to do permutations (a similar simpler scheme was also used in the logic for computing offset method handles)

Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/panama-foreign pull/667/head:pull/667
$ git checkout pull/667

Update a local copy of the PR:
$ git checkout pull/667
$ git pull https://git.openjdk.java.net/panama-foreign pull/667/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 667

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/panama-foreign/pull/667.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 10, 2022

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

@openjdk openjdk bot added the rfr Ready for review label Mar 10, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 10, 2022

Webrevs

@openjdk
Copy link

openjdk bot commented Mar 10, 2022

@mcimadamore 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:

8282953: Drop MemoryLayout::map

Reviewed-by: psandoz

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 no new commits pushed to the foreign-preview branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

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

@openjdk openjdk bot added the ready Ready to be integrated label Mar 10, 2022
mcimadamore and others added 2 commits March 11, 2022 10:09
Co-authored-by: Paul Sandoz <paul.d.sandoz@googlemail.com>
Co-authored-by: Paul Sandoz <paul.d.sandoz@googlemail.com>
@mcimadamore
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 11, 2022

Going to push as commit f645d4f.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 11, 2022
@openjdk openjdk bot closed this Mar 11, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Mar 11, 2022
@openjdk
Copy link

openjdk bot commented Mar 11, 2022

@mcimadamore Pushed as commit f645d4f.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants