FieldInsnNode f = (FieldInsnNode)node;
if (shouldDoSetter && isSettingFieldWithPrimitive(f)) {
if (LOG) System.out.println(">> SETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(2,
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(1,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (!shouldDoSetter && isSettingFieldWithPrimitive(f)) {
if (LOG) System.out.println(">> SETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (isSettingFieldWithObject(f)) {
if (LOG) System.out.println(">> SETTING FIELD FROM OBJECT index=" + i);
i = on(instructions, f)
.insertAtOffset(3,
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(2,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (isModifyingFieldWithObject(f)) {
if (LOG) System.out.println(">> SETTING-MODIFYING FIELD FROM OBJECT index=" + i);
i = on(instructions, f)
.insertAtOffset(6,
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(5,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),
new InsnNode(DUP2),
bufferHelper.invokeGetter(f.name))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(5)
.delete(4)
.delete(0)
.transform();
} else if (isLoadingFromField(f)) {
if (LOG) System.out.println("<< LOAD FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(2,
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(0,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),
new InsnNode(DUP2),
bufferHelper.invokeGetter(f.name))
.delete(1)
.delete(0)
.transform();
shouldDoSetter = false;
} else if (isGettingField(f)) {
if (LOG) System.out.println("<< GETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(1,
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(0,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),