!9390 Use arktsheap tag in arkui-x (4.1Release)

Merge pull request !9390 from xiongluo/tag_4.1release
This commit is contained in:
openharmony_ci 2024-09-19 11:04:14 +00:00 committed by Gitee
commit cd61232a04
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 34 additions and 7 deletions

View File

@ -307,6 +307,10 @@ config("ark_jsruntime_common_config") {
defines += [ "IS_PUBLIC_VERSION" ]
}
if (is_arkui_x) {
defines += [ "CROSS_PLATFORM" ]
}
if (ark_compile_mode != "release") {
ark_profiler_features = [
"ECMASCRIPT_SUPPORT_CPUPROFILER",

View File

@ -18,19 +18,35 @@
#include "ecmascript/log_wrapper.h"
namespace panda::ecmascript {
const CString GetPageTagString(PageTagType type, const std::string &spaceName, const uint32_t threadId)
const std::string GetPageTagString(PageTagType type, const std::string &spaceName, const uint32_t threadId)
{
switch (type) {
case PageTagType::HEAP:
if (threadId == 0) {
return CString(HEAP_TAG).append(spaceName);
return std::string(HEAP_TAG).append(spaceName);
}
return CString(HEAP_TAG).append(std::to_string(threadId)).append(spaceName);
return std::string(HEAP_TAG).append(std::to_string(threadId)).append(spaceName);
case PageTagType::MACHINE_CODE:
if (threadId == 0) {
return CODE_TAG;
}
return CString(CODE_TAG).append(std::to_string(threadId));
return std::string(CODE_TAG).append(std::to_string(threadId));
case PageTagType::MEMPOOL_CACHE:
return "ArkTS MemPoolCache";
default: {
LOG_ECMA(FATAL) << "this branch is unreachable";
UNREACHABLE();
}
}
}
const char *GetPageTagString(PageTagType type)
{
switch (type) {
case PageTagType::HEAP:
return HEAP_TAG;
case PageTagType::MACHINE_CODE:
return CODE_TAG;
case PageTagType::MEMPOOL_CACHE:
return "ArkTS MemPoolCache";
default: {

View File

@ -90,7 +90,8 @@ void PagePreRead(void *mem, size_t size);
void PageTag(void *mem, size_t size, PageTagType type, const std::string &spaceName = EMPTY_STRING,
const uint32_t threadId = 0);
void PageClearTag(void *mem, size_t size);
const CString GetPageTagString(PageTagType type, const std::string &spaceName, const uint32_t threadId = 0);
const std::string GetPageTagString(PageTagType type, const std::string &spaceName, const uint32_t threadId = 0);
const char *GetPageTagString(PageTagType type);
void PageProtect(void *mem, size_t size, int prot);
size_t PageSize();
} // namespace panda::ecmascript

View File

@ -74,10 +74,16 @@ void PagePreRead(void *mem, size_t size)
madvise(mem, size, MADV_WILLNEED);
}
void PageTag(void *mem, size_t size, PageTagType type, const std::string &spaceName, const uint32_t threadId)
void PageTag(void *mem, size_t size, PageTagType type, [[maybe_unused]] const std::string &spaceName,
[[maybe_unused]] const uint32_t threadId)
{
const CString &tag = GetPageTagString(type, spaceName, threadId);
#if defined(CROSS_PLATFORM)
const char *tag = GetPageTagString(type);
PrctlSetVMA(mem, size, tag);
#else
const std::string &tag = GetPageTagString(type, spaceName, threadId);
PrctlSetVMA(mem, size, tag.c_str());
#endif
}
void PageClearTag(void *mem, size_t size)