RFR: 8215412: Optimize PrintStream.println methods

Remi Forax forax at univ-mlv.fr
Wed Jan 2 12:05:13 UTC 2019

Hi Claes,
did you try instead of having a field 'internal' to inline the class check (this.getClass() == PrintStream.class) at every call site you are reading that field ?

for a method like println(), the VM has to do a class check (if CHA is defeated) before entering the method println so the JIT might be able to remove the check this.getClass() == PrintStream.class because it already know at that point that the current class is PrintStream.

happy new year,

----- Mail original -----
> De: "Claes Redestad" <claes.redestad at oracle.com>
> À: "Roger Riggs" <Roger.Riggs at oracle.com>, "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mercredi 2 Janvier 2019 09:44:20
> Objet: Re: RFR: 8215412: Optimize PrintStream.println methods

> Hi,
> new webrev:
>  http://cr.openjdk.java.net/~redestad/8215412/jdk.02/
> - Adds a forgotten String.valueOf in println(String), making sure all
> methods are semantically the same for
> - Remove the isInternal method and use only exact match with
> PrintStream.class to determine whether to use the optimized paths.
> As before:
> On 2018-12-14 21:22, Claes Redestad wrote:
>> Same performance characteristics in the simple tests I've used to
>> verify this, and no measurable regression (but no speed-up) for classes
>> overriding PrintStream.
> I've withdrawn the related CSR, since it's not relevant for this
> implementation as it doesn't observably alter behavior of types
> inheriting from PrintStream.
> Thanks!
> /Claes

More information about the core-libs-dev mailing list