Skip to content

8333725: Compiler Prototyping for Deconstructors #94

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

Draft
wants to merge 79 commits into
base: master
Choose a base branch
from

Conversation

biboudis
Copy link
Member

@biboudis biboudis commented May 13, 2024

Work-in-progress prototyping of deconstructors.


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

Issue

  • JDK-8333725: Compiler Prototyping for Deconstructors (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 94

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/amber/pull/94.diff

@bridgekeeper
Copy link

bridgekeeper bot commented May 13, 2024

👋 Welcome back abimpoudis! 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.

@openjdk
Copy link

openjdk bot commented May 13, 2024

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

@openjdk
Copy link

openjdk bot commented May 13, 2024

@biboudis this pull request can not be integrated into master 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 matchers-experiment
git fetch https://git.openjdk.org/amber.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label May 13, 2024
@biboudis biboudis marked this pull request as draft May 13, 2024 14:20
@openjdk
Copy link

openjdk bot commented May 13, 2024

⚠️ @biboudis This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label May 13, 2024
@biboudis biboudis force-pushed the matchers-experiment branch from d635684 to ccc44d4 Compare May 27, 2024 11:24
@@ -4286,6 +4366,70 @@ public void visitRecordPattern(JCRecordPattern tree) {
matchBindings = new MatchBindings(outBindings.toList(), List.nil());
}

// todo: follow the protocol in Resolve::selectBest
Copy link
Collaborator

Choose a reason for hiding this comment

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

this method I think belongs in Resolve

@@ -2779,6 +2779,32 @@ public void visitMethodDef(JCMethodDecl tree) {
syms.methodClass);
}

if (tree.sym.isPattern()) {
tree.sym.flags_field |= STATIC;
tree.sym.flags_field |= SYNTHETIC;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we are making synthetic an AST that actually appears in the source?

@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label Jun 3, 2024
expectedRecordTypes = record.getRecordComponents()
.stream()
.map(rc -> types.memberType(site, rc))
.map(t -> types.upward(t, types.captures(t)).baseType())
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure why the upward projection is used here

@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Jun 6, 2024
@biboudis biboudis force-pushed the matchers-experiment branch from 6138923 to 5246297 Compare June 6, 2024 13:46
@biboudis biboudis changed the title Pattern Declarations Compiler Prototyping for Deconstructors Jun 6, 2024
@biboudis biboudis changed the title Compiler Prototyping for Deconstructors 8333725: Compiler Prototyping for Deconstructors Jun 6, 2024
@biboudis biboudis force-pushed the matchers-experiment branch 2 times, most recently from bf45138 to 250d702 Compare June 6, 2024 14:12
@@ -201,7 +202,7 @@ int putName(Name name) {
* Puts a name and type pair into the pool and returns its index.
*/
int putNameAndType(Symbol s) {
return pool.writeIfNeeded(new NameAndType(s.name, descriptorType(s)));
return pool.writeIfNeeded(new NameAndType(s instanceof MethodSymbol ms ? ms.externalName(types) : s.name, descriptorType(s)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

same not sure why you need this change

@biboudis biboudis force-pushed the matchers-experiment branch from 250d702 to a19eff9 Compare June 6, 2024 21:13
Co-authored-by: Angelos Bimpoudis <angelos.bimpoudis@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
@biboudis biboudis force-pushed the matchers-experiment branch from a19eff9 to 4c7b0ba Compare June 7, 2024 07:42
@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label Jun 17, 2024
…o matchers-experiment

# Conflicts:
#	src/java.base/share/classes/java/lang/Class.java
@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Jun 17, 2024
biboudis and others added 6 commits February 7, 2025 10:17
…or partial deconstructor exhaustiveness groups yet. (#15)

* Attempting to add match-failed + partial deconstructors. No support for partial deconstructor exhaustiveness groups yet.

* Error recovery.
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
* Erase pattern signature for records

* Erase pattern signature for deconstructors
# Conflicts:
#	src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Feb 12, 2025
biboudis and others added 15 commits February 12, 2025 15:42
…and match candidate yet. (#20)

* First round of instance patterns. No patterns with separate instance and match candidate yet.

* A very (VERY!) basic support for instance pattern with split receiver and match candidate.

* Align calling convention between instance patterns and deconstructors

* Fix adjustment of `syntheticPattern` computation

---------

Co-authored-by: Angelos Bimpoudis <angelos.bimpoudis@oracle.com>
…23)

* Instance patterns represented by instance methods in the translation

* Second Approach: rely on the mangled name
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 26, 2025

@biboudis This pull request has been inactive for more than 16 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 bridgekeeper bot closed this Mar 26, 2025
@biboudis
Copy link
Member Author

/open

@openjdk openjdk bot reopened this Mar 26, 2025
@openjdk
Copy link

openjdk bot commented Mar 26, 2025

@biboudis This pull request is now open

@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict The pull request has a merge conflict with the target branch
Development

Successfully merging this pull request may close these issues.

5 participants