diff --git a/src/mapleall/bin/debug/dex2mpl.tar.gz b/src/mapleall/bin/debug/dex2mpl.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ab317304748087503343ecf918a18e0a0b9e7993 Binary files /dev/null and b/src/mapleall/bin/debug/dex2mpl.tar.gz differ diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_abi.h b/src/mapleall/maple_be/include/cg/aarch64/aarch64_abi.h index 727d8504717c9fbe82ed9e8d975de5902c2eb33c..12511c58e6f477dad49dc12805eef463567e09d2 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_abi.h +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_abi.h @@ -82,9 +82,9 @@ class ParmLocator { ~ParmLocator() = default; - // Return size of aggregate structure copy on stack. + /* Return size of aggregate structure copy on stack. */ int32 LocateNextParm(MIRType &mirType, PLocInfo &pLoc, bool isFirst = false); - void InitPLocInfo(PLocInfo &pLoc); + void InitPLocInfo(PLocInfo &pLoc) const; private: BECommon &beCommon; diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_isa.h b/src/mapleall/maple_be/include/cg/aarch64/aarch64_isa.h index 374d8509d4ee65d1b91b710264c9b55e4369a253..bd0e93da9c076fe2e3eedbb25962928f7cf02f13 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_isa.h +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_isa.h @@ -18,7 +18,7 @@ #include "operand.h" #include "mad.h" -#define DEFINE_MOP(op,...) op, +#define DEFINE_MOP(op, ...) op, enum AArch64MOP_t : maple::uint32 { #include "aarch64_md.def" kMopLast @@ -382,4 +382,4 @@ inline void GetNextOffsetCalleeSaved(int &offset) { MOperator GetMopPair(MOperator mop); } /* namespace maplebe */ -#endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ISA_H */ \ No newline at end of file +#endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ISA_H */ diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_md.def b/src/mapleall/maple_be/include/cg/aarch64/aarch64_md.def index d3f18e159fd677d8aaa50ae954c15026878d9729..f09cc5a6ab6bc8b0c53a452f3eef805719e45924 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_md.def +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_md.def @@ -1,5 +1,5 @@ /* - * Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2020-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_memlayout.h b/src/mapleall/maple_be/include/cg/aarch64/aarch64_memlayout.h index c84f89a7d78d2bd9635d898379bfcd2d80ca77ca..11c7b97b1ef0dc63dbb2e06e2d54f7e890cc0f9e 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_memlayout.h +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_memlayout.h @@ -195,7 +195,7 @@ class AArch64MemLayout : public MemLayout { MemSegment segGrSaveArea = MemSegment(kMsGrSaveArea); MemSegment segVrSaveArea = MemSegment(kMsVrSaveArea); int32 fixStackSize = 0; - void SetSizeAlignForTypeIdx(uint32 typeIdx, uint32 &size, uint32 &align); + void SetSizeAlignForTypeIdx(uint32 typeIdx, uint32 &size, uint32 &align) const; void SetSegmentSize(AArch64SymbolAlloc &symbolAlloc, MemSegment &segment, uint32 typeIdx); void LayoutVarargParams(); void LayoutFormalParams(); diff --git a/src/mapleall/maple_be/include/cg/cgfunc.h b/src/mapleall/maple_be/include/cg/cgfunc.h index eeca0322e26b2b77d1b1817f8ecae9c28bf203da..6ee2d01ec4da5c470fc97e16296ebefbcc4e8fb2 100644 --- a/src/mapleall/maple_be/include/cg/cgfunc.h +++ b/src/mapleall/maple_be/include/cg/cgfunc.h @@ -801,7 +801,7 @@ class CGFunc { return lSymSize; } - bool HasTakenLabel() { + bool HasTakenLabel() const{ return hasTakenLabel; } diff --git a/src/mapleall/maple_be/src/be/becommon.cpp b/src/mapleall/maple_be/src/be/becommon.cpp index 7551ef935acfb8ad49392f34b4889f09a8356b36..28b83f13749ee90eaf2daeaeab5777267a357156 100644 --- a/src/mapleall/maple_be/src/be/becommon.cpp +++ b/src/mapleall/maple_be/src/be/becommon.cpp @@ -152,7 +152,7 @@ void BECommon::ComputeStructTypeSizesAligns(MIRType &ty, const TyIdx &tyIdx) { allocedSize = std::max(allocedSize, RoundUp(allocedSizeInBits, fieldAlign * kBitsPerByte) / kBitsPerByte); if (fieldSize == 0) { - allocedSizeInBits = allocedSize *8; + allocedSizeInBits = allocedSize * kBitsPerByte; } } else { /* pad alloced_size according to the field alignment */ @@ -644,7 +644,8 @@ MIRType *BECommon::BeGetOrCreateFunctionType(TyIdx tyIdx, const std::vector GetSizeOfTypeSizeTable())) { + if (mirModule.GetSrcLang() == kSrcLangC && + (GlobalTables::GetTypeTable().GetTypeTableSize() > GetSizeOfTypeSizeTable())) { for (uint32 i = GetSizeOfTypeSizeTable(); i < GlobalTables::GetTypeTable().GetTypeTableSize(); ++i) { MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(i); AddAndComputeSizeAlign(*ty); diff --git a/src/mapleall/maple_be/src/be/lower.cpp b/src/mapleall/maple_be/src/be/lower.cpp index ad0fdc47f94a12d73d6e80b010a7f008d211331c..1924e3308d911db55325ed86389214b0d9250cf8 100644 --- a/src/mapleall/maple_be/src/be/lower.cpp +++ b/src/mapleall/maple_be/src/be/lower.cpp @@ -512,7 +512,7 @@ BlockNode *CGLowerer::LowerReturnStruct(NaryStmtNode &retNode) { MIRSymbol *retSt = curFunc->GetFormal(0); MIRPtrType *retTy = static_cast(retSt->GetType()); IassignNode *iassign = mirModule.CurFuncCodeMemPool()->New(); - if (beCommon.GetTypeSize(retTy->GetPointedTyIdx().GetIdx()) > k16ByteSize || !opnd0 || opnd0->GetPrimType() != PTY_agg) { + if ((beCommon.GetTypeSize(retTy->GetPointedTyIdx().GetIdx()) > k16ByteSize) || (opnd0->GetPrimType() != PTY_agg)) { iassign->SetTyIdx(retTy->GetTypeIndex()); } else { /* struct goes into register. */ @@ -924,7 +924,7 @@ BlockNode *CGLowerer::LowerCallAssignedStmt(StmtNode &stmt) { auto &origCall = static_cast(stmt); newCall = GenIcallNode(funcCalled, origCall); p2nRets = &origCall.GetReturnVec(); - static_cast(newCall)->SetReturnVec(*p2nRets); + static_cast(newCall)->SetReturnVec(*p2nRets); break; } default: diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp index 1f1ab63a96e497d94fae43e274197218a3b7f83a..a5a51309447fd72f6dc43d8aa34d8518b76dd15a 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp @@ -361,7 +361,7 @@ bool IsSpillRegInRA(AArch64reg regNO, bool has3RegOpnd) { } } /* namespace AArch64Abi */ -void ParmLocator::InitPLocInfo(PLocInfo &pLoc) { +void ParmLocator::InitPLocInfo(PLocInfo &pLoc) const { pLoc.reg0 = kRinvalid; pLoc.reg1 = kRinvalid; pLoc.memOffset = nextStackArgAdress; diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_args.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_args.cpp index 5089f94b0b38f9ba0a126cd728b68600c7703f70..2ce3a0d49d2acfcfbf10f2a30c8a8ac61f4a4908 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_args.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_args.cpp @@ -269,10 +269,10 @@ void AArch64MoveRegArgs::MoveVRegisterArgs() { for (uint32 i = 0; i < aarchCGFunc->GetFunction().GetFormalCount(); ++i) { if (i == 0) { - MIRFunction *func = const_cast(aarchCGFunc->GetBecommon().GetMIRModule().CurFunction()); + MIRFunction *func = const_cast(aarchCGFunc->GetBecommon().GetMIRModule().CurFunction()); if (aarchCGFunc->GetBecommon().HasFuncReturnType(*func)) { TyIdx idx = aarchCGFunc->GetBecommon().GetFuncReturnType(*func); - if (aarchCGFunc->GetBecommon().GetTypeSize(idx) <= 16) { + if (aarchCGFunc->GetBecommon().GetTypeSize(idx) <= k16BitSize) { continue; } } diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp index 3e9071657f7b4081e9ef92561555e87678ce7fd0..4ed4e78f64c192fcfeec6c087101eb23010838c5 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -5226,19 +5226,19 @@ void AArch64CGFunc::SelectParmListForAggregate(BaseNode &argExpr, AArch64ListOpe uint32 AArch64CGFunc::SelectParmListGetStructReturnSize(StmtNode &naryNode) { if (naryNode.GetOpCode() == OP_call) { - CallNode &callNode = static_cast(naryNode); + CallNode &callNode = static_cast(naryNode); MIRFunction *callFunc = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(callNode.GetPUIdx()); TyIdx retIdx = callFunc->GetReturnTyIdx(); if ((GetBecommon().GetTypeSize(retIdx.GetIdx()) == 0) && GetBecommon().HasFuncReturnType(*callFunc)) { return GetBecommon().GetTypeSize(GetBecommon().GetFuncReturnType(*callFunc)); } } else if (naryNode.GetOpCode() == OP_icall) { - IcallNode &icallNode = static_cast(naryNode); + IcallNode &icallNode = static_cast(naryNode); CallReturnVector *p2nrets = &icallNode.GetReturnVec(); - if (p2nrets->size() == 1) { + if (p2nrets->size() == k1ByteSize) { StIdx stIdx = (*p2nrets)[0].first; MIRSymbol *sym = GetBecommon().GetMIRModule().CurFunction()->GetSymTab()->GetSymbolFromStIdx(stIdx.Idx()); - if (sym) { + if (sym != nullptr) { return GetBecommon().GetTypeSize(sym->GetTyIdx().GetIdx()); } } diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_memlayout.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_memlayout.cpp index a34f0aea2cad0fe8bc74ca67e7b685ab4fd4e2dc..a6b58aff6fb7e5c91c669a4fa55755a48d3854e5 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_memlayout.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_memlayout.cpp @@ -51,7 +51,7 @@ uint32 AArch64MemLayout::ComputeStackSpaceRequirementForCall(StmtNode &stmt, in } aggCopySize = 0; - for (uint32 anum = 0; i < stmt.NumOpnds(); ++i, ++ anum) { + for (uint32 anum = 0; i < stmt.NumOpnds(); ++i, ++anum) { BaseNode *opnd = stmt.Opnd(i); MIRType *ty = nullptr; if (opnd->GetPrimType() != PTY_agg) { @@ -97,9 +97,9 @@ uint32 AArch64MemLayout::ComputeStackSpaceRequirementForCall(StmtNode &stmt, in return sizeOfArgsToStkPass; } -void AArch64MemLayout::SetSizeAlignForTypeIdx(uint32 typeIdx, uint32 &size, uint32 &align) { +void AArch64MemLayout::SetSizeAlignForTypeIdx(uint32 typeIdx, uint32 &size, uint32 &align) const { if (be.GetTypeSize(typeIdx) > k16ByteSize) { - // size > 16 is passed on stack, the formal is just a pointer to the copy on stack. + /* size > 16 is passed on stack, the formal is just a pointer to the copy on stack. */ align = kSizeOfPtr; size = kSizeOfPtr; } else { diff --git a/src/mapleall/maple_be/src/cg/emit.cpp b/src/mapleall/maple_be/src/cg/emit.cpp index 686762256b6c6def25efe453df996b32b673a234..79df8ddd6c3dda7c3e03118c6393b5f8098e20b3 100644 --- a/src/mapleall/maple_be/src/cg/emit.cpp +++ b/src/mapleall/maple_be/src/cg/emit.cpp @@ -2233,7 +2233,8 @@ void Emitter::EmitGlobalVariable() { } else { EmitArrayConstant(*mirConst); } - } else if (mirType->GetKind() == kTypeStruct || mirType->GetKind() == kTypeClass || mirType->GetKind() == kTypeUnion) { + } else if (mirType->GetKind() == kTypeStruct || mirType->GetKind() == kTypeClass || + mirType->GetKind() == kTypeUnion) { if (mirSymbol->HasAddrOfValues()) { EmitConstantTable(*mirSymbol, *mirConst, strIdx2Type); } else { @@ -2267,7 +2268,8 @@ void Emitter::EmitGlobalVariable() { } else if (kTypeArray == mirType->GetKind()) { EmitAsmLabel(*mirSymbol, kAsmSyname); EmitArrayConstant(*ct); - } else if (kTypeStruct == mirType->GetKind() || kTypeClass == mirType->GetKind() || kTypeUnion == mirType->GetKind()) { + } else if (kTypeStruct == mirType->GetKind() || kTypeClass == mirType->GetKind() || + kTypeUnion == mirType->GetKind()) { EmitAsmLabel(*mirSymbol, kAsmSyname); EmitStructConstant(*ct); } else { diff --git a/src/mrt/deplibs/libcore-static-binding-jni-qemu.a b/src/mrt/deplibs/libcore-static-binding-jni-qemu.a index 4aa1cca2f37f3f75136717a9e89d22193a4a6412..48edebeec8ef3df9d1d19c8d55bdfb104c3dd224 100644 Binary files a/src/mrt/deplibs/libcore-static-binding-jni-qemu.a and b/src/mrt/deplibs/libcore-static-binding-jni-qemu.a differ diff --git a/src/mrt/deplibs/libmplandroid.so b/src/mrt/deplibs/libmplandroid.so index b0aed0c0c9bf00aa3565fa06eda50fafaeffa58e..49df0d0ec621f77659c540b030f5bb9511b130e1 100755 Binary files a/src/mrt/deplibs/libmplandroid.so and b/src/mrt/deplibs/libmplandroid.so differ diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.cc b/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.cc index 0ca55a7213cf9376069bdd3ffe489f4043747e63..8d4fbf4422ac8dc80fb2b6d21d02326d9a4dcbab 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.cc @@ -19,7 +19,6 @@ #include "android-base/logging.h" #include "base/bit_utils.h" #include "base/globals.h" -#include namespace art { @@ -116,23 +115,11 @@ static_assert(IsAligned(kMips64StackOverflowReservedBytes), static_assert(IsAligned(kX86StackOverflowReservedBytes), "X86 gap not page aligned"); static_assert(IsAligned(kX86_64StackOverflowReservedBytes), "X86_64 gap not page aligned"); -/* -cflags += [ - "-DART_STACK_OVERFLOW_GAP_arm=8192", - "-DART_STACK_OVERFLOW_GAP_arm64=8192", - "-DART_STACK_OVERFLOW_GAP_mips=16384", - "-DART_STACK_OVERFLOW_GAP_mips64=16384", - "-DART_STACK_OVERFLOW_GAP_x86=16384", - "-DART_STACK_OVERFLOW_GAP_x86_64=20480", - "-DART_FRAME_SIZE_LIMIT=7400", - ] - */ -/* + #if !defined(ART_FRAME_SIZE_LIMIT) #error "ART frame size limit missing" #endif -*/ -const uint32_t ART_FRAME_SIZE_LIMIT = 7400; + // TODO: Should we require an extra page (RoundUp(SIZE) + kPageSize)? static_assert(ART_FRAME_SIZE_LIMIT < kArmStackOverflowReservedBytes, "Frame size limit too large"); static_assert(ART_FRAME_SIZE_LIMIT < kArm64StackOverflowReservedBytes, diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.h b/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.h index f4fe567af598419baa862577b137eb7a668bb929..7e071bd9e223fed96cc4f7582b659be4840de8cc 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/arch/instruction_set.h @@ -227,30 +227,19 @@ constexpr size_t GetBytesPerFprSpillLocation(InstructionSet isa) { } namespace instruction_set_details { -/* -cflags += [ - "-DART_STACK_OVERFLOW_GAP_arm=8192", - "-DART_STACK_OVERFLOW_GAP_arm64=8192", - "-DART_STACK_OVERFLOW_GAP_mips=16384", - "-DART_STACK_OVERFLOW_GAP_mips64=16384", - "-DART_STACK_OVERFLOW_GAP_x86=16384", - "-DART_STACK_OVERFLOW_GAP_x86_64=20480", - "-DART_FRAME_SIZE_LIMIT=7400", - ] - */ - /* + #if !defined(ART_STACK_OVERFLOW_GAP_arm) || !defined(ART_STACK_OVERFLOW_GAP_arm64) || \ !defined(ART_STACK_OVERFLOW_GAP_mips) || !defined(ART_STACK_OVERFLOW_GAP_mips64) || \ !defined(ART_STACK_OVERFLOW_GAP_x86) || !defined(ART_STACK_OVERFLOW_GAP_x86_64) #error "Missing defines for stack overflow gap" #endif -*/ -static constexpr size_t kArmStackOverflowReservedBytes = 8192; -static constexpr size_t kArm64StackOverflowReservedBytes = 8192; -static constexpr size_t kMipsStackOverflowReservedBytes = 16384; -static constexpr size_t kMips64StackOverflowReservedBytes = 16384; -static constexpr size_t kX86StackOverflowReservedBytes = 16384; -static constexpr size_t kX86_64StackOverflowReservedBytes = 20480; + +static constexpr size_t kArmStackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_arm; +static constexpr size_t kArm64StackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_arm64; +static constexpr size_t kMipsStackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_mips; +static constexpr size_t kMips64StackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_mips64; +static constexpr size_t kX86StackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_x86; +static constexpr size_t kX86_64StackOverflowReservedBytes = ART_STACK_OVERFLOW_GAP_x86_64; NO_RETURN void GetStackOverflowReservedBytesFailure(const char* error_msg); diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/arena_allocator.h b/third_party/aosp_10.0.0_r35/art/libartbase/base/arena_allocator.h index 6b6b8fc109e804a686eb05e614b26998f9b95b3f..a9ccae1b07369912d280d51d71090029bbbad658 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/arena_allocator.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/arena_allocator.h @@ -25,7 +25,6 @@ #include "dchecked_vector.h" #include "macros.h" #include "memory_tool.h" -#include namespace art { diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/bit_vector.h b/third_party/aosp_10.0.0_r35/art/libartbase/base/bit_vector.h index 6f7a9de623799c130d0a5fe9b9bd9897c235a2cd..a930f4e556901c6b8ff37e3aa1a77b74e830f428 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/bit_vector.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/bit_vector.h @@ -19,7 +19,7 @@ #include #include -#include + #include "bit_utils.h" #include "globals.h" diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/file_magic.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/file_magic.cc index 90e0b763965d8ab8b7f6a82e165c2d3d3794b5e5..1471c59b730e77c1d2ce4d94970861fdd8a64b74 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/file_magic.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/file_magic.cc @@ -19,7 +19,7 @@ #include #include #include -#include + #include #include diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/file_utils.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/file_utils.cc index a8760b667933c4f70a9241d435622ac4c1e83b0b..1216ab06626ce123a7f791794287ba1662093e9f 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/file_utils.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/file_utils.cc @@ -40,7 +40,7 @@ #include -#include + #include "android-base/stringprintf.h" #include "android-base/strings.h" @@ -401,7 +401,7 @@ bool RuntimeModuleRootDistinctFromAndroidRoot() { &error_msg); return (android_root != nullptr) && (runtime_root != nullptr) - && (StringView(android_root) != StringView(runtime_root)); + && (std::string_view(android_root) != std::string_view(runtime_root)); } int DupCloexec(int fd) { diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/hiddenapi_stubs.h b/third_party/aosp_10.0.0_r35/art/libartbase/base/hiddenapi_stubs.h index 361d4d5d692bda2ade9331817fe571282bb0fe1d..94ef95c267c6a9bae7ff853028038ca56afb7a27 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/hiddenapi_stubs.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/hiddenapi_stubs.h @@ -18,16 +18,11 @@ #define ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_ #include -#include "string_view_format.h" +#include namespace art { namespace hiddenapi { -const std::string kPublicApiStr = "public-api"; -const std::string kSystemApiStr = "system-api"; -const std::string kTestApiStr = "test-api"; -const std::string kCorePlatformApiStr = "core-platform-api"; - class ApiStubs { public: enum class Kind { @@ -37,7 +32,7 @@ class ApiStubs { kCorePlatformApi, }; - static std::string ToString(Kind api) { + static const std::string_view ToString(Kind api) { switch (api) { case Kind::kPublicApi: return kPublicApiStr; @@ -50,10 +45,16 @@ class ApiStubs { } } - static bool IsStubsFlag(const std::string& api_flag_name) { + static bool IsStubsFlag(const std::string_view& api_flag_name) { return api_flag_name == kPublicApiStr || api_flag_name == kSystemApiStr || api_flag_name == kTestApiStr || api_flag_name == kCorePlatformApiStr; } + + private: + static constexpr std::string_view kPublicApiStr{"public-api"}; + static constexpr std::string_view kSystemApiStr{"system-api"}; + static constexpr std::string_view kTestApiStr{"test-api"}; + static constexpr std::string_view kCorePlatformApiStr{"core-platform-api"}; }; } // namespace hiddenapi diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/logging.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/logging.cc index ba025666d4e15517219abe8c2205598343843432..a66a7e363546fc889fd7a4d3eded02520e180518 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/logging.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/logging.cc @@ -23,7 +23,6 @@ #include "aborting.h" #include "os.h" #include "unix_file/fd_file.h" -#include // Headers for LogMessage::LogLine. #ifdef ART_TARGET_ANDROID diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/memfd.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/memfd.cc index ebb35f92bc3b2f0c8d8c2dcb8c684785431f2180..780be328afcf56568d7c995ee46aeb450d6f4354 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/memfd.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/memfd.cc @@ -25,7 +25,6 @@ #endif #include "macros.h" -#include // When building for linux host, glibc in prebuilts does not include memfd_create system call // number. As a temporary testing measure, we add the definition here. diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/os_linux.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/os_linux.cc index a00779eb487ae938d5507aba2e9f63398b6a931f..b25e5e85b3b959e3d1c8f11b9aa5a76911e77127 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/os_linux.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/os_linux.cc @@ -62,7 +62,8 @@ File* OS::OpenFileWithFlags(const char* name, int flags, bool auto_flush) { CHECK(name != nullptr); bool read_only = ((flags & O_ACCMODE) == O_RDONLY); bool check_usage = !read_only && auto_flush; - std::unique_ptr file(new File(name, flags, 0666, check_usage)); + std::unique_ptr file( + new File(name, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, check_usage)); if (!file->IsOpened()) { return nullptr; } diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/safe_copy.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/safe_copy.cc index 951cb42b028a5b0897287a2096655b30fea9b782..ad75aa7b2812faceac28e77b0de8e6d88570c235 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/safe_copy.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/safe_copy.cc @@ -56,10 +56,10 @@ ssize_t SafeCopy(void *dst, const void *src, size_t len) { } src_iovs[iovecs_used].iov_base = const_cast(cur); - if (!IsAlignedParam(cur, sysconf(_SC_PAGE_SIZE))) { - src_iovs[iovecs_used].iov_len = AlignUp(cur, sysconf(_SC_PAGE_SIZE)) - cur; + if (!IsAlignedParam(cur, PAGE_SIZE)) { + src_iovs[iovecs_used].iov_len = AlignUp(cur, PAGE_SIZE) - cur; } else { - src_iovs[iovecs_used].iov_len = sysconf(_SC_PAGE_SIZE); + src_iovs[iovecs_used].iov_len = PAGE_SIZE; } src_iovs[iovecs_used].iov_len = std::min(src_iovs[iovecs_used].iov_len, len); diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/scoped_flock.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/scoped_flock.cc index e70208d77c990354058a2a4ae3bd9b7c988eb422..b16a45aaecdde78f18c5fd9ac58fb31e92c22dec 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/scoped_flock.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/scoped_flock.cc @@ -24,7 +24,6 @@ #include "file_utils.h" #include "unix_file/fd_file.h" -#include namespace art { diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/string_view_cpp20.h b/third_party/aosp_10.0.0_r35/art/libartbase/base/string_view_cpp20.h index 5ef3137c400ddb512584883311c78c3767d3e01a..2c11a2f2b85b0bd11e1c9d313158e6a7b9bca650 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/string_view_cpp20.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/string_view_cpp20.h @@ -17,21 +17,21 @@ #ifndef ART_LIBARTBASE_BASE_STRING_VIEW_CPP20_H_ #define ART_LIBARTBASE_BASE_STRING_VIEW_CPP20_H_ -#include "string_view_format.h" +#include namespace art { -// Replacement functions for StringView::starts_with(), ends_with() +// Replacement functions for std::string_view::starts_with(), ends_with() // which shall be available in C++20. #if __cplusplus >= 202000L #error "When upgrading to C++20, remove this error and file a bug to remove this workaround." #endif -inline bool StartsWith(StringView sv, StringView prefix) { +inline bool StartsWith(std::string_view sv, std::string_view prefix) { return sv.substr(0u, prefix.size()) == prefix; } -inline bool EndsWith(StringView sv, StringView suffix) { +inline bool EndsWith(std::string_view sv, std::string_view suffix) { return sv.size() >= suffix.size() && sv.substr(sv.size() - suffix.size()) == suffix; } diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/unix_file/fd_file.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/unix_file/fd_file.cc index d8127a955395ca57636617f8a44eef2c552a7fe1..8831b9c6b7adbfb3eb30b9300385a057123a85d4 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/unix_file/fd_file.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/unix_file/fd_file.cc @@ -20,7 +20,6 @@ #include #include #include -#include #if defined(__BIONIC__) #include diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.cc b/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.cc index 30423a47a7bcd03a0adb7d2ab307f5e41f865c4a..5af80f43960fcd5aa76e490da4c9a5885b6ea730 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.cc +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.cc @@ -29,6 +29,7 @@ #include "android-base/stringprintf.h" #include "android-base/strings.h" +#include "bit_utils.h" #include "os.h" #if defined(__APPLE__) @@ -62,6 +63,98 @@ namespace art { using android::base::ReadFileToString; using android::base::StringPrintf; +#if defined(__arm__) + +namespace { + +// Bitmap of caches to flush for cacheflush(2). Must be zero for ARM. +static constexpr int kCacheFlushFlags = 0x0; + +// Number of retry attempts when flushing cache ranges. +static constexpr size_t kMaxFlushAttempts = 4; + +int CacheFlush(uintptr_t start, uintptr_t limit) { + // The signature of cacheflush(2) seems to vary by source. On ARM the system call wrapper + // (bionic/SYSCALLS.TXT) has the form: int cacheflush(long start, long end, long flags); + int r = cacheflush(start, limit, kCacheFlushFlags); + if (r == -1) { + CHECK_NE(errno, EINVAL); + } + return r; +} + +bool TouchAndFlushCacheLinesWithinPage(uintptr_t start, uintptr_t limit, size_t attempts) { + CHECK_LT(start, limit); + CHECK_EQ(RoundDown(start, kPageSize), RoundDown(limit - 1, kPageSize)) << "range spans pages"; + // Declare a volatile variable so the compiler does not elide reads from the page being touched. + volatile uint8_t v = 0; + for (size_t i = 0; i < attempts; ++i) { + // Touch page to maximize chance page is resident. + v = *reinterpret_cast(start); + + if (LIKELY(CacheFlush(start, limit) == 0)) { + return true; + } + } + return false; +} + +} // namespace + +bool FlushCpuCaches(void* begin, void* end) { + // This method is specialized for ARM as the generic implementation below uses the + // __builtin___clear_cache() intrinsic which is declared as void. On ARMv7 flushing the CPU + // caches is a privileged operation. The Linux kernel allows these operations to fail when they + // trigger a fault (e.g. page not resident). We use a wrapper for the ARM specific cacheflush() + // system call to detect the failure and potential erroneous state of the data and instruction + // caches. + // + // The Android bug for this is b/132205399 and there's a similar discussion on + // https://reviews.llvm.org/D37788. This is primarily an issue for the dual view JIT where the + // pages where code is executed are only ever RX and never RWX. When attempting to invalidate + // instruction cache lines in the RX mapping after writing fresh code in the RW mapping, the + // page may not be resident (due to memory pressure), and this means that a fault is raised in + // the midst of a cacheflush() call and the instruction cache lines are not invalidated and so + // have stale code. + // + // Other architectures fair better for reasons such as: + // + // (1) stronger coherence between the data and instruction caches. + // + // (2) fault handling that allows flushing/invalidation to continue after + // a missing page has been faulted in. + + // In the common case, this flush of the complete range succeeds. + uintptr_t start = reinterpret_cast(begin); + const uintptr_t limit = reinterpret_cast(end); + if (LIKELY(CacheFlush(start, limit) == 0)) { + return true; + } + + // A rare failure has occurred implying that part of the range (begin, end] has been swapped + // out. Retry flushing but this time grouping cache-line flushes on individual pages and + // touching each page before flushing. + uintptr_t next_page = RoundUp(start + 1, kPageSize); + while (start < limit) { + uintptr_t boundary = std::min(next_page, limit); + if (!TouchAndFlushCacheLinesWithinPage(start, boundary, kMaxFlushAttempts)) { + return false; + } + start = boundary; + next_page += kPageSize; + } + return true; +} + +#else + +bool FlushCpuCaches(void* begin, void* end) { + __builtin___clear_cache(reinterpret_cast(begin), reinterpret_cast(end)); + return true; +} + +#endif + pid_t GetTid() { #if defined(__APPLE__) uint64_t owner; diff --git a/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.h b/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.h index 9284950c1a100fbb52c1a87767c941e4968fde28..f434cb40db2b218f2ef29bb242f0a78a1dea18a3 100644 --- a/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.h +++ b/third_party/aosp_10.0.0_r35/art/libartbase/base/utils.h @@ -113,15 +113,8 @@ static T GetRandomNumber(T min, T max) { // Sleep forever and never come back. NO_RETURN void SleepForever(); -inline void FlushDataCache(void* begin, void* end) { - __builtin___clear_cache(reinterpret_cast(begin), reinterpret_cast(end)); -} - -inline void FlushInstructionCache(void* begin, void* end) { - // Same as FlushInstructionCache for lack of other builtin. __builtin___clear_cache - // flushes both caches. - __builtin___clear_cache(reinterpret_cast(begin), reinterpret_cast(end)); -} +// Flush CPU caches. Returns true on success, false if flush failed. +WARN_UNUSED bool FlushCpuCaches(void* begin, void* end); template constexpr PointerSize ConvertToPointerSize(T any) { diff --git a/third_party/aosp_10.0.0_r35/art/libartpalette/system/palette_fake.cc b/third_party/aosp_10.0.0_r35/art/libartpalette/system/palette_fake.cc index 1edd1423e758da4dbabaf0a144c91bbfe02e949e..4cc00d0419d5742fd2b39c50938e70606e15e3e0 100644 --- a/third_party/aosp_10.0.0_r35/art/libartpalette/system/palette_fake.cc +++ b/third_party/aosp_10.0.0_r35/art/libartpalette/system/palette_fake.cc @@ -21,7 +21,7 @@ #include #include // For ATTRIBUTE_UNUSED -#include "string_view_format.h" + #include "palette_system.h" enum PaletteStatus PaletteGetVersion(int32_t* version) { @@ -54,7 +54,7 @@ enum PaletteStatus PaletteSchedGetPriority(int32_t tid, } enum PaletteStatus PaletteWriteCrashThreadStacks(/*in*/ const char* stacks, size_t stacks_len) { - LOG(INFO) << StringView(stacks, stacks_len); + LOG(INFO) << std::string_view(stacks, stacks_len); return PaletteStatus::kOkay; } diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_dex_file.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_dex_file.cc index 24cef30a11f58f98110c6d0919c87244615d3774..a5044aad7e8f709e6642841faaa3b0a51617b248 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_dex_file.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_dex_file.cc @@ -19,8 +19,6 @@ #include "base/leb128.h" #include "code_item_accessors-inl.h" #include "dex_file-inl.h" -#include -#include namespace art { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_offset_table.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_offset_table.h index e651363f3ba4768e4d8f098b9de9ae9a308fb2c4..ec759e200d1bc45df564b97483f20e4328b7249f 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_offset_table.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/compact_offset_table.h @@ -28,7 +28,7 @@ class CompactOffsetTable { public: // This value is coupled with the leb chunk bitmask. That logic must also be adjusted when the // integer is modified. - static constexpr std::size_t kElementsPerIndex = 16; + static constexpr size_t kElementsPerIndex = 16; // Leb block format: // [uint16_t] 16 bit mask for what indexes actually have a non zero offset for the chunk. @@ -61,7 +61,7 @@ class CompactOffsetTable { uint32_t* out_table_offset); // 32 bit aligned for the offset table. - static constexpr std::size_t kAlignment = sizeof(uint32_t); + static constexpr size_t kAlignment = sizeof(uint32_t); }; } // namespace art diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/descriptors_names.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/descriptors_names.cc index 1fa5fd1fc8309b7ccc58e76e5f38d5e94e2d5c69..1e8eb3349bb724d5869124a414d02ffdb8e239fc 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/descriptors_names.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/descriptors_names.cc @@ -21,8 +21,6 @@ #include "base/macros.h" #include "dex/utf-inl.h" -#include -#include namespace art { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file-inl.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file-inl.h index 3b794805c72b7da099e74b9155027d0c234ae1a7..0c3f949b919faa007fef8b5e43ad7cb970cf64e6 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file-inl.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file-inl.h @@ -28,15 +28,14 @@ #include "dex_instruction_iterator.h" #include "invoke_type.h" #include "standard_dex_file.h" -#include "string_view_format.h" namespace art { -inline StringView StringViewFromUtf16Length(const char* utf8_data, size_t utf16_length) { +inline std::string_view StringViewFromUtf16Length(const char* utf8_data, size_t utf16_length) { size_t utf8_length = LIKELY(utf8_data[utf16_length] == 0) // Is ASCII? ? utf16_length : utf16_length + strlen(utf8_data + utf16_length); - return StringView(utf8_data, utf8_length); + return std::string_view(utf8_data, utf8_length); } inline int32_t DexFile::GetStringLength(const dex::StringId& string_id) const { @@ -72,10 +71,10 @@ inline const char* DexFile::StringDataByIdx(dex::StringIndex idx) const { return StringDataAndUtf16LengthByIdx(idx, &unicode_length); } -inline StringView DexFile::StringViewByIdx(dex::StringIndex idx) const { +inline std::string_view DexFile::StringViewByIdx(dex::StringIndex idx) const { uint32_t unicode_length; const char* data = StringDataAndUtf16LengthByIdx(idx, &unicode_length); - return data != nullptr ? StringViewFromUtf16Length(data, unicode_length) : StringView(""); + return data != nullptr ? StringViewFromUtf16Length(data, unicode_length) : std::string_view(""); } inline const char* DexFile::StringByTypeIdx(dex::TypeIndex idx, uint32_t* unicode_length) const { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.cc index de96e55132e639a481e94466bb54564e54ea58f7..7db4de02238a8d006b0724d4f7b42b275f15f971 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.cc @@ -400,7 +400,7 @@ const ProtoId* DexFile::FindProtoId(dex::TypeIndex return_type_idx, } // Given a signature place the type ids into the given vector -bool DexFile::CreateTypeList(StringView signature, +bool DexFile::CreateTypeList(std::string_view signature, dex::TypeIndex* return_type_idx, std::vector* param_type_idxs) const { if (signature[0] != '(') { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.h index cf99b65c92f2501f73106cfd713a58de800b0786..b892d82426f758583b106ba436b44a566f326c5a 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file.h @@ -19,7 +19,7 @@ #include #include -#include "string_view_format.h" +#include #include #include @@ -262,7 +262,7 @@ class DexFile { const char* StringDataAndUtf16LengthByIdx(dex::StringIndex idx, uint32_t* utf16_length) const; const char* StringDataByIdx(dex::StringIndex idx) const; - StringView StringViewByIdx(dex::StringIndex idx) const; + std::string_view StringViewByIdx(dex::StringIndex idx) const; // Looks up a string id for a given modified utf8 string. const dex::StringId* FindStringId(const char* string) const; @@ -480,7 +480,7 @@ class DexFile { } // Given a signature place the type ids into the given vector, returns true on success - bool CreateTypeList(StringView signature, + bool CreateTypeList(std::string_view signature, dex::TypeIndex* return_type_idx, std::vector* param_type_idxs) const; diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_loader.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_loader.h index 23315ad5c0610f50affa058cb8847899beda4d95..49e177fce6b91af1e0b96f47a0fb71c3f0a0cea3 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_loader.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_loader.h @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_verifier.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_verifier.cc index 7e59e3e5902d540a83226b89805ce99f606e22be..86a28e5a3e8f79951ffc674b1e81ce1a5ece17a4 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_verifier.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/dex_file_verifier.cc @@ -17,7 +17,7 @@ #include "dex_file_verifier.h" #include -#include + #include #include "android-base/stringprintf.h" diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature-inl.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature-inl.h index c6dbe90d0b623577b0fa5c54207bbb9279fbabca..12ad1b303ff895da2dc728541c27970db2e0effe 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature-inl.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature-inl.h @@ -36,13 +36,13 @@ inline bool Signature::operator==(const Signature& rhs) const { uint32_t lhs_shorty_len; // For a shorty utf16 length == mutf8 length. const char* lhs_shorty_data = dex_file_->StringDataAndUtf16LengthByIdx(proto_id_->shorty_idx_, &lhs_shorty_len); - StringView lhs_shorty(lhs_shorty_data, lhs_shorty_len); + std::string_view lhs_shorty(lhs_shorty_data, lhs_shorty_len); { uint32_t rhs_shorty_len; const char* rhs_shorty_data = rhs.dex_file_->StringDataAndUtf16LengthByIdx(rhs.proto_id_->shorty_idx_, &rhs_shorty_len); - StringView rhs_shorty(rhs_shorty_data, rhs_shorty_len); + std::string_view rhs_shorty(rhs_shorty_data, rhs_shorty_len); if (lhs_shorty != rhs_shorty) { return false; // Shorty mismatch. } @@ -56,7 +56,7 @@ inline bool Signature::operator==(const Signature& rhs) const { return false; // Return type mismatch. } } - if (lhs_shorty.find('L', 1) != StringView::npos) { + if (lhs_shorty.find('L', 1) != std::string_view::npos) { const dex::TypeList* params = dex_file_->GetProtoParameters(*proto_id_); const dex::TypeList* rhs_params = rhs.dex_file_->GetProtoParameters(*rhs.proto_id_); // We found a reference parameter in the matching shorty, so both lists must be non-empty. diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.cc index b7456fd9cbb2b1984ee02b78fd55ac0f821d5468..ac004286f205c78ecca007d5698c8c2ed7e3f3b4 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.cc @@ -57,11 +57,11 @@ bool Signature::IsVoid() const { return strcmp(return_type, "V") == 0; } -bool Signature::operator==(StringView rhs) const { +bool Signature::operator==(std::string_view rhs) const { if (dex_file_ == nullptr) { return false; } - StringView tail(rhs); + std::string_view tail(rhs); if (!StartsWith(tail, "(")) { return false; // Invalid signature } @@ -69,7 +69,7 @@ bool Signature::operator==(StringView rhs) const { const TypeList* params = dex_file_->GetProtoParameters(*proto_id_); if (params != nullptr) { for (uint32_t i = 0; i < params->Size(); ++i) { - StringView param(dex_file_->StringByTypeIdx(params->GetTypeItem(i).type_idx_)); + std::string_view param(dex_file_->StringByTypeIdx(params->GetTypeItem(i).type_idx_)); if (!StartsWith(tail, param)) { return false; } diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.h b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.h index 26d0a5c9da17faa40864577a44ae295642e7d785..3fbb543d38d615fc5c5d0ef9635d80eb1b5dfe85 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/signature.h @@ -19,7 +19,7 @@ #include #include -#include "string_view_format.h" +#include #include @@ -49,7 +49,7 @@ class Signature : public ValueObject { return !(*this == rhs); } - bool operator==(StringView rhs) const; + bool operator==(std::string_view rhs) const; private: Signature(const DexFile* dex, const dex::ProtoId& proto) : dex_file_(dex), proto_id_(&proto) { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/standard_dex_file.cc b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/standard_dex_file.cc index ac9d548a6ec922c42911450c42915a1f623dcd3b..8bac44e02eeff9e77682f27e90c69e5782ef943c 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/dex/standard_dex_file.cc +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/dex/standard_dex_file.cc @@ -20,8 +20,6 @@ #include "base/leb128.h" #include "code_item_accessors-inl.h" #include "dex_file-inl.h" -#include -#include namespace art { diff --git a/third_party/aosp_10.0.0_r35/art/libdexfile/external/include/art_api/dex_file_support.h b/third_party/aosp_10.0.0_r35/art/libdexfile/external/include/art_api/dex_file_support.h index be1fa6e51ed257be31ac5170800d9c73778f311b..a98ff0e2941d7ce9385862cf6bb533ba41747a7f 100644 --- a/third_party/aosp_10.0.0_r35/art/libdexfile/external/include/art_api/dex_file_support.h +++ b/third_party/aosp_10.0.0_r35/art/libdexfile/external/include/art_api/dex_file_support.h @@ -22,7 +22,7 @@ #include #include #include -#include "string_view_format.h" +#include #include #include @@ -46,7 +46,7 @@ class DexString final { } explicit DexString(const char* str = "") : ext_string_(MakeExtDexFileString(str, std::strlen(str))) {} - explicit DexString(StringView str) + explicit DexString(std::string_view str) : ext_string_(MakeExtDexFileString(str.data(), str.size())) {} ~DexString() { g_ExtDexFileFreeString(ext_string_); } @@ -68,10 +68,10 @@ class DexString final { } size_t length() const { return size(); } - operator StringView() const { + operator std::string_view() const { size_t len; const char* chars = g_ExtDexFileGetString(ext_string_, &len); - return StringView(chars, len); + return std::string_view(chars, len); } private: diff --git a/third_party/aosp_10.0.0_r35/system/core/base/cmsg.cpp b/third_party/aosp_10.0.0_r35/system/core/base/cmsg.cpp index 47c28efd62435a634f894e432f8679894db9be83..42866f8f2bc758e180d47a050455f041a45b480f 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/cmsg.cpp +++ b/third_party/aosp_10.0.0_r35/system/core/base/cmsg.cpp @@ -21,7 +21,7 @@ #include #include #include -#include + #include #include @@ -33,7 +33,7 @@ ssize_t SendFileDescriptorVector(int sockfd, const void* data, size_t len, const std::vector& fds) { size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); - if (cmsg_space >= sysconf(_SC_PAGE_SIZE)) { + if (cmsg_space >= PAGE_SIZE) { errno = ENOMEM; return -1; } @@ -75,7 +75,7 @@ ssize_t ReceiveFileDescriptorVector(int sockfd, void* data, size_t len, size_t m fds->clear(); size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); - if (cmsg_space >= sysconf(_SC_PAGE_SIZE)) { + if (cmsg_space >= PAGE_SIZE) { errno = ENOMEM; return -1; } diff --git a/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/logging.h b/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/logging.h index 87337aec90caf6339fddd2adfcfb36529718973a..f94cc258e97be8003dc2482dd424cd9a4f5638d9 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/logging.h +++ b/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/logging.h @@ -81,7 +81,7 @@ namespace base { enum LogSeverity { VERBOSE, - DEBUG_S, + DEBUG, INFO, WARNING, ERROR, @@ -181,7 +181,7 @@ class ErrnoRestorer { // Note: DO NOT USE DIRECTLY. This is an implementation detail. #define SEVERITY_LAMBDA(severity) ([&]() { \ using ::android::base::VERBOSE; \ - using ::android::base::DEBUG_S; \ + using ::android::base::DEBUG; \ using ::android::base::INFO; \ using ::android::base::WARNING; \ using ::android::base::ERROR; \ @@ -248,7 +248,7 @@ struct LogAbortAfterFullExpr { // Logs a message to logcat with the specified log ID on Android otherwise to // stderr. If the severity is FATAL it also causes an abort. // Use an expression here so we can support the << operator following the macro, -// like "LOG(DEBUG_S) << xxx;". +// like "LOG(DEBUG) << xxx;". #define LOG_TO(dest, severity) LOGGING_PREAMBLE(severity) && LOG_STREAM_TO(dest, severity) // A variant of LOG that also logs the current errno value. To be used when diff --git a/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/strings.h b/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/strings.h index 8feb308c567fb509a967a96e89ffad641c69c941..8e9716f9feaee709f79f18e37cad95c26e59a583 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/strings.h +++ b/third_party/aosp_10.0.0_r35/system/core/base/include/android-base/strings.h @@ -19,7 +19,6 @@ #include #include #include -#include "string_view_format.h" namespace android { namespace base { @@ -57,17 +56,17 @@ extern template std::string Join(const std::vector&, const std::str extern template std::string Join(const std::vector&, const std::string&); // Tests whether 's' starts with 'prefix'. -bool StartsWith(StringView s, StringView prefix); -bool StartsWith(StringView s, char prefix); -bool StartsWithIgnoreCase(StringView s, StringView prefix); +bool StartsWith(std::string_view s, std::string_view prefix); +bool StartsWith(std::string_view s, char prefix); +bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix); // Tests whether 's' ends with 'suffix'. -bool EndsWith(StringView s, StringView suffix); -bool EndsWith(StringView s, char suffix); -bool EndsWithIgnoreCase(StringView s, StringView suffix); +bool EndsWith(std::string_view s, std::string_view suffix); +bool EndsWith(std::string_view s, char suffix); +bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix); // Tests whether 'lhs' equals 'rhs', ignoring case. -bool EqualsIgnoreCase(StringView lhs, StringView rhs); +bool EqualsIgnoreCase(std::string_view lhs, std::string_view rhs); } // namespace base } // namespace android diff --git a/third_party/aosp_10.0.0_r35/system/core/base/logging.cpp b/third_party/aosp_10.0.0_r35/system/core/base/logging.cpp index 4f0d37b2d30c00500e62fcb185e2d0f5c822bda3..f89168c0fc4dff5a1808ea23d82d476452ba22d5 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/logging.cpp +++ b/third_party/aosp_10.0.0_r35/system/core/base/logging.cpp @@ -16,11 +16,10 @@ #if defined(_WIN32) #include -#include "android-base/threads.h" #endif #include "android-base/logging.h" -#include + #include #include #include @@ -168,7 +167,7 @@ void KernelLogger(android::base::LogId, android::base::LogSeverity severity, static constexpr int kLogSeverityToKernelLogLevel[] = { [android::base::VERBOSE] = 7, // KERN_DEBUG (there is no verbose kernel log // level) - [android::base::DEBUG_S] = 7, // KERN_DEBUG_S + [android::base::DEBUG] = 7, // KERN_DEBUG [android::base::INFO] = 6, // KERN_INFO [android::base::WARNING] = 4, // KERN_WARNING [android::base::ERROR] = 3, // KERN_ERROR @@ -311,7 +310,7 @@ void InitLogging(char* argv[], LogFunction&& logger, AbortFunction&& aborter) { gMinimumLogSeverity = VERBOSE; continue; case 'd': - gMinimumLogSeverity = DEBUG_S; + gMinimumLogSeverity = DEBUG; continue; case 'i': gMinimumLogSeverity = INFO; diff --git a/third_party/aosp_10.0.0_r35/system/core/base/mapped_file.cpp b/third_party/aosp_10.0.0_r35/system/core/base/mapped_file.cpp index 7c65dc3c5bef4cdac22e0bfe7e04fe168ed9f163..d26e8ba91582a12542322d535ee7325f307d54f7 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/mapped_file.cpp +++ b/third_party/aosp_10.0.0_r35/system/core/base/mapped_file.cpp @@ -76,7 +76,7 @@ MappedFile::~MappedFile() { if (base_ != nullptr) UnmapViewOfFile(base_); if (handle_ != nullptr) CloseHandle(handle_); #else - if (base_ != nullptr) munmap(base_, size_); + if (base_ != nullptr) munmap(base_, size_ + offset_); #endif base_ = nullptr; diff --git a/third_party/aosp_10.0.0_r35/system/core/base/strings.cpp b/third_party/aosp_10.0.0_r35/system/core/base/strings.cpp index 284d4db5f1f963273c5e2240463643c061706056..bb3167ef0a02657114f56d18e58fc0c9f74b7d32 100644 --- a/third_party/aosp_10.0.0_r35/system/core/base/strings.cpp +++ b/third_party/aosp_10.0.0_r35/system/core/base/strings.cpp @@ -87,32 +87,32 @@ template std::string Join(const std::vector&, char); template std::string Join(const std::vector&, const std::string&); template std::string Join(const std::vector&, const std::string&); -bool StartsWith(StringView s, StringView prefix) { +bool StartsWith(std::string_view s, std::string_view prefix) { return s.substr(0, prefix.size()) == prefix; } -bool StartsWith(StringView s, char prefix) { +bool StartsWith(std::string_view s, char prefix) { return !s.empty() && s.front() == prefix; } -bool StartsWithIgnoreCase(StringView s, StringView prefix) { +bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix) { return s.size() >= prefix.size() && strncasecmp(s.data(), prefix.data(), prefix.size()) == 0; } -bool EndsWith(StringView s, StringView suffix) { +bool EndsWith(std::string_view s, std::string_view suffix) { return s.size() >= suffix.size() && s.substr(s.size() - suffix.size(), suffix.size()) == suffix; } -bool EndsWith(StringView s, char suffix) { +bool EndsWith(std::string_view s, char suffix) { return !s.empty() && s.back() == suffix; } -bool EndsWithIgnoreCase(StringView s, StringView suffix) { +bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix) { return s.size() >= suffix.size() && strncasecmp(s.data() + (s.size() - suffix.size()), suffix.data(), suffix.size()) == 0; } -bool EqualsIgnoreCase(StringView lhs, StringView rhs) { +bool EqualsIgnoreCase(std::string_view lhs, std::string_view rhs) { return lhs.size() == rhs.size() && strncasecmp(lhs.data(), rhs.data(), lhs.size()) == 0; } diff --git a/third_party/aosp_10.0.0_r35/system/core/include/cutils/android_filesystem_config.h b/third_party/aosp_10.0.0_r35/system/core/include/cutils/android_filesystem_config.h index 9a13e0382519eb81fff1f84bcad2da95202b033a..63c3793fd962b34d6e659b79af1bcbfae95aee3e 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/cutils/android_filesystem_config.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/cutils/android_filesystem_config.h @@ -144,7 +144,6 @@ /* The range 2900-2999 is reserved for OEM, and must never be * used here */ #define AID_OEM_RESERVED_START 2900 -#define AID_HDB 2901 /* access hdbservice */ #define AID_OEM_RESERVED_END 2999 /* The 3000 series are intended for use as supplemental group id's only. @@ -162,38 +161,6 @@ /* The range 5000-5999 is also reserved for OEM, and must never be used here. */ #define AID_OEM_RESERVED_2_START 5000 - -/* Huawei Extend AID */ -/* - * 1. ALL huawei extend AID should add VENDOR prefix,e.g. AID_VENDOR_XXXX - * 2. If the added AID was used in vendor partition only, Add it to config.fs - * vendor/huawei/chipset_common/config/common/config.fs - * 3. Huawei AID range: - * AID used in system partition: 5501-5900 - * AID used in vendor partiton only: 5900-5999 - * 4. wiki: http://3ms.huawei.com/hi/group/2844405/wiki_5160709.html?for_statistic_from=creation_group_wiki -*/ - -#define AID_VENDOR_HDB 5501 /* access hdbservice*/ - -#define AID_VENDOR_DSM 5502 /* dsm access */ - -#define AID_VENDOR_HWHFD 5503 /* Huawei kernel hot fix daemon */ - -#define AID_VENDOR_SKYTONE 5504 /* access skytone */ - -#define AID_VENDOR_ACT_RCS 5505 /* access device actr */ - -#define AID_VENDOR_ODMF 5506 /* access AI model files */ - -#define AID_VENDOR_INSTALLER 5507 /* access installer files */ - -#define AID_VENDOR_HBS 5508 /* access hbs data */ - -#define AID_DSM 5509 /* dsm access */ - -#define AID_VENDOR_FACEID 5510 /* acess faceid */ - #define AID_OEM_RESERVED_2_END 5999 #define AID_EVERYBODY 9997 /* shared between all apps in the same profile */ diff --git a/third_party/aosp_10.0.0_r35/system/core/include/cutils/fs.h b/third_party/aosp_10.0.0_r35/system/core/include/cutils/fs.h index 0d5916117bab1cfeeb2b7bba29407c31d2244b67..a34ce86022a3532cb04b083b82f2ddd4aa9a528e 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/cutils/fs.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/cutils/fs.h @@ -45,14 +45,6 @@ extern "C" { */ extern int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); -/* DTS2016051401335 AR000485VM FixUid l00214442 20160514 begin */ -/* - * Ensure that directory exists with given mode and owners. If it exists - * with a different mode or owners, they are fixed to match the given values recursively. - */ -extern int fs_prepare_dir_fixup_recursive(const char* path, mode_t mode, uid_t uid, gid_t gid, int allow_fixup); -/* DTS2016051401335 AR000485VM FixUid l00214442 20160514 end */ - /* * Ensure that directory exists with given mode and owners. If it exists * with different owners, they are not fixed and -1 is returned. diff --git a/third_party/aosp_10.0.0_r35/system/core/include/cutils/trace.h b/third_party/aosp_10.0.0_r35/system/core/include/cutils/trace.h index 195f678e89b5f0ee93f7118769e4121b3dbc0f3d..79b4b355b9d55e35cb3f7687cef0b76f8565019d 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/cutils/trace.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/cutils/trace.h @@ -18,6 +18,7 @@ #define _LIBS_CUTILS_TRACE_H #include +#include #include #include #include @@ -87,7 +88,7 @@ __BEGIN_DECLS #elif ATRACE_TAG > ATRACE_TAG_VALID_MASK #error ATRACE_TAG must be defined to be one of the tags defined in cutils/trace.h #endif -using namespace std; + /** * Opens the trace file for writing and reads the property for initial tags. * The atrace.tags.enableflags property sets the tags to trace. diff --git a/third_party/aosp_10.0.0_r35/system/core/include/log/log_id.h b/third_party/aosp_10.0.0_r35/system/core/include/log/log_id.h index 70ebd1f384a909143285ca38f6fd00d110887ee2..c052a503c07c5f77b5ad26ef61a71e74d98af6db 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/log/log_id.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/log/log_id.h @@ -58,8 +58,6 @@ int __android_log_buf_print(int bufID, int prio, const char* tag, log_id_t android_name_to_log_id(const char* logName); const char* android_log_id_to_name(log_id_t log_id); -int __hwlog_setparam(int paramid, const char *val); - #ifdef __cplusplus } #endif diff --git a/third_party/aosp_10.0.0_r35/system/core/include/private/android_filesystem_config.h b/third_party/aosp_10.0.0_r35/system/core/include/private/android_filesystem_config.h index 9a13e0382519eb81fff1f84bcad2da95202b033a..63c3793fd962b34d6e659b79af1bcbfae95aee3e 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/private/android_filesystem_config.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/private/android_filesystem_config.h @@ -144,7 +144,6 @@ /* The range 2900-2999 is reserved for OEM, and must never be * used here */ #define AID_OEM_RESERVED_START 2900 -#define AID_HDB 2901 /* access hdbservice */ #define AID_OEM_RESERVED_END 2999 /* The 3000 series are intended for use as supplemental group id's only. @@ -162,38 +161,6 @@ /* The range 5000-5999 is also reserved for OEM, and must never be used here. */ #define AID_OEM_RESERVED_2_START 5000 - -/* Huawei Extend AID */ -/* - * 1. ALL huawei extend AID should add VENDOR prefix,e.g. AID_VENDOR_XXXX - * 2. If the added AID was used in vendor partition only, Add it to config.fs - * vendor/huawei/chipset_common/config/common/config.fs - * 3. Huawei AID range: - * AID used in system partition: 5501-5900 - * AID used in vendor partiton only: 5900-5999 - * 4. wiki: http://3ms.huawei.com/hi/group/2844405/wiki_5160709.html?for_statistic_from=creation_group_wiki -*/ - -#define AID_VENDOR_HDB 5501 /* access hdbservice*/ - -#define AID_VENDOR_DSM 5502 /* dsm access */ - -#define AID_VENDOR_HWHFD 5503 /* Huawei kernel hot fix daemon */ - -#define AID_VENDOR_SKYTONE 5504 /* access skytone */ - -#define AID_VENDOR_ACT_RCS 5505 /* access device actr */ - -#define AID_VENDOR_ODMF 5506 /* access AI model files */ - -#define AID_VENDOR_INSTALLER 5507 /* access installer files */ - -#define AID_VENDOR_HBS 5508 /* access hbs data */ - -#define AID_DSM 5509 /* dsm access */ - -#define AID_VENDOR_FACEID 5510 /* acess faceid */ - #define AID_OEM_RESERVED_2_END 5999 #define AID_EVERYBODY 9997 /* shared between all apps in the same profile */ diff --git a/third_party/aosp_10.0.0_r35/system/core/include/utils/Flattenable.h b/third_party/aosp_10.0.0_r35/system/core/include/utils/Flattenable.h index 9d006023d54ef4182511b22832771e532fa7dcf6..2c4b8075d25e8c6c18b183394079c590dfec3a6a 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/utils/Flattenable.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/utils/Flattenable.h @@ -47,7 +47,12 @@ public: template static size_t align(void*& buffer) { - return align( const_cast(buffer) ); + static_assert(!(N & (N - 1)), "Can only align to a power of 2."); + void* b = buffer; + buffer = reinterpret_cast((uintptr_t(buffer) + (N-1)) & ~(N-1)); + size_t delta = size_t(uintptr_t(buffer) - uintptr_t(b)); + memset(b, 0, delta); + return delta; } static void advance(void*& buffer, size_t& size, size_t offset) { diff --git a/third_party/aosp_10.0.0_r35/system/core/include/utils/String8.h b/third_party/aosp_10.0.0_r35/system/core/include/utils/String8.h index 9043686bce6f41264e3bd2eebbca0e9c11e795b9..c8f584e306c432bf5f5dc782a4054749a17689b0 100644 --- a/third_party/aosp_10.0.0_r35/system/core/include/utils/String8.h +++ b/third_party/aosp_10.0.0_r35/system/core/include/utils/String8.h @@ -58,9 +58,6 @@ public: explicit String8(const char16_t* o, size_t numChars); explicit String8(const char32_t* o); explicit String8(const char32_t* o, size_t numChars); - //fix bug of sogou input method - explicit String8(unsigned short const* o); - //fix bug of sogou input method ~String8(); static inline const String8 empty(); diff --git a/third_party/aosp_10.0.0_r35/system/core/liblog/include/log/log_id.h b/third_party/aosp_10.0.0_r35/system/core/liblog/include/log/log_id.h index 70ebd1f384a909143285ca38f6fd00d110887ee2..c052a503c07c5f77b5ad26ef61a71e74d98af6db 100644 --- a/third_party/aosp_10.0.0_r35/system/core/liblog/include/log/log_id.h +++ b/third_party/aosp_10.0.0_r35/system/core/liblog/include/log/log_id.h @@ -58,8 +58,6 @@ int __android_log_buf_print(int bufID, int prio, const char* tag, log_id_t android_name_to_log_id(const char* logName); const char* android_log_id_to_name(log_id_t log_id); -int __hwlog_setparam(int paramid, const char *val); - #ifdef __cplusplus } #endif diff --git a/third_party/aosp_10.0.0_r35/system/core/liblog/include_vndk/log/log_id.h b/third_party/aosp_10.0.0_r35/system/core/liblog/include_vndk/log/log_id.h index 70ebd1f384a909143285ca38f6fd00d110887ee2..c052a503c07c5f77b5ad26ef61a71e74d98af6db 100644 --- a/third_party/aosp_10.0.0_r35/system/core/liblog/include_vndk/log/log_id.h +++ b/third_party/aosp_10.0.0_r35/system/core/liblog/include_vndk/log/log_id.h @@ -58,8 +58,6 @@ int __android_log_buf_print(int bufID, int prio, const char* tag, log_id_t android_name_to_log_id(const char* logName); const char* android_log_id_to_name(log_id_t log_id); -int __hwlog_setparam(int paramid, const char *val); - #ifdef __cplusplus } #endif diff --git a/third_party/aosp_10.0.0_r35/system/core/liblog/liblog.map.txt b/third_party/aosp_10.0.0_r35/system/core/liblog/liblog.map.txt index 170c26ad6b8395b566462bd2b04b5ba2f5d63d6c..ce4c53c82f7b378aa0dc9f3b97df2b625ae628e2 100644 --- a/third_party/aosp_10.0.0_r35/system/core/liblog/liblog.map.txt +++ b/third_party/aosp_10.0.0_r35/system/core/liblog/liblog.map.txt @@ -63,7 +63,6 @@ LIBLOG_Q { __android_log_security; # apex android_log_reset; #vndk android_log_parser_reset; #vndk - __hwlog_setparam; }; LIBLOG_PRIVATE { diff --git a/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/Flattenable.h b/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/Flattenable.h index 9d006023d54ef4182511b22832771e532fa7dcf6..2c4b8075d25e8c6c18b183394079c590dfec3a6a 100644 --- a/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/Flattenable.h +++ b/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/Flattenable.h @@ -47,7 +47,12 @@ public: template static size_t align(void*& buffer) { - return align( const_cast(buffer) ); + static_assert(!(N & (N - 1)), "Can only align to a power of 2."); + void* b = buffer; + buffer = reinterpret_cast((uintptr_t(buffer) + (N-1)) & ~(N-1)); + size_t delta = size_t(uintptr_t(buffer) - uintptr_t(b)); + memset(b, 0, delta); + return delta; } static void advance(void*& buffer, size_t& size, size_t offset) { diff --git a/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/String8.h b/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/String8.h index 9043686bce6f41264e3bd2eebbca0e9c11e795b9..c8f584e306c432bf5f5dc782a4054749a17689b0 100644 --- a/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/String8.h +++ b/third_party/aosp_10.0.0_r35/system/core/libutils/include/utils/String8.h @@ -58,9 +58,6 @@ public: explicit String8(const char16_t* o, size_t numChars); explicit String8(const char32_t* o); explicit String8(const char32_t* o, size_t numChars); - //fix bug of sogou input method - explicit String8(unsigned short const* o); - //fix bug of sogou input method ~String8(); static inline const String8 empty(); diff --git a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive.cc b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive.cc index 402fb201bde1fdfddd372cc10931fcfd51a505c5..0710d0addb46eb735745e620fc864fd2961a4ec3 100644 --- a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive.cc +++ b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive.cc @@ -33,7 +33,6 @@ #include #include -#include "string_view_format.h" #if defined(__APPLE__) #define lseek64 lseek @@ -104,8 +103,8 @@ static uint32_t RoundUpPower2(uint32_t val) { static uint32_t ComputeHash(const ZipString& name) { #if !defined(_WIN32) - return std::hash{}( - StringView(reinterpret_cast(name.name), name.name_length)); + return std::hash{}( + std::string_view(reinterpret_cast(name.name), name.name_length)); #else // Remove this code path once the windows compiler knows how to compile the above statement. uint32_t hash = 0; diff --git a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive_private.h b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive_private.h index a5f7a3a9073d3931046c88321ea9ec9d126c7155..330a02a0725dfac80f93c8d78543855b155f2bfe 100644 --- a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive_private.h +++ b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_archive_private.h @@ -138,7 +138,7 @@ class CentralDirectory { /** * More space efficient string representation of strings in an mmaped zipped file than - * StringView or ZipString. Using ZipString as an entry in the ZipArchive hashtable wastes + * std::string_view or ZipString. Using ZipString as an entry in the ZipArchive hashtable wastes * space. ZipString stores a pointer to a string (on 64 bit, 8 bytes) and the length to read from * that pointer, 2 bytes. Because of alignment, the structure consumes 16 bytes, wasting 6 bytes. * ZipStringOffset stores a 4 byte offset from a fixed location in the memory mapped file instead diff --git a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_writer.cc b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_writer.cc index 98b0a734db6408bc3bda9616ea48a31809a55469..0df0fa5387372ca77f054d2e03011f590e5785e1 100644 --- a/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_writer.cc +++ b/third_party/aosp_10.0.0_r35/system/core/libziparchive/zip_writer.cc @@ -358,7 +358,7 @@ int32_t ZipWriter::CompressBytes(FileEntry* file, const void* data, size_t len) CHECK(z_stream_->avail_out != 0); // Prepare the input. - z_stream_->next_in = (unsigned char *)(data); + z_stream_->next_in = reinterpret_cast(data); z_stream_->avail_in = len; while (z_stream_->avail_in > 0) {