Skip to content

Commit

Permalink
keep up-to-date with ow2 asm interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicPlayerA10 committed Sep 7, 2024
1 parent 23f0422 commit 524679e
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// THE POSSIBILITY OF SUCH DAMAGE.
package org.objectweb.asm.tree.analysis;

import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
Expand Down Expand Up @@ -90,8 +91,22 @@ public OriginalSourceValue newOperation(final AbstractInsnNode insn) {
size = 2;
break;
case LDC:
// Values able to be pushed by LDC:
// - int, float, string (object), type (Class, object), type (MethodType, object),
// handle (MethodHandle, object): one word
// - long, double, ConstantDynamic (can produce either single word values, or double word
// values): (up to) two words
Object value = ((LdcInsnNode) insn).cst;
size = value instanceof Long || value instanceof Double ? 2 : 1;
if (value instanceof Long || value instanceof Double) {
// two words guaranteed
size = 2;
} else if (value instanceof ConstantDynamic) {
// might yield two words
size = ((ConstantDynamic) value).getSize();
} else {
// one word guaranteed
size = 1;
}
break;
case GETSTATIC:
size = Type.getType(((FieldInsnNode) insn).desc).getSize();
Expand Down

0 comments on commit 524679e

Please sign in to comment.