[lworld] RFR: 8244975: [lworld] Investigate if VM can implement Object::hashCode by calling ValueBootstrapMethods for inline types [v2]

David Simms dsimms at openjdk.java.net
Mon Aug 10 08:31:04 UTC 2020


On Mon, 10 Aug 2020 06:39:11 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

>> David Simms has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   change javac not to generate equals/hashCode
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java line 1176:
> 
>> 1175:                         final List<Type> parameterTypes = methodDecl.sym.type.getParameterTypes();
>> 1176:                         switch (parameterTypes.size()) {
>> 1177:                             case 0:
> 
> I think this switch should be replaced with if (parameterTypes.size() == 0) - with only one case it reads off to use a
> switch.

Applied comments, thanks !

> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java line 1196:
> 
>> 1195:
>> 1196:             if (requireToString) {
>> 1197:                 // public String toString() { throw new RuntimeException(message); }
> 
> The two statements preceding if (requireToString) viz
> make.at(tree.pos);
>             // Make a body comprising { throw new RuntimeException(""Internal error: This method must have been replaced by
>             javac"); } JCBlock body = make.Block(Flags.SYNTHETIC, List.of(make.Throw(
>                     make.NewClass(null,
>                             null,
>                             make.Ident(names.fromString("RuntimeException")),
>                             List.of(make.Literal(CLASS, "Internal error: This method must have been replaced by javac")),
>                             null))));
> 
> should be folded into the if (requireToString) itself for better readability and encapsulation

Applied comments, thanks !

-------------

PR: https://git.openjdk.java.net/valhalla/pull/136


More information about the valhalla-dev mailing list