jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8315066: Add unsigned bounds and known bits to TypeInt/Long

Open merykitty opened this issue 1 year ago • 10 comments
trafficstars

Hi,

This patch adds unsigned bounds and known bits constraints to TypeInt and TypeLong. This opens more transformation opportunities in an elegant manner as well as helps avoid some ad-hoc rules in Hotspot.

In general, a TypeInt/Long represents a set of values x that satisfies: x s>= lo && x s<= hi && x u>= ulo && x u<= uhi && (x & zeros) == 0 && (~x & ones) == 0. These constraints are not independent, e.g. an int that lies in [0, 3] in signed domain must also lie in [0, 3] in unsigned domain and have all bits but the last 2 being unset. As a result, we must normalize the constraints (tighten the constraints so that they are optimal) before constructing a TypeInt/Long instance.

This is extracted from #15440 , node value transformations are left for later PRs. I have also added unit tests to verify the soundness of constraint normalization.

Please kindly review, thanks a lot.

Testing

  • [x] GHA
  • [x] Linux x64, tier 1-4

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

Issue

  • JDK-8315066: Add unsigned bounds and known bits to TypeInt/Long (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17508

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

Using diff file

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

Webrev

Link to Webrev Comment

merykitty avatar Jan 20 '24 19:01 merykitty

:wave: Welcome back qamai! 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 Jan 20 '24 19:01 bridgekeeper[bot]

@merykitty The following label will be automatically applied to this pull request:

  • hotspot-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 Jan 20 '24 19:01 openjdk[bot]

@TobiHartmann @eme64 I have extracted a part of #15440, could you take a look when you have time, please? Thanks a lot for your help.

merykitty avatar Jan 20 '24 19:01 merykitty

@eme64 Thanks a lot for your reviews, I hope that I have addressed your concerns.

Regarding IR tests, I don't think I can come up with any as there is no node taking advantage of the additional information yet.

merykitty avatar Jan 22 '24 18:01 merykitty

@jaskarth Thanks for looking into this patch. I have tried not having an explicit _dual field but in the end it is too hard and cumbersome without any benefits so I end up with this approach. I will address your suggestions in the next iteration. Regarding contains vs higher_equal, it is mainly due to the fact that contains being a much cheaper operation while higher_equal will do a meet followed by a hash table indexing.

merykitty avatar Jan 25 '24 02:01 merykitty

Regarding contains vs higher_equal, it is mainly due to the fact that contains being a much cheaper operation while higher_equal will do a meet followed by a hash table indexing.

I forgot that higher_equal requires hashconsing- that makes sense to me!

jaskarth avatar Jan 27 '24 23:01 jaskarth

@merykitty 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!

bridgekeeper[bot] avatar Feb 24 '24 23:02 bridgekeeper[bot]

Keep alive.

merykitty avatar Feb 25 '24 17:02 merykitty

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

openjdk[bot] avatar Mar 13 '24 20:03 openjdk[bot]

@merykitty 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!

bridgekeeper[bot] avatar Apr 12 '24 05:04 bridgekeeper[bot]

@merykitty This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar May 10 '24 06:05 bridgekeeper[bot]

/open

merykitty avatar Aug 14 '24 16:08 merykitty

@merykitty This pull request is now open

openjdk[bot] avatar Aug 14 '24 16:08 openjdk[bot]

@eme64 Gentle ping regarding this PR. Thanks a lot.

merykitty avatar Aug 14 '24 16:08 merykitty