代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/arkcompiler_runtime_core 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* Copyright (c) 2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIBPANDAFILE_INDEX_ACCESSOR_H
#define LIBPANDAFILE_INDEX_ACCESSOR_H
#include "file.h"
#include "file_items.h"
namespace panda::panda_file {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions, hicpp-special-member-functions)
class IndexAccessor {
public:
IndexAccessor(const File &pf, File::EntityId method_id)
{
constexpr size_t SKIP_NUM = 3; // 3 : skip class_idx and proto_idx and name
auto sp = pf.GetSpanFromId(method_id).SubSpan(IDX_SIZE * (SKIP_NUM - 1) + ID_SIZE);
access_flags_ = helpers::ReadULeb128(&sp);
header_index_ = access_flags_ >> (FUNTION_KIND_WIDTH + FLAG_WIDTH);
num_headers_ = pf.GetHeader()->num_indexes;
const auto *header = &(pf.GetIndexHeaders()[header_index_]);
indexes_ = pf.GetMethodIndex(header);
}
~IndexAccessor() = default;
// quick way to resolve offset by 16-bit id in method's instructions
uint32_t GetOffsetById(uint16_t idx) const
{
return indexes_[idx].GetOffset();
}
FunctionKind GetFunctionKind() const
{
return static_cast<FunctionKind>((access_flags_ & FUNCTION_KIND_MASK) >> FLAG_WIDTH);
}
uint16_t GetHeaderIndex() const
{
return header_index_;
}
uint32_t GetNumHeaders() const
{
return num_headers_;
}
private:
Span<const File::EntityId> indexes_;
uint32_t access_flags_;
uint16_t header_index_;
uint32_t num_headers_;
};
} // namespace panda::panda_file
#endif // LIBPANDAFILE_INDEX_ACCESSOR_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。