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

8269956: [lworld] javac should generate ldc LPoint; for class literal Point.class #501

Closed
wants to merge 2 commits into from

Conversation

sadayapalam
Copy link
Collaborator

@sadayapalam sadayapalam commented Jul 27, 2021

Adjust meaning of type name in class literal expressions. Adjust tests accordingly


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8269956: [lworld] javac should generate ldc LPoint; for class literal Point.class

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/valhalla pull/501/head:pull/501
$ git checkout pull/501

Update a local copy of the PR:
$ git checkout pull/501
$ git pull https://git.openjdk.java.net/valhalla pull/501/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 501

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/valhalla/pull/501.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 27, 2021

👋 Welcome back sadayapalam! A progress list of the required criteria for merging this PR into lworld 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 Jul 27, 2021

@sadayapalam This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8269956: [lworld] javac should generate `ldc LPoint;` for class literal Point.class

Reviewed-by: dsimms, thartmann, mchung

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 2 new commits pushed to the lworld branch:

  • 702f1ba: 8271229: [lworld] Test serviceability/sa/ClhsdbDumpclass.java fails with unexpected end of file
  • 865c6b5: [lworld] Problemlist TestNativeClone until 8270098 is fixed

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the lworld branch, type /integrate in a new comment.

@mlbridge
Copy link

mlbridge bot commented Jul 27, 2021

Webrevs

Copy link
Member

@MrSimms MrSimms left a comment

Runtime tests look okay, assuming they ran ?

@sadayapalam
Copy link
Collaborator Author

sadayapalam commented Jul 27, 2021

Yes, tier1,2,3 were run to identify failing tests and fixes have been provided. Thanks!

Copy link
Member

@TobiHartmann TobiHartmann left a comment

JIT compiler test changes look good to me but why are the changes to the classes passed to addHelperClasses necessary? The method is used to let the test framework know about classes that have compile command annotations like @ForceInline.

@sadayapalam
Copy link
Collaborator Author

sadayapalam commented Jul 27, 2021

I can restore them. In some case these changes came about because of mechanical search and replace.

@TobiHartmann
Copy link
Member

TobiHartmann commented Jul 27, 2021

Yes, please do so for consistency. Thanks!

…ded calls to asValueType() in addHelperClasses method invocation)
@sadayapalam
Copy link
Collaborator Author

sadayapalam commented Jul 27, 2021

Yes, please do so for consistency. Thanks!

Done, Take a look, TIA.

MethodType mtype0 = MethodType.methodType(DefaultConstructor.class);
MethodHandle mh0 = staticInitFactory(DefaultConstructor.class, mtype0);
MethodType mtype0 = MethodType.methodType(DefaultConstructor.class.asValueType());
MethodHandle mh0 = staticInitFactory(DefaultConstructor.val.class, mtype0);
DefaultConstructor o0 = (DefaultConstructor)mh0.invokeExact();
Copy link
Collaborator Author

@sadayapalam sadayapalam Jul 27, 2021

Choose a reason for hiding this comment

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

While the preferred change is go from Point.class to Point.class.asValueType(), here is one of the few places I had to resort to Point.val.class - This is because we don't have a spec for Class#asValueType() similar to Object#getClass() where the compiler munges the return type of the method. As a result, code won't compile unless I change it to Point.val.class format

Copy link
Member

@mlchung mlchung Jul 27, 2021

Choose a reason for hiding this comment

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

What special treatment of Object#getClass in javac?

It's fine with this temporary workaround. FYI. The discussion about disallowingPoint.val.class and Point.ref.class syntax to obtain the primitive value type mirror but use the Class API instead is relevant here.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Looks good.

Copy link
Member

@mlchung mlchung left a comment

Looks okay.

@@ -61,8 +61,8 @@ static Value narrow(Value.ref v) {
@Test
public static void primitiveWidening() throws Throwable {
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle mh1 = lookup.findStatic(PrimitiveTypeConversionTest.class, "narrow", methodType(Value.class, Value.ref.class));
MethodHandle mh2 = mh1.asType(methodType(Value.class, Value.class));
MethodHandle mh1 = lookup.findStatic(PrimitiveTypeConversionTest.class, "narrow", methodType(Value.class.asValueType(), Value.ref.class));
Copy link
Member

@mlchung mlchung Jul 27, 2021

Choose a reason for hiding this comment

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

Suggested change
MethodHandle mh1 = lookup.findStatic(PrimitiveTypeConversionTest.class, "narrow", methodType(Value.class.asValueType(), Value.ref.class));
MethodHandle mh1 = lookup.findStatic(PrimitiveTypeConversionTest.class, "narrow", methodType(Value.class.asValueType(), Value.class.asPrimaryType()));

This change will be needed anyway if it's decided to disallow Value.ref.class and Value.val.class. We can wait until that discussion is resolved.

MethodType mtype0 = MethodType.methodType(DefaultConstructor.class);
MethodHandle mh0 = staticInitFactory(DefaultConstructor.class, mtype0);
MethodType mtype0 = MethodType.methodType(DefaultConstructor.class.asValueType());
MethodHandle mh0 = staticInitFactory(DefaultConstructor.val.class, mtype0);
DefaultConstructor o0 = (DefaultConstructor)mh0.invokeExact();
Copy link
Member

@mlchung mlchung Jul 27, 2021

Choose a reason for hiding this comment

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

What special treatment of Object#getClass in javac?

It's fine with this temporary workaround. FYI. The discussion about disallowingPoint.val.class and Point.ref.class syntax to obtain the primitive value type mirror but use the Class API instead is relevant here.

@mlchung
Copy link
Member

mlchung commented Jul 27, 2021

The test/jdk/java/lang/invoke/VarHandles tests are generated from X-VarHandle*.template files. The templates should be updated and regenerate those tests rather than editing the generated tests. I'll change the templates to replace those test changes after you push this PR.

@sadayapalam
Copy link
Collaborator Author

sadayapalam commented Jul 28, 2021

The test/jdk/java/lang/invoke/VarHandles tests are generated from X-VarHandle*.template files. The templates should be updated and regenerate those tests rather than editing the generated tests. I'll change the templates to replace those test changes after you push this PR.

Thanks!

(See the javadoc for Object#getClass() regarding the actual result type)

@sadayapalam
Copy link
Collaborator Author

sadayapalam commented Jul 28, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Jul 28, 2021

Going to push as commit 8c1359a.
Since your change was applied there have been 2 commits pushed to the lworld branch:

  • 702f1ba: 8271229: [lworld] Test serviceability/sa/ClhsdbDumpclass.java fails with unexpected end of file
  • 865c6b5: [lworld] Problemlist TestNativeClone until 8270098 is fixed

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jul 28, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 28, 2021
@openjdk
Copy link

openjdk bot commented Jul 28, 2021

@sadayapalam Pushed as commit 8c1359a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@sadayapalam sadayapalam deleted the JDK-8269956 branch Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants