mw.visitVarInsn(ISTORE, context.var("_asm_flag_" + (i / 32)));
}
// declare and init
for (int i = 0; i < fieldListSize; ++i) {
FieldInfo fieldInfo = context.getFieldInfoList().get(i);
Class<?> fieldClass = fieldInfo.getFieldClass();
if (fieldClass == boolean.class //
|| fieldClass == byte.class //
|| fieldClass == short.class //
|| fieldClass == int.class) {
mw.visitInsn(ICONST_0);
mw.visitVarInsn(ISTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == long.class) {
mw.visitInsn(LCONST_0);
mw.visitVarInsn(LSTORE, context.var(fieldInfo.getName() + "_asm", 2));
} else if (fieldClass == float.class) {
mw.visitInsn(FCONST_0);
mw.visitVarInsn(FSTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == double.class) {
mw.visitInsn(DCONST_0);
mw.visitVarInsn(DSTORE, context.var(fieldInfo.getName() + "_asm", 2));
} else {
if (fieldClass == String.class) {
Label flagEnd_ = new Label();
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitFieldInsn(GETSTATIC, getType(Feature.class), "InitStringFieldAsEmpty",
"L" + getType(Feature.class) + ";");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "isEnabled", "(" + "L"
+ getType(Feature.class)
+ ";" + ")Z");
mw.visitJumpInsn(IFEQ, flagEnd_);
_setFlag(mw, context, i);
mw.visitLabel(flagEnd_);
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "stringDefaultValue",
"()Ljava/lang/String;");
} else {
mw.visitInsn(ACONST_NULL);
}
mw.visitTypeInsn(CHECKCAST, getType(fieldClass)); // cast
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
}
}
for (int i = 0; i < fieldListSize; ++i) {
FieldInfo fieldInfo = context.getFieldInfoList().get(i);
Class<?> fieldClass = fieldInfo.getFieldClass();
Type fieldType = fieldInfo.getFieldType();
Label notMatch_ = new Label();
if (fieldClass == boolean.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldBoolean", "([C)Z");
mw.visitVarInsn(ISTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == byte.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldInt", "([C)I");
mw.visitVarInsn(ISTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == short.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldInt", "([C)I");
mw.visitVarInsn(ISTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == int.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldInt", "([C)I");
mw.visitVarInsn(ISTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == long.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldLong", "([C)J");
mw.visitVarInsn(LSTORE, context.var(fieldInfo.getName() + "_asm", 2));
} else if (fieldClass == float.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldFloat", "([C)F");
mw.visitVarInsn(FSTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass == double.class) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldDouble", "([C)D");
mw.visitVarInsn(DSTORE, context.var(fieldInfo.getName() + "_asm", 2));
} else if (fieldClass == String.class) {
Label notEnd_ = new Label();
mw.visitIntInsn(ILOAD, context.var("matchStat"));
mw.visitInsn(ICONST_4); // END
mw.visitJumpInsn(IF_ICMPNE, notEnd_);
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "stringDefaultValue",
"()Ljava/lang/String;");
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
mw.visitJumpInsn(GOTO, notMatch_);
mw.visitLabel(notEnd_);
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldString", "([C)Ljava/lang/String;");
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
} else if (fieldClass.isEnum()) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
Label enumNull_ = new Label();
mw.visitInsn(ACONST_NULL);
mw.visitTypeInsn(CHECKCAST, getType(fieldClass)); // cast
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
mw.visitVarInsn(ALOAD, 1);
mw.visitMethodInsn(INVOKEVIRTUAL, getType(DefaultJSONParser.class), "getSymbolTable",
"()" + getDesc(SymbolTable.class));
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldSymbol",
"([C" + getDesc(SymbolTable.class) + ")Ljava/lang/String;");
mw.visitInsn(DUP);
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm_enumName"));
mw.visitJumpInsn(IFNULL, enumNull_);
mw.visitVarInsn(ALOAD, context.var(fieldInfo.getName() + "_asm_enumName"));
mw.visitMethodInsn(INVOKESTATIC, getType(fieldClass), "valueOf", "(Ljava/lang/String;)"
+ getDesc(fieldClass));
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
mw.visitLabel(enumNull_);
} else if (Collection.class.isAssignableFrom(fieldClass)) {
mw.visitVarInsn(ALOAD, context.var("lexer"));
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_prefix__", "[C");
Type actualTypeArgument = ((ParameterizedType) fieldType).getActualTypeArguments()[0];
if (actualTypeArgument instanceof Class) {
Class<?> itemClass = (Class<?>) actualTypeArgument;
if (!Modifier.isPublic(itemClass.getModifiers())) {
throw new ASMException("can not create ASMParser");
}
if (itemClass == String.class) {
mw.visitLdcInsn(com.alibaba.fastjson.asm.Type.getType(getDesc(fieldClass))); // cast
mw.visitMethodInsn(INVOKEVIRTUAL, getType(JSONLexer.class), "scanFieldStringArray",
"([CLjava/lang/Class;)" + getDesc(Collection.class));
mw.visitVarInsn(ASTORE, context.var(fieldInfo.getName() + "_asm"));
} else {
_deserialze_list_obj(context, mw, reset_, fieldInfo, fieldClass, itemClass, i);
if (i == fieldListSize - 1) {
_deserialize_endCheck(context, mw, reset_);