8323058: Revisit j.l.classfile.CodeBuilder API surface

Reviewed-by: briangoetz, psandoz
This commit is contained in:
Adam Sotona 2024-05-02 10:08:29 +00:00
parent 286cbf831c
commit ae82405ff7
53 changed files with 725 additions and 876 deletions

View file

@ -1124,7 +1124,7 @@ public final class StringConcatFactory {
}
}
len += args.parameterCount() * ARGUMENT_SIZE_FACTOR;
cb.constantInstruction(len);
cb.loadConstant(len);
cb.invokespecial(STRING_BUILDER, "<init>", INT_CONSTRUCTOR_TYPE);
// At this point, we have a blank StringBuilder on stack, fill it in with .append calls.
@ -1137,7 +1137,7 @@ public final class StringConcatFactory {
}
Class<?> cl = args.parameterType(c);
TypeKind kind = TypeKind.from(cl);
cb.loadInstruction(kind, off);
cb.loadLocal(kind, off);
off += kind.slotSize();
MethodTypeDesc desc = getSBAppendDesc(cl);
cb.invokevirtual(STRING_BUILDER, "append", desc);