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 33 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
* @throws SecurityException
* If a security manager, <i>s</i>, is present and
* the caller's class loader is not the same as or an
* ancestor of the class loader for the current class and
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo and -> an

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
@@ -455,7 +455,7 @@ void store() {
}

Item invoke() {
MethodType mtype = (MethodType)member.erasure(types);
MethodType mtype = (MethodType)member.externalType(types);
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 about this change

Copy link
Member Author

Choose a reason for hiding this comment

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

The thing is that when the time comes to Generate a var def. For example /*synthetic*/ final Object patt4$temp = ExampleStringTest$StringOps$Split.Split($b$0), the result needs to be stack(object) instead of void for the deconstructor call. The method type of split needs to be (ExampleStringTest.StringOps.Split)java.lang.Object. How can I change that earlier?

@@ -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
…o matchers-experiment

# Conflicts:
#	src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java
#	src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
#	src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
#	test/jdk/jdk/classfile/StackMapsTest.java
@openjdk openjdk bot removed the merge-conflict The pull request has a merge conflict with the target branch label Jul 19, 2024
@openjdk openjdk bot added the merge-conflict The pull request has a merge conflict with the target branch label Aug 8, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 13, 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!

@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

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