jdk
jdk copied to clipboard
8315066: Add unsigned bounds and known bits to TypeInt/Long
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
: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.
@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.
Webrevs
- 06: Full (d5ad9f1a)
- 05: Full - Incremental (6e2e6c56)
- 04: Full (ffb0abd7)
- 03: Full - Incremental (1faa48b5)
- 02: Full - Incremental (756d6159)
- 01: Full - Incremental (6b417f94)
- 00: Full (12f268a1)
@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.
@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.
@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.
Regarding
containsvshigher_equal, it is mainly due to the fact thatcontainsbeing a much cheaper operation whilehigher_equalwill do ameetfollowed by a hash table indexing.
I forgot that higher_equal requires hashconsing- that makes sense to me!
@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!
Keep alive.
❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.
@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!
@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.
/open
@merykitty This pull request is now open
@eme64 Gentle ping regarding this PR. Thanks a lot.