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

Map-held computed constants #2

Closed
wants to merge 4 commits into from

Conversation

liach
Copy link
Member

@liach liach commented Sep 20, 2023

This is an outline of the 2 computed-constant maps I proposed on leyden-dev list; they are copied from existing cc list and immutable map. They should be constant-foldable in theory but need to be confirmed by testing.

During implementation, I feel that the current CC-list impl can be improved by changing the CAS to CAE, so we just take the witness value instead of calling volatile get explicitly again.

I don't see where the condensers are; can probably think about how these maps can be precomputed by condensers too.


Progress

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

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/2.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 20, 2023

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 4, 2023

@liach This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!


@SuppressWarnings("unchecked")
public IndexedComputedConstantMap(int size,
IntFunction<? extends K> keyMapper,
Copy link
Collaborator

@minborg minborg Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want an enum map, we could just provide:

ICCM(Foo.values().length,
     Foo:ordinal,
     k -> e.values[k],

Maybe there should be a convenience method for this (that might be a bit optimized too).

private final ComputedConstant<V>[] values;

@SuppressWarnings("unchecked")
public IndexedComputedConstantMap(int size,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, it would be possible to assert the invariant that the keyMapper and keyUnmapper match. However, this might defeat the purpose of the construct.

@minborg
Copy link
Collaborator

minborg commented Dec 6, 2023

I have made several prototypes of similar map implementations but was a bit reluctant to add them in the beginning.

@openjdk
Copy link

openjdk bot commented Dec 11, 2023

@liach this pull request can not be integrated into computed-constants due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout cc/map
git fetch https://git.openjdk.org/leyden.git computed-constants
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge computed-constants"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Dec 11, 2023
@minborg
Copy link
Collaborator

minborg commented Jan 5, 2024

@liach Could you please fix the merge conflicts and I will be able to merge this PR.

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Jan 5, 2024
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Jan 5, 2024
@minborg minborg marked this pull request as ready for review January 15, 2024 11:00
@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jan 15, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 2, 2024

@liach This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Feb 18, 2024
@minborg
Copy link
Collaborator

minborg commented Feb 19, 2024

Keep alive

@openjdk
Copy link

openjdk bot commented Mar 13, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 10, 2024

@liach This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@liach
Copy link
Member Author

liach commented Apr 10, 2024

Keep alive.

@bridgekeeper
Copy link

bridgekeeper bot commented May 9, 2024

@liach This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@liach
Copy link
Member Author

liach commented May 10, 2024

Should I close this in favor of the stable values PR in jdk?

@minborg
Copy link
Collaborator

minborg commented May 30, 2024

Should I close this in favor of the stable values PR in jdk?

Yes. Please do that. Thanks for your effort with this PR!

@liach liach closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants