diff --git a/src/main/java/org/redkale/convert/json/JsonDynEncoder.java b/src/main/java/org/redkale/convert/json/JsonDynEncoder.java index 635f8304a..db274bd4b 100644 --- a/src/main/java/org/redkale/convert/json/JsonDynEncoder.java +++ b/src/main/java/org/redkale/convert/json/JsonDynEncoder.java @@ -165,6 +165,8 @@ public abstract class JsonDynEncoder extends ObjectEncoder { mv = (cw.visitMethod( ACC_PUBLIC, "", "(" + jsonfactoryDesc + typeDesc + objEncoderDesc + ")V", null, null)); // mv.setDebug(true); + Label label0 = new Label(); + mv.visitLabel(label0); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); @@ -210,12 +212,21 @@ public abstract class JsonDynEncoder extends ObjectEncoder { mv.visitFieldInsn(PUTFIELD, newDynName, fieldName + "FirstFieldChars", "[C"); } mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("factory", jsonfactoryDesc, null, label0, label2, 1); + mv.visitLocalVariable("type", typeDesc, null, label0, label2, 2); + mv.visitLocalVariable("objectEncoderSelf", objEncoderDesc, null, label0, label2, 3); mv.visitMaxs(1 + elements.size(), 1 + elements.size()); mv.visitEnd(); } { // convertTo 方法 mv = (cw.visitMethod(ACC_PUBLIC, "convertTo", "(" + jsonwriterDesc + valtypeDesc + ")V", null, null)); + Label commaLabel = null; + Label label0 = new Label(); + mv.visitLabel(label0); // mv.setDebug(true); { // if (value == null) { out.writeObjectNull(null); return; } mv.visitVarInsn(ALOAD, 2); @@ -432,6 +443,8 @@ public abstract class JsonDynEncoder extends ObjectEncoder { if (!mustHadComma) { // boolean comma = false; mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 3); + commaLabel = new Label(); + mv.visitLabel(commaLabel); } for (AccessibleObject element : elements) { elementIndex++; @@ -658,6 +671,14 @@ public abstract class JsonDynEncoder extends ObjectEncoder { } } mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("out", "Lorg/redkale/convert/json/JsonWriter;", null, label0, label2, 1); + mv.visitLocalVariable("value", "Lorg/redkale/test/convert/json/Message;", null, label0, label2, 2); + if (commaLabel != null) { + mv.visitLocalVariable("comma", "Z", null, commaLabel, label2, 3); + } mv.visitMaxs(maxLocals, maxLocals); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/convert/pb/ProtobufDynEncoder.java b/src/main/java/org/redkale/convert/pb/ProtobufDynEncoder.java index e3f9e7bb2..d95ea6dc3 100644 --- a/src/main/java/org/redkale/convert/pb/ProtobufDynEncoder.java +++ b/src/main/java/org/redkale/convert/pb/ProtobufDynEncoder.java @@ -134,6 +134,8 @@ public abstract class ProtobufDynEncoder extends ProtobufObjectEncoder { { // 构造函数 mv = (cw.visitMethod( ACC_PUBLIC, "", "(" + pbfactoryDesc + typeDesc + pbencoderDesc + ")V", null, null)); + Label label0 = new Label(); + mv.visitLabel(label0); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); @@ -141,12 +143,20 @@ public abstract class ProtobufDynEncoder extends ProtobufObjectEncoder { mv.visitMethodInsn( INVOKESPECIAL, supDynName, "", "(" + pbfactoryDesc + typeDesc + pbencoderDesc + ")V", false); mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("factory", pbfactoryDesc, null, label0, label2, 1); + mv.visitLocalVariable("type", typeDesc, null, label0, label2, 2); + mv.visitLocalVariable("objectEncoder", pbencoderDesc, null, label0, label2, 3); mv.visitMaxs(4, 4); mv.visitEnd(); } { // convertTo 方法 mv = (cw.visitMethod( ACC_PUBLIC, "convertTo", "(" + pbwriterDesc + enMemberDesc + valtypeDesc + ")V", null, null)); + Label label0 = new Label(); + mv.visitLabel(label0); // if (value == null) return; mv.visitVarInsn(ALOAD, 3); // value Label ifLabel = new Label(); @@ -168,6 +178,8 @@ public abstract class ProtobufDynEncoder extends ProtobufObjectEncoder { "(" + pbwriterDesc + enMemberDesc + objectDesc + ")" + pbwriterDesc, false); mv.visitVarInsn(ASTORE, 4); + Label sublabel = new Label(); + mv.visitLabel(sublabel); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ALOAD, 3); @@ -291,6 +303,13 @@ public abstract class ProtobufDynEncoder extends ProtobufObjectEncoder { INVOKEVIRTUAL, newDynName, "offerWriter", "(" + pbwriterDesc + pbwriterDesc + ")V", false); mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("out", pbwriterDesc, null, label0, label2, 1); + mv.visitLocalVariable("parentMember", enMemberDesc, null, label0, label2, 2); + mv.visitLocalVariable("value", valtypeDesc, null, label0, label2, 3); + mv.visitLocalVariable("subout", pbwriterDesc, null, sublabel, label2, 4); mv.visitMaxs(4, 3); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/net/http/HttpServlet.java b/src/main/java/org/redkale/net/http/HttpServlet.java index 9c414fdc5..baa68fed9 100644 --- a/src/main/java/org/redkale/net/http/HttpServlet.java +++ b/src/main/java/org/redkale/net/http/HttpServlet.java @@ -553,8 +553,8 @@ public class HttpServlet extends Servlet final String interDesc = org.redkale.asm.Type.getDescriptor(this.getClass()); final String requestSupDesc = org.redkale.asm.Type.getDescriptor(Request.class); final String responseSupDesc = org.redkale.asm.Type.getDescriptor(Response.class); - final String requestDesc = org.redkale.asm.Type.getDescriptor(HttpRequest.class); - final String responseDesc = org.redkale.asm.Type.getDescriptor(HttpResponse.class); + final String reqDesc = org.redkale.asm.Type.getDescriptor(HttpRequest.class); + final String respDesc = org.redkale.asm.Type.getDescriptor(HttpResponse.class); final String factfield = "_factServlet"; StringBuilder tmpps = new StringBuilder(); for (Class cz : method.getParameterTypes()) { @@ -593,16 +593,22 @@ public class HttpServlet extends Servlet mv.visitEnd(); } { - mv = (cw.visitMethod(ACC_PUBLIC, "execute", "(" + requestDesc + responseDesc + ")V", null, new String[] { + mv = (cw.visitMethod(ACC_PUBLIC, "execute", "(" + reqDesc + respDesc + ")V", null, new String[] { "java/io/IOException" })); + Label label0 = new Label(); + mv.visitLabel(label0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, newDynName, factfield, interDesc); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn( - INVOKEVIRTUAL, interName, method.getName(), "(" + requestDesc + responseDesc + ")V", false); + mv.visitMethodInsn(INVOKEVIRTUAL, interName, method.getName(), "(" + reqDesc + respDesc + ")V", false); mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("req", reqDesc, null, label0, label2, 1); + mv.visitLocalVariable("resp", respDesc, null, label0, label2, 2); mv.visitMaxs(3, 3); mv.visitEnd(); } @@ -618,7 +624,7 @@ public class HttpServlet extends Servlet mv.visitTypeInsn(CHECKCAST, HttpRequest.class.getName().replace('.', '/')); mv.visitVarInsn(ALOAD, 2); mv.visitTypeInsn(CHECKCAST, HttpResponse.class.getName().replace('.', '/')); - mv.visitMethodInsn(INVOKEVIRTUAL, newDynName, "execute", "(" + requestDesc + responseDesc + ")V", false); + mv.visitMethodInsn(INVOKEVIRTUAL, newDynName, "execute", "(" + reqDesc + respDesc + ")V", false); mv.visitInsn(RETURN); mv.visitMaxs(3, 3); mv.visitEnd(); diff --git a/src/main/java/org/redkale/net/http/Rest.java b/src/main/java/org/redkale/net/http/Rest.java index d585b2a67..40747919a 100644 --- a/src/main/java/org/redkale/net/http/Rest.java +++ b/src/main/java/org/redkale/net/http/Rest.java @@ -2136,6 +2136,8 @@ public final class Rest { ACC_PUBLIC, entry.newMethodName, "(" + reqDesc + respDesc + ")V", null, new String[] { "java/io/IOException" })); + Label label0 = new Label(); + mv.visitLabel(label0); // mv.setDebug(true); mv.debugLine(); @@ -3990,6 +3992,11 @@ public final class Rest { mv.visitInsn(RETURN); maxLocals++; } + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("req", reqDesc, null, label0, label2, 1); + mv.visitLocalVariable("resp", respDesc, null, label0, label2, 2); mv.visitMaxs(maxStack, maxLocals); mappingMap.put("params", paramMaps); @@ -4013,6 +4020,8 @@ public final class Rest { } { mv = new MethodDebugVisitor(cw2.visitMethod(0, "", "(L" + newDynName + ";)V", null, null)); + Label sublabel0 = new Label(); + mv.visitLabel(sublabel0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, httpServletName, "", "()V", false); mv.visitVarInsn(ALOAD, 0); @@ -4026,6 +4035,16 @@ public final class Rest { mv.visitInsn(entry.nonBlocking ? ICONST_1 : ICONST_0); mv.visitFieldInsn(PUTFIELD, newDynName + "$" + entry.newActionClassName, "_nonBlocking", "Z"); mv.visitInsn(RETURN); + Label sublabel2 = new Label(); + mv.visitLabel(sublabel2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, sublabel0, sublabel2, 0); + mv.visitLocalVariable( + "parentServlet", + "L" + newDynName + "$" + entry.newActionClassName + ";", + null, + sublabel0, + sublabel2, + 1); mv.visitMaxs(2, 2); mv.visitEnd(); } @@ -4045,6 +4064,8 @@ public final class Rest { cw2.visitMethod(ACC_PUBLIC, "execute", "(" + reqDesc + respDesc + ")V", null, new String[] { "java/io/IOException" })); + Label sublabel0 = new Label(); + mv.visitLabel(sublabel0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn( GETFIELD, @@ -4056,6 +4077,11 @@ public final class Rest { mv.visitMethodInsn( INVOKEVIRTUAL, newDynName, entry.newMethodName, "(" + reqDesc + respDesc + ")V", false); mv.visitInsn(RETURN); + Label sublabel2 = new Label(); + mv.visitLabel(sublabel2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, sublabel0, sublabel2, 0); + mv.visitLocalVariable("req", reqDesc, null, sublabel0, sublabel2, 1); + mv.visitLocalVariable("resp", respDesc, null, sublabel0, sublabel2, 2); mv.visitMaxs(3, 3); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/source/EntityFullFunc.java b/src/main/java/org/redkale/source/EntityFullFunc.java index dff250b05..ec27aedc1 100644 --- a/src/main/java/org/redkale/source/EntityFullFunc.java +++ b/src/main/java/org/redkale/source/EntityFullFunc.java @@ -127,6 +127,8 @@ public abstract class EntityFullFunc { } { // getObject(DataResultSetRow row) mv = cw.visitMethod(ACC_PUBLIC, "getObject", "(" + rowDesc + ")" + entityDesc, null, null); + Label label0 = new Label(); + mv.visitLabel(label0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEINTERFACE, rowName, "wasNull", "()Z", true); Label ifLabel = new Label(); @@ -143,6 +145,8 @@ public abstract class EntityFullFunc { mv.visitMethodInsn(INVOKEINTERFACE, creatorName, "create", "([Ljava/lang/Object;)Ljava/lang/Object;", true); mv.visitTypeInsn(CHECKCAST, entityName); mv.visitVarInsn(ASTORE, 2); + Label label1 = new Label(); + mv.visitLabel(label1); for (int i = 0; i < attrs.length; i++) { final int colIndex = i + 1; @@ -442,6 +446,11 @@ public abstract class EntityFullFunc { mv.visitVarInsn(ALOAD, 2); // obj mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("row", rowDesc, null, label0, label2, 1); + mv.visitLocalVariable("obj", entityDesc, null, label1, label2, 2); mv.visitMaxs(5, 3); mv.visitEnd(); } @@ -458,6 +467,8 @@ public abstract class EntityFullFunc { { // getObject(Serializable... values) mv = cw.visitMethod(ACC_PUBLIC | ACC_VARARGS, "getObject", "(" + serisDesc + ")" + entityDesc, null, null); + Label label0 = new Label(); + mv.visitLabel(label0); // creator.create() mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, supDynName, "creator", creatorDesc); @@ -466,6 +477,8 @@ public abstract class EntityFullFunc { mv.visitMethodInsn(INVOKEINTERFACE, creatorName, "create", "([Ljava/lang/Object;)" + objectDesc, true); mv.visitTypeInsn(CHECKCAST, entityName); mv.visitVarInsn(ASTORE, 2); + Label label1 = new Label(); + mv.visitLabel(label1); for (int i = 0; i < attrs.length; i++) { final int attrIndex = i; @@ -777,6 +790,11 @@ public abstract class EntityFullFunc { } mv.visitVarInsn(ALOAD, 2); // obj mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("values", serisDesc, null, label0, label2, 1); + mv.visitLocalVariable("obj", entityDesc, null, label1, label2, 2); mv.visitMaxs(3, 3); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/util/Attribute.java b/src/main/java/org/redkale/util/Attribute.java index b674c1500..517a4a9ce 100644 --- a/src/main/java/org/redkale/util/Attribute.java +++ b/src/main/java/org/redkale/util/Attribute.java @@ -1102,6 +1102,8 @@ public interface Attribute { } { // get 方法 mv = cw.visitMethod(ACC_PUBLIC, "get", "(" + interDesc + ")" + columnDesc, null, null); + Label label0 = new Label(); + mv.visitLabel(label0); int m = 1; if (tgetter == null) { if (tfield == null) { @@ -1142,11 +1144,17 @@ public interface Attribute { } } mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("obj", interDesc, null, label0, label2, 1); mv.visitMaxs(m, 2); mv.visitEnd(); } { // set 方法 mv = cw.visitMethod(ACC_PUBLIC, "set", "(" + interDesc + columnDesc + ")V", null, null); + Label label0 = new Label(); + mv.visitLabel(label0); int m = 2; if (tsetter == null) { if (tfield == null || java.lang.reflect.Modifier.isFinal(tfield.getModifiers())) { @@ -1187,6 +1195,11 @@ public interface Attribute { INVOKEVIRTUAL, interName, tsetter.getName(), Type.getMethodDescriptor(tsetter), false); } mv.visitInsn(RETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("obj", interDesc, null, label0, label2, 1); + mv.visitLocalVariable("value", columnDesc, null, label0, label2, 2); mv.visitMaxs(m, 3); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/util/Copier.java b/src/main/java/org/redkale/util/Copier.java index d77ebff60..f893b30d5 100644 --- a/src/main/java/org/redkale/util/Copier.java +++ b/src/main/java/org/redkale/util/Copier.java @@ -719,6 +719,8 @@ public interface Copier extends BiFunction { if (srcIsMap) { // Map -> JavaBean { mv = (cw.visitMethod(ACC_PUBLIC, "apply", "(" + srcDesc + destDesc + ")" + destDesc, null, null)); + Label label0 = new Label(); + mv.visitLabel(label0); // mv.setDebug(true); { // if(src == null) return null; @@ -760,6 +762,11 @@ public interface Copier extends BiFunction { srcClass.isInterface()); mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("src", srcDesc, null, label0, label2, 1); + mv.visitLocalVariable("dest", destDesc, null, label0, label2, 2); mv.visitMaxs(2, 3); mv.visitEnd(); } @@ -841,6 +848,8 @@ public interface Copier extends BiFunction { } } else { // JavaBean -> Map/JavaBean mv = (cw.visitMethod(ACC_PUBLIC, "apply", "(" + srcDesc + destDesc + ")" + destDesc, null, null)); + Label label0 = new Label(); + mv.visitLabel(label0); // mv.setDebug(true); { // if(src == null) return null; @@ -1310,6 +1319,11 @@ public interface Copier extends BiFunction { } mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("src", srcDesc, null, label0, label2, 1); + mv.visitLocalVariable("dest", destDesc, null, label0, label2, 2); mv.visitMaxs(3, 3); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/util/Creator.java b/src/main/java/org/redkale/util/Creator.java index 621236510..3d317e663 100644 --- a/src/main/java/org/redkale/util/Creator.java +++ b/src/main/java/org/redkale/util/Creator.java @@ -461,6 +461,8 @@ public interface Creator { { // create 方法 mv = cw.visitMethod( ACC_PUBLIC + ACC_VARARGS, "create", "([Ljava/lang/Object;)L" + interName + ";", null, null); + Label label0 = new Label(); + mv.visitLabel(label0); if (constructorParameters.length > 0 && constructorParameters[0] != null) { av0 = mv.visitAnnotation(Type.getDescriptor(ConstructorParameters.class), true); AnnotationVisitor av1 = av0.visitArray("value"); @@ -547,6 +549,10 @@ public interface Creator { // --------------------------------------- mv.visitMethodInsn(INVOKESPECIAL, interName, "", Type.getConstructorDescriptor(constructor), false); mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("params", "[Ljava/lang/Object;", null, label0, label2, 1); mv.visitMaxs(3, 2); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/util/Inners.java b/src/main/java/org/redkale/util/Inners.java index 89aca880e..33d096f6a 100644 --- a/src/main/java/org/redkale/util/Inners.java +++ b/src/main/java/org/redkale/util/Inners.java @@ -264,9 +264,15 @@ class Inners { } { // apply 方法 mv = cw.visitMethod(ACC_PUBLIC, "apply", "(I)[" + interDesc, null, null); + Label label0 = new Label(); + mv.visitLabel(label0); mv.visitVarInsn(ILOAD, 1); mv.visitTypeInsn(ANEWARRAY, interName); mv.visitInsn(ARETURN); + Label label2 = new Label(); + mv.visitLabel(label2); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0); + mv.visitLocalVariable("size", "I", null, label0, label2, 1); mv.visitMaxs(1, 2); mv.visitEnd(); } diff --git a/src/main/java/org/redkale/util/Invoker.java b/src/main/java/org/redkale/util/Invoker.java index 714112988..e936dc3f5 100644 --- a/src/main/java/org/redkale/util/Invoker.java +++ b/src/main/java/org/redkale/util/Invoker.java @@ -134,6 +134,8 @@ public interface Invoker { "(" + interDesc + "[Ljava/lang/Object;)" + returnDesc, null, null)); + Label label00 = new Label(); + mv.visitLabel(label00); Label label0 = new Label(); Label label1 = new Label(); @@ -182,6 +184,11 @@ public interface Invoker { INVOKESPECIAL, "java/lang/RuntimeException", "", "(Ljava/lang/Throwable;)V", false); mv.visitInsn(ATHROW); } + Label label22 = new Label(); + mv.visitLabel(label22); + mv.visitLocalVariable("this", "L" + newDynName + ";", null, label00, label22, 0); + mv.visitLocalVariable("obj", interDesc, null, label00, label22, 1); + mv.visitLocalVariable("params", "[Ljava/lang/Object;", null, label00, label22, 2); mv.visitMaxs(3 + method.getParameterCount(), 4); mv.visitEnd(); }