mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 01:59:58 +00:00
!9390 Use arktsheap tag in arkui-x (4.1Release)
Merge pull request !9390 from xiongluo/tag_4.1release
This commit is contained in:
commit
cd61232a04
4
BUILD.gn
4
BUILD.gn
@ -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",
|
||||
|
@ -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: {
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user