Skip to content

Commit

Permalink
8341199: Use ClassFile's new API loadConstant(int)
Browse files Browse the repository at this point in the history
Reviewed-by: liach, redestad
  • Loading branch information
wenshao committed Sep 30, 2024
1 parent 860d49d commit f1bf469
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ public void accept(CodeBuilder cb) {
* length = length(this.length, arg0, arg1, ..., argN);
*/
if (staticConcat) {
cb.ldc(length);
cb.loadConstant(length);
} else {
cb.aload(thisSlot)
.getfield(concatClass, "length", CD_int);
Expand All @@ -1549,15 +1549,15 @@ public void accept(CodeBuilder cb) {
* length -= suffix.length();
*/
if (staticConcat) {
cb.ldc(constants[paramCount].length())
cb.loadConstant(constants[paramCount].length())
.isub()
.istore(lengthSlot);
} else {
cb.aload(thisSlot)
.getfield(concatClass, "constants", CD_Array_String)
.dup()
.astore(constantsSlot)
.ldc(paramCount)
.loadConstant(paramCount)
.aaload()
.dup()
.astore(suffixSlot)
Expand All @@ -1572,7 +1572,7 @@ public void accept(CodeBuilder cb) {
* buf = newArrayWithSuffix(suffix, length, coder)
*/
if (staticConcat) {
cb.ldc(constants[paramCount]);
cb.loadConstant(constants[paramCount]);
} else {
cb.aload(suffixSlot);
}
Expand Down Expand Up @@ -1759,10 +1759,10 @@ public void accept(CodeBuilder cb) {
.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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ private static Consumer<CodeBuilder> generateTypeSwitchSkeleton(Class<?> selecto
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 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void buildSetMethod(ClassBuilder builder) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ private void makeInstrumented() {
// 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());
Expand Down

1 comment on commit f1bf469

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.