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

8333725: Compiler Prototyping for Deconstructors #94

Draft
wants to merge 43 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
@@ -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 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
src/java.base/share/classes/java/lang/Class.java Outdated Show resolved Hide resolved
src/java.base/share/classes/java/lang/Class.java Outdated Show resolved Hide resolved
src/java.base/share/classes/java/lang/Class.java Outdated Show resolved Hide resolved
src/java.base/share/classes/java/lang/Class.java Outdated Show resolved Hide resolved
@@ -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

Co-authored-by: Angelos Bimpoudis <[email protected]>
Co-authored-by: Jan Lahoda <[email protected]>
Co-authored-by: Vicente Romero <[email protected]>
@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
Copy link
Member Author

Keep it, keep it, keep it.

biboudis and others added 8 commits August 30, 2024 15:26
* A crude sketch of unreflect for deconstructors.

* Reuse the same mangling everywhere.

* Cleanup.
* Switching to Carriers.boxedComponentValueArray

* Fixing UnreflectPattern
* Introduce Deconstructor <: MemberPattern <: Executable

* Fix MemberPattern.setAccessible

* Retain signature of unreflectDeconstructor
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 8, 2024

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

@Rick-24
Copy link

Rick-24 commented Oct 8, 2024 via email

@biboudis
Copy link
Member Author

biboudis commented Oct 9, 2024

Definitely keep it open :D

@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Oct 31, 2024
…periment

# Conflicts:
#	src/java.base/share/classes/java/lang/classfile/AccessFlags.java
#	src/java.base/share/classes/java/lang/classfile/Attribute.java
#	src/java.base/share/classes/java/lang/classfile/AttributedElement.java
#	src/java.base/share/classes/java/lang/classfile/MethodElement.java
#	src/java.base/share/classes/java/lang/reflect/ReflectAccess.java
#	src/java.base/share/classes/jdk/internal/classfile/impl/ClassRemapperImpl.java
#	src/java.base/share/classes/jdk/internal/classfile/impl/UnboundAttribute.java
#	src/java.base/share/native/libjava/Class.c
#	src/java.compiler/share/classes/javax/lang/model/element/Modifier.java
#	src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java
#	src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
#	src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
#	test/jdk/jdk/classfile/StackMapsTest.java
@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label Nov 1, 2024
…periment

# Conflicts:
#	src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Nov 1, 2024
@biboudis biboudis force-pushed the matchers-experiment branch 2 times, most recently from b856cb6 to 7fbda10 Compare November 3, 2024 11:37
- Fix crash when assigning to bindings
- Disallow pattern no matching on all control paths

Co-authored-by: Jan Lahoda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants