diff --git a/src/mapleall/bin/debug/dex2mpl.tar.gz b/src/mapleall/bin/debug/dex2mpl.tar.gz index d170bb0eeb75863f1a57cc66638978787d0598c6..fe5a1834588fe645f561ef31f1695421b6db3d45 100644 Binary files a/src/mapleall/bin/debug/dex2mpl.tar.gz and b/src/mapleall/bin/debug/dex2mpl.tar.gz differ diff --git a/src/mapleall/maple_be/src/cg/emit.cpp b/src/mapleall/maple_be/src/cg/emit.cpp index f8ff0f0da06e562895c0617563b86804d17aac76..5f0e665a1630b0cd4e1e1adea05eb02497bb9f43 100644 --- a/src/mapleall/maple_be/src/cg/emit.cpp +++ b/src/mapleall/maple_be/src/cg/emit.cpp @@ -1461,19 +1461,7 @@ void Emitter::EmitArrayConstant(MIRConst &mirConst) { MIRAggConst &arrayCt = static_cast(mirConst); MIRArrayType &arrayType = static_cast(mirType); size_t uNum = arrayCt.GetConstVec().size(); - uint32 dim = arrayType.GetSizeArrayItem(0); - TyIdx scalarIdx = arrayType.GetElemTyIdx(); - if (uNum == 0 && dim) { - MIRType *subTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(scalarIdx); - while (subTy->GetKind() == kTypeArray) { - MIRArrayType *aSubTy = static_cast(subTy); - if (aSubTy->GetSizeArrayItem(0) > 0) { - dim *= (aSubTy->GetSizeArrayItem(0)); - } - scalarIdx = aSubTy->GetElemTyIdx(); - subTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(scalarIdx); - } - } + int64 iNum = (arrayType.GetSizeArrayItem(0) > 0) ? (static_cast(arrayType.GetSizeArrayItem(0))) - uNum : 0; for (size_t i = 0; i < uNum; ++i) { MIRConst *elemConst = arrayCt.GetConstVecItem(i); if (IsPrimitiveScalar(elemConst->GetType().GetPrimType())) { @@ -1491,26 +1479,19 @@ void Emitter::EmitArrayConstant(MIRConst &mirConst) { } } else if (elemConst->GetType().GetKind() == kTypeArray) { EmitArrayConstant(*elemConst); - } else if (elemConst->GetType().GetKind() == kTypeStruct || elemConst->GetType().GetKind() == kTypeClass || - elemConst->GetType().GetKind() == kTypeUnion) { + } else if (elemConst->GetType().GetKind() == kTypeStruct || elemConst->GetType().GetKind() == kTypeClass) { EmitStructConstant(*elemConst); } else { ASSERT(false, "should not run here"); } } - int64 iNum = (arrayType.GetSizeArrayItem(0) > 0) ? (static_cast(arrayType.GetSizeArrayItem(0))) - uNum : 0; if (iNum > 0) { CHECK_FATAL(!Globals::GetInstance()->GetBECommon()->IsEmptyOfTypeSizeTable(), "container empty check"); CHECK_FATAL(!arrayCt.GetConstVec().empty(), "container empty check"); - if (uNum > 0) { - uint64 unInSizeInByte = static_cast(iNum) * static_cast( - Globals::GetInstance()->GetBECommon()->GetTypeSize(arrayCt.GetConstVecItem(0)->GetType().GetTypeIndex())); - if (unInSizeInByte != 0) { - EmitNullConstant(unInSizeInByte); - } - } else { - uint32 size = Globals::GetInstance()->GetBECommon()->GetTypeSize(scalarIdx.GetIdx()) * dim; - Emit("\t.zero\t").Emit(size).Emit("\n"); + uint64 unInSizeInByte = static_cast(iNum) * static_cast( + Globals::GetInstance()->GetBECommon()->GetTypeSize(arrayCt.GetConstVecItem(0)->GetType().GetTypeIndex())); + if (unInSizeInByte != 0) { + EmitNullConstant(unInSizeInByte); } } Emit("\n"); @@ -1528,7 +1509,7 @@ void Emitter::EmitStructConstant(MIRConst &mirConst) { if (structType.GetKind() == kTypeUnion) { num = 1; } else { - num = structType.GetFieldsSize(); + num = static_cast(structType.GetFieldsSize()); } /* total size of emitted elements size. */ uint32 size = Globals::GetInstance()->GetBECommon()->GetTypeSize(structType.GetTypeIndex()); @@ -1567,9 +1548,7 @@ void Emitter::EmitStructConstant(MIRConst &mirConst) { if (IsPrimitiveScalar(elemType.GetPrimType())) { EmitScalarConstant(*elemConst, true, false, true); } else if (elemType.GetKind() == kTypeArray) { - if (elemType.GetSize() != 0) { - EmitArrayConstant(*elemConst); - } + EmitArrayConstant(*elemConst); } else if ((elemType.GetKind() == kTypeStruct) || (elemType.GetKind() == kTypeClass)) { EmitStructConstant(*elemConst); } else {