8341199: Use ClassFile's new API loadConstant(int)

Reviewed-by: liach, redestad
This commit is contained in:
Shaojin Wen 2024-09-30 14:12:01 +00:00
parent 860d49db22
commit f1bf469b4e
4 changed files with 9 additions and 9 deletions
src
java.base/share/classes/java/lang
jdk.jfr/share/classes/jdk/jfr/internal

@ -1526,7 +1526,7 @@ public final class StringConcatFactory {
* length = length(this.length, arg0, arg1, ..., argN);
*/
if (staticConcat) {
cb.ldc(length);
cb.loadConstant(length);
} else {
cb.aload(thisSlot)
.getfield(concatClass, "length", CD_int);
@ -1549,7 +1549,7 @@ public final class StringConcatFactory {
* length -= suffix.length();
*/
if (staticConcat) {
cb.ldc(constants[paramCount].length())
cb.loadConstant(constants[paramCount].length())
.isub()
.istore(lengthSlot);
} else {
@ -1557,7 +1557,7 @@ public final class StringConcatFactory {
.getfield(concatClass, "constants", CD_Array_String)
.dup()
.astore(constantsSlot)
.ldc(paramCount)
.loadConstant(paramCount)
.aaload()
.dup()
.astore(suffixSlot)
@ -1572,7 +1572,7 @@ public final class StringConcatFactory {
* buf = newArrayWithSuffix(suffix, length, coder)
*/
if (staticConcat) {
cb.ldc(constants[paramCount]);
cb.loadConstant(constants[paramCount]);
} else {
cb.aload(suffixSlot);
}
@ -1759,10 +1759,10 @@ public final class StringConcatFactory {
.loadLocal(kind, cb.parameterSlot(i));
if (staticConcat) {
cb.ldc(constants[i - 3]);
cb.loadConstant(constants[i - 3]);
} else {
cb.aload(constantsSlot)
.ldc(i - 4)
.loadConstant(i - 4)
.aaload();
}

@ -659,7 +659,7 @@ public class SwitchBootstraps {
MethodTypeDesc.of(ConstantDescs.CD_char));
cb.labelBinding(compare);
cb.ldc(integerLabel);
cb.loadConstant(integerLabel);
cb.if_icmpne(next);
} else if ((caseLabel instanceof Long ||
caseLabel instanceof Float ||

@ -84,7 +84,7 @@ public final class EventClassBuilder {
int index = 0;
for (ValueDescriptor v : fields) {
codeBuilder.iload(1);
codeBuilder.ldc(index);
codeBuilder.loadConstant(index);
Label notEqual = codeBuilder.newLabel();
codeBuilder.if_icmpne(notEqual);
codeBuilder.aload(0); // this

@ -499,7 +499,7 @@ final class EventInstrumentation {
// if (!settingsMethod(eventConfiguration.settingX)) goto fail;
codeBuilder.aload(0);
getEventConfiguration(codeBuilder);
codeBuilder.ldc(index);
codeBuilder.loadConstant(index);
invokevirtual(codeBuilder, TYPE_EVENT_CONFIGURATION, METHOD_EVENT_CONFIGURATION_GET_SETTING);
MethodTypeDesc mdesc = MethodTypeDesc.ofDescriptor("(" + sd.paramType().descriptorString() + ")Z");
codeBuilder.checkcast(sd.paramType());