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

Srikanth Adayapalam sadayapalam at openjdk.java.net
Mon Aug 10 06:44:36 UTC 2020


On Fri, 7 Aug 2020 23:16:56 GMT, David Simms <dsimms at openjdk.org> wrote:

>> Use ValueBootstrapMethods for Object::hashCode()
>
> 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 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

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

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


More information about the valhalla-dev mailing list