RFR: 8303078: Reduce allocations when pretty printing JCTree during compilation [v2]

Christoph Dreis duke at openjdk.org
Wed Feb 22 18:22:44 UTC 2023


On Wed, 22 Feb 2023 17:49:25 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Christoph Dreis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8303078: Reduce allocations for single characters in DocPretty
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java line 1246:
> 
>> 1244:             if (tree.paramKind == JCLambda.ParameterKind.EXPLICIT) {
>> 1245:                 printExprs(tree.params);
>> 1246:             } else {
> 
> nit, just below: `String sep = "";` -> `char sep = '\0';` also `sep = ","` -> `sep = ','`?

Done

> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java line 1456:
> 
>> 1454:                     break;
>> 1455:                 case CHAR:
>> 1456:                     print("\'");
> 
> `print(''');` ?

Done

> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java line 1458:
> 
>> 1456:                     print("\'");
>> 1457:                     print(Convert.quote(String.valueOf((char)((Number)tree.value).intValue())));
>> 1458:                     print("\'");
> 
> same: `print(''');` ?

Already resolved

> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java line 1467:
> 
>> 1465:                     break;
>> 1466:                 default:
>> 1467:                     print("\"");
> 
> `print('"');`?

Done

> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java line 1469:
> 
>> 1467:                     print("\"");
>> 1468:                     print(Convert.quote(tree.value.toString()));
>> 1469:                     print("\"");
> 
> same as above

Done

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

PR: https://git.openjdk.org/jdk/pull/12667


More information about the compiler-dev mailing list