Skip to content

Commit

Permalink
Serialization code generation conflicts with some instrumenting Java …
Browse files Browse the repository at this point in the history
…agents
  • Loading branch information
apangin committed Apr 12, 2019
1 parent 1280c67 commit 4724c37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/one/nio/serial/gen/DelegateGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ private static void generateRead(ClassVisitor cv, Class cls, FieldDescriptor[] f
mv.visitVarInsn(ALOAD, 2);
mv.visitLdcInsn(unsafe.objectFieldOffset(parentField));
mv.visitTypeInsn(NEW, Type.getInternalName(parentField.getType()));
mv.visitInsn(DUP);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
mv.visitMethodInsn(INVOKESPECIAL, "sun/misc/Unsafe", "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V");
}

Expand Down Expand Up @@ -508,6 +510,8 @@ private static void generateReadJsonField(MethodVisitor mv, FieldDescriptor fd,
mv.visitVarInsn(ALOAD, 2);
mv.visitLdcInsn(unsafe.objectFieldOffset(parentField));
mv.visitTypeInsn(NEW, Type.getInternalName(parentField.getType()));
mv.visitInsn(DUP);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
mv.visitMethodInsn(INVOKESPECIAL, "sun/misc/Unsafe", "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V");
}

Expand Down

0 comments on commit 4724c37

Please sign in to comment.