!544 Fix compiler codestyle

Merge pull request !544 from ober-man/fix-static-core-compiler-codecheck
This commit is contained in:
openharmony_ci 2023-11-11 08:17:56 +00:00 committed by Gitee
commit 60109cde57
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
359 changed files with 2113 additions and 2012 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -845,7 +845,7 @@ void ElfBuilder<ARCH, IS_JIT_MODE>::Write(const std::string &file_name)
elf_file.write(reinterpret_cast<char *>(data_span.Data()), data_span.Size());
}
static inline void CopyToSpan(Span<uint8_t> to, const char *from, size_t size, size_t begin_index)
inline void CopyToSpan(Span<uint8_t> to, const char *from, size_t size, size_t begin_index)
{
ASSERT(begin_index < to.Size());
auto max_size {to.Size() - begin_index};

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -40,10 +40,10 @@ static inline Expected<const uint8_t *, std::string> LoadSymbol(const panda::os:
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define LOAD_AOT_SYMBOL(name) \
auto name = LoadSymbol(handle, #name); \
if (!name) { \
return Unexpected("Cannot load name section: " + name.Error()); \
#define LOAD_AOT_SYMBOL(name) \
auto name = LoadSymbol(handle, (#name)); \
if (!(name)) { \
return Unexpected("Cannot load name section: " + (name).Error()); \
}
Expected<std::unique_ptr<AotFile>, std::string> AotFile::Open(const std::string &file_name, uint32_t gc_type,

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -35,7 +35,7 @@ void CodeInfo::Dump(std::ostream &stream, const StackMap &stack_map, Arch arch)
stream << "Stackmap #" << stack_map.GetRow() << ": npc=0x" << std::hex << stack_map.GetNativePcUnpacked(arch)
<< ", bpc=0x" << std::hex << stack_map.GetBytecodePc();
if (stack_map.HasInlineInfoIndex()) {
stream << ", inline_depth=" << GetInlineDepth(stack_map) + 1;
stream << ", inline_depth=" << (GetInlineDepth(stack_map) + 1);
}
if (stack_map.HasRootsRegMaskIndex() || stack_map.HasRootsStackMaskIndex()) {
stream << ", roots=[";

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -94,7 +94,7 @@ void CodeInfoBuilder::EndStackMap()
void CodeInfoBuilder::DumpCurrentStackMap(std::ostream &stream) const
{
stream << "Stackmap #" << stack_maps_.GetRowsCount() - 1 << ": npc=0x" << std::hex
stream << "Stackmap #" << (stack_maps_.GetRowsCount() - 1) << ": npc=0x" << std::hex
<< StackMap::UnpackAddress(current_stack_map_[StackMap::COLUMN_NATIVE_PC], arch_) << ", bpc=0x" << std::hex
<< current_stack_map_[StackMap::COLUMN_BYTECODE_PC];
if (current_stack_map_[StackMap::COLUMN_INLINE_INFO_INDEX] != StackMap::NO_VALUE) {

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -195,7 +195,6 @@ bool JITCompileMethod(RuntimeInterface *runtime, Method *method, bool is_osr, Co
auto arch {Arch::NONE};
bool is_dynamic = panda::panda_file::IsDynamicLanguage(method->GetClass()->GetSourceLang());
if (!CompileInGraph(runtime, method, is_osr, allocator, local_allocator, is_dynamic, &arch, method_name, &graph,
jit_stats)) {
return false;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -34,8 +34,8 @@ void CompilerLogger::SetComponents(const std::vector<std::string>& args)
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DEF(COMPONENT, NAME) \
if (NAME == arg) { \
components_.set(COMPONENT); \
if ((NAME) == arg) { \
components_.set(COMPONENT); \
continue; \
}
COMPILER_LOG_COMPONENTS(DEF)

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -123,7 +123,7 @@ private:
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DEF(FEATURE, NAME) \
if (NAME == arg) { \
if ((NAME) == arg) { \
EnableCpuFeature(FEATURE); \
continue; \
}

View File

@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -308,6 +308,37 @@ AliasType AliasAnalysis::CheckRefAlias(Inst *ref1, Inst *ref2) const
return CheckMemAddress(Pointer::CreateObject(ref1), Pointer::CreateObject(ref2));
}
AliasType AliasAnalysis::CheckMemAddressEmptyIntersectionCase(const PointerSet &aliases1, const PointerSet &aliases2,
const Pointer &p1, const Pointer &p2) const
{
// If at least one set of aliases consists of only local aliases then there is NO_ALIAS
auto is_outer = [](Pointer const &p) { return !p.IsLocal(); };
if (std::find_if(aliases1.begin(), aliases1.end(), is_outer) == aliases1.end() ||
std::find_if(aliases2.begin(), aliases2.end(), is_outer) == aliases2.end()) {
return NO_ALIAS;
}
// Different fields cannot alias each other even if they are not created locally
if (p1.GetType() == OBJECT_FIELD && !p1.HasSameOffset(p2)) {
return NO_ALIAS;
}
if (p1.GetType() == ARRAY_ELEMENT) {
auto equal = IsSameOffsets(p1.GetIdx(), p2.GetIdx());
// If it is known that indices are different OR Imm indices are different then there is
// no alias. If they are both different we can't certainly say so.
if ((equal == Trilean::FALSE && p1.GetImm() == p2.GetImm()) ||
(equal == Trilean::TRUE && p1.GetImm() != p2.GetImm())) {
return NO_ALIAS;
}
}
if (p1.GetType() == DICTIONARY_ELEMENT) {
auto equal = IsSameOffsets(p1.GetIdx(), p2.GetIdx());
if (equal == Trilean::FALSE && p1.GetImm() == p2.GetImm()) {
return NO_ALIAS;
}
}
return MAY_ALIAS;
}
/**
* We have 5 types of pointers: OBJECT, OBJECT_FIELD, POOL_CONSTANT,
* STATIC_FIELD and ARRAY_ELEMENT. They correspond to groups of memory storing
@ -362,36 +393,10 @@ AliasType AliasAnalysis::CheckMemAddress(const Pointer &p1, const Pointer &p2) c
if (intersection != nullptr && aliases1.size() == 1 && aliases2.size() == 1) {
return SingleIntersectionAliasing(p1, p2, intersection);
}
// Empty intersection: check that both addresses are not parameters
if (intersection == nullptr) {
// If at least one set of aliases consists of only local aliases then there is NO_ALIAS
auto is_outer = [](Pointer const &p) { return !p.IsLocal(); };
if (std::find_if(aliases1.begin(), aliases1.end(), is_outer) == aliases1.end() ||
std::find_if(aliases2.begin(), aliases2.end(), is_outer) == aliases2.end()) {
return NO_ALIAS;
}
// Different fields cannot alias each other even if they are not created locally
if (p1.GetType() == OBJECT_FIELD && !p1.HasSameOffset(p2)) {
return NO_ALIAS;
}
if (p1.GetType() == ARRAY_ELEMENT) {
auto equal = IsSameOffsets(p1.GetIdx(), p2.GetIdx());
// If it is known that indices are different OR Imm indices are different then there is
// no alias. If they are both different we can't certainly say so.
if ((equal == Trilean::FALSE && p1.GetImm() == p2.GetImm()) ||
(equal == Trilean::TRUE && p1.GetImm() != p2.GetImm())) {
return NO_ALIAS;
}
}
if (p1.GetType() == DICTIONARY_ELEMENT) {
auto equal = IsSameOffsets(p1.GetIdx(), p2.GetIdx());
if (equal == Trilean::FALSE && p1.GetImm() == p2.GetImm()) {
return NO_ALIAS;
}
}
return CheckMemAddressEmptyIntersectionCase(aliases1, aliases2, p1, p2);
}
return MAY_ALIAS;
}
@ -433,6 +438,62 @@ AliasType AliasAnalysis::SingleIntersectionAliasing(const Pointer &p1, const Poi
return MUST_ALIAS;
}
void AliasAnalysis::SolveConstraintsMainLoop(Pointer &ref, Pointer &edge, bool &added, PointerSet &sols)
{
for (auto &alias : points_to_.at(ref)) {
ASSERT(alias.GetBase() == nullptr || alias.GetBase()->GetOpcode() != Opcode::NullCheck);
if (edge.GetType() == OBJECT_FIELD && ref.GetBase() == edge.GetBase()) {
// Propagating from object to fields: A{a} -> A.F{a.f}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateObjectField(alias.GetBase(), edge.GetImm(), edge.GetTypePtr());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a.g} -> A.F we propagate symbolic name: A{a.g} -> A.F{A.F}
Pointer p = Pointer::CreateObjectField(ref.GetBase(), edge.GetImm(), edge.GetTypePtr());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
if (edge.GetType() == ARRAY_ELEMENT && ref.GetBase() == edge.GetBase()) {
// Propagating from object to elements: A{a} -> A[i]{a[i]}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateArrayElement(alias.GetBase(), edge.GetIdx(), edge.GetImm());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a[j]} -> A[i] we propagate symbolic name: A{a[j]} -> A[i]{A[i]}
Pointer p = Pointer::CreateArrayElement(ref.GetBase(), edge.GetIdx(), edge.GetImm());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
if (edge.GetType() == DICTIONARY_ELEMENT && ref.GetBase() == edge.GetBase()) {
// Propagating from object to elements: A{a} -> A[i]{a[i]}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateDictionaryElement(alias.GetBase(), edge.GetIdx());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a[j]} -> A[i] we propagate symbolic name: A{a[j]} -> A[i]{A[i]}
Pointer p = Pointer::CreateDictionaryElement(ref.GetBase(), edge.GetIdx());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
added |= sols.insert(alias).second;
}
}
/**
* Here we propagate solutions obtained from direct constraints through copy
* constraints e.g: we have a node A with solution {a} and the node A was
@ -482,58 +543,9 @@ void AliasAnalysis::SolveConstraints()
ASSERT(edge.GetType() != POOL_CONSTANT);
auto &sols = points_to_.try_emplace(edge, GetGraph()->GetAllocator()->Adapter()).first->second;
bool added = false;
for (auto &alias : points_to_.at(ref)) {
ASSERT(alias.GetBase() == nullptr || alias.GetBase()->GetOpcode() != Opcode::NullCheck);
if (edge.GetType() == OBJECT_FIELD && ref.GetBase() == edge.GetBase()) {
// Propagating from object to fields: A{a} -> A.F{a.f}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateObjectField(alias.GetBase(), edge.GetImm(), edge.GetTypePtr());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a.g} -> A.F we propagate symbolic name: A{a.g} -> A.F{A.F}
Pointer p = Pointer::CreateObjectField(ref.GetBase(), edge.GetImm(), edge.GetTypePtr());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
SolveConstraintsMainLoop(ref, edge, added, sols);
added |= sols.insert(p).second;
continue;
}
if (edge.GetType() == ARRAY_ELEMENT && ref.GetBase() == edge.GetBase()) {
// Propagating from object to elements: A{a} -> A[i]{a[i]}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateArrayElement(alias.GetBase(), edge.GetIdx(), edge.GetImm());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a[j]} -> A[i] we propagate symbolic name: A{a[j]} -> A[i]{A[i]}
Pointer p = Pointer::CreateArrayElement(ref.GetBase(), edge.GetIdx(), edge.GetImm());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
if (edge.GetType() == DICTIONARY_ELEMENT && ref.GetBase() == edge.GetBase()) {
// Propagating from object to elements: A{a} -> A[i]{a[i]}
if (alias.GetType() == OBJECT) {
Pointer p = Pointer::CreateDictionaryElement(alias.GetBase(), edge.GetIdx());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
// In case A{a[j]} -> A[i] we propagate symbolic name: A{a[j]} -> A[i]{A[i]}
Pointer p = Pointer::CreateDictionaryElement(ref.GetBase(), edge.GetIdx());
p.SetLocalVolatile(alias.IsLocal(), edge.IsVolatile());
added |= sols.insert(p).second;
continue;
}
added |= sols.insert(alias).second;
}
if (added && chains_->find(edge) != chains_->end()) {
worklist.push(edge);
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -413,7 +413,9 @@ private:
static Trilean IsSameOffsets(const Inst *off1, const Inst *off2);
static AliasType SingleIntersectionAliasing(const Pointer &p1, const Pointer &p2, const Pointer *intersection);
AliasType CheckMemAddressEmptyIntersectionCase(const PointerSet &aliases1, const PointerSet &aliases2,
const Pointer &p1, const Pointer &p2) const;
void SolveConstraintsMainLoop(Pointer &ref, Pointer &edge, bool &added, PointerSet &sols);
void DumpChains(std::ostream *out) const;
private:

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -858,7 +858,6 @@ void BoundsAnalysis::VisitIfImm(GraphVisitor *v, Inst *inst)
}
auto op0 = compare->GetInput(0).GetInst();
auto op1 = compare->GetInput(1).GetInst();
if ((DataType::GetCommonType(op0->GetType()) != DataType::INT64 && op0->GetType() != DataType::REFERENCE) ||
(DataType::GetCommonType(op1->GetType()) != DataType::INT64 && op1->GetType() != DataType::REFERENCE)) {
return;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -56,6 +56,7 @@ private:
void SetNormalizedConditionCode();
bool IsConditionCodeAcceptable();
BasicBlock *FindLoopExitBlock();
bool CheckParsingLoopCorrectness();
private:
const Loop &loop_;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -168,7 +168,6 @@ BasicBlock *LinearOrder::LeastLikelySuccessorByBranchCounter(const BasicBlock *b
auto counter0 = GetBranchCounter(block, true);
auto counter1 = GetBranchCounter(block, false);
if (counter0 > 0 || counter1 > 0) {
auto denom = std::max(counter0, counter1);
ASSERT(denom != 0);

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -861,21 +861,15 @@ LifeNumber LifeIntervals::GetFirstIntersectionWith(const LifeIntervals *other, L
}
auto range_begin = std::max<LifeNumber>(search_from, range.GetBegin());
auto other_range_begin = std::max<LifeNumber>(search_from, other_range.GetBegin());
if (range_begin <= other_range_begin) {
if (other_range_begin < range.GetEnd()) {
// [range]
// [other]
return other_range_begin;
}
ASSERT(other_range_begin >= range.GetEnd());
} else {
if (range_begin <= other_range_begin && other_range_begin < range.GetEnd()) {
// [range]
// [other]
return other_range_begin;
// NOLINTNEXTLINE(readability-else-after-return)
} else if (range_begin > other_range_begin && range_begin < other_range.GetEnd()) {
// [range]
// [other]
if (range_begin < other_range.GetEnd()) {
return range_begin;
}
ASSERT(range_begin >= other_range.GetEnd());
return range_begin;
}
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -100,19 +100,34 @@ public:
~CallConvMode() = default;
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DECLARE_CALLCONV_MODE_MODIFIERS(name) \
void Set##name(bool v) \
{ \
Flag##name ::Set(v, &value_); \
} \
bool Is##name() const \
{ \
return Flag##name ::Get(value_); \
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DECLARE_CALLCONV_MODE(name) \
static CallConvMode name(bool set = true) \
{ \
return CallConvMode(Flag##name ::Encode(set)); \
} \
void Set##name(bool v) \
{ \
Flag##name ::Set(v, &value_); \
} \
bool Is##name() const \
{ \
return Flag##name ::Get(value_); \
DECLARE_CALLCONV_MODE_MODIFIERS(name)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DECLARE_CALLCONV_MODE_MODIFIERS(name) \
void Set##name(bool v) \
{ \
Flag##name ::Set(v, &value_); \
} \
bool Is##name() const \
{ \
return Flag##name ::Get(value_); \
}
// Panda ABI convention (native - otherwise)
@ -125,6 +140,7 @@ public:
DECLARE_CALLCONV_MODE(OptIrtoc);
#undef DECLARE_CALLCONV_MODE
#undef DECLARE_CALLCONV_MODIFIERS
private:
using FlagPanda = BitField<bool, 0, 1>;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -520,7 +520,7 @@ void Codegen::IssueDisasm()
pc = new_pc;
}
} else if (std::holds_alternative<std::string>(item)) {
stream << std::get<std::string>(item);
stream << (std::get<std::string>(item));
}
}
}
@ -574,28 +574,7 @@ bool Codegen::RunImpl()
}
}
if (GetDisasm()->IsEnabled()) {
GetDisasm()->PrintMethodEntry(this);
}
if (!BeginMethod()) {
return false;
}
if (!VisitGraph()) {
return false;
}
EndMethod();
if (!CopyToCodeCache()) {
return false;
}
if (GetDisasm()->IsEnabled()) {
IssueDisasm();
}
return true;
return Finalize();
}
void Codegen::Initialize()
@ -666,6 +645,32 @@ void Codegen::Initialize()
}
}
bool Codegen::Finalize()
{
if (GetDisasm()->IsEnabled()) {
GetDisasm()->PrintMethodEntry(this);
}
if (!BeginMethod()) {
return false;
}
if (!VisitGraph()) {
return false;
}
EndMethod();
if (!CopyToCodeCache()) {
return false;
}
if (GetDisasm()->IsEnabled()) {
IssueDisasm();
}
return true;
}
Reg Codegen::ConvertRegister(Register r, DataType::Type type)
{
switch (type) {
@ -1109,7 +1114,6 @@ void Codegen::CreateNewObjCall(NewObjectInst *new_obj)
auto runtime = GetRuntime();
auto max_tlab_size = runtime->GetTLABMaxSize();
if (max_tlab_size == 0 ||
(init_class->GetOpcode() != Opcode::LoadAndInitClass && init_class->GetOpcode() != Opcode::LoadImmediate)) {
CallRuntime(new_obj, EntrypointId::CREATE_OBJECT_BY_CLASS, dst, RegMask::GetZeroMask(), src);
@ -1819,7 +1823,6 @@ void Codegen::CreatePreWRB(Inst *inst, MemRef mem, RegMask preserved, bool store
TryInsertImplicitNullCheck(inst, prev_offset);
if constexpr (IS_CLASS) {
enc->EncodeLdr(tmp_ref, false, MemRef(tmp_ref, runtime->GetManagedClassOffset(GetArch())));
} else {
CheckObject(tmp_ref, label);
}
@ -2857,6 +2860,26 @@ void EncodeVisitor::VisitFillConstArray(GraphVisitor *visitor, Inst *inst)
}
}
static void GetEntryPointId(uint64_t element_size, RuntimeInterface::EntrypointId &eid)
{
switch (element_size) {
case sizeof(uint8_t):
eid = RuntimeInterface::EntrypointId::ALLOCATE_ARRAY_TLAB8;
break;
case sizeof(uint16_t):
eid = RuntimeInterface::EntrypointId::ALLOCATE_ARRAY_TLAB16;
break;
case sizeof(uint32_t):
eid = RuntimeInterface::EntrypointId::ALLOCATE_ARRAY_TLAB32;
break;
case sizeof(uint64_t):
eid = RuntimeInterface::EntrypointId::ALLOCATE_ARRAY_TLAB64;
break;
default:
UNREACHABLE();
}
}
void Codegen::VisitNewArray(Inst *inst)
{
auto method = inst->CastToNewArray()->GetMethod();
@ -2868,7 +2891,6 @@ void Codegen::VisitNewArray(Inst *inst)
auto encoder = GetEncoder();
auto max_tlab_size = runtime->GetTLABMaxSize();
// TODO(msherstennikov): support NewArray fast path for arm32
if (max_tlab_size == 0 || GetArch() == Arch::AARCH32) {
CallRuntime(inst, EntrypointId::CREATE_ARRAY, dst, RegMask::GetZeroMask(), src_class, src_size);
@ -2897,23 +2919,7 @@ void Codegen::VisitNewArray(Inst *inst)
}
EntrypointId eid;
switch (element_size) {
case sizeof(uint8_t):
eid = EntrypointId::ALLOCATE_ARRAY_TLAB8;
break;
case sizeof(uint16_t):
eid = EntrypointId::ALLOCATE_ARRAY_TLAB16;
break;
case sizeof(uint32_t):
eid = EntrypointId::ALLOCATE_ARRAY_TLAB32;
break;
case sizeof(uint64_t):
eid = EntrypointId::ALLOCATE_ARRAY_TLAB64;
break;
default:
UNREACHABLE();
}
GetEntryPointId(element_size, eid);
CallFastPath(inst, eid, dst, RegMask::GetZeroMask(), src_class, src_size);
if (inst->GetFlag(inst_flags::MEM_BARRIER)) {
encoder->EncodeMemoryBarrier(memory_order::RELEASE);
@ -2936,7 +2942,6 @@ void EncodeVisitor::VisitParameter(GraphVisitor *visitor, Inst *inst)
auto codegen = enc->GetCodegen();
auto param_inst = inst->CastToParameter();
auto sf = param_inst->GetLocationData();
if (sf.GetSrc() == sf.GetDst()) {
return;
}
@ -4199,7 +4204,6 @@ void EncodeVisitor::VisitCheckCast(GraphVisitor *visitor, Inst *inst)
auto encoder = enc->GetEncoder();
auto klass_type = inst->CastToCheckCast()->GetClassType();
if (klass_type == ClassType::UNRESOLVED_CLASS) {
FillUnresolvedClass(visitor, inst);
return;
@ -5405,43 +5409,15 @@ void EncodeVisitor::VisitObjByIndexCheck(GraphVisitor *visitor, Inst *inst)
UNREACHABLE();
}
auto id = enc->GetCodegen()->CreateSlowPath<SlowPathDeoptimize>(inst, DeoptimizeType::ANY_TYPE_CHECK)->GetLabel();
if (TryObjByIndexCheckPluginGen(check_inst, enc, id)) {
return;
}
UNREACHABLE();
}
/**
* Returns true if codegen emits call(s) to some library function(s)
* while processing the instruction.
*/
bool Codegen::InstEncodedWithLibCall(const Inst *inst, Arch arch)
static bool GetNeedBarrierProperty(const Inst *inst)
{
ASSERT(inst != nullptr);
Opcode op = inst->GetOpcode();
if (op == Opcode::Mod) {
auto dst_type = inst->GetType();
if (arch == Arch::AARCH64 || arch == Arch::X86_64) {
return dst_type == DataType::FLOAT32 || dst_type == DataType::FLOAT64;
}
return arch == Arch::AARCH32;
}
if (op == Opcode::Div && arch == Arch::AARCH32) {
auto dst_type = inst->GetType();
return dst_type == DataType::INT64 || dst_type == DataType::UINT64;
}
if (op == Opcode::Cast && arch == Arch::AARCH32) {
auto dst_type = inst->GetType();
auto src_type = inst->GetInputType(0);
if (dst_type == DataType::FLOAT32 || dst_type == DataType::FLOAT64) {
return src_type == DataType::INT64 || src_type == DataType::UINT64;
}
if (src_type == DataType::FLOAT32 || src_type == DataType::FLOAT64) {
return dst_type == DataType::INT64 || dst_type == DataType::UINT64;
}
return false;
}
if (op == Opcode::LoadObject) {
return inst->CastToLoadObject()->GetNeedBarrier();
}
@ -5481,6 +5457,40 @@ bool Codegen::InstEncodedWithLibCall(const Inst *inst, Arch arch)
return false;
}
/**
* Returns true if codegen emits call(s) to some library function(s)
* while processing the instruction.
*/
bool Codegen::InstEncodedWithLibCall(const Inst *inst, Arch arch)
{
ASSERT(inst != nullptr);
Opcode op = inst->GetOpcode();
if (op == Opcode::Mod) {
auto dst_type = inst->GetType();
if (arch == Arch::AARCH64 || arch == Arch::X86_64) {
return dst_type == DataType::FLOAT32 || dst_type == DataType::FLOAT64;
}
return arch == Arch::AARCH32;
}
if (op == Opcode::Div && arch == Arch::AARCH32) {
auto dst_type = inst->GetType();
return dst_type == DataType::INT64 || dst_type == DataType::UINT64;
}
if (op == Opcode::Cast && arch == Arch::AARCH32) {
auto dst_type = inst->GetType();
auto src_type = inst->GetInputType(0);
if (dst_type == DataType::FLOAT32 || dst_type == DataType::FLOAT64) {
return src_type == DataType::INT64 || src_type == DataType::UINT64;
}
if (src_type == DataType::FLOAT32 || src_type == DataType::FLOAT64) {
return dst_type == DataType::INT64 || dst_type == DataType::UINT64;
}
return false;
}
return GetNeedBarrierProperty(inst);
}
Reg Codegen::ConvertInstTmpReg(const Inst *inst, DataType::Type type) const
{
ASSERT(inst->GetTmpLocation().IsFixedRegister());

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -335,13 +335,16 @@ public:
GetEncoder()->EncodeMov(dst_reg, ret_reg);
}
}
CallEntrypointFinalize(live_regs, params_mask, inst);
}
void CallEntrypointFinalize(RegMask &live_regs, RegMask &params_mask, Inst *inst)
{
LoadCallerRegisters(live_regs, VRegMask(), true);
if (!inst->HasImplicitRuntimeCall()) {
return;
}
ASSERT(!GetRuntime()->IsEntrypointNoreturn(id));
for (auto i = 0U; i < params_mask.size(); i++) {
if (params_mask.test(i)) {
inst->GetSaveState()->GetRootsRegsMask().reset(i);
@ -502,6 +505,7 @@ public:
// Initialization internal variables
void Initialize();
bool Finalize();
const Disassembly *GetDisasm() const
{

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -705,17 +705,17 @@ private:
inline ArenaVector<std::pair<uint8_t, uint8_t>> ResoveParameterSequence(
ArenaVector<std::pair<uint8_t, uint8_t>> *moved_registers, uint8_t tmp, ArenaAllocator *allocator)
{
constexpr uint8_t INVALID_FIST = -1;
constexpr uint8_t INVALID_FIRST = -1;
constexpr uint8_t INVALID_SECOND = -2;
moved_registers->emplace_back(std::pair<uint8_t, uint8_t>(INVALID_FIST, INVALID_SECOND));
moved_registers->emplace_back(std::pair<uint8_t, uint8_t>(INVALID_FIRST, INVALID_SECOND));
/*
Example:
1. mov x0 <- x3
2. mov x1 <- x0
3. mov x2 <- x3
4. mov x3 <- x2
Agreement - in dst can't be multipy same registers (double move to one register)
Agreement - dst-s can't hold same registers multiple times (double move to one register)
- src for movs can hold same register multiply times
Algorithm:
@ -749,11 +749,10 @@ inline ArenaVector<std::pair<uint8_t, uint8_t>> ResoveParameterSequence(
for (;;) {
/* Need support single mov x1 <- x1:
ASSERT(moved_registers->size() != 1);
*/
*/
auto curr_pair = moved_registers->begin();
if (curr_pair->first == INVALID_FIST && curr_pair->second == INVALID_SECOND) {
if (curr_pair->first == INVALID_FIRST && curr_pair->second == INVALID_SECOND) {
moved_registers->erase(curr_pair);
break;
// Finish algorithm - only marker in vector
@ -766,22 +765,18 @@ inline ArenaVector<std::pair<uint8_t, uint8_t>> ResoveParameterSequence(
auto curr_reg = curr_pair->second;
moved_registers->erase(curr_pair);
for (; curr_pair != moved_registers->end();) {
while (curr_pair != moved_registers->end()) {
curr_pair = std::find_if(moved_registers->begin(), moved_registers->end(),
[curr_reg](auto in_pair) { return in_pair.first == curr_reg; });
if (curr_pair != moved_registers->end()) {
if (curr_pair->second == saved_reg) {
result.emplace_back(std::pair<uint8_t, uint8_t>(curr_pair->first, tmp));
moved_registers->erase(curr_pair);
break;
// exit from loop
};
result.emplace_back(*curr_pair);
curr_reg = curr_pair->second;
ASSERT(curr_pair != moved_registers->end());
if (curr_pair->second == saved_reg) {
result.emplace_back(std::pair<uint8_t, uint8_t>(curr_pair->first, tmp));
moved_registers->erase(curr_pair);
} else {
ASSERT(curr_pair != moved_registers->end());
}
break;
};
result.emplace_back(*curr_pair);
curr_reg = curr_pair->second;
moved_registers->erase(curr_pair);
}
}
return result;
@ -815,7 +810,7 @@ enum Condition {
INVALID_COND
};
static inline bool IsTestCc(Condition cond)
inline bool IsTestCc(Condition cond)
{
return cond == TST_EQ || cond == TST_NE;
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -156,6 +156,29 @@ void SpillFillEncoder::EncodeSpillFill()
}
}
void SpillFillEncoder::EncodeImmWithCorrectType(DataType::Type sf_type, MemRef dst_mem, ConstantInst *const_inst)
{
ASSERT(DataType::IsTypeNumeric(sf_type));
switch (sf_type) {
case DataType::Type::FLOAT32: {
auto imm = const_inst->GetFloatValue();
encoder_->EncodeSti(imm, dst_mem);
break;
}
case DataType::Type::FLOAT64: {
auto imm = const_inst->GetDoubleValue();
encoder_->EncodeSti(imm, dst_mem);
break;
}
default: {
auto imm = const_inst->GetRawValue();
auto store_size = Codegen::ConvertDataType(sf_type, codegen_->GetArch()).GetSize() / BYTE_SIZE;
encoder_->EncodeSti(imm, store_size, dst_mem);
break;
}
}
}
size_t SpillFillEncoder::EncodeImmToX(const SpillFillData &sf)
{
auto const_inst = graph_->GetSpilledConstant(sf.SrcValue());
@ -192,25 +215,7 @@ size_t SpillFillEncoder::EncodeImmToX(const SpillFillData &sf)
ASSERT(sf.GetDst().IsAnyStack()); // imm -> stack
auto dst_mem = codegen_->GetMemRefForSlot(sf.GetDst());
auto sf_type = sf.GetCommonType();
ASSERT(DataType::IsTypeNumeric(sf_type));
switch (sf_type) {
case DataType::Type::FLOAT32: {
auto imm = const_inst->GetFloatValue();
encoder_->EncodeSti(imm, dst_mem);
break;
}
case DataType::Type::FLOAT64: {
auto imm = const_inst->GetDoubleValue();
encoder_->EncodeSti(imm, dst_mem);
break;
}
default: {
auto imm = const_inst->GetRawValue();
auto store_size = Codegen::ConvertDataType(sf_type, codegen_->GetArch()).GetSize() / BYTE_SIZE;
encoder_->EncodeSti(imm, store_size, dst_mem);
break;
}
}
EncodeImmWithCorrectType(sf_type, dst_mem, const_inst);
return 1U;
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -60,6 +60,7 @@ private:
size_t EncodeRegisterToX(const SpillFillData &sf, const SpillFillData *next, int consecutive_ops_hint = 0);
size_t EncodeStackToX(const SpillFillData &sf, const SpillFillData *next, int consecutive_ops_hint = 0);
static bool AreConsecutiveOps(const SpillFillData &pred, const SpillFillData &succ);
void EncodeImmWithCorrectType(DataType::Type sf_type, MemRef dst_mem, ConstantInst *const_inst);
SpillFillInst *inst_;
Graph *graph_;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -1891,7 +1891,6 @@ void Aarch32Encoder::EncodeVorr(Reg dst, Reg src0, Reg src1)
vixl::aarch32::DRegister(src0.GetId() / 2U),
vixl::aarch32::DRegister(tmp_reg.GetReg().GetId() / 2U));
GetMasm()->Vmov(VixlVReg(dst).S(), vixl::aarch32::SRegister(tmp_reg.GetReg().GetId() + (src0.GetId() & 1U)));
} else {
GetMasm()->Vorr(VixlVReg(dst).D(), VixlVReg(src0).D(), VixlVReg(src1).D());
}
@ -2782,7 +2781,7 @@ bool Aarch32Encoder::CanEncodeImmLogical(uint64_t imm, uint32_t size)
#ifndef NDEBUG
if (size < DOUBLE_WORD_SIZE) {
// Test if the highest part is consistent:
ASSERT((imm >> size == 0) || ((~imm) >> size == 0));
ASSERT(((imm >> size) == 0) || (((~imm) >> size) == 0));
}
#endif // NDEBUG
return vixl::aarch32::ImmediateA32::IsImmediateA32(imm);

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -49,6 +49,7 @@ struct DivLSResult {
// NOLINTNEXTLINE(readability-identifier-naming,misc-definitions-in-headers)
DivLUResult __aeabi_uldivmod(uint64_t numerator, uint64_t denominator)
{
ASSERT(denominator != 0);
DivLUResult res {0, 0};
res.quotient = numerator / denominator;
res.remainder = numerator % denominator;
@ -57,6 +58,7 @@ DivLUResult __aeabi_uldivmod(uint64_t numerator, uint64_t denominator)
// NOLINTNEXTLINE(readability-identifier-naming,misc-definitions-in-headers)
DivLSResult __aeabi_ldivmod(int64_t numerator, int64_t denominator)
{
ASSERT(denominator != 0);
DivLSResult res {0, 0};
res.quotient = numerator / denominator;
res.remainder = numerator % denominator;
@ -76,6 +78,7 @@ struct DivSResult {
// NOLINTNEXTLINE(readability-identifier-naming,misc-definitions-in-headers)
DivUResult __aeabi_uidivmod(uint32_t numerator, uint32_t denominator)
{
ASSERT(denominator != 0);
DivUResult res {0, 0};
res.quotient = numerator / denominator;
res.remainder = numerator % denominator;
@ -84,6 +87,7 @@ DivUResult __aeabi_uidivmod(uint32_t numerator, uint32_t denominator)
// NOLINTNEXTLINE(readability-identifier-naming,misc-definitions-in-headers)
DivSResult __aeabi_idivmod(int32_t numerator, int32_t denominator)
{
ASSERT(denominator != 0);
DivSResult res {0, 0};
res.quotient = numerator / denominator;
res.remainder = numerator % denominator;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -2428,7 +2428,7 @@ bool Aarch64Encoder::CanEncodeImmLogical(uint64_t imm, uint32_t size)
#ifndef NDEBUG
if (size < DOUBLE_WORD_SIZE) {
// Test if the highest part is consistent:
ASSERT((imm >> size == 0) || ((~imm) >> size == 0));
ASSERT(((imm >> size) == 0) || (((~imm) >> size) == 0));
}
#endif // NDEBUG
return vixl::aarch64::Assembler::IsImmLogical(imm, size);
@ -2673,31 +2673,29 @@ void Aarch64Encoder::LoadStoreRegisters(RegMask registers, bool is_fp, int32_t s
if (!has_mask) {
index++;
}
if (last_id != -1) {
auto reg =
CPURegister(id, vixl::aarch64::kXRegSize, is_fp ? CPURegister::kVRegister : CPURegister::kRegister);
auto last_reg = CPURegister(last_id, vixl::aarch64::kXRegSize,
is_fp ? CPURegister::kVRegister : CPURegister::kRegister);
if (!has_mask || last_id + 1 == id) {
static constexpr ssize_t OFFSET = 2;
if constexpr (IS_STORE) { // NOLINT
GetMasm()->Stp(last_reg, reg,
MemOperand(base_reg, (slot + index - OFFSET) * DOUBLE_WORD_SIZE_BYTES));
} else { // NOLINT
GetMasm()->Ldp(last_reg, reg,
MemOperand(base_reg, (slot + index - OFFSET) * DOUBLE_WORD_SIZE_BYTES));
}
last_id = -1;
} else {
if constexpr (IS_STORE) { // NOLINT
GetMasm()->Str(last_reg, MemOperand(base_reg, (slot + last_index - 1) * DOUBLE_WORD_SIZE_BYTES));
} else { // NOLINT
GetMasm()->Ldr(last_reg, MemOperand(base_reg, (slot + last_index - 1) * DOUBLE_WORD_SIZE_BYTES));
}
last_id = id;
last_index = index;
if (last_id == -1) {
last_id = id;
last_index = index;
continue;
}
auto reg = CPURegister(id, vixl::aarch64::kXRegSize, is_fp ? CPURegister::kVRegister : CPURegister::kRegister);
auto last_reg =
CPURegister(last_id, vixl::aarch64::kXRegSize, is_fp ? CPURegister::kVRegister : CPURegister::kRegister);
if (!has_mask || last_id + 1 == id) {
static constexpr ssize_t OFFSET = 2;
if constexpr (IS_STORE) { // NOLINT
GetMasm()->Stp(last_reg, reg, MemOperand(base_reg, (slot + index - OFFSET) * DOUBLE_WORD_SIZE_BYTES));
} else { // NOLINT
GetMasm()->Ldp(last_reg, reg, MemOperand(base_reg, (slot + index - OFFSET) * DOUBLE_WORD_SIZE_BYTES));
}
last_id = -1;
} else {
if constexpr (IS_STORE) { // NOLINT
GetMasm()->Str(last_reg, MemOperand(base_reg, (slot + last_index - 1) * DOUBLE_WORD_SIZE_BYTES));
} else { // NOLINT
GetMasm()->Ldr(last_reg, MemOperand(base_reg, (slot + last_index - 1) * DOUBLE_WORD_SIZE_BYTES));
}
last_id = id;
last_index = index;
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -1556,7 +1556,6 @@ void Amd64Encoder::EncodeOr(Reg dst, Reg src, Imm imm)
{
ASSERT(dst.IsScalar());
auto imm_val = ImmToUnsignedInt(imm);
if (ImmFitsSize(imm_val, dst.GetSize())) {
EncodeMov(dst, src);
GetMasm()->or_(ArchReg(dst), imm_val);
@ -1576,7 +1575,6 @@ void Amd64Encoder::EncodeXor(Reg dst, Reg src, Imm imm)
{
ASSERT(dst.IsScalar());
auto imm_val = ImmToUnsignedInt(imm);
if (ImmFitsSize(imm_val, dst.GetSize())) {
EncodeMov(dst, src);
GetMasm()->xor_(ArchReg(dst), imm_val);
@ -2229,7 +2227,7 @@ bool Amd64Encoder::CanEncodeImmLogical(uint64_t imm, uint32_t size)
#ifndef NDEBUG
if (size < DOUBLE_WORD_SIZE) {
// Test if the highest part is consistent:
ASSERT((imm >> size == 0) || ((~imm) >> size == 0));
ASSERT(((imm >> size) == 0) || (((~imm) >> size) == 0));
}
#endif // NDEBUG
return ImmFitsSize(imm, size);

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -293,7 +293,6 @@ public:
mem_ = asmjit::x86::ptr(ArchReg(mem.GetBase()), ArchReg(mem.GetIndex(), base_size));
} else {
auto scale = mem.GetScale();
if (scale <= 3U) {
mem_ = asmjit::x86::ptr(ArchReg(mem.GetBase()), ArchReg(mem.GetIndex(), base_size), scale);
} else {

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -246,6 +246,17 @@ static bool IsSaveStateForGc(Inst *inst)
return false;
}
bool FindAndRemindObjectInSaveState(Inst *object, Inst *inst, Inst **failed_ss)
{
if (IsSaveStateForGc(inst) && !FindObjectInSaveState(object, inst)) {
if (failed_ss != nullptr) {
*failed_ss = inst;
}
return false;
}
return true;
}
// Checks if object is correctly used in SaveStates between it and user
bool CheckObjectRec(Inst *object, const Inst *user, const BasicBlock *block, Inst *start_from, Marker visited,
Inst **failed_ss)
@ -260,10 +271,7 @@ bool CheckObjectRec(Inst *object, const Inst *user, const BasicBlock *block, Ins
if (inst->SetMarker(visited) || inst == object || inst == user) {
return true;
}
if (IsSaveStateForGc(inst) && !FindObjectInSaveState(object, inst)) {
if (failed_ss != nullptr) {
*failed_ss = inst;
}
if (!FindAndRemindObjectInSaveState(object, inst, failed_ss)) {
return false;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -40,7 +40,7 @@ std::optional<bool> IsIfInverted(BasicBlock *phi_block, IfImmInst *if_imm);
// If object input has known class, return pointer to the class, else returns nullptr
RuntimeInterface::ClassPtr GetClassPtrForObject(Inst *inst, size_t input_num = 0);
static inline bool IsInstInDifferentBlocks(Inst *i1, Inst *i2)
inline bool IsInstInDifferentBlocks(Inst *i1, Inst *i2)
{
return i1->GetBasicBlock() != i2->GetBasicBlock();
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

Some files were not shown because too many files have changed in this diff Show More