From d43c58d87cb5b76f106817d450db708a66abb65e Mon Sep 17 00:00:00 2001 From: xingshunxiang Date: Wed, 11 Jun 2025 20:30:04 +0800 Subject: [PATCH] Enable ast-cache and fix crash Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICEFYG?from=project-issue Reason: need enable ast-cache again, and fix hello world demo Tests: ninja tests passed tests/tests-u-runner/runner.sh --ets-cts --show-progress --build-dir x64.release --processes=all passed tests/tests-u-runner/runner.sh --ets-func-tests --show-progress --build-dir x64.release --processes=all passed tests/tests-u-runner/runner.sh --astchecker --show-progress --build-dir x64.release --processes=all passed tests/tests-u-runner/runner.sh --ets-runtime --show-progress --build-dir x64.release --processes=all passed tests/tests-u-runner/runner.sh --parser --no-js --show-progress --build-dir x64.release --processes=all passed Signed-off-by: xingshunxiang --- ets2panda/checker/ets/object.cpp | 4 +--- ets2panda/checker/types/ets/etsObjectType.cpp | 7 ++----- .../checker/types/ets/etsObjectTypeConstants.h | 17 ++++++++--------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ets2panda/checker/ets/object.cpp b/ets2panda/checker/ets/object.cpp index 4760ea0ca1..c0eca82ba6 100644 --- a/ets2panda/checker/ets/object.cpp +++ b/ets2panda/checker/ets/object.cpp @@ -1101,7 +1101,7 @@ void ETSChecker::MaybeReportErrorsForOverridingValidation(ArenaVectorHasObjectFlag(ETSObjectFlags::CHECKED_COMPATIBLE_ABSTRACTS)) { + if (GetCachedComputedAbstracts()->find(classType) != GetCachedComputedAbstracts()->end()) { return; } @@ -1133,8 +1133,6 @@ void ETSChecker::ValidateOverriding(ETSObjectType *classType, const lexer::Sourc } while (superIter != nullptr); ValidateAbstractMethodsToBeImplemented(abstractsToBeImplemented, classType, implementedSignatures); MaybeReportErrorsForOverridingValidation(abstractsToBeImplemented, classType, pos, throwError); - - classType->AddObjectFlag(ETSObjectFlags::CHECKED_COMPATIBLE_ABSTRACTS); } void ETSChecker::AddImplementedSignature(std::vector *implementedSignatures, diff --git a/ets2panda/checker/types/ets/etsObjectType.cpp b/ets2panda/checker/types/ets/etsObjectType.cpp index c86dbcd510..251915475c 100644 --- a/ets2panda/checker/types/ets/etsObjectType.cpp +++ b/ets2panda/checker/types/ets/etsObjectType.cpp @@ -533,7 +533,6 @@ void ETSObjectType::Identical(TypeRelation *relation, Type *other) bool ETSObjectType::CheckIdenticalFlags(ETSObjectType *other) const { constexpr auto FLAGS_TO_REMOVE = ETSObjectFlags::INCOMPLETE_INSTANTIATION | - ETSObjectFlags::CHECKED_COMPATIBLE_ABSTRACTS | ETSObjectFlags::CHECKED_INVOKE_LEGITIMACY | ETSObjectFlags::EXTENSION_FUNCTION; auto cleanedTargetFlags = other->ObjectFlags(); @@ -946,8 +945,7 @@ Type *ETSObjectType::Instantiate(ArenaAllocator *const allocator, TypeRelation * ES2PANDA_ASSERT(copiedType->internalName_ == internalName_); ES2PANDA_ASSERT(copiedType->name_ == name_); copiedType->typeFlags_ = typeFlags_; - copiedType->RemoveObjectFlag(ETSObjectFlags::CHECKED_COMPATIBLE_ABSTRACTS | - ETSObjectFlags::INCOMPLETE_INSTANTIATION | ETSObjectFlags::CHECKED_INVOKE_LEGITIMACY); + copiedType->RemoveObjectFlag(ETSObjectFlags::INCOMPLETE_INSTANTIATION | ETSObjectFlags::CHECKED_INVOKE_LEGITIMACY); copiedType->SetVariable(variable_); copiedType->SetSuperType(superType_); @@ -1044,8 +1042,7 @@ void ETSObjectType::SetCopiedTypeProperties(TypeRelation *const relation, ETSObj ArenaVector &&newTypeArgs, ETSObjectType *base) { copiedType->typeFlags_ = typeFlags_; - copiedType->RemoveObjectFlag(ETSObjectFlags::CHECKED_COMPATIBLE_ABSTRACTS | - ETSObjectFlags::INCOMPLETE_INSTANTIATION | ETSObjectFlags::CHECKED_INVOKE_LEGITIMACY); + copiedType->RemoveObjectFlag(ETSObjectFlags::INCOMPLETE_INSTANTIATION | ETSObjectFlags::CHECKED_INVOKE_LEGITIMACY); copiedType->SetVariable(variable_); // #25295 Need to do some refactor on baseType for partial diff --git a/ets2panda/checker/types/ets/etsObjectTypeConstants.h b/ets2panda/checker/types/ets/etsObjectTypeConstants.h index 1b27c6e7c7..6bd4357e59 100644 --- a/ets2panda/checker/types/ets/etsObjectTypeConstants.h +++ b/ets2panda/checker/types/ets/etsObjectTypeConstants.h @@ -34,15 +34,14 @@ enum class ETSObjectFlags : std::uint64_t { RESOLVED_INTERFACES = 1U << 7U, RESOLVED_SUPER = 1U << 8U, RESOLVED_TYPE_PARAMS = 1U << 9U, - CHECKED_COMPATIBLE_ABSTRACTS = 1U << 10U, - STRING = 1U << 11U, - INCOMPLETE_INSTANTIATION = 1U << 12U, - INNER = 1U << 13U, - DYNAMIC = 1U << 14U, - ASYNC_FUNC_RETURN_TYPE = 1U << 15U, - CHECKED_INVOKE_LEGITIMACY = 1U << 16U, - REQUIRED = 1U << 17U, - READONLY = 1U << 18U, + STRING = 1U << 10U, + INCOMPLETE_INSTANTIATION = 1U << 11U, + INNER = 1U << 12U, + DYNAMIC = 1U << 13U, + ASYNC_FUNC_RETURN_TYPE = 1U << 14U, + CHECKED_INVOKE_LEGITIMACY = 1U << 15U, + REQUIRED = 1U << 16U, + READONLY = 1U << 17U, BUILTIN_BIGINT = 1U << 22U, BUILTIN_STRING = 1U << 23U, -- Gitee