8338937: Optimize the string concatenation of ClassDesc

Reviewed-by: liach
This commit is contained in:
Shaojin Wen 2024-09-04 22:45:17 +00:00 committed by Chen Liang
parent d4dfa0127f
commit 55312e1549
7 changed files with 53 additions and 18 deletions

View file

@ -125,7 +125,7 @@ class InvokerBytecodeGenerator {
name = makeDumpableClassName(name);
}
this.name = name;
this.className = CLASS_PREFIX + name;
this.className = CLASS_PREFIX.concat(name);
this.classDesc = ClassDesc.ofInternalName(className);
this.lambdaForm = lambdaForm;
this.invokerName = invokerName;
@ -180,11 +180,16 @@ class InvokerBytecodeGenerator {
if (ctr == null) ctr = 0;
DUMP_CLASS_FILES_COUNTERS.put(className, ctr+1);
}
String sfx = ctr.toString();
while (sfx.length() < 3)
sfx = "0" + sfx;
className += sfx;
return className;
var buf = new StringBuilder(className.length() + 3).append(className);
int ctrVal = ctr;
if (ctrVal < 10) {
buf.repeat('0', 2);
} else if (ctrVal < 100) {
buf.append('0');
}
buf.append(ctrVal);
return buf.toString();
}
static class ClassData {