mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-10-07 13:54:17 +00:00
!544 Fix compiler codestyle
Merge pull request !544 from ober-man/fix-static-core-compiler-codecheck
This commit is contained in:
commit
60109cde57
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -41,9 +41,9 @@ 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()); \
|
||||
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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=[";
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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,7 +34,7 @@ void CompilerLogger::SetComponents(const std::vector<std::string>& args)
|
||||
}
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define DEF(COMPONENT, NAME) \
|
||||
if (NAME == arg) { \
|
||||
if ((NAME) == arg) { \
|
||||
components_.set(COMPONENT); \
|
||||
continue; \
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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; \
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
return CheckMemAddressEmptyIntersectionCase(aliases1, aliases2, p1, p2);
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -433,55 +438,8 @@ AliasType AliasAnalysis::SingleIntersectionAliasing(const Pointer &p1, const Poi
|
||||
return MUST_ALIAS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* copied to B and C (this->chains_ maintains these links), and C was copied to
|
||||
* D.
|
||||
*
|
||||
* A{a} -> B
|
||||
* \-> C -> D
|
||||
*
|
||||
* After first iteration (iterating A node) we will obtain
|
||||
*
|
||||
* A{a} -> B{a}
|
||||
* \-> C{a} -> D
|
||||
*
|
||||
* After second iteration (iterating B node) nothing changes
|
||||
*
|
||||
* After third iteration (iterating C node):
|
||||
*
|
||||
* A{a} -> B{a}
|
||||
* \-> C{a} -> D{a}
|
||||
*
|
||||
* For complex nodes (OBJECT_FIELD, ARRAY_ELEMENT) we create auxiliary nodes e.g.
|
||||
* if a field F was accessed from object A then we have two nodes:
|
||||
*
|
||||
* A{a} -> A.F
|
||||
*
|
||||
* And solutions from A would be propagated as following:
|
||||
*
|
||||
* A{a} -> A.F{a.F}
|
||||
*
|
||||
* The function works using worklist to process only updated nodes.
|
||||
*/
|
||||
void AliasAnalysis::SolveConstraints()
|
||||
void AliasAnalysis::SolveConstraintsMainLoop(Pointer &ref, Pointer &edge, bool &added, PointerSet &sols)
|
||||
{
|
||||
ArenaQueue<Pointer> worklist(GetGraph()->GetLocalAllocator()->Adapter());
|
||||
for (auto &pair : *direct_) {
|
||||
if (chains_->find(pair.first) != chains_->end()) {
|
||||
worklist.push(pair.first);
|
||||
}
|
||||
}
|
||||
|
||||
while (!worklist.empty()) {
|
||||
Pointer &ref = worklist.front();
|
||||
ASSERT(ref.GetBase() == nullptr || ref.GetBase()->GetOpcode() != Opcode::NullCheck);
|
||||
for (auto &edge : chains_->at(ref)) {
|
||||
// POOL_CONSTANT cannot be assignee
|
||||
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()) {
|
||||
@ -534,6 +492,60 @@ void AliasAnalysis::SolveConstraints()
|
||||
}
|
||||
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
|
||||
* copied to B and C (this->chains_ maintains these links), and C was copied to
|
||||
* D.
|
||||
*
|
||||
* A{a} -> B
|
||||
* \-> C -> D
|
||||
*
|
||||
* After first iteration (iterating A node) we will obtain
|
||||
*
|
||||
* A{a} -> B{a}
|
||||
* \-> C{a} -> D
|
||||
*
|
||||
* After second iteration (iterating B node) nothing changes
|
||||
*
|
||||
* After third iteration (iterating C node):
|
||||
*
|
||||
* A{a} -> B{a}
|
||||
* \-> C{a} -> D{a}
|
||||
*
|
||||
* For complex nodes (OBJECT_FIELD, ARRAY_ELEMENT) we create auxiliary nodes e.g.
|
||||
* if a field F was accessed from object A then we have two nodes:
|
||||
*
|
||||
* A{a} -> A.F
|
||||
*
|
||||
* And solutions from A would be propagated as following:
|
||||
*
|
||||
* A{a} -> A.F{a.F}
|
||||
*
|
||||
* The function works using worklist to process only updated nodes.
|
||||
*/
|
||||
void AliasAnalysis::SolveConstraints()
|
||||
{
|
||||
ArenaQueue<Pointer> worklist(GetGraph()->GetLocalAllocator()->Adapter());
|
||||
for (auto &pair : *direct_) {
|
||||
if (chains_->find(pair.first) != chains_->end()) {
|
||||
worklist.push(pair.first);
|
||||
}
|
||||
}
|
||||
|
||||
while (!worklist.empty()) {
|
||||
Pointer &ref = worklist.front();
|
||||
ASSERT(ref.GetBase() == nullptr || ref.GetBase()->GetOpcode() != Opcode::NullCheck);
|
||||
for (auto &edge : chains_->at(ref)) {
|
||||
// POOL_CONSTANT cannot be assignee
|
||||
ASSERT(edge.GetType() != POOL_CONSTANT);
|
||||
auto &sols = points_to_.try_emplace(edge, GetGraph()->GetAllocator()->Adapter()).first->second;
|
||||
bool added = false;
|
||||
|
||||
SolveConstraintsMainLoop(ref, edge, added, sols);
|
||||
|
||||
if (added && chains_->find(edge) != chains_->end()) {
|
||||
worklist.push(edge);
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,22 +861,16 @@ 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()) {
|
||||
if (range_begin <= other_range_begin && other_range_begin < range.GetEnd()) {
|
||||
// [range]
|
||||
// [other]
|
||||
return other_range_begin;
|
||||
}
|
||||
ASSERT(other_range_begin >= range.GetEnd());
|
||||
} else {
|
||||
// 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 INVALID_LIFE_NUMBER;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,12 +100,27 @@ 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)); \
|
||||
} \
|
||||
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_); \
|
||||
@ -125,6 +140,7 @@ public:
|
||||
DECLARE_CALLCONV_MODE(OptIrtoc);
|
||||
|
||||
#undef DECLARE_CALLCONV_MODE
|
||||
#undef DECLARE_CALLCONV_MODIFIERS
|
||||
|
||||
private:
|
||||
using FlagPanda = BitField<bool, 0, 1>;
|
||||
|
@ -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());
|
||||
|
@ -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 ¶ms_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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
@ -752,8 +752,7 @@ inline ArenaVector<std::pair<uint8_t, uint8_t>> ResoveParameterSequence(
|
||||
*/
|
||||
|
||||
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()) {
|
||||
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);
|
||||
break;
|
||||
// exit from loop
|
||||
};
|
||||
result.emplace_back(*curr_pair);
|
||||
curr_reg = curr_pair->second;
|
||||
moved_registers->erase(curr_pair);
|
||||
} else {
|
||||
ASSERT(curr_pair != moved_registers->end());
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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_;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,19 +2673,21 @@ 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 (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));
|
||||
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));
|
||||
GetMasm()->Ldp(last_reg, reg, MemOperand(base_reg, (slot + index - OFFSET) * DOUBLE_WORD_SIZE_BYTES));
|
||||
}
|
||||
last_id = -1;
|
||||
} else {
|
||||
@ -2697,10 +2699,6 @@ void Aarch64Encoder::LoadStoreRegisters(RegMask registers, bool is_fp, int32_t s
|
||||
last_id = id;
|
||||
last_index = index;
|
||||
}
|
||||
} else {
|
||||
last_id = id;
|
||||
last_index = index;
|
||||
}
|
||||
}
|
||||
if (last_id != -1) {
|
||||
auto last_reg =
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user