diff --git a/BUILD.gn b/BUILD.gn index 4ac71bf36535a7248d4956bc788568c3d841cb3c..f392bab9d5e78f8b4e3e22757c70701894aa8586 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -699,7 +699,6 @@ ecma_source = [ "ecmascript/base/sort_helper.cpp", "ecmascript/base/string_helper.cpp", "ecmascript/base/typed_array_helper.cpp", - "ecmascript/base/utf_helper.cpp", "ecmascript/base/bit_helper.cpp", "ecmascript/builtins/builtins.cpp", "ecmascript/builtins/builtins_ark_tools.cpp", @@ -1053,6 +1052,7 @@ ecma_source = [ # ecmascript use implement from common_components ecma_source += [ + "common_components/base/utf_helper.cpp", "common_components/log/log.cpp", "common_components/objects/base_object.cpp", "common_components/objects/base_string.cpp", @@ -1358,7 +1358,7 @@ ohos_source_set("libcommon_components_set") { } else { deps += [ "$ark_root/libpandafile:arkfile_header_deps" ] } - deps += [ "common_components/common_runtime/src:libarkcommon-runtime" ] + deps += [ "common_components:libarkcommon-runtime" ] # hiviewdfx libraries external_deps += hiviewdfx_ext_deps diff --git a/common_components/common_runtime/src/BUILD.gn b/common_components/BUILD.gn similarity index 86% rename from common_components/common_runtime/src/BUILD.gn rename to common_components/BUILD.gn index 523f8118679aa1cbac4df4dbbd7914d0ce11b79e..9748cdf6b3d6e2d0572058dc92d845f05435e5fd 100755 --- a/common_components/common_runtime/src/BUILD.gn +++ b/common_components/BUILD.gn @@ -11,9 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -#import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -#import("$build_root/toolchain/toolchain.gni") +import("../js_runtime_config.gni") if (!ark_standalone_build && is_ohos) { import("//build/ohos.gni") @@ -23,7 +21,6 @@ source_Base = [ "base/sys_call.cpp", "base/c_string.cpp", "base/time_utils.cpp", - "base/log_file.cpp", "base/mem_utils.cpp", ] source_Common = [ "common/run_type.cpp" ] @@ -53,6 +50,7 @@ source_Heap = [ "heap/w_collector/preforward_barrier.cpp", "heap/w_collector/post_trace_barrier.cpp", "heap/collector/trace_collector.cpp", + "heap/heap_manager.cpp", "common/page_cache.cpp", ] @@ -65,33 +63,27 @@ source_Mutator = [ ohos_source_set("libarkcommon-runtime") { configs = [ - "../../..:ark_jsruntime_public_config", - "../../..:ark_jsruntime_common_config", + "..:ark_jsruntime_public_config", + "..:ark_jsruntime_common_config", ] - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - deps = hiviewdfx_deps - - include_dirs = [] cflags_cc = [ "-Wno-unused-lambda-capture" ] - sources = [ - "heap_manager.cpp", - "log_manager.cpp", - ] + + sources = [] sources += source_Base sources += source_Common - sources += source_Heap - sources += source_Mutator + include_dirs = [] include_dirs += [ "./", - - "heap", ] + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + deps = hiviewdfx_deps + part_name = "ets_runtime" subsystem_name = "arkcompiler" } diff --git a/ecmascript/base/asan_interface.h b/common_components/base/asan_interface.h similarity index 90% rename from ecmascript/base/asan_interface.h rename to common_components/base/asan_interface.h index fabb81e35353c177fdfa67920f5d1da58591d987..21ec669ce730ef67dbe74db435f4f6982fc261f0 100644 --- a/ecmascript/base/asan_interface.h +++ b/common_components/base/asan_interface.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_BASE_ASAN_INTERFACE_H -#define ECMASCRIPT_BASE_ASAN_INTERFACE_H +#ifndef COMMON_COMPONENTS_BASE_ASAN_INTERFACE_H +#define COMMON_COMPONENTS_BASE_ASAN_INTERFACE_H #if (defined(__has_feature) && __has_feature(address_sanitizer)) || defined(__SANITIZE_ADDRESS__) #define HAS_SANITIZER @@ -53,4 +53,4 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size) __att #define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) #endif -#endif // ECMASCRIPT_BASE_ASAN_INTERFACE_H +#endif // COMMON_COMPONENTS_BASE_ASAN_INTERFACE_H diff --git a/common_components/common_runtime/src/base/atomic_spin_lock.h b/common_components/base/atomic_spin_lock.h similarity index 85% rename from common_components/common_runtime/src/base/atomic_spin_lock.h rename to common_components/base/atomic_spin_lock.h index 93335ec02c5e7df9bc3c3ec0517922a77f0ea725..f267cd4465eb575de4ddb26636de63db9391d50e 100755 --- a/common_components/common_runtime/src/base/atomic_spin_lock.h +++ b/common_components/base/atomic_spin_lock.h @@ -13,14 +13,14 @@ * limitations under the License. */ -#ifndef ARK_COMMON_ATOMIC_SPINLOCK_H -#define ARK_COMMON_ATOMIC_SPINLOCK_H +#ifndef COMMON_COMPONENTS_BASE_ATOMIC_SPINLOCK_H +#define COMMON_COMPONENTS_BASE_ATOMIC_SPINLOCK_H #include #include "common_interfaces/base/common.h" -namespace panda { +namespace common { class AtomicSpinLock { public: AtomicSpinLock() {} @@ -40,6 +40,6 @@ private: NO_COPY_SEMANTIC_CC(AtomicSpinLock); }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_ATOMIC_SPINLOCK_H +#endif // COMMON_COMPONENTS_BASE_ATOMIC_SPINLOCK_H diff --git a/common_components/common_runtime/src/base/c_string.cpp b/common_components/base/c_string.cpp similarity index 99% rename from common_components/common_runtime/src/base/c_string.cpp rename to common_components/base/c_string.cpp index 4e7d9fe07b9f20069baccee6331744d2233785bc..b8dc233cd4ac5ea8f017814b36fd549213eb07df 100755 --- a/common_components/common_runtime/src/base/c_string.cpp +++ b/common_components/base/c_string.cpp @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/base/c_string.h" +#include "common_components/base/c_string.h" #include -namespace panda { +namespace common { // The last two characters are units, such as "kb" or "ms". constexpr int8_t LAST_CHARACTERS_SIZE = 2; // nDecimal = ceil(sizeof(int32_t) * 8 * log(2)) = ceil(2.41 * sizeof(int32_t)) @@ -546,4 +546,4 @@ void CString::ReplaceAll(CString replacement, CString target) return; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/base/c_string.h b/common_components/base/c_string.h similarity index 96% rename from common_components/common_runtime/src/base/c_string.h rename to common_components/base/c_string.h index 2c00a2e454e3786f0ec00c3136a955d6c609b6f7..80268ca40c16825fc72856a4c5e7b6814f4d7315 100755 --- a/common_components/common_runtime/src/base/c_string.h +++ b/common_components/base/c_string.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_C_STRING_H -#define ARK_COMMON_C_STRING_H +#ifndef COMMON_COMPONENTS_BASE_C_STRING_H +#define COMMON_COMPONENTS_BASE_C_STRING_H #include #include @@ -22,7 +22,7 @@ #include "securec.h" #include "common_components/log/log.h" -namespace panda { +namespace common { class CString { public: CString(); @@ -143,5 +143,5 @@ private: size_t capacity_ = C_STRING_MIN_SIZE; size_t length_ = 0; }; -} // namespace panda -#endif // ARK_COMMON_C_STRING_H +} // namespace common +#endif // COMMON_COMPONENTS_BASE_C_STRING_H diff --git a/common_components/common_runtime/src/log_manager.cpp b/common_components/base/config.h old mode 100755 new mode 100644 similarity index 55% rename from common_components/common_runtime/src/log_manager.cpp rename to common_components/base/config.h index 3a729ad5fd62fd9c0d449819b99e822854989ba3..79d9df0d6c36da209e307feee06413a6c4ac00b7 --- a/common_components/common_runtime/src/log_manager.cpp +++ b/common_components/base/config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * 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 @@ -12,14 +12,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/log_manager.h" -#include "common_components/common_runtime/src/base/log_file.h" +#ifndef COMMON_COMPONENTS_BASE_CONFIG_H +#define COMMON_COMPONENTS_BASE_CONFIG_H -namespace panda { -LogManager::LogManager() {} +namespace common { + +#if defined (NEXT_OPTIMIZATION_MACRO) +#define ENABLE_NEXT_OPTIMIZATION 1 +#else +#define ENABLE_NEXT_OPTIMIZATION 0 +#endif -void LogManager::Init() { LogFile::Init(); } +#if ENABLE_NEXT_OPTIMIZATION + #define NEXT_OPTIMIZATION_BOOL true +#else + #define NEXT_OPTIMIZATION_BOOL false +#endif -void LogManager::Fini() { LogFile::Fini(); } -} // namespace panda +} // namespace common + +#endif // COMMON_COMPONENTS_BASE_CONFIG_H \ No newline at end of file diff --git a/common_components/common_runtime/src/base/globals.h b/common_components/base/globals.h similarity index 88% rename from common_components/common_runtime/src/base/globals.h rename to common_components/base/globals.h index 4793fe9efb2e897c7bd4fec99d7538c51c4a850c..02b99f15a8cb34bdd9b3f3e1c6164d818b801d2f 100755 --- a/common_components/common_runtime/src/base/globals.h +++ b/common_components/base/globals.h @@ -13,15 +13,15 @@ * limitations under the License. */ -#ifndef ARK_COMMON_GLOBALS_H -#define ARK_COMMON_GLOBALS_H +#ifndef COMMON_COMPONENTS_BASE_GLOBALS_H +#define COMMON_COMPONENTS_BASE_GLOBALS_H #include +#include "common_components/base/asan_interface.h" #include "common_interfaces/base/common.h" -#include "ecmascript/base/asan_interface.h" -namespace panda { +namespace common { // Time Factors constexpr uint64_t TIME_FACTOR = 1000LL; constexpr uint64_t SECOND_TO_NANO_SECOND = TIME_FACTOR * TIME_FACTOR * TIME_FACTOR; @@ -37,7 +37,7 @@ struct Identity { using type = T; }; -extern const size_t ARK_COMMON_PAGE_SIZE; +extern const size_t COMMON_PAGE_SIZE; template constexpr bool IsPowerOfTwo(T x) @@ -80,6 +80,6 @@ constexpr T AlignDown(T size, T alignment) { return (size & ~static_cast(alignment - 1)); } -} // namespace panda +} // namespace common -#endif // ARK_COMMON_GLOBALS_H +#endif // COMMON_COMPONENTS_BASE_GLOBALS_H diff --git a/common_components/common_runtime/src/base/hash_utils.h b/common_components/base/hash_utils.h similarity index 83% rename from common_components/common_runtime/src/base/hash_utils.h rename to common_components/base/hash_utils.h index 5d6f9be0924aac3f9d42e99374d81cbc12411ec6..41ed0f6ea442549b3861cfc74f0678b39a2a42d3 100755 --- a/common_components/common_runtime/src/base/hash_utils.h +++ b/common_components/base/hash_utils.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef HASH_UTILS_H -#define HASH_UTILS_H + +#ifndef COMMON_COMPONENTS_BASE_HASH_UTILS_H +#define COMMON_COMPONENTS_BASE_HASH_UTILS_H #include -#include "common_components/common_runtime/src/base/c_string.h" +#include "common_components/base/c_string.h" -namespace panda { +namespace common { struct HashString { // 211 is a proper prime, which can reduce the conflict rate. @@ -40,6 +41,6 @@ struct EqualString { bool operator()(const char* lhs, const char* rhs) const { return strcmp(lhs, rhs) == 0; } }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_BASE_LOG_H +#endif // COMMON_COMPONENTS_BASE_HASH_UTILS_H diff --git a/common_components/common_runtime/src/base/immortal_wrapper.h b/common_components/base/immortal_wrapper.h similarity index 88% rename from common_components/common_runtime/src/base/immortal_wrapper.h rename to common_components/base/immortal_wrapper.h index 01615a71a5834697c666b9af47cf6584b7e9b35c..6c4393dbbd262b6780db5de0a6c15a9aeeb97488 100755 --- a/common_components/common_runtime/src/base/immortal_wrapper.h +++ b/common_components/base/immortal_wrapper.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_IMMORTAL_WRAPPER_H -#define ARK_COMMON_IMMORTAL_WRAPPER_H + +#ifndef COMMON_COMPONENTS_BASE_IMMORTAL_WRAPPER_H +#define COMMON_COMPONENTS_BASE_IMMORTAL_WRAPPER_H #include #include -namespace panda { +namespace common { // Utility class ensuring ordered destruction of static global objects to prevent dependency-related issues during // program termination. template @@ -45,5 +46,5 @@ public: private: alignas(Type) unsigned char buffer_[sizeof(Type)] = { 0 }; }; -} // namespace panda -#endif // ARK_COMMON_IMMORTAL_WRAPPER_H +} // namespace common +#endif // COMMON_COMPONENTS_BASE_IMMORTAL_WRAPPER_H diff --git a/common_components/common_runtime/src/base/mem_utils.cpp b/common_components/base/mem_utils.cpp similarity index 97% rename from common_components/common_runtime/src/base/mem_utils.cpp rename to common_components/base/mem_utils.cpp index 0d05cbff65c37d643125c309446fa8b87aa49122..ae72054f41e891baffd3ed27e6726b5c882169e7 100755 --- a/common_components/common_runtime/src/base/mem_utils.cpp +++ b/common_components/base/mem_utils.cpp @@ -16,7 +16,7 @@ #include "common_components/log/log.h" #include "securec.h" -namespace panda { +namespace common { void MemorySet(uintptr_t dest, size_t size, int c, size_t count) { uintptr_t destAddress = dest; @@ -46,4 +46,4 @@ void MemoryCopy(uintptr_t dest, size_t size, const uintptr_t src, size_t count) srcAddress += sizePerChunk; } } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/base/mem_utils.h b/common_components/base/mem_utils.h similarity index 84% rename from common_components/common_runtime/src/base/mem_utils.h rename to common_components/base/mem_utils.h index 12e2eedd9acd450ce934b24f1735f2a3714e76ce..5a1b63e42e37a8c3fa2edbcaf2baee2c752c2519 100755 --- a/common_components/common_runtime/src/base/mem_utils.h +++ b/common_components/base/mem_utils.h @@ -12,13 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_MEM_UTILS_H -#define ARK_COMMON_MEM_UTILS_H -namespace panda { +#ifndef COMMON_COMPONENTS_BASE_MEM_UTILS_H +#define COMMON_COMPONENTS_BASE_MEM_UTILS_H + +namespace common { // memset_s wrapper for the situation that memset size is greater than SECUREC_MEM_MAX_LEN(2GB). void MemorySet(uintptr_t dest, size_t destMax, int c, size_t count); // memcpy_s wrapper for the situation that memcpy size is greater than SECUREC_MEM_MAX_LEN(2GB). void MemoryCopy(uintptr_t dest, size_t destMax, const uintptr_t src, size_t count); -} // namespace panda -#endif // ARK_COMMON_MEM_UTILS_H \ No newline at end of file +} // namespace common + +#endif // COMMON_COMPONENTS_BASE_MEM_UTILS_H \ No newline at end of file diff --git a/common_components/common_runtime/src/base/rw_lock.h b/common_components/base/rw_lock.h similarity index 93% rename from common_components/common_runtime/src/base/rw_lock.h rename to common_components/base/rw_lock.h index 6be6b4a5d645c5f9f8bd049a542bcd20d70e29c3..27398fdfc22a2b078a4354b8021e1a61eacb8177 100755 --- a/common_components/common_runtime/src/base/rw_lock.h +++ b/common_components/base/rw_lock.h @@ -13,15 +13,15 @@ * limitations under the License. */ -#ifndef ARK_COMMON_RWLOCK_H -#define ARK_COMMON_RWLOCK_H +#ifndef COMMON_COMPONENTS_BASE_RWLOCK_H +#define COMMON_COMPONENTS_BASE_RWLOCK_H #include #include #include "common_components/log/log.h" -namespace panda { +namespace common { class RwLock { public: void LockRead() @@ -85,5 +85,5 @@ private: static constexpr int WRITE_LOCKED = -1; std::atomic lockCount_{ 0 }; }; -} // namespace panda -#endif // ARK_COMMON_SPINLOCK_H +} // namespace common +#endif // COMMON_COMPONENTS_BASE_SPINLOCK_H diff --git a/common_components/common_runtime/src/base/spin_lock.h b/common_components/base/spin_lock.h similarity index 86% rename from common_components/common_runtime/src/base/spin_lock.h rename to common_components/base/spin_lock.h index 1a68556385ddc9a6bd160eaf607dc27224670864..bfe8b7157867dc09702dd21b51bff179f5373f46 100755 --- a/common_components/common_runtime/src/base/spin_lock.h +++ b/common_components/base/spin_lock.h @@ -13,13 +13,14 @@ * limitations under the License. */ -#ifndef ARK_COMMON_SPINLOCK_H -#define ARK_COMMON_SPINLOCK_H +#ifndef COMMON_COMPONENTS_BASE_SPINLOCK_H +#define COMMON_COMPONENTS_BASE_SPINLOCK_H + #include #include "common_interfaces/base/common.h" -namespace panda { +namespace common { class SpinLock { public: // Create a Mutex that is not held by anybody. @@ -37,5 +38,6 @@ private: pthread_spinlock_t spinlock_; NO_COPY_SEMANTIC_CC(SpinLock); }; -} // namespace panda -#endif // ARK_COMMON_SPINLOCK_H +} // namespace common + +#endif // COMMON_COMPONENTS_BASE_SPINLOCK_H diff --git a/common_components/common_runtime/src/base/sys_call.cpp b/common_components/base/sys_call.cpp similarity index 93% rename from common_components/common_runtime/src/base/sys_call.cpp rename to common_components/base/sys_call.cpp index 631f2c1de8b15d29dfbc02dde321f114c2fd0bd3..7f36f48cdfaa1bcc55c33ba069da4fc6e693a987 100755 --- a/common_components/common_runtime/src/base/sys_call.cpp +++ b/common_components/base/sys_call.cpp @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/base/sys_call.h" +#include "common_components/base/sys_call.h" #include #include @@ -25,7 +25,7 @@ #include "sys/syscall.h" #endif -namespace panda { +namespace common { #ifndef SYS_futex #define SYS_futex __NR_futex #endif @@ -61,4 +61,4 @@ int GetPid() return syscall(SYS_getpid); #endif } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/base/sys_call.h b/common_components/base/sys_call.h similarity index 85% rename from common_components/common_runtime/src/base/sys_call.h rename to common_components/base/sys_call.h index 313d0214134739e231781abdbff682ea8807792d..09cbc6064e21dbe2278ed0b649fbc294c6391e14 100755 --- a/common_components/common_runtime/src/base/sys_call.h +++ b/common_components/base/sys_call.h @@ -13,8 +13,9 @@ * limitations under the License. */ -#ifndef ARK_COMMON_SYSCALL_H -#define ARK_COMMON_SYSCALL_H +#ifndef COMMON_COMPONENTS_BASE_SYSCALL_H +#define COMMON_COMPONENTS_BASE_SYSCALL_H + #include #if defined(_WIN64) #include @@ -26,7 +27,7 @@ #include "linux/futex.h" #endif -namespace panda { +namespace common { #if defined(__linux__) || defined(PANDA_TARGET_OHOS) int Futex(const volatile int* uaddr, int op, int val); #endif @@ -43,8 +44,9 @@ int GetPid(); // prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME), can set name for anon VMA. // Considering the purpose is for debuging, in windows we just simply remove it. -#define ARK_COMMON_PRCTL(base_address, allocated_size, mmtag) \ +#define COMMON_PRCTL(base_address, allocated_size, mmtag) \ (void)prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, base_address, allocated_size, mmtag) #endif -} // namespace panda -#endif // ARK_COMMON_SYSCALL_H +} // namespace common + +#endif // COMMON_COMPONENTS_BASE_SYSCALL_H diff --git a/common_components/common_runtime/src/base/time_utils.cpp b/common_components/base/time_utils.cpp similarity index 96% rename from common_components/common_runtime/src/base/time_utils.cpp rename to common_components/base/time_utils.cpp index 8c78d8cc377eeaed842469c77ca5c989857d8c71..be31beeedd4d45daeadbe2c0777e50061c0a2f07 100755 --- a/common_components/common_runtime/src/base/time_utils.cpp +++ b/common_components/base/time_utils.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/base/time_utils.h" +#include "common_components/base/time_utils.h" #include #include @@ -23,7 +23,7 @@ #include "securec.h" -namespace panda { +namespace common { namespace TimeUtil { using Sec = std::chrono::seconds; using Ms = std::chrono::milliseconds; @@ -96,4 +96,4 @@ CString GetTimestamp() return CString(buf); } } // namespace TimeUtil -} // end namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/base/time_utils.h b/common_components/base/time_utils.h similarity index 85% rename from common_components/common_runtime/src/base/time_utils.h rename to common_components/base/time_utils.h index ad180609dd3b772da3514e448eb760be36367cf1..fbbe72f1e3b02a5e7345c1714366050d0f34e55f 100755 --- a/common_components/common_runtime/src/base/time_utils.h +++ b/common_components/base/time_utils.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_TIME_UTILS_H -#define ARK_COMMON_TIME_UTILS_H + +#ifndef COMMON_COMPONENTS_BASE_TIME_UTILS_H +#define COMMON_COMPONENTS_BASE_TIME_UTILS_H #include -#include "common_components/common_runtime/src/base/c_string.h" +#include "common_components/base/c_string.h" -namespace panda { +namespace common { namespace TimeUtil { // returns the monotonic time since epoch starting point in milliseconds uint64_t MilliSeconds(); @@ -41,5 +42,6 @@ CString GetDigitDate(); // returns the current date in ISO yyyy-mm-dd hh:mm::ss.ms format PUBLIC_API CString GetTimestamp(); } // namespace TimeUtil -} // namespace panda -#endif // ARK_COMMON_TIME_UTILS_H +} // namespace common + +#endif // COMMON_COMPONENTS_BASE_TIME_UTILS_H diff --git a/ecmascript/base/utf_helper.cpp b/common_components/base/utf_helper.cpp similarity index 84% rename from ecmascript/base/utf_helper.cpp rename to common_components/base/utf_helper.cpp index 7a800a9acebb87ddfcb948f73cba4472bc70d62c..ef8f496c16b011ef02685457d0c3e30b84d7bf3b 100644 --- a/ecmascript/base/utf_helper.cpp +++ b/common_components/base/utf_helper.cpp @@ -13,9 +13,10 @@ * limitations under the License. */ -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" -#include "ecmascript/log_wrapper.h" +#include "common_components/log/log.h" +#include "libpandabase/utils/span.h" // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) static constexpr int32_t U16_SURROGATE_OFFSET = (0xd800 << 10UL) + 0xdc00 - 0x10000; @@ -23,11 +24,11 @@ static constexpr int32_t U16_SURROGATE_OFFSET = (0xd800 << 10UL) + 0xdc00 - 0x10 #define U16_GET_SUPPLEMENTARY(lead, trail) \ ((static_cast(lead) << 10UL) + static_cast(trail) - U16_SURROGATE_OFFSET) -namespace panda::ecmascript::base::utf_helper { +namespace common::utf_helper { uint32_t UTF16Decode(uint16_t lead, uint16_t trail) { - ASSERT((lead >= DECODE_LEAD_LOW && lead <= DECODE_LEAD_HIGH) && + DCHECK_CC((lead >= DECODE_LEAD_LOW && lead <= DECODE_LEAD_HIGH) && (trail >= DECODE_TRAIL_LOW && trail <= DECODE_TRAIL_HIGH)); uint32_t cp = (lead - DECODE_LEAD_LOW) * DECODE_FIRST_FACTOR + (trail - DECODE_TRAIL_LOW) + DECODE_SECOND_FACTOR; return cp; @@ -143,8 +144,8 @@ bool IsValidUTF8(const std::vector &data) } break; default: - LOG_ECMA(FATAL) << "this branch is unreachable"; - UNREACHABLE(); + LOG_COMMON(FATAL) << "this branch is unreachable"; + UNREACHABLE_CC(); break; } @@ -160,10 +161,10 @@ Utf8Char ConvertUtf16ToUtf8(uint16_t d0, uint16_t d1, bool modify, bool isWriteB { // when first utf16 code is in 0xd800-0xdfff and second utf16 code is 0, // means that is a single code point, it needs to be represented by three UTF8 code. - if (d1 == 0 && d0 >= utf::HI_SURROGATE_MIN && d0 <= utf::LO_SURROGATE_MAX) { + if (d1 == 0 && d0 >= HI_SURROGATE_MIN && d0 <= LO_SURROGATE_MAX) { auto ch0 = static_cast(UTF8_3B_FIRST | static_cast(d0 >> UtfOffset::TWELVE)); - auto ch1 = static_cast(UTF8_3B_SECOND | (static_cast(d0 >> UtfOffset::SIX) & utf::MASK_6BIT)); - auto ch2 = static_cast(UTF8_3B_THIRD | (d0 & utf::MASK_6BIT)); + auto ch1 = static_cast(UTF8_3B_SECOND | (static_cast(d0 >> UtfOffset::SIX) & MASK_6BIT)); + auto ch2 = static_cast(UTF8_3B_THIRD | (d0 & MASK_6BIT)); return {UtfLength::THREE, {ch0, ch1, ch2}}; } @@ -183,27 +184,27 @@ Utf8Char ConvertUtf16ToUtf8(uint16_t d0, uint16_t d1, bool modify, bool isWriteB } if (d0 <= UTF8_2B_MAX) { auto ch0 = static_cast(UTF8_2B_FIRST | static_cast(d0 >> UtfOffset::SIX)); - auto ch1 = static_cast(UTF8_2B_SECOND | (d0 & utf::MASK_6BIT)); + auto ch1 = static_cast(UTF8_2B_SECOND | (d0 & MASK_6BIT)); return {UtfLength::TWO, {ch0, ch1}}; } - if (d0 < utf::HI_SURROGATE_MIN || d0 > utf::HI_SURROGATE_MAX) { + if (d0 < HI_SURROGATE_MIN || d0 > HI_SURROGATE_MAX) { auto ch0 = static_cast(UTF8_3B_FIRST | static_cast(d0 >> UtfOffset::TWELVE)); - auto ch1 = static_cast(UTF8_3B_SECOND | (static_cast(d0 >> UtfOffset::SIX) & utf::MASK_6BIT)); - auto ch2 = static_cast(UTF8_3B_THIRD | (d0 & utf::MASK_6BIT)); + auto ch1 = static_cast(UTF8_3B_SECOND | (static_cast(d0 >> UtfOffset::SIX) & MASK_6BIT)); + auto ch2 = static_cast(UTF8_3B_THIRD | (d0 & MASK_6BIT)); return {UtfLength::THREE, {ch0, ch1, ch2}}; } - if (d1 < utf::LO_SURROGATE_MIN || d1 > utf::LO_SURROGATE_MAX) { + if (d1 < LO_SURROGATE_MIN || d1 > LO_SURROGATE_MAX) { // Bad sequence - LOG_ECMA(FATAL) << "this branch is unreachable"; - UNREACHABLE(); + LOG_COMMON(FATAL) << "this branch is unreachable"; + UNREACHABLE_CC(); } uint32_t codePoint = CombineTwoU16(d0, d1); auto ch0 = static_cast((codePoint >> UtfOffset::EIGHTEEN) | UTF8_4B_FIRST); - auto ch1 = static_cast(((codePoint >> UtfOffset::TWELVE) & utf::MASK_6BIT) | utf::MASK1); - auto ch2 = static_cast(((codePoint >> UtfOffset::SIX) & utf::MASK_6BIT) | utf::MASK1); - auto ch3 = static_cast((codePoint & utf::MASK_6BIT) | utf::MASK1); + auto ch1 = static_cast(((codePoint >> UtfOffset::TWELVE) & MASK_6BIT) | MASK1); + auto ch2 = static_cast(((codePoint >> UtfOffset::SIX) & MASK_6BIT) | MASK1); + auto ch3 = static_cast((codePoint & MASK_6BIT) | MASK1); return {UtfLength::FOUR, {ch0, ch1, ch2, ch3}}; } @@ -212,8 +213,8 @@ size_t Utf16ToUtf8Size(const uint16_t *utf16, uint32_t length, bool modify, bool size_t res = 1; // zero byte // when utf16 data length is only 1 and code in 0xd800-0xdfff, // means that is a single code point, it needs to be represented by three UTF8 code. - if (length == 1 && utf16[0] >= utf::HI_SURROGATE_MIN && // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - utf16[0] <= utf::LO_SURROGATE_MAX) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + if (length == 1 && utf16[0] >= HI_SURROGATE_MIN && // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + utf16[0] <= LO_SURROGATE_MAX) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) res += UtfLength::THREE; return res; } @@ -230,12 +231,12 @@ size_t Utf16ToUtf8Size(const uint16_t *utf16, uint32_t length, bool modify, bool } else if (utf16[i] <= UTF8_2B_MAX) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) res += UtfLength::TWO; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - } else if (utf16[i] < utf::HI_SURROGATE_MIN || utf16[i] > utf::HI_SURROGATE_MAX) { + } else if (utf16[i] < HI_SURROGATE_MIN || utf16[i] > HI_SURROGATE_MAX) { res += UtfLength::THREE; } else { if (!cesu8 && i < length - 1 && - utf16[i + 1] >= utf::LO_SURROGATE_MIN && // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - utf16[i + 1] <= utf::LO_SURROGATE_MAX) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + utf16[i + 1] >= LO_SURROGATE_MIN && // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + utf16[i + 1] <= LO_SURROGATE_MAX) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) res += UtfLength::FOUR; ++i; } else { @@ -311,34 +312,34 @@ size_t DebuggerConvertRegionUtf16ToUtf8(const uint16_t *utf16In, uint8_t *utf8Ou std::pair ConvertUtf8ToUtf16Pair(const uint8_t *data, bool combine) { uint8_t d0 = data[0]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if ((d0 & utf::MASK1) == 0) { + if ((d0 & MASK1) == 0) { return {d0, 1}; } uint8_t d1 = data[1]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if ((d0 & utf::MASK2) == 0) { - return {((d0 & utf::MASK_5BIT) << utf::DATA_WIDTH) | (d1 & utf::MASK_6BIT), UtfLength::TWO}; + if ((d0 & MASK2) == 0) { + return {((d0 & MASK_5BIT) << DATA_WIDTH) | (d1 & MASK_6BIT), UtfLength::TWO}; } uint8_t d2 = data[UtfLength::TWO]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if ((d0 & utf::MASK3) == 0) { - return {((d0 & utf::MASK_4BIT) << UtfOffset::TWELVE) | ((d1 & utf::MASK_6BIT) << utf::DATA_WIDTH) | - (d2 & utf::MASK_6BIT), + if ((d0 & MASK3) == 0) { + return {((d0 & MASK_4BIT) << UtfOffset::TWELVE) | ((d1 & MASK_6BIT) << DATA_WIDTH) | + (d2 & MASK_6BIT), UtfLength::THREE}; } uint8_t d3 = data[UtfLength::THREE]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - uint32_t codePoint = ((d0 & utf::MASK_4BIT) << UtfOffset::EIGHTEEN) | ((d1 & utf::MASK_6BIT) << UtfOffset::TWELVE) | - ((d2 & utf::MASK_6BIT) << utf::DATA_WIDTH) | (d3 & utf::MASK_6BIT); + uint32_t codePoint = ((d0 & MASK_4BIT) << UtfOffset::EIGHTEEN) | ((d1 & MASK_6BIT) << UtfOffset::TWELVE) | + ((d2 & MASK_6BIT) << DATA_WIDTH) | (d3 & MASK_6BIT); uint32_t pair = 0; if (combine) { - uint32_t lead = ((codePoint >> (utf::PAIR_ELEMENT_WIDTH - utf::DATA_WIDTH)) + utf::U16_LEAD); - uint32_t tail = ((codePoint & utf::MASK_10BIT) + utf::U16_TAIL) & utf::MASK_16BIT; + uint32_t lead = ((codePoint >> (PAIR_ELEMENT_WIDTH - DATA_WIDTH)) + U16_LEAD); + uint32_t tail = ((codePoint & MASK_10BIT) + U16_TAIL) & MASK_16BIT; pair = static_cast(U16_GET_SUPPLEMENTARY(lead, tail)); // NOLINTNEXTLINE(hicpp-signed-bitwise) } else { - pair |= ((codePoint >> (utf::PAIR_ELEMENT_WIDTH - utf::DATA_WIDTH)) + utf::U16_LEAD) << utf::PAIR_ELEMENT_WIDTH; - pair |= ((codePoint & utf::MASK_10BIT) + utf::U16_TAIL) & utf::MASK_16BIT; + pair |= ((codePoint >> (PAIR_ELEMENT_WIDTH - DATA_WIDTH)) + U16_LEAD) << PAIR_ELEMENT_WIDTH; + pair |= ((codePoint & MASK_10BIT) + U16_TAIL) & MASK_16BIT; } return {pair, UtfLength::FOUR}; @@ -424,7 +425,7 @@ size_t ConvertRegionUtf8ToUtf16(const uint8_t *utf8In, uint16_t *utf16Out, size_ uint32_t codePoint = ((src & LOW_3BITS) << OFFSET_18POS) | ((c2 & LOW_6BITS) << OFFSET_12POS) | ((c3 & LOW_6BITS) << OFFSET_6POS) | (c4 & LOW_6BITS); if (codePoint >= SURROGATE_RAIR_START) { - ASSERT(utf16Len >= 1); + DCHECK_CC(utf16Len >= 1); if (out_pos >= utf16Len - 1) { return out_pos; } @@ -489,7 +490,7 @@ std::pair ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t if (maxLen == 0) { return {INVALID_UTF8, 0}; } - Span sp(utf8, maxLen); + panda::Span sp(utf8, maxLen); // one byte uint8_t d0 = sp[0]; if ((d0 & BIT_MASK_1) == 0) { @@ -502,7 +503,7 @@ std::pair ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t uint8_t d1 = sp[UtfLength::ONE]; if ((d0 & BIT_MASK_3) == BIT_MASK_2) { if ((d1 & BIT_MASK_2) == BIT_MASK_1) { - return {((d0 & utf::MASK_5BIT) << utf::DATA_WIDTH) | (d1 & utf::MASK_6BIT), UtfLength::TWO}; + return {((d0 & MASK_5BIT) << DATA_WIDTH) | (d1 & MASK_6BIT), UtfLength::TWO}; } else { return {INVALID_UTF8, 0}; } @@ -514,8 +515,8 @@ std::pair ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t uint8_t d2 = sp[UtfLength::TWO]; if ((d0 & BIT_MASK_4) == BIT_MASK_3) { if (((d1 & BIT_MASK_2) == BIT_MASK_1) && ((d2 & BIT_MASK_2) == BIT_MASK_1)) { - return {((d0 & utf::MASK_4BIT) << UtfOffset::TWELVE) | - ((d1 & utf::MASK_6BIT) << utf::DATA_WIDTH) | (d2 & utf::MASK_6BIT), UtfLength::THREE}; + return {((d0 & MASK_4BIT) << UtfOffset::TWELVE) | + ((d1 & MASK_6BIT) << DATA_WIDTH) | (d2 & MASK_6BIT), UtfLength::THREE}; } else { return {INVALID_UTF8, 0}; } @@ -528,12 +529,12 @@ std::pair ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t if ((d0 & BIT_MASK_5) == BIT_MASK_4) { if (((d1 & BIT_MASK_2) == BIT_MASK_1) && ((d2 & BIT_MASK_2) == BIT_MASK_1) && ((d3 & BIT_MASK_2) == BIT_MASK_1)) { - return {((d0 & utf::MASK_4BIT) << UtfOffset::EIGHTEEN) | ((d1 & utf::MASK_6BIT) << UtfOffset::TWELVE) | - ((d2 & utf::MASK_6BIT) << utf::DATA_WIDTH) | (d3 & utf::MASK_6BIT), UtfLength::FOUR}; + return {((d0 & MASK_4BIT) << UtfOffset::EIGHTEEN) | ((d1 & MASK_6BIT) << UtfOffset::TWELVE) | + ((d2 & MASK_6BIT) << DATA_WIDTH) | (d3 & MASK_6BIT), UtfLength::FOUR}; } else { return {INVALID_UTF8, 0}; } } return {INVALID_UTF8, 0}; } -} // namespace panda::ecmascript::base::utf_helper +} // namespace common::utf_helper diff --git a/ecmascript/base/utf_helper.h b/common_components/base/utf_helper.h similarity index 89% rename from ecmascript/base/utf_helper.h rename to common_components/base/utf_helper.h index cba0962ff859e47f544cd4c645cd1c4302181494..c3a198a252388a343c37a1e2edb41b7f393ad8f9 100644 --- a/ecmascript/base/utf_helper.h +++ b/common_components/base/utf_helper.h @@ -16,13 +16,19 @@ #ifndef ECMASCRIPT_BASE_UTF_HELPER_H #define ECMASCRIPT_BASE_UTF_HELPER_H +#include #include #include -#include "libpandabase/utils/utf.h" -#include "ecmascript/common.h" +#include "common_interfaces/base/common.h" -namespace panda::ecmascript::base::utf_helper { +namespace common::utf_helper { +constexpr size_t HI_SURROGATE_MIN = 0xd800; +constexpr size_t HI_SURROGATE_MAX = 0xdbff; +constexpr size_t LO_SURROGATE_MIN = 0xdc00; +constexpr size_t LO_SURROGATE_MAX = 0xdfff; + +constexpr size_t LO_SUPPLEMENTS_MIN = 0x10000; static constexpr size_t CONST_2 = 2; static constexpr size_t CONST_3 = 3; @@ -52,6 +58,12 @@ static constexpr uint32_t UTF16_OFFSET = 10; static constexpr uint16_t SURROGATE_MASK = 0xF800; static constexpr uint16_t UTF16_REPLACEMENT_CHARACTER = 0xFFFD; +constexpr size_t DATA_WIDTH = 6; +constexpr size_t PAIR_ELEMENT_WIDTH = 16; + +constexpr size_t U16_LEAD = 0xd7c0; +constexpr size_t U16_TAIL = 0xdc00; + static constexpr uint8_t BIT_MASK_1 = 0x80; static constexpr uint8_t BIT_MASK_2 = 0xC0; static constexpr uint8_t BIT_MASK_3 = 0xE0; @@ -60,6 +72,12 @@ static constexpr uint8_t BIT_MASK_5 = 0xF8; static constexpr uint8_t BIT_MASK_FF = 0xFF; static constexpr uint16_t BIT16_MASK = 0x3FF; +constexpr size_t MASK_4BIT = 0x0f; +constexpr size_t MASK_5BIT = 0x1f; +constexpr size_t MASK_6BIT = 0x3f; +constexpr size_t MASK_10BIT = 0x03ff; +constexpr size_t MASK_16BIT = 0xffff; + static constexpr uint8_t UTF8_1B_MAX = 0x7f; static constexpr uint16_t UTF8_2B_MAX = 0x7ff; @@ -147,10 +165,10 @@ size_t ConvertRegionUtf16ToLatin1(const uint16_t *utf16In, uint8_t *latin1Out, s static inline uint32_t CombineTwoU16(uint16_t d0, uint16_t d1) { - uint32_t codePoint = d0 - utf::HI_SURROGATE_MIN; + uint32_t codePoint = d0 - HI_SURROGATE_MIN; codePoint <<= UtfOffset::TEN; - codePoint |= d1 - utf::LO_SURROGATE_MIN; - codePoint += utf::LO_SUPPLEMENTS_MIN; + codePoint |= d1 - LO_SURROGATE_MIN; + codePoint += LO_SUPPLEMENTS_MIN; return codePoint; } @@ -178,7 +196,7 @@ static inline size_t HexChar16Value(uint16_t ch) // | ... | // | 'f' | 0x66 | 15 | // +------+-------+-------+ - ASSERT(IsHexDigits(ch)); + DCHECK_CC(IsHexDigits(ch)); size_t res = ch - '0'; // res in [0x0, 0x9], [0x11, 0x16], [0x31, 0x36] if (res > 9) { // 9: res in [0x11, 0x16], [0x31, 0x36], which means ch in ['A', 'F'], ['a', 'f'] @@ -215,9 +233,9 @@ static inline uint8_t GetValueFromTwoHex(uint8_t front, uint8_t behind) { size_t high = HexChar16Value(front); size_t low = HexChar16Value(behind); - uint8_t res = ((high << 4U) | low) & base::utf_helper::BIT_MASK_FF; // NOLINT 4: means shift left by 4 digits + uint8_t res = ((high << 4U) | low) & common::utf_helper::BIT_MASK_FF; // NOLINT 4: means shift left by 4 digits return res; } -} // namespace panda::ecmascript::base::utf_helper +} // namespace common::utf_helper #endif // ECMASCRIPT_BASE_UTF_HELPER_H diff --git a/common_components/base_runtime/base_runtime.cpp b/common_components/base_runtime/base_runtime.cpp index a692674b8bfd04600788ba7a5df33cdf86cda1b0..9984adc71bdec80c3cc1a21d9e0b9e621706fe7a 100755 --- a/common_components/base_runtime/base_runtime.cpp +++ b/common_components/base_runtime/base_runtime.cpp @@ -17,19 +17,18 @@ #include "common_components/base_runtime/base_runtime_param.h" #include "common_components/base_runtime/hooks.h" -#include "common_components/common_runtime/src/common/page_pool.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" -#include "common_components/common_runtime/src/heap/heap.h" -#include "common_components/common_runtime/src/heap_manager.h" -#include "common_components/common_runtime/src/log_manager.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/common/page_pool.h" +#include "common_components/heap/allocator/region_desc.h" +#include "common_components/heap/heap.h" +#include "common_components/heap/heap_manager.h" +#include "common_components/mutator/mutator_manager.h" #include "common_interfaces/thread/thread_state_transition.h" -namespace panda { -namespace ecmascript { +namespace panda::ecmascript { class TaggedObject; } +namespace common { using panda::ecmascript::TaggedObject; std::mutex BaseRuntime::vmCreationLock_; @@ -98,8 +97,7 @@ void BaseRuntime::Init(const RuntimeParam ¶m) param_ = param; - PagePool::Instance().Init(param_.heapParam.heapSize * KB / ARK_COMMON_PAGE_SIZE); - logManager_ = NewAndInit(); + PagePool::Instance().Init(param_.heapParam.heapSize * KB / COMMON_PAGE_SIZE); mutatorManager_ = NewAndInit(); heapManager_ = NewAndInit(param_); @@ -132,7 +130,6 @@ void BaseRuntime::Fini() // here we need to check and call fini. CheckAndFini(heapManager_); CheckAndFini(mutatorManager_); - CheckAndFini(logManager_); PagePool::Instance().Fini(); } @@ -204,6 +201,6 @@ void BaseRuntime::WaitForGCFinish() { Heap::GetHeap().WaitForGCFinish(); } bool BaseRuntime::ForEachObj(HeapVisitor& visitor, bool safe) { - return panda::Heap::GetHeap().ForEachObject(visitor, safe); + return Heap::GetHeap().ForEachObject(visitor, safe); } -} // namespace panda +} // namespace common diff --git a/common_components/base_runtime/base_runtime_param.cpp b/common_components/base_runtime/base_runtime_param.cpp index 2a819f37349d95fa6ab7384a4e9931f2a5667103..7fd833578160e7cfaa394ec5f28dc5238a16c834 100755 --- a/common_components/base_runtime/base_runtime_param.cpp +++ b/common_components/base_runtime/base_runtime_param.cpp @@ -15,10 +15,10 @@ #include "common_components/base_runtime/base_runtime_param.h" -#include "common_components/common_runtime/src/base/globals.h" +#include "common_components/base/globals.h" #include "common_components/platform/cpu.h" -namespace panda { +namespace common { size_t BaseRuntimeParam::InitHeapSize() { size_t systemSize = PhysicalSize(); @@ -43,4 +43,4 @@ RuntimeParam BaseRuntimeParam::DefaultRuntimeParam() return param; } -} // namespace panda +} // namespace common diff --git a/common_components/base_runtime/base_runtime_param.h b/common_components/base_runtime/base_runtime_param.h index 1bfa8e3b0ffc0dca0e5001d4e425604a424fd99a..89b36fb58639f4be9f47ceab5a06b2a870582940 100755 --- a/common_components/base_runtime/base_runtime_param.h +++ b/common_components/base_runtime/base_runtime_param.h @@ -19,7 +19,7 @@ #include "common_interfaces/base/common.h" #include "common_interfaces/base/runtime_param.h" -namespace panda { +namespace common { class BaseRuntimeParam { public: static RuntimeParam DefaultRuntimeParam(); @@ -88,6 +88,6 @@ private: size_t, 0, INT64_MAX, 512 * KB ) /* byte */; #endif // PANDA_TARGET_OHOS -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_BASE_RUNTIME_BASE_RUNTIME_PARAM_H diff --git a/common_components/base_runtime/hooks.h b/common_components/base_runtime/hooks.h index ce0e97a26d0677847f1c4ee26ed4b826137aad53..b76029fbad48831bb558710cd332e54575f01f81 100644 --- a/common_components/base_runtime/hooks.h +++ b/common_components/base_runtime/hooks.h @@ -23,7 +23,7 @@ // Visitor that iterate all `RefField`s in a TaggedObject and add them to // `WorkStack` Should be moved to BaseRT and panda namespace later -namespace panda { +namespace common { // Dynamic VM Roots scanning PUBLIC_API void VisitDynamicRoots(const RefFieldVisitor &visitor, bool isMark); PUBLIC_API void VisitDynamicWeakRoots(const WeakRefFieldVisitor &visitorFunc); @@ -41,5 +41,5 @@ PUBLIC_API void SweepThreadLocalJitFort(); PUBLIC_API bool IsMachineCodeObject(uintptr_t obj); PUBLIC_API void JitFortUnProt(size_t size, void* base); -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_BASE_RUNTIME_HOOKS_H diff --git a/common_components/common_runtime/src/common/base_object.h b/common_components/common/base_object.h similarity index 81% rename from common_components/common_runtime/src/common/base_object.h rename to common_components/common/base_object.h index 7849636d07153a8ad5fecba73ab0c2b8ea43248b..51b818cd584d7f1b505586a69453ab4383b850c1 100755 --- a/common_components/common_runtime/src/common/base_object.h +++ b/common_components/common/base_object.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_BASE_OBJECT_H -#define ARK_COMMON_BASE_OBJECT_H + +#ifndef COMMON_COMPONENTS_COMMON_BASE_OBJECT_H +#define COMMON_COMPONENTS_COMMON_BASE_OBJECT_H #include "common_interfaces/objects/base_object.h" -namespace panda { -using panda::BaseObject; +namespace common { +using common::BaseObject; using ObjectPtr = BaseObject*; using ObjectVisitor = std::function; @@ -28,5 +29,6 @@ struct ObjectRef { using RawRefVisitor = std::function; using RootVisitor = RawRefVisitor; using StackPtrVisitor = RawRefVisitor; -} -#endif // ARK_COMMON_BASE_OBJECT_H +} // namespace common + +#endif // COMMON_COMPONENTS_COMMON_BASE_OBJECT_H diff --git a/common_components/common_runtime/src/common/mark_work_stack.h b/common_components/common/mark_work_stack.h similarity index 96% rename from common_components/common_runtime/src/common/mark_work_stack.h rename to common_components/common/mark_work_stack.h index 2f08f22b354d756b5e0e6db96d6c4d6444e57f36..37ee3cce842199544bb1786e4a0d1a45e72f9173 100755 --- a/common_components/common_runtime/src/common/mark_work_stack.h +++ b/common_components/common/mark_work_stack.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_NEW_MARK_STACK_H -#define ARK_COMMON_NEW_MARK_STACK_H + +#ifndef COMMON_COMPONENTS_COMMON_NEW_MARK_STACK_H +#define COMMON_COMPONENTS_COMMON_NEW_MARK_STACK_H #include -#include "common_components/common_runtime/src/base/time_utils.h" +#include "common_components/base/time_utils.h" -namespace panda { +namespace common { template class MarkStackBuffer { constexpr static size_t MAX = 64; @@ -239,4 +240,4 @@ private: size_t s_ = 0; }; } -#endif // ARK_COMMON_NEW_MARK_STACK_H +#endif // COMMON_COMPONENTS_COMMON_NEW_MARK_STACK_H diff --git a/common_components/common_runtime/src/common/mem_common.h b/common_components/common/mem_common.h similarity index 95% rename from common_components/common_runtime/src/common/mem_common.h rename to common_components/common/mem_common.h index e275aaf38417067a02833fe8e32d7152b36d68e9..0c73d0a224fedc803b7ee3985a21ad4903f0a9e4 100755 --- a/common_components/common_runtime/src/common/mem_common.h +++ b/common_components/common/mem_common.h @@ -12,17 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_MEM_COMMON_H -#define ARK_COMMON_MEM_COMMON_H + +#ifndef COMMON_COMPONENTS_COMMON_MEM_COMMON_H +#define COMMON_COMPONENTS_COMMON_MEM_COMMON_H #include #include #include #include -#include "common_components/common_runtime/src/common/page_pool.h" +#include "common_components/common/page_pool.h" -namespace panda { +namespace common { using pageID = unsigned long long; // The maximum number of pages that PageCache can allocate constexpr size_t MAX_NPAGES = 129; @@ -46,7 +47,7 @@ enum AlignShift { ALIGN_8_SIFT = 3, ALIGN_16_SIFT = 4, ALIGN_128_SIFT = 7, ALIGN // Allocate memory resources from the system inline void* SystemAlloc(size_t kpage) { - return PagePool::Instance().GetPage(kpage * panda::ARK_COMMON_PAGE_SIZE); + return PagePool::Instance().GetPage(kpage * COMMON_PAGE_SIZE); } // Return a reference to the first 4 or 8 bytes of the passed-in space @@ -193,5 +194,5 @@ private: Span* head_ = new Span; std::mutex mtx_; }; -} // namespace panda +} // namespace common #endif diff --git a/common_components/common_runtime/src/common/page_allocator.h b/common_components/common/page_allocator.h similarity index 92% rename from common_components/common_runtime/src/common/page_allocator.h rename to common_components/common/page_allocator.h index a150e234c8d20e945239c7466ba2aba174fe6cdd..33d6a84bf13542c0723c47fb13b172c98992b6cb 100755 --- a/common_components/common_runtime/src/common/page_allocator.h +++ b/common_components/common/page_allocator.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_PAGEALLOCATOR_H -#define ARK_COMMON_PAGEALLOCATOR_H + +#ifndef COMMON_COMPONENTS_COMMON_PAGEALLOCATOR_H +#define COMMON_COMPONENTS_COMMON_PAGEALLOCATOR_H #include #if defined(__linux__) || defined(PANDA_TARGET_OHOS) || defined(__APPLE__) @@ -23,12 +24,12 @@ #include #include -#include "common_components/common_runtime/src/base/globals.h" -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/common/run_type.h" -#include "common_components/common_runtime/src/common/page_pool.h" +#include "common_components/base/globals.h" +#include "common_components/common/run_type.h" +#include "common_components/common/page_pool.h" +#include "common_components/log/log.h" -namespace panda { +namespace common { // when there is a need to use PageAllocator to manage // the memory for a specific data structure, please add // a new type @@ -108,7 +109,7 @@ public: explicit PageAllocator(uint16_t size) : nonFull_(nullptr), totalPages_(0), slotSize_(size) { - slotAlignment_ = panda::AlignUp(size, AllocatorUtils::ALLOC_ALIGNMENT); + slotAlignment_ = AlignUp(size, AllocatorUtils::ALLOC_ALIGNMENT); } ~PageAllocator() = default; @@ -118,7 +119,7 @@ public: void Init(uint16_t size) { slotSize_ = size; - slotAlignment_ = panda::AlignUp(size, AllocatorUtils::ALLOC_ALIGNMENT); + slotAlignment_ = AlignUp(size, AllocatorUtils::ALLOC_ALIGNMENT); } // allocation entrypoint @@ -155,7 +156,7 @@ public: void Deallocate(void* slot) { Page* current = reinterpret_cast( - panda::AlignDown(reinterpret_cast(slot), AllocatorUtils::ALLOC_PAGE_SIZE)); + AlignDown(reinterpret_cast(slot), AllocatorUtils::ALLOC_PAGE_SIZE)); std::lock_guard lockGuard(allocLock_); // Transition from full to non-full state if the current resource is unavailable. @@ -189,7 +190,7 @@ private: { page.prev_ = nullptr; page.next_ = nullptr; - constexpr uint32_t offset = panda::AlignUp(sizeof(Page), AllocatorUtils::ALLOC_ALIGNMENT); + constexpr uint32_t offset = AlignUp(sizeof(Page), AllocatorUtils::ALLOC_ALIGNMENT); page.free_ = (AllocatorUtils::ALLOC_PAGE_SIZE - offset) / slotAlignment_; page.total_ = page.free_; LOGF_CHECK(page.free_ >= 1) << "use the wrong allocator! slot size = " << slotAlignment_; @@ -282,7 +283,7 @@ public: // choose appropriate allocation to allocate void* Allocate(size_t size) { - uint32_t alignedSize = panda::AlignUp(static_cast(size), AllocatorUtils::ALLOC_ALIGNMENT); + uint32_t alignedSize = AlignUp(static_cast(size), AllocatorUtils::ALLOC_ALIGNMENT); if (alignedSize <= RUN_ALLOC_LARGE_SIZE) { uint32_t index = RUNTYPE_SIZE_TO_RUN_IDX(alignedSize); return allocator_[index].Allocate(); @@ -293,7 +294,7 @@ public: NO_INLINE_CC void Deallocate(void* p, size_t size) { - uint32_t alignedSize = panda::AlignUp(static_cast(size), AllocatorUtils::ALLOC_ALIGNMENT); + uint32_t alignedSize = AlignUp(static_cast(size), AllocatorUtils::ALLOC_ALIGNMENT); if (alignedSize <= RUN_ALLOC_LARGE_SIZE) { uint32_t index = RUNTYPE_SIZE_TO_RUN_IDX(alignedSize); allocator_[index].Deallocate(p); @@ -374,5 +375,5 @@ inline bool operator==(StdContainerAllocator&, StdContainerAllocatorpageId + i] = span; } } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/common/page_cache.h b/common_components/common/page_cache.h similarity index 90% rename from common_components/common_runtime/src/common/page_cache.h rename to common_components/common/page_cache.h index 4cbd8d5370d15e286f1528d27f9df4a686c4b757..b9b22a25b3d3dd3419d6ce729faac58bfb081894 100755 --- a/common_components/common_runtime/src/common/page_cache.h +++ b/common_components/common/page_cache.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_PAGE_CACHE_H -#define ARK_COMMON_PAGE_CACHE_H -#include "common_components/common_runtime/src/common/mem_common.h" +#ifndef COMMON_COMPONENTS_COMMON_PAGE_CACHE_H +#define COMMON_COMPONENTS_COMMON_PAGE_CACHE_H -namespace panda { +#include "common_components/common/mem_common.h" + +namespace common { class PageCache { public: // Return the singleton object of PageCache @@ -54,5 +55,5 @@ public: ~ScopedPageCacheMutex() { PageCache::GetInstance()->GetPageMutex().unlock(); } }; -} // namespace panda +} // namespace common #endif diff --git a/common_components/common_runtime/src/common/page_pool.h b/common_components/common/page_pool.h similarity index 75% rename from common_components/common_runtime/src/common/page_pool.h rename to common_components/common/page_pool.h index 2fbaa6eedbefeaba0fbffb5cc68a8247603e997b..a52061d3b934fa2e0e11bb85594cd15c4d9c50d8 100755 --- a/common_components/common_runtime/src/common/page_pool.h +++ b/common_components/common/page_pool.h @@ -25,16 +25,16 @@ #include #endif +#include "common_components/base/globals.h" +#include "common_components/base/sys_call.h" +#include "common_components/heap/allocator/treap.h" #include "common_components/platform/os.h" -#include "common_components/common_runtime/src/base/globals.h" -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/heap/allocator/treap.h" #include "securec.h" #if defined(_WIN64) || defined(__APPLE__) -#include "common_components/common_runtime/src/base/mem_utils.h" +#include "common_components/base/mem_utils.h" #endif -namespace panda { +namespace common { // a page pool maintain a pool of free pages, serve page allocation and free class PagePool { public: @@ -47,7 +47,7 @@ public: totalPageCount_ = pageCount; smallPageUsed_ = 0; usedZone_ = 0; - size_t size = static_cast(totalPageCount_) * panda::ARK_COMMON_PAGE_SIZE; + size_t size = static_cast(totalPageCount_) * COMMON_PAGE_SIZE; freePagesTree_.Init(totalPageCount_); base_ = MapMemory(size, tag_); totalSize_ = size; @@ -59,21 +59,21 @@ public: LOGE_IF(!VirtualFree(base, 0, MEM_RELEASE) << "VirtualFree failed in PagePool destruction, errno: " << GetLastError(); #else - LOGE_IF(munmap(base_, totalPageCount_ * panda::ARK_COMMON_PAGE_SIZE) != EOK) << + LOGE_IF(munmap(base_, totalPageCount_ * COMMON_PAGE_SIZE) != EOK) << "munmap failed in PagePool destruction, errno: " << errno; #endif } - uint8_t* GetPage(size_t bytes = panda::ARK_COMMON_PAGE_SIZE) + uint8_t* GetPage(size_t bytes = COMMON_PAGE_SIZE) { uint32_t idx = 0; - size_t count = (bytes + panda::ARK_COMMON_PAGE_SIZE - 1) / panda::ARK_COMMON_PAGE_SIZE; - size_t pageSize = RoundUp(bytes, panda::ARK_COMMON_PAGE_SIZE); + size_t count = (bytes + COMMON_PAGE_SIZE - 1) / COMMON_PAGE_SIZE; + size_t pageSize = RoundUp(bytes, COMMON_PAGE_SIZE); LOGF_CHECK(count < std::numeric_limits::max()) << "native memory out of memory!"; { std::lock_guard lg(freePagesMutex_); if (freePagesTree_.TakeUnits(static_cast(count), idx, false)) { - auto* ret = base_ + static_cast(idx) * panda::ARK_COMMON_PAGE_SIZE; + auto* ret = base_ + static_cast(idx) * COMMON_PAGE_SIZE; #ifdef _WIN64 LOGE_IF(UNLIKELY_CC(!VirtualAlloc(ret, pageSize, MEM_COMMIT, PAGE_READWRITE))) << "VirtualAlloc commit failed in GetPage, errno: " << GetLastError(); @@ -93,31 +93,31 @@ public: return MapMemory(pageSize, tag_, true); } - void ReturnPage(uint8_t* page, size_t bytes = panda::ARK_COMMON_PAGE_SIZE) noexcept + void ReturnPage(uint8_t* page, size_t bytes = COMMON_PAGE_SIZE) noexcept { uint8_t* end = base_ + totalSize_; - size_t num = (bytes + panda::ARK_COMMON_PAGE_SIZE - 1) / panda::ARK_COMMON_PAGE_SIZE; + size_t num = (bytes + COMMON_PAGE_SIZE - 1) / COMMON_PAGE_SIZE; if (page < base_ || page >= end) { #ifdef _WIN64 LOGE_IF(UNLIKELY_CC(!VirtualFree(page, 0, MEM_RELEASE))) << - "VirtualFree failed in ReturnPage, errno: " << GetLastError(); + "VirtualFree failed in ReturnPage, errno: " << GetLastError(); #else - LOGE_IF(UNLIKELY_CC(munmap(page, num * panda::ARK_COMMON_PAGE_SIZE) != EOK)) << + LOGE_IF(UNLIKELY_CC(munmap(page, num * COMMON_PAGE_SIZE) != EOK)) << "munmap failed in ReturnPage, errno: " << errno; #endif return; } LOGF_CHECK(num < std::numeric_limits::max()) << "native memory out of memory!"; - uint32_t idx = static_cast((page - base_) / panda::ARK_COMMON_PAGE_SIZE); + uint32_t idx = static_cast((page - base_) / COMMON_PAGE_SIZE); #if defined(_WIN64) - LOGE_IF(UNLIKELY_CC(!VirtualFree(page, num * panda::ARK_COMMON_PAGE_SIZE, MEM_DECOMMIT))) << + LOGE_IF(UNLIKELY_CC(!VirtualFree(page, num * COMMON_PAGE_SIZE, MEM_DECOMMIT))) << "VirtualFree failed in ReturnPage, errno: " << GetLastError(); #elif defined(__APPLE__) - panda::MemorySet(reinterpret_cast(page), num * panda::ARK_COMMON_PAGE_SIZE, 0, - num * panda::ARK_COMMON_PAGE_SIZE); - (void)madvise(page, num * panda::ARK_COMMON_PAGE_SIZE, MADV_DONTNEED); + MemorySet(reinterpret_cast(page), num * COMMON_PAGE_SIZE, 0, + num * COMMON_PAGE_SIZE); + (void)madvise(page, num * COMMON_PAGE_SIZE, MADV_DONTNEED); #else - (void)madvise(page, num * panda::ARK_COMMON_PAGE_SIZE, MADV_DONTNEED); + (void)madvise(page, num * COMMON_PAGE_SIZE, MADV_DONTNEED); #endif std::lock_guard lg(freePagesMutex_); LOGF_CHECK(freePagesTree_.MergeInsert(idx, static_cast(num), false)) << @@ -150,7 +150,7 @@ protected: #endif #if defined(__linux__) || defined(PANDA_TARGET_OHOS) - ARK_COMMON_PRCTL(result, size, memName); + COMMON_PRCTL(result, size, memName); #endif os::PrctlSetVMA(result, size, (std::string("ARKTS_CMC_GC_PAGE_POOL_") + memName).c_str()); return reinterpret_cast(result); @@ -167,5 +167,5 @@ private: std::atomic smallPageUsed_ = { 0 }; uint32_t totalPageCount_ = 0; }; -} // namespace panda +} // namespace common #endif // ARK_COMM_RUNTIME_ALLOCATOR_PAGE_POOL_H diff --git a/common_components/common_runtime/src/common/run_type.cpp b/common_components/common/run_type.cpp similarity index 98% rename from common_components/common_runtime/src/common/run_type.cpp rename to common_components/common/run_type.cpp index baf602a9d0ccfea147daa3b16bf77aa9a505c250..a48b7e1e34d746b792d69af4884922fffec8d5d4 100755 --- a/common_components/common_runtime/src/common/run_type.cpp +++ b/common_components/common/run_type.cpp @@ -12,9 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/common/run_type.h" +#include "common_components/common/run_type.h" -namespace panda { +namespace common { // REMEMBER TO CHANGE NUM_OF_RUN_TYPES WHEN YOU ADD/REMOVE CONFIGS // this stores a config for each kind of run (represented by an index) const RunType RunType::TYPES[NUM_OF_RUN_TYPES] = { @@ -125,4 +125,4 @@ void RunType::InitRunTypeMap() ASSERT_LOGF(RUNTYPE_SIZE_TO_RUN_IDX(RUN_ALLOC_LARGE_SIZE) + 1 == RunType::NUM_OF_RUN_TYPES, "run config inconsistent: large size"); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/common/run_type.h b/common_components/common/run_type.h similarity index 93% rename from common_components/common_runtime/src/common/run_type.h rename to common_components/common/run_type.h index 2da219c7bf70074d3c1caf3bf150f5653a89165c..a1153ccdc185f538f2415ab3134ffec393219bb6 100755 --- a/common_components/common_runtime/src/common/run_type.h +++ b/common_components/common/run_type.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_RUN_TYPE_H -#define ARK_COMMON_RUN_TYPE_H + +#ifndef COMMON_COMPONENTS_COMMON_RUN_TYPE_H +#define COMMON_COMPONENTS_COMMON_RUN_TYPE_H #include "common_components/log/log.h" -namespace panda { +namespace common { // slot with size no more than RUN_ALLOC_SMALL_SIZE is small slot. // small slot is allocated from cache run in thread-local buffer first. // slot with size (RUN_ALLOC_SMALL_SIZE, RUN_ALLOC_LARGE_SIZE] is allocated from global buffer. @@ -62,6 +63,6 @@ public: #define RUNTYPE_RUN_IDX_TO_SIZE(idx) (RunType::TYPES[(idx)].size) constexpr int DEFAULT_PAGE_PER_RUN = 1; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_RUN_TYPE_H +#endif // COMMON_COMPONENTS_COMMON_RUN_TYPE_H diff --git a/common_components/common_runtime/src/common/scoped_object_access.h b/common_components/common/scoped_object_access.h similarity index 88% rename from common_components/common_runtime/src/common/scoped_object_access.h rename to common_components/common/scoped_object_access.h index 970f3f7a7f8249cff0214116b80e662d03dccb72..3f4fa0b4cd44f2b52b6b7289b95e8e1ff45a6602 100755 --- a/common_components/common_runtime/src/common/scoped_object_access.h +++ b/common_components/common/scoped_object_access.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_SCOPED_SAFEREGION_H -#define ARK_COMMON_SCOPED_SAFEREGION_H -#include "common_components/common_runtime/src/mutator/mutator.inline.h" +#ifndef COMMON_COMPONENTS_COMMON_SCOPED_SAFEREGION_H +#define COMMON_COMPONENTS_COMMON_SCOPED_SAFEREGION_H -namespace panda { +#include "common_components/mutator/mutator.inline.h" + +namespace common { // Scoped guard for saferegion. class ScopedEnterSaferegion { public: @@ -63,6 +64,6 @@ private: Mutator& mutator; bool leavedSafeRegion; }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_SCOPED_SAFEREGION_H +#endif // COMMON_COMPONENTS_COMMON_SCOPED_SAFEREGION_H diff --git a/common_components/common_runtime/src/common/scoped_object_lock.h b/common_components/common/scoped_object_lock.h similarity index 65% rename from common_components/common_runtime/src/common/scoped_object_lock.h rename to common_components/common/scoped_object_lock.h index 833daa9e50e9efbcc5af91bd2bc63d84718c4037..677fa42e6add658808ee51c9e15dd98beb0d2eff 100755 --- a/common_components/common_runtime/src/common/scoped_object_lock.h +++ b/common_components/common/scoped_object_lock.h @@ -12,27 +12,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_SCOPED_LOCK_OBJECT_H -#define ARK_COMMON_SCOPED_LOCK_OBJECT_H -#include "common_components/common_runtime/src/common/base_object.h" + +#ifndef COMMON_COMPONENTS_COMMON_SCOPED_LOCK_OBJECT_H +#define COMMON_COMPONENTS_COMMON_SCOPED_LOCK_OBJECT_H + +#include "common_components/common/base_object.h" #include "common_components/log/log.h" -namespace panda { +namespace common { class ScopedObjectLock { public: NO_INLINE_CC explicit ScopedObjectLock(BaseObject& obj) { do { - panda::BaseStateWord::ForwardState state = obj.GetBaseStateWord().GetForwardState(); - if (state == panda::BaseStateWord::ForwardState::FORWARDING || - state == panda::BaseStateWord::ForwardState::FORWARDED || - state == panda::BaseStateWord::ForwardState::NORMAL) { + BaseStateWord::ForwardState state = obj.GetBaseStateWord().GetForwardState(); + if (state == BaseStateWord::ForwardState::FORWARDING || + state == BaseStateWord::ForwardState::FORWARDED || + state == BaseStateWord::ForwardState::NORMAL) { lockedObj_ = &obj; } else { LOG_COMMON(FATAL) << "this state need to be dealt with when lock object, state: " << static_cast(state); return; } - panda::BaseStateWord curState = lockedObj_->GetBaseStateWord(); + BaseStateWord curState = lockedObj_->GetBaseStateWord(); if (lockedObj_->TryLockExclusive(curState)) { return; } @@ -41,11 +43,11 @@ public: ~ScopedObjectLock() { LOGF_CHECK(lockedObj_ != nullptr) << "from copy is nullptr when unlock object\n"; - lockedObj_->UnlockExclusive(panda::BaseStateWord::ForwardState::NORMAL); + lockedObj_->UnlockExclusive(BaseStateWord::ForwardState::NORMAL); } private: BaseObject* lockedObj_ = { nullptr }; }; -} // namespace panda -#endif // ~ARK_COMMON_SCOPED_LOCK_OBJECT_H +} // namespace common +#endif // ~COMMON_COMPONENTS_COMMON_SCOPED_LOCK_OBJECT_H diff --git a/common_components/common_runtime/src/common/type_def.h b/common_components/common/type_def.h similarity index 87% rename from common_components/common_runtime/src/common/type_def.h rename to common_components/common/type_def.h index 08992ee4e2ac8fc11a03d97262c272792096c47b..53f024ceef4abc70e9e037789298b41f1857e5e7 100755 --- a/common_components/common_runtime/src/common/type_def.h +++ b/common_components/common/type_def.h @@ -12,15 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_TYPE_DEF_H -#define ARK_COMMON_TYPE_DEF_H + +#ifndef COMMON_COMPONENTS_COMMON_TYPE_DEF_H +#define COMMON_COMPONENTS_COMMON_TYPE_DEF_H #include #include #include #ifdef USE_CMC_GC -namespace panda { +namespace common { class BaseObject; } #endif @@ -28,14 +29,14 @@ class BaseObject; // commonly agreed type interfaces for a managed runtime: // they're opaque across modules, but we still want it provides a degree // of type safety. -namespace panda { +namespace common { // Those are mostly managed pointer types for GC using HeapAddress = uintptr_t; // Managed address constexpr uintptr_t NULL_ADDRESS = 0; // object model related types #ifdef USE_CMC_GC -using panda::BaseObject; +using common::BaseObject; #else class BaseObject; #endif @@ -52,6 +53,6 @@ enum class AllocType { RAW_POINTER_OBJECT, READ_ONLY_OBJECT, }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_TYPE_DEF_H +#endif // COMMON_COMPONENTS_COMMON_TYPE_DEF_H diff --git a/common_components/common_runtime/src/base/log_file.cpp b/common_components/common_runtime/src/base/log_file.cpp old mode 100755 new mode 100644 index 767debd5cff0840755997963e238a219d6966a0d..a64eca43557c46d5dbf7834f971149bbb596fb3d --- a/common_components/common_runtime/src/base/log_file.cpp +++ b/common_components/common_runtime/src/base/log_file.cpp @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "common_components/common_runtime/src/base/log_file.h" #include -#include "common_components/common_runtime/src/base/sys_call.h" +#include "common_components/base/sys_call.h" #include "securec.h" -namespace panda { +namespace common { LogFile::LogFileItem LogFile::logFile_[LOG_TYPE_NUMBER]; const char* LOG_TYPE_NAMES[LOG_TYPE_NUMBER] = { @@ -86,13 +87,13 @@ void LogFile::SetFlags() #ifndef NDEBUG void LogFile::OpenLogFiles() { - CString pid = CString(panda::GetPid()); + CString pid = CString(GetPid()); CString dateDigit = ""; CString dirName = "."; for (int i = 0; i < LOG_TYPE_NUMBER; ++i) { if (logFile_[i].enableLog) { - if (panda::GetEnv("ARK_LOG_STDOUT", 0) == 1) { + if (GetEnv("ARK_LOG_STDOUT", 0) == 1) { logFile_[i].file = fopen("/dev/stdout", "w"); if (logFile_[i].file == nullptr) { LOG_COMMON(ERROR) << "LogFile::OpenLogFiles(): fail to set file /dev/stdout"; @@ -142,7 +143,7 @@ static void WriteLogImpl(bool addPrefix, LogType type, const char* format, va_li } int index = 0; if (addPrefix) { - index = sprintf_s(buf, sizeof(buf), "%s %d ", TimeUtil::GetTimestamp().Str(), panda::GetTid()); + index = sprintf_s(buf, sizeof(buf), "%s %d ", TimeUtil::GetTimestamp().Str(), GetTid()); if (index == -1) { LOG_COMMON(ERROR) << "WriteLogImpl sprintf_s failed. msg: " << strerror(errno); return; @@ -304,4 +305,4 @@ Level InitLogLevel() } return Level::ERROR; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/base/log_file.h b/common_components/common_runtime/src/base/log_file.h index 3bfaacc18b8370dbba759ca52e3bbc95da952bdc..f396c5e1080fcef68f7c5fb5d4ab695a16a0c329 100755 --- a/common_components/common_runtime/src/base/log_file.h +++ b/common_components/common_runtime/src/base/log_file.h @@ -12,15 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef ARK_COMMON_LOG_FILE_H #define ARK_COMMON_LOG_FILE_H #include -#include "common_components/common_runtime/src/base/time_utils.h" +#include "common_components/base/time_utils.h" -namespace panda { +namespace common { enum LogType { // for overall brief report REPORT = 0, @@ -278,5 +279,5 @@ private: uint64_t startTime_ = 0; LogType logType_; }; -} // namespace panda +} // namespace common #endif // ARK_COMMON_LOG_FILE_H diff --git a/common_components/common_runtime/src/inspector/heap_data.cpp b/common_components/common_runtime/src/inspector/heap_data.cpp index ff4c4e839bf627fd91fa19c46e3e2cf74720e391..b156abf39a47213b3358fd56f0eb49752cec0933 100755 --- a/common_components/common_runtime/src/inspector/heap_data.cpp +++ b/common_components/common_runtime/src/inspector/heap_data.cpp @@ -57,7 +57,7 @@ void ArkHeapData::DumpHeap() if (dumpAfterOOM && !g_oomIsTrigged) { g_oomIsTrigged = true; specifiedPath = ""; - auto pid = panda::GetPid(); + auto pid = GetPid(); CString dumpFile = CString("ark_OOM_pid") + CString(pid) + CString(".dat"); #if defined(_WIN64) const char* separator = "\\"; diff --git a/common_components/common_runtime/src/log_manager.h b/common_components/common_runtime/src/log_manager.h deleted file mode 100755 index 4fbe99c0332cd2654226cc7da890fd8607edef58..0000000000000000000000000000000000000000 --- a/common_components/common_runtime/src/log_manager.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2025 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 ARK_COMMON_LOG_MANAGER_H -#define ARK_COMMON_LOG_MANAGER_H - -namespace panda { -// manager of logging and tracing facility -class LogManager { -public: - LogManager(); - ~LogManager() = default; - - // Runtime module interfaces - void Init(); - void Fini(); -}; -} // namespace panda - -#endif // ARK_COMMON_LOG_MANAGER_H diff --git a/common_components/common_runtime/src/heap/allocator/alloc_buffer.h b/common_components/heap/allocator/alloc_buffer.h similarity index 92% rename from common_components/common_runtime/src/heap/allocator/alloc_buffer.h rename to common_components/heap/allocator/alloc_buffer.h index 3c51cfdccf2891b216895b0c8c6c6f44768d306b..aa442ec51a115014972c0619bd3d2694c04427b2 100755 --- a/common_components/common_runtime/src/heap/allocator/alloc_buffer.h +++ b/common_components/heap/allocator/alloc_buffer.h @@ -12,15 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ALLOC_BUFFER_H -#define ARK_COMMON_ALLOC_BUFFER_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOC_BUFFER_H +#define COMMON_COMPONENTS_HEAP_ALLOC_BUFFER_H #include -#include "common_components/common_runtime/src/heap/allocator/region_list.h" -#include "common_components/common_runtime/src/common/mark_work_stack.h" +#include "common_components/heap/allocator/region_list.h" +#include "common_components/common/mark_work_stack.h" -namespace panda { +namespace common { // thread-local data structure class AllocationBuffer { public: @@ -98,6 +99,6 @@ private: }; static_assert(AllocationBuffer::GetTLRegionOffset() == 0); +} // namespace common -} // namespace panda -#endif // ~ARK_COMMON_ALLOC_BUFFER_H +#endif // COMMON_COMPONENTS_HEAP_ALLOC_BUFFER_H diff --git a/common_components/common_runtime/src/heap/allocator/alloc_buffer_manager.h b/common_components/heap/allocator/alloc_buffer_manager.h similarity index 82% rename from common_components/common_runtime/src/heap/allocator/alloc_buffer_manager.h rename to common_components/heap/allocator/alloc_buffer_manager.h index ce4613f0e3a039d97d00e73538841bc3c8557762..129ba158d859be1665f037c5dd98a0b8f01c9bbd 100755 --- a/common_components/common_runtime/src/heap/allocator/alloc_buffer_manager.h +++ b/common_components/heap/allocator/alloc_buffer_manager.h @@ -12,17 +12,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ALLOC_BUFFER_MANAGER -#define ARK_COMMON_ALLOC_BUFFER_MANAGER + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_BUFFER_MANAGER +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_BUFFER_MANAGER + #include #include #include -#include "common_components/common_runtime/src/heap/allocator/alloc_buffer.h" -#include "common_components/common_runtime/src/base/atomic_spin_lock.h" -#include "common_components/common_runtime/src/common/page_allocator.h" -#include "common_components/common_runtime/src/common/run_type.h" -namespace panda { +#include "common_components/heap/allocator/alloc_buffer.h" +#include "common_components/base/atomic_spin_lock.h" +#include "common_components/common/page_allocator.h" +#include "common_components/common/run_type.h" +namespace common { using AllocBufferVisitor = std::function; class AllocBufferManager { public: @@ -73,5 +75,5 @@ private: std::mutex hungryBuffersLock_; AtomicSpinLock allocBufferLock_; }; -} // namespace panda -#endif // ~ARK_COMMON_ALLOC_BUFFER_MANAGER +} // namespace common +#endif // ~COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_BUFFER_MANAGER diff --git a/common_components/common_runtime/src/heap/allocator/alloc_util.h b/common_components/heap/allocator/alloc_util.h similarity index 88% rename from common_components/common_runtime/src/heap/allocator/alloc_util.h rename to common_components/heap/allocator/alloc_util.h index 687ce9701447a24fcb7fc75de1b62c2a6f644677..291e13b9c88c44de551bddfabcbd0acff5f58269 100755 --- a/common_components/common_runtime/src/heap/allocator/alloc_util.h +++ b/common_components/heap/allocator/alloc_util.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ALLOC_UTILS_H -#define ARK_COMMON_ALLOC_UTILS_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_UTILS_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_UTILS_H #include #include -namespace panda { +namespace common { constexpr uint32_t ALLOC_UTIL_PAGE_SIZE = 4096; #define ALLOCUTIL_PAGE_RND_UP(x) \ (((static_cast(x)) + ALLOC_UTIL_PAGE_SIZE - 1) & (~(ALLOC_UTIL_PAGE_SIZE - 1))) @@ -49,6 +50,6 @@ constexpr T AllocUtilRndUp(T x, size_t n) return AllocUtilRndDown(x + n - 1, n); } -} // namespace panda +} // namespace common -#endif // ARK_COMMON_ALLOC_UTILS_H +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_UTILS_H diff --git a/common_components/common_runtime/src/heap/allocator/allocator.cpp b/common_components/heap/allocator/allocator.cpp similarity index 85% rename from common_components/common_runtime/src/heap/allocator/allocator.cpp rename to common_components/heap/allocator/allocator.cpp index 9a99c64fc0bc70578d7238e9c58cab09f0c71370..2b57eaf6ea7f130905754f6064138b594b831b21 100755 --- a/common_components/common_runtime/src/heap/allocator/allocator.cpp +++ b/common_components/heap/allocator/allocator.cpp @@ -12,17 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/allocator/allocator.h" +#include "common_components/heap/allocator/allocator.h" #include #include -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/common/base_object.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/mutator/thread_local.h" +#include "common_components/base/immortal_wrapper.h" +#include "common_components/common/base_object.h" +#include "common_components/heap/allocator/region_space.h" +#include "common_components/mutator/thread_local.h" -namespace panda { +namespace common { using namespace std; Allocator::Allocator() { @@ -84,4 +84,4 @@ Allocator* Allocator::CreateAllocator() LOGF_CHECK(regionSpace != nullptr) << "New RegionSpace failed"; return regionSpace; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/allocator/allocator.h b/common_components/heap/allocator/allocator.h similarity index 92% rename from common_components/common_runtime/src/heap/allocator/allocator.h rename to common_components/heap/allocator/allocator.h index 9c905beb20889d7193a60f125ebf7584cd937c6e..330c7b036573f23526c486871937365576f21b43 100755 --- a/common_components/common_runtime/src/heap/allocator/allocator.h +++ b/common_components/heap/allocator/allocator.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ALLOCATOR_H -#define ARK_COMMON_ALLOCATOR_H -#include "common_components/common_runtime/src/heap/allocator/alloc_buffer_manager.h" -#include "common_components/common_runtime/src/heap/heap.h" +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOCATOR_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOCATOR_H -namespace panda { +#include "common_components/heap/allocator/alloc_buffer_manager.h" +#include "common_components/heap/heap.h" + +namespace common { // Allocator abstract class class Allocator { public: @@ -82,6 +83,6 @@ private: bool InitAyncAllocation(); bool asyncAllocationInitSwitch_ = true; }; -} // namespace panda +} // namespace common #endif diff --git a/common_components/common_runtime/src/heap/allocator/free_region_manager.h b/common_components/heap/allocator/free_region_manager.h similarity index 93% rename from common_components/common_runtime/src/heap/allocator/free_region_manager.h rename to common_components/heap/allocator/free_region_manager.h index 29a2559795da8bee50c95c2bcfb4156d740fac99..3225176ceacf916b1b13780ffe18ba27980b61dd 100755 --- a/common_components/common_runtime/src/heap/allocator/free_region_manager.h +++ b/common_components/heap/allocator/free_region_manager.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_FREE_REGION_MANAGER_H -#define ARK_COMMON_FREE_REGION_MANAGER_H -#include "common_components/common_runtime/src/heap/allocator/treap.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" -#include "common_components/common_runtime/src/common/scoped_object_access.h" +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_FREE_REGION_MANAGER_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_FREE_REGION_MANAGER_H -namespace panda { +#include "common_components/heap/allocator/treap.h" +#include "common_components/heap/allocator/region_desc.h" +#include "common_components/common/scoped_object_access.h" + +namespace common { class RegionManager; // This class is and should be accessed only for region allocation. we do not rely on it to check region status. @@ -136,5 +137,5 @@ private: std::mutex dirtyUnitTreeMutex_; Treap dirtyUnitTree_; }; -} // namespace panda -#endif // ARK_COMMON_FREE_REGION_MANAGER_H +} // namespace common +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_FREE_REGION_MANAGER_H diff --git a/common_components/common_runtime/src/heap/allocator/local_deque.h b/common_components/heap/allocator/local_deque.h similarity index 96% rename from common_components/common_runtime/src/heap/allocator/local_deque.h rename to common_components/heap/allocator/local_deque.h index 373a3bfdf12fe1ce613d0265c0ad3f9cbd8deead..afe07d276ee09fc4b105b8bf1ad483daaefa000f 100755 --- a/common_components/common_runtime/src/heap/allocator/local_deque.h +++ b/common_components/heap/allocator/local_deque.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ROSALLOC_DEQUE_H -#define ARK_COMMON_ROSALLOC_DEQUE_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_ROSALLOC_DEQUE_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_ROSALLOC_DEQUE_H #include #include -#include "common_components/common_runtime/src/heap/allocator/memory_map.h" +#include "common_components/heap/allocator/memory_map.h" #include "common_components/log/log.h" #define DEBUG_DEQUE false @@ -28,7 +29,7 @@ #define DEQUE_ASSERT(cond, msg) (void(0)) #endif -namespace panda { +namespace common { // Designed for single-use, single-purpose operations // Supports both queue-like and stack-like operations // Memory is efficiently cleared in O(1) time by simply resetting pointers @@ -237,6 +238,6 @@ private: HeapAddress endAddr_ = 0; MemoryMap* memMap_ = nullptr; }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_ROSALLOC_DEQUE_H +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_ROSALLOC_DEQUE_H diff --git a/common_components/common_runtime/src/heap/allocator/memory_map.cpp b/common_components/heap/allocator/memory_map.cpp similarity index 95% rename from common_components/common_runtime/src/heap/allocator/memory_map.cpp rename to common_components/heap/allocator/memory_map.cpp index feb7c4618866673f5043deec9361b7271762101c..e8bec46cbe5de6e5d7b009f7001ae93297a9cf68 100755 --- a/common_components/common_runtime/src/heap/allocator/memory_map.cpp +++ b/common_components/heap/allocator/memory_map.cpp @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/allocator/memory_map.h" +#include "common_components/heap/allocator/memory_map.h" #include #include "base/globals.h" @@ -24,11 +24,12 @@ #include "common_components/platform/os.h" #include "common_components/base_runtime/hooks.h" -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/base/sys_call.h" +#include "common_components/base/sys_call.h" #include "common_components/log/log.h" -namespace panda { +#include "securec.h" + +namespace common { using namespace std; // not thread safe, do not call from multiple threads @@ -55,7 +56,7 @@ MemoryMap* MemoryMap::MapMemory(size_t reqSize, size_t initSize, const Option& o #else if (mappedAddr != MAP_FAILED) { (void)madvise(mappedAddr, reqSize, MADV_NOHUGEPAGE); - ARK_COMMON_PRCTL(mappedAddr, reqSize, opt.tag); + COMMON_PRCTL(mappedAddr, reqSize, opt.tag); #endif // if protAll, all memory is protected at creation, and we never change it (save time) size_t protSize = opt.protAll ? reqSize : initSize; @@ -138,7 +139,7 @@ MemoryMap* MemoryMap::MapMemoryAlignInner4G(size_t reqSize, size_t initSize, con #else if (mappedAddr != MAP_FAILED) { (void)madvise(mappedAddr, reqSize, MADV_NOHUGEPAGE); - ARK_COMMON_PRCTL(mappedAddr, reqSize, opt.tag); + COMMON_PRCTL(mappedAddr, reqSize, opt.tag); #endif // if protAll, all memory is protected at creation, and we never change it (save time) size_t protSize = opt.protAll ? reqSize : initSize; @@ -192,4 +193,4 @@ MemoryMap::~MemoryMap() memCurrEndAddr_ = nullptr; memMappedEndAddr_ = nullptr; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/allocator/memory_map.h b/common_components/heap/allocator/memory_map.h similarity index 91% rename from common_components/common_runtime/src/heap/allocator/memory_map.h rename to common_components/heap/allocator/memory_map.h index ad039cb64826b8497980dc4c038295399a1def8b..40500d4c67cd7b5004e21fbf554175fcd61f484f 100755 --- a/common_components/common_runtime/src/heap/allocator/memory_map.h +++ b/common_components/heap/allocator/memory_map.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ALLOC_MEM_MAP_H -#define ARK_COMMON_ALLOC_MEM_MAP_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_MEM_MAP_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_MEM_MAP_H #include "common_interfaces/base/common.h" #ifdef _WIN64 @@ -22,10 +23,10 @@ #else #include #endif -#include "common_components/common_runtime/src/heap/allocator/alloc_util.h" -#include "common_components/common_runtime/src/common/type_def.h" +#include "common_components/heap/allocator/alloc_util.h" +#include "common_components/common/type_def.h" -namespace panda { +namespace common { class MemoryMap { public: #ifdef _WIN64 @@ -95,5 +96,6 @@ private: // MemoryMap is created via factory method MemoryMap(void* baseAddr, size_t initSize, size_t mappedSize); }; // class MemoryMap -} // namespace panda -#endif // ARK_COMMON_ALLOC_MEM_MAP_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_ALLOC_MEM_MAP_H diff --git a/common_components/common_runtime/src/heap/allocator/region_desc.h b/common_components/heap/allocator/region_desc.h similarity index 96% rename from common_components/common_runtime/src/heap/allocator/region_desc.h rename to common_components/heap/allocator/region_desc.h index da00f39f107dca107f0fce331935034ed0d2258e..7537f0a33e53543fa09e2302009d9566ae331d99 100755 --- a/common_components/common_runtime/src/heap/allocator/region_desc.h +++ b/common_components/heap/allocator/region_desc.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_REGION_INFO_H -#define ARK_COMMON_REGION_INFO_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_INFO_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_INFO_H #include #include @@ -30,19 +31,19 @@ #else #include #endif -#include "common_components/common_runtime/src/base/globals.h" -#include "common_components/common_runtime/src/base/mem_utils.h" -#include "common_components/common_runtime/src/base/rw_lock.h" -#include "common_components/common_runtime/src/heap/collector/copy_data_manager.h" -#include "common_components/common_runtime/src/heap/collector/gc_infos.h" -#include "common_components/common_runtime/src/heap/collector/region_bitmap.h" +#include "common_components/base/globals.h" +#include "common_components/base/mem_utils.h" +#include "common_components/base/rw_lock.h" +#include "common_components/heap/collector/copy_data_manager.h" +#include "common_components/heap/collector/gc_infos.h" +#include "common_components/heap/collector/region_bitmap.h" #include "common_components/log/log.h" #include "securec.h" -#ifdef ARKCOMMON_ASAN_SUPPORT -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#ifdef COMMON_ASAN_SUPPORT +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { template class BitFields { public: @@ -165,7 +166,7 @@ public: return liveInfo; } liveInfo = AllocLiveInfo(liveInfo); - if(liveInfo != nullptr) { + if (liveInfo != nullptr) { return liveInfo; } } while (true); @@ -459,7 +460,7 @@ public: static RegionDesc* GetRegionDesc(uint32_t idx) { UnitInfo* unit = RegionDesc::UnitInfo::GetUnitInfo(idx); - ASSERT(((uintptr_t)unit % 8 == 0)); + DCHECK_CC((reinterpret_cast(unit) % 8) == 0); // 8: Align with 8 if (static_cast(unit->GetMetadata().unitRole) == UnitRole::SUBORDINATE_UNIT) { return unit->GetMetadata().ownerRegion; } else { @@ -472,7 +473,7 @@ public: UnitInfo* unit = reinterpret_cast(UnitInfo::heapStartAddress - (((allocAddr - UnitInfo::heapStartAddress) / UNIT_SIZE) + 1) * sizeof(RegionDesc)); - ASSERT(((uintptr_t)unit % 8 == 0)); + DCHECK_CC((reinterpret_cast(unit) % 8) == 0); // 8: Align with 8 if (static_cast(unit->GetMetadata().unitRole) == UnitRole::SUBORDINATE_UNIT) { return unit->GetMetadata().ownerRegion; } else { @@ -507,7 +508,7 @@ public: size_t size = cnt * RegionDesc::UNIT_SIZE; DLOG(REGION, "clear dirty units[%zu+%zu, %zu) @[%#zx+%zu, %#zx)", idx, cnt, idx + cnt, unitAddress, size, RegionDesc::GetUnitAddress(idx + cnt)); - panda::MemorySet(unitAddress, size, 0, size); + MemorySet(unitAddress, size, 0, size); } static void ReleaseUnits(size_t idx, size_t cnt) @@ -526,14 +527,14 @@ public: #else (void)madvise(unitAddress, size, MADV_DONTNEED); #endif -#ifdef ARKCOMMON_ASAN_SUPPORT +#ifdef COMMON_ASAN_SUPPORT Sanitizer::OnHeapMadvise(unitAddress, size); #endif #ifdef ARK_ASAN_ON ASAN_POISON_MEMORY_REGION(unitAddress, size); - const uintptr_t p_size = size; - LOG_COMMON(DEBUG) << std::hex << "set [" << unitAddress; - LOG_COMMON(DEBUG) << std::hex << ", " << (uintptr_t)unitAddress + p_size << ") unaddressable\n"; + const uintptr_t pSize = size; + LOG_COMMON(DEBUG) << std::hex << "set [" << unitAddress << ", " << + (reinterpret_cast(unitAddress) + pSize) << ") unaddressable\n"; #endif } @@ -806,7 +807,10 @@ public: // copyable during concurrent copying gc. bool IsSmallRegion() const { return static_cast(metadata.unitRole) == UnitRole::SMALL_SIZED_UNITS; } - ALWAYS_INLINE bool IsLargeRegion() const { return static_cast(metadata.unitRole) == UnitRole::LARGE_SIZED_UNITS; } + ALWAYS_INLINE bool IsLargeRegion() const + { + return static_cast(metadata.unitRole) == UnitRole::LARGE_SIZED_UNITS; + } bool IsFixedRegion() const { @@ -1089,7 +1093,7 @@ private: static size_t GetUnitIdx(const UnitInfo* unit) { uintptr_t ptr = reinterpret_cast(unit); - ASSERT(unitInfoStart <= ptr && ptr < heapStartAddress); + DCHECK_CC(unitInfoStart <= ptr && ptr < heapStartAddress); return ((heapStartAddress - ptr) / sizeof(UnitInfo)) - 1; } @@ -1162,10 +1166,10 @@ private: __atomic_store_n(&metadata.rawPointerObjectCount, 0, __ATOMIC_SEQ_CST); #ifdef ARK_ASAN_ON ASAN_UNPOISON_MEMORY_REGION(metadata.allocPtr, nUnit * RegionDesc::UNIT_SIZE); - uintptr_t p_addr = metadata.allocPtr; - uintptr_t p_size = nUnit * RegionDesc::UNIT_SIZE; - LOG_COMMON(DEBUG) << std::hex << "set [" << p_addr; - LOG_COMMON(DEBUG) << std::hex << ", " << p_addr + p_size << ") unaddressable\n"; + uintptr_t pAddr = metadata.allocPtr; + uintptr_t pSize = nUnit * RegionDesc::UNIT_SIZE; + LOG_COMMON(DEBUG) << std::hex << "set [" << pAddr; + LOG_COMMON(DEBUG) << std::hex << ", " << (pAddr + pSize) << ") unaddressable\n"; #endif } @@ -1183,5 +1187,6 @@ private: static constexpr uint32_t NULLPTR_IDX = UnitInfo::INVALID_IDX; UnitMetadata metadata; }; -} // namespace panda -#endif // ARK_COMMON_REGION_INFO_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_INFO_H diff --git a/common_components/common_runtime/src/heap/allocator/region_list.h b/common_components/heap/allocator/region_list.h similarity index 95% rename from common_components/common_runtime/src/heap/allocator/region_list.h rename to common_components/heap/allocator/region_list.h index e9bcb31f8205852dcb6ee6f16f98c02d47d4bc0c..ad4e7c609a328cb07c3f84abf20131e65806a646 100755 --- a/common_components/common_runtime/src/heap/allocator/region_list.h +++ b/common_components/heap/allocator/region_list.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_REGION_LIST_H -#define ARK_COMMON_REGION_LIST_H -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" -#include "common_components/common_runtime/src/heap/allocator/slot_list.h" +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_LIST_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_LIST_H -namespace panda { +#include "common_components/heap/allocator/region_desc.h" +#include "common_components/heap/allocator/slot_list.h" + +namespace common { class RegionList { public: RegionList(const char* name) : listName_(name) {} @@ -235,5 +236,5 @@ public: private: bool active_ = false; }; -} // namespace panda -#endif // ARK_COMMON_REGION_LIST_H +} // namespace common +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_LIST_H diff --git a/common_components/common_runtime/src/heap/allocator/region_manager.cpp b/common_components/heap/allocator/region_manager.cpp similarity index 97% rename from common_components/common_runtime/src/heap/allocator/region_manager.cpp rename to common_components/heap/allocator/region_manager.cpp index b2444474050a3d1428305e060d4ff7a988a42478..ada697c470225bb972d756e2adce0b7e75ffe99e 100755 --- a/common_components/common_runtime/src/heap/allocator/region_manager.cpp +++ b/common_components/heap/allocator/region_manager.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/heap/allocator/region_manager.h" +#include "common_components/heap/allocator/region_manager.h" #include #include @@ -21,25 +21,25 @@ #include #include "common_components/base_runtime/hooks.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/base/c_string.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/collector/trace_collector.h" -#include "common_components/common_runtime/src/common/base_object.h" -#include "common_components/common_runtime/src/common/scoped_object_access.h" -#include "common_components/common_runtime/src/heap/heap.h" -#include "common_components/common_runtime/src/mutator/mutator.inline.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" - -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/heap/allocator/region_desc.h" +#include "common_components/heap/allocator/region_space.h" +#include "common_components/base/c_string.h" +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/collector/trace_collector.h" +#include "common_components/common/base_object.h" +#include "common_components/common/scoped_object_access.h" +#include "common_components/heap/heap.h" +#include "common_components/mutator/mutator.inline.h" +#include "common_components/mutator/mutator_manager.h" + +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif #include "common_components/log/log.h" #include "common_components/taskpool/taskpool.h" #include "common_interfaces/base_runtime.h" -namespace panda { +namespace common { uintptr_t RegionDesc::UnitInfo::totalUnitCount = 0; uintptr_t RegionDesc::UnitInfo::unitInfoStart = 0; uintptr_t RegionDesc::UnitInfo::heapStartAddress = 0; @@ -64,20 +64,20 @@ static size_t GetPageSize() noexcept } // System default page size -const size_t ARK_COMMON_PAGE_SIZE = GetPageSize(); -const size_t AllocatorUtils::ALLOC_PAGE_SIZE = panda::ARK_COMMON_PAGE_SIZE; +const size_t COMMON_PAGE_SIZE = GetPageSize(); +const size_t AllocatorUtils::ALLOC_PAGE_SIZE = COMMON_PAGE_SIZE; // region unit size: same as system page size -const size_t RegionDesc::UNIT_SIZE = panda::ARK_COMMON_PAGE_SIZE; +const size_t RegionDesc::UNIT_SIZE = COMMON_PAGE_SIZE; // regarding a object as a large object when the size is greater than 32KB or one page size, // depending on the system page size. -const size_t RegionDesc::LARGE_OBJECT_DEFAULT_THRESHOLD = panda::ARK_COMMON_PAGE_SIZE > (32 * KB) ? - panda::ARK_COMMON_PAGE_SIZE : 32 * KB; +const size_t RegionDesc::LARGE_OBJECT_DEFAULT_THRESHOLD = COMMON_PAGE_SIZE > (32 * KB) ? + COMMON_PAGE_SIZE : 32 * KB; // max size of per region is 128KB. -const size_t RegionManager::MAX_UNIT_COUNT_PER_REGION = (128 * KB) / panda::ARK_COMMON_PAGE_SIZE; +const size_t RegionManager::MAX_UNIT_COUNT_PER_REGION = (128 * KB) / COMMON_PAGE_SIZE; // size of huge page is 2048KB. -const size_t RegionManager::HUGE_PAGE = (2048 * KB) / panda::ARK_COMMON_PAGE_SIZE; +const size_t RegionManager::HUGE_PAGE = (2048 * KB) / COMMON_PAGE_SIZE; -class CopyTask : public Task { +class CopyTask : public common::Task { public: CopyTask(int32_t id, RegionManager& manager, RegionDesc& region, size_t regionCnt, TaskPackMonitor &monitor) : Task(id), regionManager_(manager), startRegion_(region), regionCount_(regionCnt), monitor_(monitor) {} @@ -816,7 +816,7 @@ static void FixRecentRegion(TraceCollector& collector, RegionDesc* region) // handle dead objects in tl-regions for concurrent gc. if (collector.IsToVersion(object)) { collector.FixObjectRefFields(object); - object->SetForwardState(panda::BaseStateWord::ForwardState::NORMAL); + object->SetForwardState(BaseStateWord::ForwardState::NORMAL); } else { DLOG(FIX, "fix: skip new obj %p<%p>(%zu)", object, object->GetTypeInfo(), object->GetSize()); } @@ -1299,4 +1299,4 @@ uintptr_t RegionManager::AllocReadOnly(size_t size, bool allowGC) DLOG(ALLOC, "alloc read only obj 0x%zx(%zu)", addr, size); return addr; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/allocator/region_manager.h b/common_components/heap/allocator/region_manager.h similarity index 97% rename from common_components/common_runtime/src/heap/allocator/region_manager.h rename to common_components/heap/allocator/region_manager.h index 026d623dcff704eca502a49cd1e92cacefb09db3..4417943f986c235fcecfb500d047acc7086f24da 100755 --- a/common_components/common_runtime/src/heap/allocator/region_manager.h +++ b/common_components/heap/allocator/region_manager.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_REGION_MANAGER_H -#define ARK_COMMON_REGION_MANAGER_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_MANAGER_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_MANAGER_H #include #include @@ -21,14 +22,14 @@ #include #include -#include "common_components/common_runtime/src/common/run_type.h" -#include "common_components/common_runtime/src/heap/allocator/alloc_buffer.h" -#include "common_components/common_runtime/src/heap/allocator/allocator.h" -#include "common_components/common_runtime/src/heap/allocator/free_region_manager.h" -#include "common_components/common_runtime/src/heap/allocator/region_list.h" -#include "common_components/common_runtime/src/heap/allocator/slot_list.h" +#include "common_components/common/run_type.h" +#include "common_components/heap/allocator/alloc_buffer.h" +#include "common_components/heap/allocator/allocator.h" +#include "common_components/heap/allocator/free_region_manager.h" +#include "common_components/heap/allocator/region_list.h" +#include "common_components/heap/allocator/slot_list.h" -namespace panda { +namespace common { using JitFortUnProtHookType = void (*)(size_t size, void* base); class TraceCollector; @@ -63,7 +64,7 @@ public: static size_t GetMetadataSize(size_t regionNum) { size_t metadataSize = regionNum * sizeof(RegionDesc); - return RoundUp(metadataSize, panda::ARK_COMMON_PAGE_SIZE); + return RoundUp(metadataSize, COMMON_PAGE_SIZE); } void Initialize(size_t regionNum, uintptr_t regionInfoStart); @@ -663,5 +664,6 @@ private: friend class VerifyIterator; }; -} // namespace panda -#endif // ARK_COMMON_REGION_MANAGER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_MANAGER_H diff --git a/common_components/common_runtime/src/heap/allocator/region_space.cpp b/common_components/heap/allocator/region_space.cpp similarity index 94% rename from common_components/common_runtime/src/heap/allocator/region_space.cpp rename to common_components/heap/allocator/region_space.cpp index 1b77acac44feca0c00aa0ce97d1defcff2eb904a..a4a07687ea05b2540dba0541b0027d5d6edb529f 100755 --- a/common_components/common_runtime/src/heap/allocator/region_space.cpp +++ b/common_components/heap/allocator/region_space.cpp @@ -13,19 +13,18 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/heap/allocator/region_space.h" - +#include "common_components/heap/allocator/region_space.h" +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/collector/collector_resources.h" #include "common_components/platform/os.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/collector/collector_resources.h" -#if defined(ARKCOMMON_SANITIZER_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#if defined(COMMON_SANITIZER_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -#include "common_components/common_runtime/src/common/scoped_object_access.h" -#include "common_components/common_runtime/src/heap/heap.h" +#include "common_components/common/scoped_object_access.h" +#include "common_components/heap/heap.h" -namespace panda { +namespace common { HeapAddress RegionSpace::TryAllocateOnce(size_t allocSize, AllocType allocType) { if (UNLIKELY_CC(allocType == AllocType::PINNED_OBJECT)) { @@ -98,7 +97,7 @@ HeapAddress RegionSpace::Allocate(size_t size, AllocType allocType) if (internalAddr == 0) { return 0; } -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanAllocObject(reinterpret_cast(internalAddr), allocSize); #endif return internalAddr + HEADER_SIZE; @@ -121,7 +120,7 @@ HeapAddress RegionSpace::AllocateNoGC(size_t size, AllocType allocType) if (internalAddr == 0) { return 0; } -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanAllocObject(reinterpret_cast(internalAddr), allocSize); #endif return internalAddr + HEADER_SIZE; @@ -134,7 +133,7 @@ void RegionSpace::Init(const RuntimeParam& param) size_t heapSize = param.heapParam.heapSize * KB; size_t totalSize = RegionManager::GetHeapMemorySize(heapSize); size_t regionNum = RegionManager::GetHeapUnitCount(heapSize); -#if defined(ARKCOMMON_ASAN_SUPPORT) +#if defined(COMMON_ASAN_SUPPORT) // asan's memory alias technique needs a shareable page opt.flags &= ~MAP_PRIVATE; opt.flags |= MAP_SHARED; @@ -149,7 +148,7 @@ void RegionSpace::Init(const RuntimeParam& param) os::PrctlSetVMA(reinterpret_cast(baseAddr + metadataSize), totalSize - metadataSize, "ARKTS_CMC_GC_REGION_HEAP"); -#if defined(ARKCOMMON_SANITIZER_SUPPORT) +#if defined(COMMON_SANITIZER_SUPPORT) Sanitizer::OnHeapAllocated(map->GetBaseAddr(), map->GetMappedSize()); #endif @@ -157,7 +156,7 @@ void RegionSpace::Init(const RuntimeParam& param) regionManager_.Initialize(regionNum, metadata); reservedStart_ = regionManager_.GetRegionHeapStart(); reservedEnd_ = reinterpret_cast(map_->GetMappedEndAddr()); -#if defined(ARK_COMMON_DUMP_ADDRESS) +#if defined(COMMON_DUMP_ADDRESS) VLOG(REPORT, "region metadata@%zx, heap @[0x%zx+%zu, 0x%zx)", metadata, reservedStart, reservedEnd - reservedStart, reservedEnd); #endif @@ -332,4 +331,4 @@ void RegionSpace::FeedHungryBuffers() regionManager_.CollectRegion(region); } } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/allocator/region_space.h b/common_components/heap/allocator/region_space.h similarity index 91% rename from common_components/common_runtime/src/heap/allocator/region_space.h rename to common_components/heap/allocator/region_space.h index ac64a5b9c7c8e837ebc84bda1a9ba3c144804141..8c96b407e22edfb646aa435f69059431e260827a 100755 --- a/common_components/common_runtime/src/heap/allocator/region_space.h +++ b/common_components/heap/allocator/region_space.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_REGION_SPACE_H -#define ARK_COMMON_REGION_SPACE_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_SPACE_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_SPACE_H #include #include @@ -22,16 +23,16 @@ #include #include -#include "common_components/common_runtime/src/heap/allocator/alloc_util.h" -#include "common_components/common_runtime/src/heap/allocator/allocator.h" -#include "common_components/common_runtime/src/heap/allocator/region_manager.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_SANITIZER_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/heap/allocator/alloc_util.h" +#include "common_components/heap/allocator/allocator.h" +#include "common_components/heap/allocator/region_manager.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_SANITIZER_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif #include "common_interfaces/base_runtime.h" -namespace panda { +namespace common { class Taskpool; // RegionSpace aims to be the API for other components of runtime @@ -58,7 +59,7 @@ public: delete allocBufferManager_; allocBufferManager_ = nullptr; } -#if defined(ARKCOMMON_SANITIZER_SUPPORT) +#if defined(COMMON_SANITIZER_SUPPORT) Sanitizer::OnHeapDeallocated(map->GetBaseAddr(), map->GetMappedSize()); #endif MemoryMap::DestroyMemoryMap(map_); @@ -109,11 +110,11 @@ public: size_t ReclaimGarbageMemory(bool releaseAll) override { { - ARK_COMMON_PHASE_TIMER("ReclaimGarbageRegions"); + COMMON_PHASE_TIMER("ReclaimGarbageRegions"); regionManager_.ReclaimGarbageRegions(); } - ARK_COMMON_PHASE_TIMER("ReleaseGarbageMemory"); + COMMON_PHASE_TIMER("ReleaseGarbageMemory"); if (releaseAll) { return regionManager_.ReleaseGarbageRegions(0); } else { @@ -136,7 +137,7 @@ public: void ExemptFromSpace() { - ARK_COMMON_PHASE_TIMER("ExemptFromRegions"); + COMMON_PHASE_TIMER("ExemptFromRegions"); regionManager_.ExemptFromRegions(); } @@ -153,7 +154,7 @@ public: void CopyFromSpace(Taskpool *threadPool) { - ARK_COMMON_PHASE_TIMER("CopyFromRegions"); + COMMON_PHASE_TIMER("CopyFromRegions"); regionManager_.CopyFromRegions(threadPool); } @@ -265,5 +266,6 @@ private: RegionManager regionManager_; MemoryMap* map_{ nullptr }; }; -} // namespace panda -#endif // ARK_COMMON_REGION_SPACE_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_REGION_SPACE_H diff --git a/common_components/common_runtime/src/heap/allocator/slot_list.h b/common_components/heap/allocator/slot_list.h similarity index 82% rename from common_components/common_runtime/src/heap/allocator/slot_list.h rename to common_components/heap/allocator/slot_list.h index 63852effba28a0df6e3376e82d4763db3c6fc788..a41aa6811305d9932437c89a3ca23ab447138804 100755 --- a/common_components/common_runtime/src/heap/allocator/slot_list.h +++ b/common_components/heap/allocator/slot_list.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_SLOT_LIST_H -#define ARK_COMMON_SLOT_LIST_H -#include "common_components/common_runtime/src/common/base_object.h" +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_SLOT_LIST_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_SLOT_LIST_H -namespace panda { +#include "common_components/common/base_object.h" + +namespace common { struct ObjectSlot { ObjectSlot* next; }; @@ -46,5 +47,6 @@ public: private: ObjectSlot* head_ = nullptr; }; -} // namespace panda -#endif // ARK_COMMON_SLOT_LIST_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_SLOT_LIST_H diff --git a/common_components/common_runtime/src/heap/allocator/treap.cpp b/common_components/heap/allocator/treap.cpp similarity index 96% rename from common_components/common_runtime/src/heap/allocator/treap.cpp rename to common_components/heap/allocator/treap.cpp index 51faa15ca1d930565672d2abb05d6338cabf6736..bcde1c4936c4fe9e6ebe0b09b2d8bda48cd10ac0 100755 --- a/common_components/common_runtime/src/heap/allocator/treap.cpp +++ b/common_components/heap/allocator/treap.cpp @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/allocator/treap.h" +#include "common_components/heap/allocator/treap.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" +#include "common_components/heap/allocator/region_desc.h" -namespace panda { +namespace common { bool Treap::MergeInsertInternal(uint32_t idx, uint32_t num, bool refreshRegionDesc) { // +-------------+ +--------------+ @@ -141,4 +141,4 @@ void Treap::TreapNode::ReleaseMemory() uint32_t cnt = GetCount(); RegionDesc::ReleaseUnits(idx, cnt); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/allocator/treap.h b/common_components/heap/allocator/treap.h similarity index 98% rename from common_components/common_runtime/src/heap/allocator/treap.h rename to common_components/heap/allocator/treap.h index 8ebdff7ad4a332a239a28eec9ec5c932ebfd29c9..3cc48bff5d63241cc16d4b24f1dd8394257a3acf 100755 --- a/common_components/common_runtime/src/heap/allocator/treap.h +++ b/common_components/heap/allocator/treap.h @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_CARTESIAN_TREE_H -#define ARK_COMMON_CARTESIAN_TREE_H + +#ifndef COMMON_COMPONENTS_HEAP_ALLOCATOR_TREAP_H +#define COMMON_COMPONENTS_HEAP_ALLOCATOR_TREAP_H #include #include -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/heap/allocator/local_deque.h" +#include "common_components/heap/allocator/local_deque.h" #include "common_components/log/log.h" #ifndef NDEBUG @@ -39,7 +39,7 @@ // the art of automatic memory management. Chapman and Hall/CRC, 2016. // This data structure doesn't guarantee the multi-thread safety, so the external invoker should take some // policy to avoid competition problems. -namespace panda { +namespace common { class Treap { public: Treap() = default; @@ -614,5 +614,6 @@ private: } #endif }; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_ALLOCATOR_TREAP_H diff --git a/common_components/common_runtime/src/heap/barrier/barrier.cpp b/common_components/heap/barrier/barrier.cpp similarity index 92% rename from common_components/common_runtime/src/heap/barrier/barrier.cpp rename to common_components/heap/barrier/barrier.cpp index 02a14d7aac81c4bbc0a2b0d1e8dd1b3cd28b5cbc..3483d8af15872648b5d077344b4cd951b2caf4db 100755 --- a/common_components/common_runtime/src/heap/barrier/barrier.cpp +++ b/common_components/heap/barrier/barrier.cpp @@ -12,14 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/heap.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" + +#include "common_components/heap/barrier/barrier.h" + +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/heap.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif +#include "common_components/log/log.h" +#include "securec.h" -namespace panda { +namespace common { void Barrier::WriteRefField(BaseObject* obj, RefField& field, BaseObject* ref) const { @@ -36,7 +40,7 @@ void Barrier::WriteStruct(BaseObject* obj, HeapAddress dst, size_t dstLen, HeapA { LOGF_CHECK(memcpy_s(reinterpret_cast(dst), dstLen, reinterpret_cast(src), srcLen) == EOK) << "memcpy_s failed"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) CHECK_EQ(srcLen, dstLen); Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dst), dstLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(src), srcLen); @@ -111,7 +115,7 @@ void Barrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex d { LOGF_CHECK(memmove_s(reinterpret_cast(dstField), dstSize, reinterpret_cast(srcField), srcSize) == EOK) << "memmove_s failed"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) size_t copyLen = (dstSize < srcSize ? dstSize : srcSize); Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dstField), copyLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(srcField), copyLen); @@ -139,4 +143,4 @@ void Barrier::ReadStruct(HeapAddress dst, BaseObject* obj, HeapAddress src, size "read struct memcpy_s failed"; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/barrier/barrier.h b/common_components/heap/barrier/barrier.h similarity index 91% rename from common_components/common_runtime/src/heap/barrier/barrier.h rename to common_components/heap/barrier/barrier.h index 4cce6e7669eb2ba55e8c2eb149b016e514745ff9..9043959de95e164f9a43a3b6839febcd8fce5e92 100755 --- a/common_components/common_runtime/src/heap/barrier/barrier.h +++ b/common_components/heap/barrier/barrier.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_BARRIER_H -#define ARK_COMMON_BARRIER_H -#include "common_components/common_runtime/src/common/base_object.h" -#include "common_components/common_runtime/src/common/type_def.h" +#ifndef COMMON_COMPONENTS_HEAP_BARRIER_BARRIER_H +#define COMMON_COMPONENTS_HEAP_BARRIER_BARRIER_H -namespace panda { +#include "common_components/common/base_object.h" +#include "common_components/common/type_def.h" + +namespace common { class Collector; // Barrier is the base class to define read/write barriers. class Barrier { @@ -80,5 +81,6 @@ protected: }; Collector& theCollector; }; -} // namespace panda -#endif // ~ARK_COMMON_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_BARRIER_BARRIER_H diff --git a/common_components/common_runtime/src/heap/collector/collector.cpp b/common_components/heap/collector/collector.cpp similarity index 89% rename from common_components/common_runtime/src/heap/collector/collector.cpp rename to common_components/heap/collector/collector.cpp index 45adf65bb7cb9a166b9d6feb85c4017544ca7aac..bc0652ebd281032a217be10167dbd5abdfd71dfd 100755 --- a/common_components/common_runtime/src/heap/collector/collector.cpp +++ b/common_components/heap/collector/collector.cpp @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/collector.h" +#include "common_components/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/heap.h" -#include "common_components/common_runtime/src/mutator/mutator.h" +#include "common_components/heap/heap.h" +#include "common_components/mutator/mutator.h" -namespace panda { +namespace common { namespace { const char* const COLLECTOR_NAME[] = { "No Collector", "Proxy Collector", "Regional-Copying Collector", "Smooth Collector" }; @@ -56,4 +56,4 @@ void Collector::RequestGC(GCReason reason, bool async) RequestGCInternal(reason, async); return; } -} // namespace panda. +} // namespace common. diff --git a/common_components/common_runtime/src/heap/collector/collector.h b/common_components/heap/collector/collector.h similarity index 91% rename from common_components/common_runtime/src/heap/collector/collector.h rename to common_components/heap/collector/collector.h index 94d6c710c468829b5c182e7cbe90f3118529b626..cd520f4484bdeed8a1235ed4c2176a08e5ca39eb 100755 --- a/common_components/common_runtime/src/heap/collector/collector.h +++ b/common_components/heap/collector/collector.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COLLECTOR_H -#define ARK_COMMON_COLLECTOR_H + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_H #include #include @@ -22,13 +23,13 @@ #include #include -#include "common_components/common_runtime/src/common/base_object.h" -#include "common_components/common_runtime/src/heap/collector/gc_request.h" -#include "common_components/common_runtime/src/heap/collector/gc_stats.h" +#include "common_components/common/base_object.h" +#include "common_components/heap/collector/gc_request.h" +#include "common_components/heap/collector/gc_stats.h" #include "common_interfaces/thread/mutator_base.h" #include "common_interfaces/base/runtime_param.h" -namespace panda { +namespace common { enum CollectorType { NO_COLLECTOR = 0, // No Collector PROXY_COLLECTOR, // Proxy of Collector @@ -116,6 +117,6 @@ protected: CollectorType collectorType_ = CollectorType::NO_COLLECTOR; std::atomic gcPhase_ = { GCPhase::GC_PHASE_IDLE }; }; -} // namespace panda +} // namespace common -#endif +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_H diff --git a/common_components/common_runtime/src/heap/collector/collector_proxy.cpp b/common_components/heap/collector/collector_proxy.cpp similarity index 92% rename from common_components/common_runtime/src/heap/collector/collector_proxy.cpp rename to common_components/heap/collector/collector_proxy.cpp index 044e8eeb9f2b4942368421122344d44c4225314f..27476aab7c036cd41cbe36549d65d3b6624f578b 100755 --- a/common_components/common_runtime/src/heap/collector/collector_proxy.cpp +++ b/common_components/heap/collector/collector_proxy.cpp @@ -12,9 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/collector_proxy.h" +#include "common_components/heap/collector/collector_proxy.h" -namespace panda { +namespace common { void CollectorProxy::Init(const RuntimeParam& param) { wCollector_.Init(param); @@ -45,4 +45,4 @@ void CollectorProxy::RunGarbageCollection(uint64_t gcIndex, GCReason reason) currentCollector_->SetGcStarted(true); currentCollector_->RunGarbageCollection(gcIndex, reason); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/collector_proxy.h b/common_components/heap/collector/collector_proxy.h similarity index 90% rename from common_components/common_runtime/src/heap/collector/collector_proxy.h rename to common_components/heap/collector/collector_proxy.h index d8fd5d7a3700475e6c213c7edc9292b3be9fcf1b..317bca8bd9aea84fb036b6bfa8851ff1a92c60bc 100755 --- a/common_components/common_runtime/src/heap/collector/collector_proxy.h +++ b/common_components/heap/collector/collector_proxy.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COLLECTOR_PROXY_H -#define ARK_COMMON_COLLECTOR_PROXY_H -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/collector/collector_resources.h" -#include "common_components/common_runtime/src/heap/w_collector/w_collector.h" +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_PROXY_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_PROXY_H -namespace panda { +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/collector/collector_resources.h" +#include "common_components/heap/w_collector/w_collector.h" + +namespace common { // CollectorProxy is a special kind of collector, it is derived from Base class Collector, thus behaves like a real // collector. However, it actually manages a set of collectors implemented yet, and delegate garbage-collecting to // one of these collectors. @@ -89,6 +90,6 @@ private: TraceCollector* currentCollector_ = nullptr; WCollector wCollector_; }; -} // namespace panda +} // namespace common -#endif // ~ARK_COMMON_COLLECTOR_PROXY_H +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_PROXY_H diff --git a/common_components/common_runtime/src/heap/collector/collector_resources.cpp b/common_components/heap/collector/collector_resources.cpp similarity index 93% rename from common_components/common_runtime/src/heap/collector/collector_resources.cpp rename to common_components/heap/collector/collector_resources.cpp index 7b4587b8a0ad4530394b916b9ceaa3e53b593f4b..7b31fbb6891c71c946158dc079f0d22e39ec9dd2 100755 --- a/common_components/common_runtime/src/heap/collector/collector_resources.cpp +++ b/common_components/heap/collector/collector_resources.cpp @@ -12,20 +12,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/collector_resources.h" +#include "common_components/heap/collector/collector_resources.h" #include -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/heap/collector/collector_proxy.h" -#include "common_components/common_runtime/src/common/run_type.h" -#include "common_components/common_runtime/src/common/scoped_object_access.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/base/sys_call.h" +#include "common_components/heap/collector/collector_proxy.h" +#include "common_components/common/run_type.h" +#include "common_components/common/scoped_object_access.h" +#include "common_components/mutator/mutator_manager.h" #ifdef ENABLE_QOS #include "qos.h" #endif -namespace panda { +namespace common { void* CollectorResources::GCMainThreadEntry(void* arg) { @@ -46,7 +46,7 @@ void* CollectorResources::GCMainThreadEntry(void* arg) LOG_COMMON(INFO) << "[GC] CollectorResources Thread begin."; #ifdef ENABLE_QOS - OHOS::QOS::SetQosForOtherThread(OHOS::QOS::QosLevel::QOS_USER_INITIATED, panda::GetTid()); + OHOS::QOS::SetQosForOtherThread(OHOS::QOS::QosLevel::QOS_USER_INITIATED, GetTid()); #endif // run event loop in this thread. @@ -131,7 +131,7 @@ void CollectorResources::StopGCThreads() void CollectorResources::RunTaskLoop() { - gcTid_.store(panda::GetTid(), std::memory_order_release); + gcTid_.store(GetTid(), std::memory_order_release); taskQueue_->DrainTaskQueue(&collectorProxy_); NotifyGCFinished(GCTask::TASK_INDEX_GC_EXIT); } @@ -236,7 +236,7 @@ void CollectorResources::StartGCThreads() LOG_COMMON(FATAL) << "[GC] CollectorResources Thread already begin."; UNREACHABLE(); } - ASSERT(gcThreadPool_ == nullptr); + DCHECK_CC(gcThreadPool_ == nullptr); gcThreadPool_ = Taskpool::GetCurrentTaskpool(); gcThreadPool_->Initialize(); LOGF_CHECK(gcThreadPool_ != nullptr) << "new GCThreadPool failed"; @@ -288,4 +288,4 @@ void CollectorResources::RequestHeapDump(GCTask::GCTaskType gcTask) taskQueue_->EnqueueSync(dumpTask, filter); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/collector_resources.h b/common_components/heap/collector/collector_resources.h similarity index 92% rename from common_components/common_runtime/src/heap/collector/collector_resources.h rename to common_components/heap/collector/collector_resources.h index 438d1f6a78d26dba74850af63c2e889b9382af59..559b1eeb5b15fb5399da23fade737e73d97053c3 100755 --- a/common_components/common_runtime/src/heap/collector/collector_resources.h +++ b/common_components/heap/collector/collector_resources.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COLLECTOR_RESOURCES_H -#define ARK_COMMON_COLLECTOR_RESOURCES_H -#include "common_components/common_runtime/src/heap/collector/finalizer_processor.h" -#include "common_components/common_runtime/src/heap/collector/task_queue.h" +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_RESOURCES_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_RESOURCES_H + +#include "common_components/heap/collector/finalizer_processor.h" +#include "common_components/heap/collector/task_queue.h" #include "common_components/taskpool/taskpool.h" -namespace panda { +namespace common { class CollectorProxy; // CollectorResources provides the resources that a functional collector need, // such as gc thread/threadPool, gc task queue... @@ -122,5 +123,6 @@ private: GCStats gcStats_; bool hasRelease = false; }; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_COLLECTOR_RESOURCES_H diff --git a/common_components/common_runtime/src/heap/collector/copy_data_manager.cpp b/common_components/heap/collector/copy_data_manager.cpp similarity index 81% rename from common_components/common_runtime/src/heap/collector/copy_data_manager.cpp rename to common_components/heap/collector/copy_data_manager.cpp index 4c93e60b6a90d007bda6dc6851f8aadf417e463a..386992c51810d757956428439080c3053e3c0f08 100755 --- a/common_components/common_runtime/src/heap/collector/copy_data_manager.cpp +++ b/common_components/heap/collector/copy_data_manager.cpp @@ -18,13 +18,13 @@ #include #endif +#include "common_components/base/immortal_wrapper.h" +#include "common_components/heap/allocator/region_desc.h" +#include "common_components/heap/collector/region_bitmap.h" +#include "common_components/heap/collector/copy_data_manager.h" #include "common_components/platform/os.h" -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" -#include "common_components/common_runtime/src/heap/collector/region_bitmap.h" -#include "common_components/common_runtime/src/heap/collector/copy_data_manager.h" -namespace panda { +namespace common { static ImmortalWrapper forwardDataManager; HeapBitmapManager& HeapBitmapManager::GetHeapBitmapManager() { return *forwardDataManager; } @@ -32,7 +32,7 @@ HeapBitmapManager& HeapBitmapManager::GetHeapBitmapManager() { return *forwardDa void HeapBitmapManager::InitializeHeapBitmap() { size_t maxHeapBytes = Heap::GetHeap().GetMaxCapacity(); - size_t heapBitmapSize = RoundUp(GetHeapBitmapSize(maxHeapBytes), panda::ARK_COMMON_PAGE_SIZE); + size_t heapBitmapSize = RoundUp(GetHeapBitmapSize(maxHeapBytes), COMMON_PAGE_SIZE); allHeapBitmapSize_ = heapBitmapSize; #ifdef _WIN64 @@ -49,7 +49,7 @@ void HeapBitmapManager::InitializeHeapBitmap() } else { #ifndef __APPLE__ (void)madvise(startAddress, allHeapBitmapSize_, MADV_NOHUGEPAGE); - ARK_COMMON_PRCTL(startAddress, allHeapBitmapSize_, "forward_data"); + COMMON_PRCTL(startAddress, allHeapBitmapSize_, "forward_data"); #endif } #endif @@ -59,4 +59,4 @@ void HeapBitmapManager::InitializeHeapBitmap() os::PrctlSetVMA(startAddress, allHeapBitmapSize_, "ARKTS_CMC_GC_HEAP_BIT_MAP"); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/copy_data_manager.h b/common_components/heap/collector/copy_data_manager.h similarity index 86% rename from common_components/common_runtime/src/heap/collector/copy_data_manager.h rename to common_components/heap/collector/copy_data_manager.h index 2e96f9548c884f69ffd88bd846e35ba0950ce430..b39f04235132a2bcd6e1c5a6fae2030cef43387c 100755 --- a/common_components/common_runtime/src/heap/collector/copy_data_manager.h +++ b/common_components/heap/collector/copy_data_manager.h @@ -12,20 +12,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COPY_DATA_MANAGER_H -#define ARK_COMMON_COPY_DATA_MANAGER_H -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/heap/heap.h" + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_COPY_DATA_MANAGER_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_COPY_DATA_MANAGER_H + +#include "common_components/base/immortal_wrapper.h" +#include "common_components/heap/heap.h" #if defined(__linux__) || defined(PANDA_TARGET_OHOS) || defined(__APPLE__) #include #endif -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/base/mem_utils.h" -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/heap/collector/region_bitmap.h" + +#include "common_components/base/mem_utils.h" +#include "common_components/base/sys_call.h" +#include "common_components/heap/collector/region_bitmap.h" +#include "common_components/log/log.h" #ifdef _WIN64 -#include "common_components/common_runtime/src/base/atomic_spin_lock.h" +#include "common_components/base/atomic_spin_lock.h" #include #include #include @@ -33,7 +36,7 @@ #include #endif -namespace panda { +namespace common { class HeapBitmapManager { class Memory { @@ -80,7 +83,7 @@ class HeapBitmapManager { allocSpinLock.Unlock(); return startAddr; } - size_t pageSize = RoundUp(sz, panda::ARK_COMMON_PAGE_SIZE); + size_t pageSize = RoundUp(sz, COMMON_PAGE_SIZE); LOGE_IF(UNLIKELY_CC(!VirtualAlloc(reinterpret_cast(lastAddr), pageSize, MEM_COMMIT, PAGE_READWRITE))) << "VirtualAlloc commit failed in Allocate, errno: " << GetLastError(); lastCommitEndAddr[type].store(lastAddr + pageSize); @@ -96,10 +99,10 @@ class HeapBitmapManager { LOGE_IF(UNLIKELY_CC(!VirtualFree(reinterpret_cast(startAddress), size, MEM_DECOMMIT))) << "VirtualFree failed in ReturnPage, errno: " << GetLastError(); #elif defined(__APPLE__) - panda::MemorySet(startAddress, size, 0, size); + MemorySet(startAddress, size, 0, size); (void)madvise(reinterpret_cast(startAddress), size, MADV_DONTNEED); #else - panda::MemorySet(startAddress_, size_, 0, size_); + MemorySet(startAddress_, size_, 0, size_); DLOG(REGION, "clear copy-data @[%#zx+%zu, %#zx)", startAddress_, size_, startAddress_ + size_); if (madvise(reinterpret_cast(startAddress_), size_, MADV_DONTNEED) == 0) { DLOG(REGION, "release copy-data @[%#zx+%zu, %#zx)", startAddress_, size_, startAddress_ + size_); @@ -163,7 +166,7 @@ public: private: size_t GetHeapBitmapSize(size_t heapSize) { - const size_t REGION_UNIT_SIZE = panda::ARK_COMMON_PAGE_SIZE; // must be equal to RegionDesc::UNIT_SIZE + const size_t REGION_UNIT_SIZE = COMMON_PAGE_SIZE; // must be equal to RegionDesc::UNIT_SIZE heapSize = RoundUp(heapSize, REGION_UNIT_SIZE); size_t unitCnt = heapSize / REGION_UNIT_SIZE; regionUnitCount_ = unitCnt; @@ -180,5 +183,5 @@ private: uintptr_t heapBitmapStart_ = 0; size_t allHeapBitmapSize_ = 0; }; -} // namespace panda -#endif // ARK_COMMON_COPY_DATA_MANAGER_H +} // namespace common +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_COPY_DATA_MANAGER_H diff --git a/common_components/common_runtime/src/heap/collector/finalizer_processor.cpp b/common_components/heap/collector/finalizer_processor.cpp similarity index 95% rename from common_components/common_runtime/src/heap/collector/finalizer_processor.cpp rename to common_components/heap/collector/finalizer_processor.cpp index a65934f1f467630d7f88b993698a18a902cd6a7a..bd3c1af91ce6a05cde9ec94b2ca2204846460e14 100755 --- a/common_components/common_runtime/src/heap/collector/finalizer_processor.cpp +++ b/common_components/heap/collector/finalizer_processor.cpp @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/finalizer_processor.h" +#include "common_components/heap/collector/finalizer_processor.h" -#include "common_components/common_runtime/src/common/scoped_object_access.h" -#include "common_components/common_runtime/src/mutator/mutator.h" +#include "common_components/common/scoped_object_access.h" +#include "common_components/mutator/mutator.h" -namespace panda { +namespace common { constexpr uint32_t DEFAULT_FINALIZER_TIMEOUT_MS = 2000; // Note: can only be called by FinalizerProcessor thread @@ -93,7 +93,7 @@ void FinalizerProcessor::Run() if (hasFinalizableJob_.load(std::memory_order_relaxed)) { // In theory we currently won't have this ProcessFinalizables(); -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG LogAfterProcess(); #endif } @@ -107,7 +107,7 @@ void FinalizerProcessor::Run() } { - ARK_COMMON_PHASE_TIMER("finalizerProcessor waitting time", FINALIZE); + COMMON_PHASE_TIMER("finalizerProcessor waitting time", FINALIZE); while (running_) { Wait(iterationWaitTime_); if (hasFinalizableJob_.load(std::memory_order_relaxed) || @@ -217,7 +217,7 @@ void FinalizerProcessor::ProcessFinalizableList() void FinalizerProcessor::ProcessFinalizables() { - ARK_COMMON_PHASE_TIMER("Finalizer", FINALIZE); + COMMON_PHASE_TIMER("Finalizer", FINALIZE); { // we leave saferegion to avoid GC visit those changing queues. ScopedObjectAccess soa; @@ -233,7 +233,7 @@ void FinalizerProcessor::ProcessFinalizables() } } -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG void FinalizerProcessor::LogAfterProcess() { if (!ENABLE_LOG(FINALIZE)) { @@ -269,4 +269,4 @@ void FinalizerProcessor::FeedHungryBuffers() Heap::GetHeap().GetAllocator().FeedHungryBuffers(); shouldFeedHungryBuffers_.store(false, std::memory_order_relaxed); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/finalizer_processor.h b/common_components/heap/collector/finalizer_processor.h similarity index 91% rename from common_components/common_runtime/src/heap/collector/finalizer_processor.h rename to common_components/heap/collector/finalizer_processor.h index 6ff8d98ef2cd5acecc6847b0c7d54a506405d4db..44b6ed84c4c5c27eccf9493a40331197c26e4034 100755 --- a/common_components/common_runtime/src/heap/collector/finalizer_processor.h +++ b/common_components/heap/collector/finalizer_processor.h @@ -12,20 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_FINALIZER_PROCESSOR_H -#define ARK_COMMON_FINALIZER_PROCESSOR_H + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_FINALIZER_PROCESSOR_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_FINALIZER_PROCESSOR_H #include #include #include #include -#include "common_components/common_runtime/src/common/page_allocator.h" -#include "common_components/common_runtime/src/common/type_def.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" +#include "common_components/common/page_allocator.h" +#include "common_components/common/type_def.h" +#include "common_components/heap/collector/collector.h" #include "common_components/log/log.h" -namespace panda { +namespace common { template using ManagedList = std::list>; @@ -130,7 +131,7 @@ private: std::atomic hasFinalizableJob_; std::atomic shouldReclaimHeapGarbage_; std::atomic shouldFeedHungryBuffers_; -#ifndef NDEBUG + #if defined(GCINFO_DEBUG) && GCINFO_DEBUG // stats void LogAfterProcess(); #endif @@ -141,5 +142,6 @@ private: pthread_t threadHandle_ = 0; // thread handle to thread Mutator* fpMutator_ = nullptr; }; -} // namespace panda -#endif // ARK_COMMON_FINALIZER_PROCESSOR_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_FINALIZER_PROCESSOR_H diff --git a/common_components/common_runtime/src/heap/collector/gc_infos.h b/common_components/heap/collector/gc_infos.h similarity index 95% rename from common_components/common_runtime/src/heap/collector/gc_infos.h rename to common_components/heap/collector/gc_infos.h index 080047ad7f68854f94730caaac29221977bf9201..a3ef4cddc7940d9e77f78ccd9c6873fa3c984b6f 100755 --- a/common_components/common_runtime/src/heap/collector/gc_infos.h +++ b/common_components/heap/collector/gc_infos.h @@ -12,15 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_GC_DEBUGGER_H -#define ARK_COMMON_GC_DEBUGGER_H +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_GC_DEBUGGER_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_GC_DEBUGGER_H + #include #include #include #include -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/base/time_utils.h" +#include "common_components/base/time_utils.h" +#include "common_components/log/log.h" #ifndef NDEBUG #define GCINFO_DEBUG (false) @@ -28,8 +29,8 @@ #define GCINFO_DEBUG (false) #endif -namespace panda { -#if GCINFO_DEBUG +namespace common { +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG class GCInfoNode { public: enum RootType { @@ -227,5 +228,6 @@ private: std::list gcInfos; }; #endif -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_GC_DEBUGGER_H diff --git a/common_components/common_runtime/src/heap/collector/gc_request.cpp b/common_components/heap/collector/gc_request.cpp similarity index 91% rename from common_components/common_runtime/src/heap/collector/gc_request.cpp rename to common_components/heap/collector/gc_request.cpp index 0294a1c4ac562466aea4e847f773845322fa2966..1ac9be0a4770fddbbca7518eb1a5deb9a5fc1ca2 100755 --- a/common_components/common_runtime/src/heap/collector/gc_request.cpp +++ b/common_components/heap/collector/gc_request.cpp @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/gc_request.h" +#include "common_components/heap/collector/gc_request.h" -#include "common_components/common_runtime/src/base/time_utils.h" -#include "common_components/common_runtime/src/heap/collector/gc_stats.h" -namespace panda { +#include "common_components/base/time_utils.h" +#include "common_components/heap/collector/gc_stats.h" +namespace common { namespace { // Set a safe initial value so that the first GC is able to trigger. uint64_t g_initHeuTriggerTimestamp = TimeUtil::NanoSeconds() - LONG_MIN_HEU_GC_INTERVAL_NS; @@ -70,4 +70,4 @@ GCRequest g_gcRequests[] = { { GC_REASON_FORCE, "force", true, false, 0, 0 }, { GC_REASON_APPSPAWN, "appspawn", true, false, 0, 0 } }; -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/gc_request.h b/common_components/heap/collector/gc_request.h similarity index 86% rename from common_components/common_runtime/src/heap/collector/gc_request.h rename to common_components/heap/collector/gc_request.h index 9cb2aa3c72bf67418b39ef26485919c9703e24b4..a4657f46ed33c37a24f750f2f5294cfdeaed961d 100755 --- a/common_components/common_runtime/src/heap/collector/gc_request.h +++ b/common_components/heap/collector/gc_request.h @@ -12,18 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_GCREQUEST_H -#define ARK_COMMON_GCREQUEST_H +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_GCREQUEST_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_GCREQUEST_H #include #include -#include "common_components/common_runtime/src/base/globals.h" +#include "common_components/base/globals.h" -namespace panda { +namespace common { // Minimum time between async GC (heuristic, native). -constexpr uint64_t MIN_ASYNC_GC_INTERVAL_NS = panda::SECOND_TO_NANO_SECOND; -constexpr uint64_t LONG_MIN_HEU_GC_INTERVAL_NS = 200 * panda::MILLI_SECOND_TO_NANO_SECOND; +constexpr uint64_t MIN_ASYNC_GC_INTERVAL_NS = SECOND_TO_NANO_SECOND; +constexpr uint64_t LONG_MIN_HEU_GC_INTERVAL_NS = 200 * MILLI_SECOND_TO_NANO_SECOND; // Used by Collector::RequestGC. // It tells why GC is triggered. @@ -68,5 +68,6 @@ struct GCRequest { // Defined in gcRequest.cpp extern GCRequest g_gcRequests[]; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_GC_DEBUGGER_H diff --git a/common_components/common_runtime/src/heap/collector/gc_stats.cpp b/common_components/heap/collector/gc_stats.cpp similarity index 76% rename from common_components/common_runtime/src/heap/collector/gc_stats.cpp rename to common_components/heap/collector/gc_stats.cpp index 05c5d331d808a5e09494932098a53bed35685129..e3619e78f40c1feff3a9a0c20787158480d6e3a4 100755 --- a/common_components/common_runtime/src/heap/collector/gc_stats.cpp +++ b/common_components/heap/collector/gc_stats.cpp @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/gc_stats.h" +#include "common_components/heap/collector/gc_stats.h" -#include "common_components/common_runtime/src/base/log_file.h" -#include "common_components/common_runtime/src/heap/heap.h" #include "common_interfaces/base_runtime.h" +#include "common_components/base/time_utils.h" +#include "common_components/heap/heap.h" +#include "common_components/log/log.h" -namespace panda { +namespace common { size_t g_gcCount = 0; uint64_t g_gcTotalTimeUs = 0; size_t g_gcCollectedTotalBytes = 0; @@ -76,16 +77,15 @@ void GCStats::Dump() const // display to std-output. take care to modify. LOG_COMMON(INFO) << "GC for " << g_gcRequests[reason].name << ": " << (async ? "async:" : "sync:") << " collected objects: " << - collectedObjects << "(" << collectedBytes << "->" << PrettyOrderInfo(collectedBytes, "B").Str() << "), " << - (utilization * 100) << "% utilization (" << liveSize << // 100 for percentage. - "->" << PrettyOrderInfo(liveSize, "B").Str() << "/" << heapSize << "->" << - PrettyOrderInfo(heapSize, "B").Str() << "), max pause: " << MaxSTWTime() << - "->" << PrettyOrderMathNano(MaxSTWTime(), "s").Str() << ", total pause: " << - TotalSTWTime() << "->" << PrettyOrderMathNano(TotalSTWTime(), "s").Str() << + collectedObjects << "(" << collectedBytes << "->" << PrettyOrderInfo(collectedBytes, "B") << "), " << + "->" << PrettyOrderInfo(liveSize, "B") << "/" << heapSize << "->" << + PrettyOrderInfo(heapSize, "B") << "), max pause: " << MaxSTWTime() << + "->" << PrettyOrderMathNano(MaxSTWTime(), "s") << ", total pause: " << + TotalSTWTime() << "->" << PrettyOrderMathNano(TotalSTWTime(), "s") << ", total GC time: " << (gcEndTime - gcStartTime) << "->" << - PrettyOrderMathNano(gcEndTime - gcStartTime, "s").Str(); + PrettyOrderMathNano(gcEndTime - gcStartTime, "s"); - VLOG(REPORT, "allocated size: %s, heap size: %s, heap utilization: %.2f%%", Pretty(liveSize).Str(), - Pretty(heapSize).Str(), utilization * 100); // 100 for percentage. + VLOG(REPORT, "allocated size: %s, heap size: %s, heap utilization: %.2f%%", Pretty(liveSize), + Pretty(heapSize), utilization * 100); // 100 for percentage. } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/gc_stats.h b/common_components/heap/collector/gc_stats.h similarity index 89% rename from common_components/common_runtime/src/heap/collector/gc_stats.h rename to common_components/heap/collector/gc_stats.h index bdf18cdd10184daf1c431dd5f757b543fc062d48..aecee8bfbeaf76b4cdd612ff65fdb0f7d751aaa2 100755 --- a/common_components/common_runtime/src/heap/collector/gc_stats.h +++ b/common_components/heap/collector/gc_stats.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_STATS_H -#define ARK_COMMON_STATS_H + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_STATS_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_STATS_H #include #include @@ -21,11 +22,11 @@ #include #include -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/heap/collector/gc_request.h" +#include "common_components/base/immortal_wrapper.h" +#include "common_components/heap/collector/gc_request.h" #include "common_components/log/log.h" -namespace panda { +namespace common { // statistics for previous gc. class GCStats { public: @@ -111,6 +112,6 @@ extern size_t g_gcCollectedTotalBytes; extern size_t g_fullGCCount; extern double g_fullGCMeanRate; -} // namespace panda +} // namespace common -#endif +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_STATS_H diff --git a/common_components/common_runtime/src/heap/collector/region_bitmap.h b/common_components/heap/collector/region_bitmap.h similarity index 87% rename from common_components/common_runtime/src/heap/collector/region_bitmap.h rename to common_components/heap/collector/region_bitmap.h index c0009e3a510892266c0f7a01c09804d6d4694547..4099cf06b643b70642235c68cb987ae2a4560d67 100755 --- a/common_components/common_runtime/src/heap/collector/region_bitmap.h +++ b/common_components/heap/collector/region_bitmap.h @@ -12,17 +12,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_LIVE_INFO_H -#define ARK_COMMON_LIVE_INFO_H -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/base/mem_utils.h" -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/heap/heap.h" + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_REGION_BITMAP_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_REGION_BITMAP_H + +#include "common_components/base/immortal_wrapper.h" +#include "common_components/base/mem_utils.h" +#include "common_components/base/sys_call.h" +#include "common_components/heap/heap.h" #if defined(__linux__) || defined(PANDA_TARGET_OHOS) || defined(__APPLE__) #include #endif -namespace panda { +namespace common { constexpr size_t kBitsPerByte = 8; constexpr size_t kMarkedBytesPerBit = 8; constexpr size_t kBitsPerWord = sizeof(uint64_t) * kBitsPerByte; @@ -76,6 +78,6 @@ struct RegionLiveDesc { RegionBitmap* resurrectBitmap = nullptr; RegionBitmap* enqueueBitmap = nullptr; }; +} // namespace common -} // namespace panda -#endif // ARK_COMMON_LIVE_INFO_H +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_REGION_BITMAP_H diff --git a/common_components/common_runtime/src/heap/collector/task_queue.cpp b/common_components/heap/collector/task_queue.cpp similarity index 92% rename from common_components/common_runtime/src/heap/collector/task_queue.cpp rename to common_components/heap/collector/task_queue.cpp index 8fa4f36a0fb4d7cf15622f41e0099a640e0f63a0..bcd5ee8c90f05d4169da3ebc71b41397776032a0 100755 --- a/common_components/common_runtime/src/heap/collector/task_queue.cpp +++ b/common_components/heap/collector/task_queue.cpp @@ -13,11 +13,11 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/task_queue.h" +#include "common_components/heap/collector/task_queue.h" -#include "common_components/common_runtime/src/heap/collector/collector_proxy.h" +#include "common_components/heap/collector/collector_proxy.h" -namespace panda { +namespace common { bool GCRunner::Execute(void* owner) { ASSERT_LOGF(owner != nullptr, "task queue owner ptr should not be null!"); @@ -64,4 +64,4 @@ bool GCRunner::Execute(void* owner) } return true; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/task_queue.h b/common_components/heap/collector/task_queue.h similarity index 96% rename from common_components/common_runtime/src/heap/collector/task_queue.h rename to common_components/heap/collector/task_queue.h index 72a763ef60f6e06be470f138dce48ec1c307dda5..998edcd31b22a666b5342d5bfa6d7565fd70462d 100755 --- a/common_components/common_runtime/src/heap/collector/task_queue.h +++ b/common_components/heap/collector/task_queue.h @@ -13,20 +13,20 @@ * limitations under the License. */ -#ifndef ARK_COMMON_TASK_QUEUE_H -#define ARK_COMMON_TASK_QUEUE_H +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_TASK_QUEUE_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_TASK_QUEUE_H #include #include #include -#include "common_components/common_runtime/src/common/page_allocator.h" -#include "common_components/common_runtime/src/heap/collector/gc_request.h" -#include "common_components/common_runtime/src/heap/heap.h" +#include "common_components/common/page_allocator.h" +#include "common_components/heap/collector/gc_request.h" +#include "common_components/heap/heap.h" #include "common_components/log/log.h" // gc task and task queue implementation -namespace panda { +namespace common { class GCTask { public: enum class GCTaskType : uint32_t { @@ -203,7 +203,7 @@ private: template class GCTaskQueue { - static_assert(std::is_base_of::value, "T is not a subclass of panda::GCTask"); + static_assert(std::is_base_of::value, "T is not a subclass of GCTask"); public: using GCTaskFilter = std::function; @@ -294,5 +294,6 @@ private: GCTaskQueueType syncTaskQueue_; GCLocklessTaskQueue asyncTaskQueue_; }; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_TASK_QUEUE_H diff --git a/common_components/common_runtime/src/heap/collector/trace_collector.cpp b/common_components/heap/collector/trace_collector.cpp similarity index 96% rename from common_components/common_runtime/src/heap/collector/trace_collector.cpp rename to common_components/heap/collector/trace_collector.cpp index 593a8b67d49cfad8c757cd2883b2d8b47ac968b2..f24bd7555ebf5ab0b8f91347b17db4963b1b38e2 100755 --- a/common_components/common_runtime/src/heap/collector/trace_collector.cpp +++ b/common_components/heap/collector/trace_collector.cpp @@ -12,14 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/collector/trace_collector.h" + +#include "common_components/heap/collector/trace_collector.h" + #include #include -#include "base/runtime_param.h" -#include "common_components/common_runtime/src/heap/allocator/alloc_buffer.h" +#include "common_components/heap/allocator/alloc_buffer.h" +#include "common_interfaces/base/runtime_param.h" -namespace panda { +namespace common { const size_t TraceCollector::MAX_MARKING_WORK_SIZE = 16; // fork task if bigger const size_t TraceCollector::MIN_MARKING_WORK_SIZE = 8; // forbid forking task if smaller @@ -68,7 +70,7 @@ public: void AddWorkStack(TraceCollector::WorkStack &&stack) { - ASSERT(!stack.empty()); + DCHECK_CC(!stack.empty()); std::lock_guard guard(mtx_); workStacks_.push_back(std::move(stack)); } @@ -103,7 +105,7 @@ public: void NotifyFinish() { std::lock_guard guard(mtx_); - ASSERT(!finished_); + DCHECK_CC(!finished_); finished_ = true; cv_.notify_all(); } @@ -114,7 +116,7 @@ private: std::vector workStacks_; }; -class ConcurrentMarkingTask : public Task { +class ConcurrentMarkingTask : public common::Task { public: ConcurrentMarkingTask(uint32_t id, TraceCollector &tc, Taskpool *pool, TaskPackMonitor &monitor, GlobalWorkStackQueue &globalQueue) @@ -198,7 +200,7 @@ void TraceCollector::ProcessMarkStack([[maybe_unused]] uint32_t threadIndex, Tas TraceObjectRefFields(obj, workStack, weakStack); #else - auto beforeSize = workStack.count(); + [[maybe_unused]] auto beforeSize = workStack.count(); TraceObjectRefFields(obj, workStack, weakStack); DLOG(TRACE, "[tracing] visit finished, workstack size: before=%d, after=%d, newly added=%d", beforeSize, workStack.count(), workStack.count() - beforeSize); @@ -295,7 +297,7 @@ bool TraceCollector::AddConcurrentTracingWork(WorkStack& workStack, GlobalWorkSt if (workStack.size() <= threadCount * MIN_MARKING_WORK_SIZE) { return false; // too less init tasks, which may lead to workload imbalance, add work rejected } - ASSERT(threadCount > 0); + DCHECK_CC(threadCount > 0); const size_t chunkSize = std::min(workStack.size() / threadCount + 1, MIN_MARKING_WORK_SIZE); // Split the current work stack into work tasks. while (!workStack.empty()) { @@ -308,30 +310,29 @@ bool TraceCollector::AddConcurrentTracingWork(WorkStack& workStack, GlobalWorkSt void TraceCollector::TraceRoots(WorkStack& workStack) { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::TraceRoots", ""); - ARK_COMMON_PHASE_TIMER("TraceRoots"); + COMMON_PHASE_TIMER("TraceRoots"); VLOG(REPORT, "roots size: %zu", workStack.size()); - Taskpool *threadPool = GetThreadPool(); - ASSERT_LOGF(threadPool != nullptr, "null thread pool"); + ASSERT_LOGF(GetThreadPool() != nullptr, "null thread pool"); // use fewer threads and lower priority for concurrent mark. const uint32_t maxWorkers = GetGCThreadCount(true) - 1; VLOG(REPORT, "Concurrent mark with %u threads, workStack: %zu", (maxWorkers + 1), workStack.size()); { - ARK_COMMON_PHASE_TIMER("Concurrent marking"); + COMMON_PHASE_TIMER("Concurrent marking"); TracingImpl(workStack, maxWorkers > 0); } { #ifdef ARK_USE_SATB_BARRIER - ARK_COMMON_PHASE_TIMER("Concurrent re-marking"); + COMMON_PHASE_TIMER("Concurrent re-marking"); ConcurrentReMark(workStack, maxWorkers > 0); ProcessWeakReferences(); #else OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::ReMark[STW]", ""); if (!BaseRuntime::GetInstance()->GetMutatorManager().WorldStopped()) { - ARK_COMMON_PHASE_TIMER("STW re-marking"); + COMMON_PHASE_TIMER("STW re-marking"); ScopedStopTheWorld stw("final-mark", true, GCPhase::GC_PHASE_FINAL_MARK); EnumerateAllRoots(workStack); TracingImpl(workStack, maxWorkers > 0); @@ -345,7 +346,7 @@ void TraceCollector::TraceRoots(WorkStack& workStack) { // weakref -> strong ref - ARK_COMMON_PHASE_TIMER("concurrent resurrection"); + COMMON_PHASE_TIMER("concurrent resurrection"); DoResurrection(workStack); } @@ -355,7 +356,7 @@ void TraceCollector::TraceRoots(WorkStack& workStack) bool TraceCollector::MarkSatbBuffer(WorkStack& workStack) { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::MarkSatbBuffer", ""); - ARK_COMMON_PHASE_TIMER("MarkSatbBuffer"); + COMMON_PHASE_TIMER("MarkSatbBuffer"); if (!workStack.empty()) { workStack.clear(); } @@ -472,7 +473,7 @@ void TraceCollector::EnumFinalizerProcessorRoots(RootSet& rootSet) const collectorResources_.GetFinalizerProcessor().VisitGCRoots(visitor); } -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG void TraceCollector::DumpHeap(const CString& tag) { ASSERT_LOGF(MutatorManager::Instance().WorldStopped(), "Not In STW"); @@ -514,8 +515,8 @@ void TraceCollector::DumpRoots(LogType logType) void TraceCollector::PreGarbageCollection(bool isConcurrent) { VLOG(REPORT, "Begin GC log. GCReason: %s, Current allocated %s, Current threshold %s", - g_gcRequests[gcReason_].name, Pretty(Heap::GetHeap().GetAllocatedSize()).Str(), - Pretty(Heap::GetHeap().GetCollector().GetGCStats().GetThreshold()).Str()); + g_gcRequests[gcReason_].name, Pretty(Heap::GetHeap().GetAllocatedSize()), + Pretty(Heap::GetHeap().GetCollector().GetGCStats().GetThreshold())); // SatbBuffer should be initialized before concurrent enumeration. SatbBuffer::Instance().Init(); @@ -524,7 +525,7 @@ void TraceCollector::PreGarbageCollection(bool isConcurrent) GetGCStats().reason = gcReason_; GetGCStats().async = !g_gcRequests[gcReason_].IsSyncGC(); GetGCStats().isConcurrentMark = isConcurrent; -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG DumpBeforeGC(); #endif OHOS_HITRACE_COUNT(HITRACE_LEVEL_MAX, "ARK_RT_pre_GC_HeapSize", @@ -538,7 +539,7 @@ void TraceCollector::PostGarbageCollection(uint64_t gcIndex) PagePool::Instance().Trim(); collectorResources_.NotifyGCFinished(gcIndex); -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG DumpAfterGC(); #endif } @@ -647,7 +648,7 @@ void TraceCollector::CopyObject(const BaseObject& fromObj, BaseObject& toObj, si uintptr_t to = reinterpret_cast(&toObj); LOGE_IF(memmove_s(reinterpret_cast(to), size, reinterpret_cast(from), size) != EOK) << "memmove_s fail"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanFixShadow(reinterpret_cast(from), reinterpret_cast(to), size); #endif } @@ -685,7 +686,7 @@ void TraceCollector::RunGarbageCollection(uint64_t gcIndex, GCReason reason) { std::ostringstream oss; const int prec = 3; - oss << "total gc time: " << Pretty(gcTimeNs / NS_PER_US).Str() << " us, collection rate "; + oss << "total gc time: " << Pretty(gcTimeNs / NS_PER_US) << " us, collection rate "; oss << std::setprecision(prec) << rate << " MB/s"; LOG_COMMON(INFO) << oss.str(); } @@ -729,4 +730,4 @@ void TraceCollector::ExemptFromSpace() space.ExemptFromSpace(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/collector/trace_collector.h b/common_components/heap/collector/trace_collector.h similarity index 90% rename from common_components/common_runtime/src/heap/collector/trace_collector.h rename to common_components/heap/collector/trace_collector.h index 425146e12627809eb976b062e47a8af8ae57266b..ad55f81367846692e7f34e1265165fc1b6de0a4b 100755 --- a/common_components/common_runtime/src/heap/collector/trace_collector.h +++ b/common_components/heap/collector/trace_collector.h @@ -12,20 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COLLECTOR_TRACING_H -#define ARK_COMMON_COLLECTOR_TRACING_H + +#ifndef COMMON_COMPONENTS_HEAP_COLLECTOR_TRACE_COLLECTOR_H +#define COMMON_COMPONENTS_HEAP_COLLECTOR_TRACE_COLLECTOR_H #include #include -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/collector/collector_resources.h" -#include "common_components/common_runtime/src/common/mark_work_stack.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/heap/collector/copy_data_manager.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/collector/collector_resources.h" +#include "common_components/common/mark_work_stack.h" +#include "common_components/heap/allocator/region_space.h" +#include "common_components/heap/collector/copy_data_manager.h" +#include "common_components/mutator/mutator_manager.h" -namespace panda { +namespace common { class GlobalWorkStackQueue; // number of nanoseconds in a microsecond. @@ -37,9 +38,9 @@ constexpr uint64_t NS_PER_S = 1000000000; constexpr int MARK_PREFETCH_DISTANCE = 16; // when it is changed, remember to change MACRO_MARK_PREFETCH_DISTANCE. // Small queue implementation, for prefetching. -#define ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE_LOG 5UL -#define ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE (1UL << ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE_LOG) -#if ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE <= MACRO_MARK_PREFETCH_DISTANCE +#define COMMON_MAX_PREFETCH_QUEUE_SIZE_LOG 5UL +#define COMMON_MAX_PREFETCH_QUEUE_SIZE (1UL << COMMON_MAX_PREFETCH_QUEUE_SIZE_LOG) +#if COMMON_MAX_PREFETCH_QUEUE_SIZE <= MACRO_MARK_PREFETCH_DISTANCE #error Prefetch queue size must be strictly greater than prefetch distance. #endif @@ -51,7 +52,7 @@ public: { size_t t = tail_; elems_[t] = objaddr; - tail_ = (t + 1) & (ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); + tail_ = (t + 1) & (COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); __builtin_prefetch(reinterpret_cast(objaddr), 0, PREFETCH_LOCALITY); } @@ -60,12 +61,12 @@ public: { size_t h = head_; BaseObject* objaddr = elems_[h]; - head_ = (h + 1) & (ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); + head_ = (h + 1) & (COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); return objaddr; } - inline size_t Length() const { return (tail_ - head_) & (ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); } + inline size_t Length() const { return (tail_ - head_) & (COMMON_MAX_PREFETCH_QUEUE_SIZE - 1UL); } inline bool Empty() const { return head_ == tail_; } @@ -73,7 +74,7 @@ public: private: static constexpr int PREFETCH_LOCALITY = 3; - BaseObject* elems_[ARK_COMMON_MAX_PREFETCH_QUEUE_SIZE]; + BaseObject* elems_[COMMON_MAX_PREFETCH_QUEUE_SIZE]; size_t distance_; size_t tail_; size_t head_; @@ -125,7 +126,7 @@ public: void Init(const RuntimeParam& param) override; void Fini() override; -#ifndef NDEBUG +#if defined(GCINFO_DEBUG) && GCINFO_DEBUG void DumpRoots(LogType logType); void DumpHeap(const CString& tag); void DumpBeforeGC() @@ -321,5 +322,6 @@ private: void VisitStaticRoots(const RefFieldVisitor& visitor) const; void VisitFinalizerRoots(const RootVisitor& visitor) const; }; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_COLLECTOR_TRACE_COLLECTOR_H diff --git a/common_components/common_runtime/src/heap/heap.cpp b/common_components/heap/heap.cpp similarity index 92% rename from common_components/common_runtime/src/heap/heap.cpp rename to common_components/heap/heap.cpp index 87e9ab4d7e66874e289bb1ee961a779cdace49c9..2bb733ce449f2749f4d593f875f2ea9137868079 100644 --- a/common_components/common_runtime/src/heap/heap.cpp +++ b/common_components/heap/heap.cpp @@ -13,17 +13,17 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/heap/heap.h" - -#include "common_components/common_runtime/src/heap/collector/collector_proxy.h" -#include "common_components/common_runtime/src/heap/collector/collector_resources.h" -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" -#include "common_components/common_runtime/src/heap/w_collector/enum_barrier.h" -#include "common_components/common_runtime/src/heap/w_collector/trace_barrier.h" -#include "common_components/common_runtime/src/heap/w_collector/post_trace_barrier.h" -#include "common_components/common_runtime/src/heap/w_collector/preforward_barrier.h" -#include "common_components/common_runtime/src/heap/w_collector/copy_barrier.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/heap/heap.h" + +#include "common_components/heap/collector/collector_proxy.h" +#include "common_components/heap/collector/collector_resources.h" +#include "common_components/heap/w_collector/idle_barrier.h" +#include "common_components/heap/w_collector/enum_barrier.h" +#include "common_components/heap/w_collector/trace_barrier.h" +#include "common_components/heap/w_collector/post_trace_barrier.h" +#include "common_components/heap/w_collector/preforward_barrier.h" +#include "common_components/heap/w_collector/copy_barrier.h" +#include "common_components/mutator/mutator_manager.h" #include "common_interfaces/base_runtime.h" #if defined(_WIN64) #include @@ -32,7 +32,7 @@ #if defined(__APPLE__) #include #endif -namespace panda { +namespace common { Barrier** Heap::currentBarrierPtr = nullptr; Barrier* Heap::stwBarrierPtr = nullptr; HeapAddress Heap::heapStartAddr = 0; @@ -275,7 +275,7 @@ ssize_t HeapImpl::GetHeapPhysicalMemorySize() const #else ssize_t HeapImpl::GetHeapPhysicalMemorySize() const { - CString smapsFile = CString("/proc/") + CString(panda::GetPid()) + "/smaps"; + CString smapsFile = CString("/proc/") + CString(GetPid()) + "/smaps"; ScopedFileHandler fileHandler(smapsFile.Str(), "r"); FILE* file = fileHandler.GetFile(); if (file == nullptr) { @@ -328,4 +328,4 @@ CollectorResources& HeapImpl::GetCollectorResources() { return collectorResource void HeapImpl::StopGCWork() { collectorResources.StopGCWork(); } void HeapImpl::RegisterAllocBuffer(AllocationBuffer& buffer) { GetAllocator().RegisterAllocBuffer(buffer); } -} // end namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/heap.h b/common_components/heap/heap.h similarity index 91% rename from common_components/common_runtime/src/heap/heap.h rename to common_components/heap/heap.h index 72f0ad33b05c71a744697dafdd680d9dba2bb473..dfedc9ae67e5f2547810e4ae20dd89e58dd74753 100755 --- a/common_components/common_runtime/src/heap/heap.h +++ b/common_components/heap/heap.h @@ -12,20 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_HEAP_H -#define ARK_COMMON_HEAP_H + +#ifndef COMMON_COMPONENTS_HEAP_HEAP_H +#define COMMON_COMPONENTS_HEAP_HEAP_H #include #include -#include "common_components/common_runtime/src/base/immortal_wrapper.h" -#include "common_components/common_runtime/src/common/base_object.h" -#include "common_components/common_runtime/src/common/type_def.h" -#include "common_components/common_runtime/src/heap/barrier/barrier.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" +#include "common_components/base/immortal_wrapper.h" +#include "common_components/common/base_object.h" +#include "common_components/common/type_def.h" +#include "common_components/heap/barrier/barrier.h" +#include "common_components/heap/collector/collector.h" #include "common_interfaces/base/runtime_param.h" -namespace panda { +namespace common { class Allocator; class AllocationBuffer; class FinalizerProcessor; @@ -148,6 +149,6 @@ public: static Barrier* stwBarrierPtr; // record nonGC barrier static HeapAddress heapStartAddr; static HeapAddress heapCurrentEnd; -}; // end class Heap -} // end namespace panda +}; // class Heap +} // namespace common #endif diff --git a/common_components/heap/heap_allocator.cpp b/common_components/heap/heap_allocator.cpp index f4ca627d82d7366853577ecc3bd5dc5d8f6e70b2..d93cd4dca4f156f56778dd02a186abe2dd06e104 100755 --- a/common_components/heap/heap_allocator.cpp +++ b/common_components/heap/heap_allocator.cpp @@ -15,12 +15,12 @@ #include "common_interfaces/heap/heap_allocator.h" -#include "common_components/common_runtime/src/common/type_def.h" -#include "common_components/common_runtime/src/heap_manager.h" -#include "common_components/common_runtime/src/heap/allocator/region_manager.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" +#include "common_components/common/type_def.h" +#include "common_components/heap/heap_manager.h" +#include "common_components/heap/allocator/region_manager.h" +#include "common_components/heap/allocator/region_space.h" -namespace panda { +namespace common { Address HeapAllocator::Allocate(size_t size, LanguageType language) { auto address = HeapManager::Allocate(size); @@ -93,4 +93,4 @@ Address HeapAllocator::AllocateLargeRegion(size_t size) return manager.AllocLargeRegion(size); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap_manager.cpp b/common_components/heap/heap_manager.cpp similarity index 71% rename from common_components/common_runtime/src/heap_manager.cpp rename to common_components/heap/heap_manager.cpp index 1ba58b1c1a647691cc69100c2ae858ccb33c71fb..7300bf391e29682883cea96e9300352ddf7652eb 100755 --- a/common_components/common_runtime/src/heap_manager.cpp +++ b/common_components/heap/heap_manager.cpp @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap_manager.h" +#include "common_components/heap/heap_manager.h" -#include "common_components/common_runtime/src/heap/heap.h" -#include "common_components/common_runtime/src/heap/collector/collector.h" -#include "common_components/common_runtime/src/heap/allocator/region_manager.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" +#include "common_components/heap/heap.h" +#include "common_components/heap/collector/collector.h" +#include "common_components/heap/allocator/region_manager.h" +#include "common_components/heap/allocator/region_space.h" -namespace panda { +namespace common { HeapManager::HeapManager() {} void HeapManager::RequestGC(GCReason reason, bool async) { @@ -45,13 +45,13 @@ void HeapManager::StopRuntimeThreads() { Heap::GetHeap().StopRuntimeThreads(); } void HeapManager::SetReadOnlyToROSpace() { - RegionManager& manager = reinterpret_cast(panda::Heap::GetHeap().GetAllocator()).GetRegionManager(); + RegionManager& manager = reinterpret_cast(Heap::GetHeap().GetAllocator()).GetRegionManager(); manager.SetReadOnlyToRORegionList(); } void HeapManager::ClearReadOnlyFromROSpace() { - RegionManager& manager = reinterpret_cast(panda::Heap::GetHeap().GetAllocator()).GetRegionManager(); + RegionManager& manager = reinterpret_cast(Heap::GetHeap().GetAllocator()).GetRegionManager(); manager.ClearReadOnlyFromRORegionList(); } @@ -59,4 +59,4 @@ bool HeapManager::IsInROSpace(BaseObject *obj) { return RegionSpace::IsReadOnlyObject(obj); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap_manager.h b/common_components/heap/heap_manager.h similarity index 83% rename from common_components/common_runtime/src/heap_manager.h rename to common_components/heap/heap_manager.h index 8942f4ad59260798e0aa44cca738fb3e2d6191f8..6cf3a55e8328dae51c9d610b8845949f1021a067 100755 --- a/common_components/common_runtime/src/heap_manager.h +++ b/common_components/heap/heap_manager.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_HEAP_MANAGER_H -#define ARK_COMMON_HEAP_MANAGER_H -#include "common_components/common_runtime/src/common/type_def.h" -#include "common_components/common_runtime/src/heap/collector/gc_request.h" +#ifndef COMMON_COMPONENTS_HEAP_HEAP_MANAGER_H +#define COMMON_COMPONENTS_HEAP_HEAP_MANAGER_H + +#include "common_components/common/type_def.h" +#include "common_components/heap/collector/gc_request.h" #include "common_interfaces/base/runtime_param.h" -namespace panda { +namespace common { class BaseObject; // replace this for Heap. class HeapManager { @@ -46,5 +47,5 @@ public: void ClearReadOnlyFromROSpace(); bool IsInROSpace(BaseObject *obj); }; -} // namespace panda -#endif // ARK_COMMON_HEAP_MANAGER_H +} // namespace common +#endif // COMMON_COMPONENTS_HEAP_HEAP_MANAGER_H diff --git a/common_components/heap/heap_visitor.cpp b/common_components/heap/heap_visitor.cpp index 938268c93beca61001a81c0d8fc1f3e8c357a3f1..f08d132dc29331cab72608d4d4a07ea5688572f8 100755 --- a/common_components/heap/heap_visitor.cpp +++ b/common_components/heap/heap_visitor.cpp @@ -17,7 +17,7 @@ #include "common_components/base_runtime/hooks.h" -namespace panda { +namespace common { void VisitRoots(const RefFieldVisitor &visitor, bool isMark) { VisitDynamicRoots(visitor, isMark); @@ -27,4 +27,4 @@ void VisitWeakRoots(const WeakRefFieldVisitor &visitor) { VisitDynamicWeakRoots(visitor); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/heap_work.h b/common_components/heap/heap_work.h similarity index 87% rename from common_components/common_runtime/src/heap/heap_work.h rename to common_components/heap/heap_work.h index 28ce0fea097b3c78825b13e37e65163d53f4b5af..46144220deef53e5d53c4cc96f9fc4ca2c6e7c10 100755 --- a/common_components/common_runtime/src/heap/heap_work.h +++ b/common_components/heap/heap_work.h @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_HEAP_WORK_H -#define ARK_COMMON_HEAP_WORK_H + +#ifndef COMMON_COMPONENTS_HEAP_HEAP_WORK_H +#define COMMON_COMPONENTS_HEAP_HEAP_WORK_H #include #include @@ -23,7 +24,7 @@ #include #include -namespace panda { +namespace common { class HeapWork { public: virtual void Execute(size_t threadId) = 0; @@ -40,6 +41,6 @@ public: private: std::function func_; }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_HEAP_WORK_H +#endif // COMMON_COMPONENTS_HEAP_HEAP_WORK_H diff --git a/common_components/common_runtime/src/heap/verification.cpp b/common_components/heap/verification.cpp similarity index 99% rename from common_components/common_runtime/src/heap/verification.cpp rename to common_components/heap/verification.cpp index 56fa2ae5a141803902c13d298fbcf44186d8ed4b..be4a3b552ce61188129c3777be5d4abbc6807880 100755 --- a/common_components/common_runtime/src/heap/verification.cpp +++ b/common_components/heap/verification.cpp @@ -48,9 +48,7 @@ * openharmony: * ./build_system.sh --gn-args="ets_runtime_enable_heap_verify=true ets_runtime_enable_rb_dfx=true" ... */ - -namespace panda { - +namespace common { void VisitRoots(const RefFieldVisitor& visitorFunc, bool isMark); void VisitWeakRoots(const WeakRefFieldVisitor& visitorFunc); @@ -505,4 +503,4 @@ void WVerify::DisableReadBarrierDFX(WCollector& collector) } } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/verification.h b/common_components/heap/verification.h similarity index 97% rename from common_components/common_runtime/src/heap/verification.h rename to common_components/heap/verification.h index 3bede7a004fb95dc3f24e8fd0c2a56d4fb41b31d..45cd6177219aab9df87e9d843264370e8fa6771d 100755 --- a/common_components/common_runtime/src/heap/verification.h +++ b/common_components/heap/verification.h @@ -18,7 +18,7 @@ #include "w_collector/w_collector.h" -namespace panda { +namespace common { class WVerify { public: @@ -36,6 +36,6 @@ private: static void DisableReadBarrierDFXInternal(RegionSpace &space); }; -} // namespace panda +} // namespace common #endif // VERIFICATION_H diff --git a/common_components/common_runtime/src/heap/w_collector/copy_barrier.cpp b/common_components/heap/w_collector/copy_barrier.cpp similarity index 91% rename from common_components/common_runtime/src/heap/w_collector/copy_barrier.cpp rename to common_components/heap/w_collector/copy_barrier.cpp index a95d1096cf4547c1c2fa12c8575370025b4e6ee7..7084fd00071c1eea1efce693e5b78ebf71be7308 100755 --- a/common_components/common_runtime/src/heap/w_collector/copy_barrier.cpp +++ b/common_components/heap/w_collector/copy_barrier.cpp @@ -12,16 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/copy_barrier.h" +#include "common_components/heap/w_collector/copy_barrier.h" -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/common/scoped_object_lock.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/base/sys_call.h" +#include "common_components/common/scoped_object_lock.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { BaseObject* CopyBarrier::ReadRefField(BaseObject* obj, RefField& field) const { do { @@ -127,4 +127,4 @@ void CopyBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MInd LOG_COMMON(FATAL) << "Unresolved fatal"; UNREACHABLE_CC(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/copy_barrier.h b/common_components/heap/w_collector/copy_barrier.h similarity index 86% rename from common_components/common_runtime/src/heap/w_collector/copy_barrier.h rename to common_components/heap/w_collector/copy_barrier.h index 5dc4f5178962548c492504dc68db6bcc03112b22..36e9310851a198404768bf56e94d62667bdb4557 100755 --- a/common_components/common_runtime/src/heap/w_collector/copy_barrier.h +++ b/common_components/heap/w_collector/copy_barrier.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_COPY_BARRIER_H -#define ARK_COMMON_COPY_BARRIER_H -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_COPY_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_COPY_BARRIER_H -namespace panda { +#include "common_components/heap/w_collector/idle_barrier.h" + +namespace common { // CopyBarrier is the barrier for concurrent forwarding. class CopyBarrier : public IdleBarrier { public: @@ -40,5 +41,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_COPY_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_COPY_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/enum_barrier.cpp b/common_components/heap/w_collector/enum_barrier.cpp similarity index 95% rename from common_components/common_runtime/src/heap/w_collector/enum_barrier.cpp rename to common_components/heap/w_collector/enum_barrier.cpp index ca25b946a08ca970862bdac058126e6f3a8a2069..0a3fe6babff64e129bb1ef5a48199acde607487c 100755 --- a/common_components/common_runtime/src/heap/w_collector/enum_barrier.cpp +++ b/common_components/heap/w_collector/enum_barrier.cpp @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/enum_barrier.h" +#include "common_components/heap/w_collector/enum_barrier.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { // Because gc thread will also have impact on tagged pointer in enum and trace phase, // so we don't expect reading barrier have the ability to modify the referent field. BaseObject* EnumBarrier::ReadRefField(BaseObject* obj, RefField& field) const @@ -109,7 +109,7 @@ void EnumBarrier::WriteStruct(BaseObject* obj, HeapAddress dst, size_t dstLen, H std::atomic_thread_fence(std::memory_order_seq_cst); LOGF_CHECK(memcpy_s(reinterpret_cast(dst), dstLen, reinterpret_cast(src), srcLen) == EOK) << "memcpy_s failed"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dst), dstLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(src), srcLen); #endif @@ -189,4 +189,4 @@ void EnumBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MInd UNREACHABLE_CC(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/enum_barrier.h b/common_components/heap/w_collector/enum_barrier.h similarity index 88% rename from common_components/common_runtime/src/heap/w_collector/enum_barrier.h rename to common_components/heap/w_collector/enum_barrier.h index ae8650cf259aeefe996425c3d9b80b59ad581c66..245dcdfbd6af50988f7486b6e241a6ca7a55a27d 100755 --- a/common_components/common_runtime/src/heap/w_collector/enum_barrier.h +++ b/common_components/heap/w_collector/enum_barrier.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_ENUM_BARRIER_H -#define ARK_COMMON_ENUM_BARRIER_H -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_ENUM_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_ENUM_BARRIER_H -namespace panda { +#include "common_components/heap/w_collector/idle_barrier.h" + +namespace common { // EnumBarrier is the barrier for concurrent enum phase class EnumBarrier : public IdleBarrier { public: @@ -46,5 +47,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_ENUM_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_ENUM_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/idle_barrier.cpp b/common_components/heap/w_collector/idle_barrier.cpp similarity index 93% rename from common_components/common_runtime/src/heap/w_collector/idle_barrier.cpp rename to common_components/heap/w_collector/idle_barrier.cpp index 708551b1462b140526767fb910aaf7652c9cc125..87955c89119b39b57738a84416628f3d7ebc6527 100755 --- a/common_components/common_runtime/src/heap/w_collector/idle_barrier.cpp +++ b/common_components/heap/w_collector/idle_barrier.cpp @@ -12,15 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#include "common_components/heap/w_collector/idle_barrier.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif #include "securec.h" -namespace panda { +namespace common { BaseObject* IdleBarrier::ReadRefField(BaseObject* obj, RefField& field) const { RefField<> oldField(field); @@ -101,7 +101,7 @@ void IdleBarrier::WriteBarrier(BaseObject* obj, RefField& field, BaseObje void IdleBarrier::WriteStruct(BaseObject* obj, HeapAddress dst, size_t dstLen, HeapAddress src, size_t srcLen) const { CHECK_CC(memcpy_s(reinterpret_cast(dst), dstLen, reinterpret_cast(src), srcLen) == EOK); -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) CHECK_CC(srcLen == dstLen); Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dst), dstLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(src), srcLen); @@ -123,9 +123,9 @@ void IdleBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MInd LOGF_CHECK(memmove_s(reinterpret_cast(dstField), dstSize, reinterpret_cast(srcField), srcSize) == EOK) << "memmove_s failed"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dstField), dstSize); Sanitizer::TsanReadMemoryRange(reinterpret_cast(srcField), srcSize); #endif } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/idle_barrier.h b/common_components/heap/w_collector/idle_barrier.h similarity index 89% rename from common_components/common_runtime/src/heap/w_collector/idle_barrier.h rename to common_components/heap/w_collector/idle_barrier.h index c3afc900060dbb40e4057a853a54235abf77c710..6a8db3566c41814623033dc5f3f12d3b83a20fe3 100755 --- a/common_components/common_runtime/src/heap/w_collector/idle_barrier.h +++ b/common_components/heap/w_collector/idle_barrier.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_IDLE_BARRIER_H -#define ARK_COMMON_IDLE_BARRIER_H -#include "common_components/common_runtime/src/heap/barrier/barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_IDLE_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_IDLE_BARRIER_H -namespace panda { +#include "common_components/heap/barrier/barrier.h" + +namespace common { // IdleBarrier is the barrier for concurrent enum phase class IdleBarrier : public Barrier { public: @@ -46,5 +47,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_IDLE_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_IDLE_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/post_trace_barrier.cpp b/common_components/heap/w_collector/post_trace_barrier.cpp similarity index 93% rename from common_components/common_runtime/src/heap/w_collector/post_trace_barrier.cpp rename to common_components/heap/w_collector/post_trace_barrier.cpp index 5f60b9ddba714ea973ac7acff2fd68df47853f88..1a2d876d907683fe5224770b8294933060356e20 100755 --- a/common_components/common_runtime/src/heap/w_collector/post_trace_barrier.cpp +++ b/common_components/heap/w_collector/post_trace_barrier.cpp @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/post_trace_barrier.h" +#include "common_components/heap/w_collector/post_trace_barrier.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { BaseObject* PostTraceBarrier::ReadRefField(BaseObject* obj, RefField& field) const { RefField<> tmpField(field); @@ -55,7 +55,7 @@ void PostTraceBarrier::WriteStruct(BaseObject* obj, HeapAddress dst, size_t dstL CHECK_CC(obj != nullptr); CHECK_CC(memcpy_s(reinterpret_cast(dst), dstLen, reinterpret_cast(src), srcLen) == EOK); -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dst), dstLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(src), srcLen); #endif @@ -129,9 +129,9 @@ void PostTraceBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, LOGF_CHECK(memmove_s(reinterpret_cast(dstField), dstSize, reinterpret_cast(srcField), srcSize) == EOK) << "memmove_s failed"; -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dstField), dstSize); Sanitizer::TsanReadMemoryRange(reinterpret_cast(srcField), srcSize); #endif } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/post_trace_barrier.h b/common_components/heap/w_collector/post_trace_barrier.h similarity index 88% rename from common_components/common_runtime/src/heap/w_collector/post_trace_barrier.h rename to common_components/heap/w_collector/post_trace_barrier.h index b2038c79102294a6a1df495b60d97f7b1a17f8d5..987a98e5c5825988bc49cdb22d8ccce3a16cd990 100755 --- a/common_components/common_runtime/src/heap/w_collector/post_trace_barrier.h +++ b/common_components/heap/w_collector/post_trace_barrier.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_POST_TRACE_BARRIER_H -#define ARK_COMMON_POST_TRACE_BARRIER_H -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_POST_TRACE_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_POST_TRACE_BARRIER_H -namespace panda { +#include "common_components/heap/w_collector/idle_barrier.h" + +namespace common { // PostTraceBarrier is the barrier for concurrent marking phase. // rename to TracingBarrier. Marking is confusing in consideration of MarkObject. class PostTraceBarrier : public IdleBarrier { @@ -44,5 +45,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_MARK_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_MARK_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/preforward_barrier.cpp b/common_components/heap/w_collector/preforward_barrier.cpp similarity index 91% rename from common_components/common_runtime/src/heap/w_collector/preforward_barrier.cpp rename to common_components/heap/w_collector/preforward_barrier.cpp index d0f82968063294cb169ebd0946dbe0878adff39b..ca6f25b5a0331b3b84a2e12cbd24852ddf93ab94 100755 --- a/common_components/common_runtime/src/heap/w_collector/preforward_barrier.cpp +++ b/common_components/heap/w_collector/preforward_barrier.cpp @@ -12,16 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/preforward_barrier.h" +#include "common_components/heap/w_collector/preforward_barrier.h" -#include "common_components/common_runtime/src/base/sys_call.h" -#include "common_components/common_runtime/src/common/scoped_object_lock.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/base/sys_call.h" +#include "common_components/common/scoped_object_lock.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { BaseObject* PreforwardBarrier::ReadRefField(BaseObject* obj, RefField& field) const { do { @@ -130,4 +130,4 @@ void PreforwardBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField LOG_COMMON(FATAL) << "Unresolved fatal"; UNREACHABLE_CC(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/preforward_barrier.h b/common_components/heap/w_collector/preforward_barrier.h similarity index 84% rename from common_components/common_runtime/src/heap/w_collector/preforward_barrier.h rename to common_components/heap/w_collector/preforward_barrier.h index 855c1f3f2ae882b9c90b20b9e823f51ac9c0ac72..82fc86f039cf72c3a183fb5a4e2c0ea50d32a035 100755 --- a/common_components/common_runtime/src/heap/w_collector/preforward_barrier.h +++ b/common_components/heap/w_collector/preforward_barrier.h @@ -12,13 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_TRACE_FIX_BARRIER_H -#define ARK_COMMON_TRACE_FIX_BARRIER_H -#include "common_components/common_runtime/src/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_TRACE_FIX_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_TRACE_FIX_BARRIER_H -namespace panda { +#include "common_components/heap/allocator/region_space.h" +#include "common_components/heap/w_collector/idle_barrier.h" + +namespace common { // PreforwardBarrier is the barrier for concurrent copying gc in fixup stage class PreforwardBarrier : public IdleBarrier { public: @@ -41,5 +42,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_TRACE_FIX_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_TRACE_FIX_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/trace_barrier.cpp b/common_components/heap/w_collector/trace_barrier.cpp similarity index 95% rename from common_components/common_runtime/src/heap/w_collector/trace_barrier.cpp rename to common_components/heap/w_collector/trace_barrier.cpp index 63ea1eb94c1da2a85ecdd3f9f0c831abe2b07692..2b5d3e1fde2ec92649c82628502f3f40938bcb4a 100755 --- a/common_components/common_runtime/src/heap/w_collector/trace_barrier.cpp +++ b/common_components/heap/w_collector/trace_barrier.cpp @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/trace_barrier.h" +#include "common_components/heap/w_collector/trace_barrier.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#if defined(ARKCOMMON_TSAN_SUPPORT) -#include "common_components/common_runtime/src/sanitizer/sanitizer_interface.h" +#include "common_components/mutator/mutator.h" +#if defined(COMMON_TSAN_SUPPORT) +#include "common_components/sanitizer/sanitizer_interface.h" #endif -namespace panda { +namespace common { // Because gc thread will also have impact on tagged pointer in enum and trace phase, // so we don't expect reading barrier have the ability to modify the referent field. BaseObject* TraceBarrier::ReadRefField(BaseObject* obj, RefField& field) const @@ -109,7 +109,7 @@ void TraceBarrier::WriteStruct(BaseObject* obj, HeapAddress dst, size_t dstLen, std::atomic_thread_fence(std::memory_order_seq_cst); CHECK_CC(memcpy_s(reinterpret_cast(dst), dstLen, reinterpret_cast(src), srcLen) == EOK); -#if defined(ARKCOMMON_TSAN_SUPPORT) +#if defined(COMMON_TSAN_SUPPORT) Sanitizer::TsanWriteMemoryRange(reinterpret_cast(dst), dstLen); Sanitizer::TsanReadMemoryRange(reinterpret_cast(src), srcLen); #endif @@ -186,4 +186,4 @@ void TraceBarrier::CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIn UNREACHABLE_CC(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/trace_barrier.h b/common_components/heap/w_collector/trace_barrier.h similarity index 89% rename from common_components/common_runtime/src/heap/w_collector/trace_barrier.h rename to common_components/heap/w_collector/trace_barrier.h index 0d381729572ae95753da4f0fcbc21a5fd705d0a3..9397728a9729d8044dd5022a9360b2a756da00e5 100755 --- a/common_components/common_runtime/src/heap/w_collector/trace_barrier.h +++ b/common_components/heap/w_collector/trace_barrier.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_TRACE_BARRIER_H -#define ARK_COMMON_TRACE_BARRIER_H -#include "common_components/common_runtime/src/heap/w_collector/idle_barrier.h" +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_TRACE_BARRIER_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_TRACE_BARRIER_H -namespace panda { +#include "common_components/heap/w_collector/idle_barrier.h" + +namespace common { // TraceBarrier is the barrier for concurrent marking phase. // rename to TracingBarrier. Marking is confusing in consideration of MarkObject. class TraceBarrier : public IdleBarrier { @@ -44,5 +45,6 @@ public: void CopyStructArray(BaseObject* dstObj, HeapAddress dstField, MIndex dstSize, BaseObject* srcObj, HeapAddress srcField, MIndex srcSize) const override; }; -} // namespace panda -#endif // ~ARK_COMMON_MARK_BARRIER_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_MARK_BARRIER_H diff --git a/common_components/common_runtime/src/heap/w_collector/w_collector.cpp b/common_components/heap/w_collector/w_collector.cpp similarity index 95% rename from common_components/common_runtime/src/heap/w_collector/w_collector.cpp rename to common_components/heap/w_collector/w_collector.cpp index 0b28f2ed18094ef2ef7c1682a3b79d926b5e1e8b..548776f4e48213cb7f9c53fa2c3e6aeb9473d7cf 100755 --- a/common_components/common_runtime/src/heap/w_collector/w_collector.cpp +++ b/common_components/heap/w_collector/w_collector.cpp @@ -12,16 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/heap/w_collector/w_collector.h" +#include "common_components/heap/w_collector/w_collector.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" -#include "common_interfaces/heap/heap_visitor.h" +#include "common_components/base_runtime/hooks.h" #include "common_components/log/log.h" +#include "common_components/mutator/mutator_manager.h" +#include "common_components/heap/verification.h" +#include "common_interfaces/heap/heap_visitor.h" #include "common_interfaces/objects/ref_field.h" -#include "common_components/base_runtime/hooks.h" -#include "verification.h" -namespace panda { +namespace common { bool WCollector::IsUnmovableFromObject(BaseObject* obj) const { // filter const string object. @@ -230,7 +230,8 @@ void WCollector::TraceRefField(BaseObject* obj, RefField<>& field, WorkStack& wo // field is tagged object, should be in heap DCHECK_CC(Heap::IsHeapAddress(targetObj)); - DLOG(TRACE, "trace obj %p ref@%p: %p<%p>(%zu)", obj, &field, targetObj, targetObj->GetTypeInfo(), targetObj->GetSize()); + DLOG(TRACE, "trace obj %p ref@%p: %p<%p>(%zu)", + obj, &field, targetObj, targetObj->GetTypeInfo(), targetObj->GetSize()); if (region->IsNewObjectSinceTrace(targetObj)) { DLOG(TRACE, "trace: skip new obj %p<%p>(%zu)", targetObj, targetObj->GetTypeInfo(), targetObj->GetSize()); return; @@ -307,7 +308,7 @@ BaseObject* WCollector::ForwardUpdateRawRef(ObjectRef& root) void WCollector::PreforwardStaticRoots() { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::PreforwardStaticRoots", ""); - panda::RefFieldVisitor visitor = [this](RefField<>& refField) { + RefFieldVisitor visitor = [this](RefField<>& refField) { RefField<> oldField(refField); BaseObject* oldObj = oldField.GetTargetObject(); DLOG(FIX, "visit raw-ref @%p: %p", &refField, oldObj); @@ -322,7 +323,7 @@ void WCollector::PreforwardStaticRoots() } }; - panda::WeakRefFieldVisitor weakVisitor = [this](RefField<> &refField) -> bool { + WeakRefFieldVisitor weakVisitor = [this](RefField<> &refField) -> bool { RefField<> oldField(refField); BaseObject *oldObj = oldField.GetTargetObject(); if (!IsMarkedObject(oldObj) && !RegionSpace::IsNewObjectSinceTrace(oldObj)) { @@ -377,7 +378,7 @@ void WCollector::EnumRoots(WorkStack& workStack) reinterpret_cast(theAllocator_).AssembleGarbageCandidates(); reinterpret_cast(theAllocator_).PrepareTrace(); - ARK_COMMON_PHASE_TIMER("enum roots & update old pointers within"); + COMMON_PHASE_TIMER("enum roots & update old pointers within"); OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::EnumRoots", ""); TransitionToGCPhase(GCPhase::GC_PHASE_ENUM, true); EnumerateAllRoots(workStack); @@ -385,7 +386,7 @@ void WCollector::EnumRoots(WorkStack& workStack) void WCollector::TraceHeap(WorkStack& workStack) { - ARK_COMMON_PHASE_TIMER("trace live objects"); + COMMON_PHASE_TIMER("trace live objects"); markedObjectCount_.store(0, std::memory_order_relaxed); TransitionToGCPhase(GCPhase::GC_PHASE_MARK, true); @@ -396,7 +397,7 @@ void WCollector::TraceHeap(WorkStack& workStack) void WCollector::PostTrace() { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::PostTrace", ""); - ARK_COMMON_PHASE_TIMER("PostTrace"); + COMMON_PHASE_TIMER("PostTrace"); TransitionToGCPhase(GC_PHASE_POST_MARK, true); // clear satb buffer when gc finish tracing. @@ -407,7 +408,7 @@ void WCollector::PostTrace() } void WCollector::Preforward() { - ARK_COMMON_PHASE_TIMER("Preforward"); + COMMON_PHASE_TIMER("Preforward"); OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::Preforward[STW]", ""); TransitionToGCPhase(GCPhase::GC_PHASE_PRECOPY, true); @@ -422,7 +423,7 @@ void WCollector::Preforward() void WCollector::PrepareFix() { // make sure all objects before fixline is initialized - ARK_COMMON_PHASE_TIMER("PrepareFix"); + COMMON_PHASE_TIMER("PrepareFix"); OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::PrepareFix[STW]", ""); reinterpret_cast(theAllocator_).PrepareFix(); reinterpret_cast(theAllocator_).PrepareFixForPin(); @@ -431,7 +432,7 @@ void WCollector::PrepareFix() void WCollector::FixHeap() { - ARK_COMMON_PHASE_TIMER("FixHeap"); + COMMON_PHASE_TIMER("FixHeap"); OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::FixHeap", ""); reinterpret_cast(theAllocator_).FixHeap(); @@ -570,7 +571,7 @@ void WCollector::ProcessWeakReferences() #ifndef ARK_USE_SATB_BARRIER { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::ProcessWeakRoots", ""); - panda::WeakRefFieldVisitor weakVisitor = [this](RefField<> &refField) -> bool { + WeakRefFieldVisitor weakVisitor = [this](RefField<> &refField) -> bool { RefField<> oldField(refField); BaseObject *oldObj = oldField.GetTargetObject(); if (!IsMarkedObject(oldObj) && !RegionSpace::IsNewObjectSinceTrace(oldObj)) { @@ -652,22 +653,23 @@ BaseObject* WCollector::CopyObjectAfterExclusive(BaseObject* obj) size_t size = RegionSpace::GetAllocSize(*obj); // 8: size of free object, but free object can not be copied. if (size == 8) { - LOG_COMMON(FATAL) << "forward free obj: " << obj << "is survived: " << IsSurvivedObject(obj) ? "true" : "false"; + LOG_COMMON(FATAL) << "forward free obj: " << obj << + "is survived: " << IsSurvivedObject(obj) ? "true" : "false"; } BaseObject* toObj = fwdTable_.RouteObject(obj, size); if (toObj == nullptr) { ASSERT_LOGF(0, "OOM"); // ConcurrentGC - obj->UnlockExclusive(panda::BaseStateWord::ForwardState::NORMAL); + obj->UnlockExclusive(BaseStateWord::ForwardState::NORMAL); return toObj; } DLOG(COPY, "copy obj %p<%p>(%zu) to %p", obj, obj->GetTypeInfo(), size, toObj); CopyObject(*obj, *toObj, size); if (IsToObject(toObj)) { - toObj->SetForwardState(panda::BaseStateWord::ForwardState::NORMAL); + toObj->SetForwardState(BaseStateWord::ForwardState::NORMAL); } else { // if this object is not in to-space, we label it as to-object explicitly. - toObj->SetForwardState(panda::BaseStateWord::ForwardState::TO_VERSION); + toObj->SetForwardState(BaseStateWord::ForwardState::TO_VERSION); } std::atomic_thread_fence(std::memory_order_release); obj->SetSizeForwarded(size); @@ -677,7 +679,7 @@ BaseObject* WCollector::CopyObjectAfterExclusive(BaseObject* obj) void WCollector::ClearAllGCInfo() { - ARK_COMMON_PHASE_TIMER("ClearAllGCInfo"); + COMMON_PHASE_TIMER("ClearAllGCInfo"); RegionSpace& space = reinterpret_cast(theAllocator_); space.ClearAllGCInfo(); } @@ -688,7 +690,7 @@ void WCollector::CollectSmallSpace() GCStats& stats = GetGCStats(); RegionSpace& space = reinterpret_cast(theAllocator_); { - ARK_COMMON_PHASE_TIMER("CollectFromSpaceGarbage"); + COMMON_PHASE_TIMER("CollectFromSpaceGarbage"); stats.collectedBytes += stats.smallGarbageSize; if (gcReason_ == GC_REASON_APPSPAWN) { VLOG(REPORT, "APPSPAWN GC Collect"); @@ -714,4 +716,4 @@ void WCollector::CollectSmallSpace() } bool WCollector::ShouldIgnoreRequest(GCRequest& request) { return request.ShouldBeIgnored(); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/heap/w_collector/w_collector.h b/common_components/heap/w_collector/w_collector.h similarity index 94% rename from common_components/common_runtime/src/heap/w_collector/w_collector.h rename to common_components/heap/w_collector/w_collector.h index e10e1861ae0dcec7125376ca9d8673bf411428b9..5c050e59a5584892026bc7f0e432c1e10f69d1f9 100755 --- a/common_components/common_runtime/src/heap/w_collector/w_collector.h +++ b/common_components/heap/w_collector/w_collector.h @@ -12,15 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_WCOLLECTOR_H -#define ARK_COMMON_WCOLLECTOR_H + +#ifndef COMMON_COMPONENTS_HEAP_W_COLLECTOR_WCOLLECTOR_H +#define COMMON_COMPONENTS_HEAP_W_COLLECTOR_WCOLLECTOR_H + #include -#include "common_components/common_runtime/src/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/heap/collector/trace_collector.h" +#include "common_components/heap/allocator/region_space.h" +#include "common_components/heap/collector/trace_collector.h" #include "common_interfaces/base_runtime.h" -namespace panda { +namespace common { class CopyTable { public: @@ -148,7 +150,7 @@ protected: void CollectLargeGarbage() { - ARK_COMMON_PHASE_TIMER("Collect large garbage"); + COMMON_PHASE_TIMER("Collect large garbage"); RegionSpace& space = reinterpret_cast(theAllocator_); GCStats& stats = GetGCStats(); stats.largeSpaceSize = space.LargeObjectSize(); @@ -193,5 +195,6 @@ private: GCMode gcMode_ = GCMode::CMC; }; -} // namespace panda -#endif // ~ARK_COMMON_WCOLLECTOR_H +} // namespace common + +#endif // COMMON_COMPONENTS_HEAP_W_COLLECTOR_WCOLLECTOR_H diff --git a/common_components/log/log.cpp b/common_components/log/log.cpp index 9f08190f7c19d67412793eaf478507600bf02bf5..d43f3fec041b3faacd195453da55531227eefd85 100755 --- a/common_components/log/log.cpp +++ b/common_components/log/log.cpp @@ -22,185 +22,239 @@ #include #endif -namespace panda { - #ifdef ENABLE_HILOG - namespace { - Level ConvertToLevel(LogLevel hilogLevel) - { - Level level = Level::ERROR; - std::string logLevel; - switch (hilogLevel) { - case LogLevel::LOG_INFO: - level = Level::INFO; - break; - case LogLevel::LOG_WARN: - level = Level::WARN; - break; - case LogLevel::LOG_ERROR: - level = Level::ERROR; - break; - case LogLevel::LOG_FATAL: - case LogLevel::LOG_LEVEL_MAX: - level = Level::FATAL; - break; - case LogLevel::LOG_DEBUG: - default: - level = Level::DEBUG; - break; - } - - return level; - } - - LogLevel GetHiLogLevel() - { - for (int32_t level = LogLevel::LOG_LEVEL_MIN; level <= LogLevel::LOG_LEVEL_MAX; level++) { - if (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, static_cast(level))) { - return static_cast(level); - } - } - return LogLevel::LOG_LEVEL_MAX; - } - } // namespace - #endif - - Level Log::level_ = Level::ERROR; - ComponentMark Log::components_ = static_cast(Component::ALL); - - Level Log::ConvertFromRuntime(LOG_LEVEL level) - { - Level logLevel = Level::INFO; - switch (level) { - case LOG_LEVEL::FOLLOW: - #ifdef ENABLE_HILOG - logLevel = ConvertToLevel(GetHiLogLevel()); - break; - #endif - case LOG_LEVEL::INFO: - logLevel = Level::INFO; - break; - case LOG_LEVEL::WARN: - logLevel = Level::WARN; - break; - case LOG_LEVEL::ERROR: - logLevel = Level::ERROR; - break; - case LOG_LEVEL::FATAL: - logLevel = Level::FATAL; - break; - case LOG_LEVEL::DEBUG: - default: - logLevel = Level::DEBUG; - break; - } - - return logLevel; - } - - std::string Log::LevelToString(Level level) - { - std::string logLevel; - switch (level) { - case Level::INFO: - logLevel = "info"; - break; - case Level::WARN: - logLevel = "warning"; - break; - case Level::ERROR: - logLevel = "error"; - break; - case Level::FATAL: - logLevel = "fatal"; - break; - case Level::DEBUG: - default: - logLevel = "debug"; - break; - } - - return logLevel; +namespace common { +#ifdef ENABLE_HILOG +Level ConvertToLevel(LogLevel hilogLevel) +{ + Level level = Level::ERROR; + std::string logLevel; + switch (hilogLevel) { + case LogLevel::LOG_INFO: + level = Level::INFO; + break; + case LogLevel::LOG_WARN: + level = Level::WARN; + break; + case LogLevel::LOG_ERROR: + level = Level::ERROR; + break; + case LogLevel::LOG_FATAL: + case LogLevel::LOG_LEVEL_MAX: + level = Level::FATAL; + break; + case LogLevel::LOG_DEBUG: + default: + level = Level::DEBUG; + break; } - int32_t Log::PrintLogger(int32_t, int32_t level, const char *, const char *, const char *message) - { - switch (level) { - case Logger::PandaLog2MobileLog::VERBOSE: - LOG_COMMON(VERBOSE) << message; - break; - case Logger::PandaLog2MobileLog::DEBUG: - LOG_COMMON(DEBUG) << message; - break; - case Logger::PandaLog2MobileLog::INFO: - LOG_COMMON(INFO) << message; - break; - case Logger::PandaLog2MobileLog::WARN: - LOG_COMMON(WARN) << message; - break; - case Logger::PandaLog2MobileLog::ERROR: - LOG_COMMON(ERROR) << message; - break; - case Logger::PandaLog2MobileLog::FATAL: - LOG_COMMON(FATAL) << message; - break; - default: - LOG_COMMON(DEBUG) << message; - break; + return level; +} + +LogLevel GetHiLogLevel() +{ + for (int32_t level = LogLevel::LOG_LEVEL_MIN; level <= LogLevel::LOG_LEVEL_MAX; level++) { + if (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, static_cast(level))) { + return static_cast(level); } - return 0; } - - void Log::Initialize(const LogOptions &options) - { - // For ArkTS runtime log - level_ = options.level; - components_ = options.component; - - // For runtime core log - base_options::Options baseOptions(""); - baseOptions.SetLogLevel(LevelToString(level_)); - baseOptions.SetLogComponents({ "all" }); - Logger::Initialize(baseOptions); - Logger::SetMobileLogPrintEntryPointByPtr(reinterpret_cast(Log::PrintLogger)); + return LogLevel::LOG_LEVEL_MAX; +} +#endif + +Level Log::level_ = Level::ERROR; +ComponentMark Log::components_ = static_cast(Component::ALL); + +Level Log::ConvertFromRuntime(LOG_LEVEL level) +{ + Level logLevel = Level::INFO; + switch (level) { + case LOG_LEVEL::FOLLOW: +#ifdef ENABLE_HILOG + logLevel = ConvertToLevel(GetHiLogLevel()); + break; +#endif + case LOG_LEVEL::INFO: + logLevel = Level::INFO; + break; + case LOG_LEVEL::WARN: + logLevel = Level::WARN; + break; + case LOG_LEVEL::ERROR: + logLevel = Level::ERROR; + break; + case LOG_LEVEL::FATAL: + logLevel = Level::FATAL; + break; + case LOG_LEVEL::DEBUG: + default: + logLevel = Level::DEBUG; + break; } - - #ifdef ENABLE_ANLOG - const char *tag = "ArkCompiler"; - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_VERBOSE, tag, stream_.str().c_str()); + + return logLevel; +} + +std::string Log::LevelToString(Level level) +{ + std::string logLevel; + switch (level) { + case Level::INFO: + logLevel = "info"; + break; + case Level::WARN: + logLevel = "warning"; + break; + case Level::ERROR: + logLevel = "error"; + break; + case Level::FATAL: + logLevel = "fatal"; + break; + case Level::DEBUG: + default: + logLevel = "debug"; + break; } - - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_DEBUG, tag, stream_.str().c_str()); + + return logLevel; +} + +int32_t Log::PrintLogger(int32_t, int32_t level, const char *, const char *, const char *message) +{ + switch (level) { + case panda::Logger::PandaLog2MobileLog::VERBOSE: + LOG_COMMON(VERBOSE) << message; + break; + case panda::Logger::PandaLog2MobileLog::DEBUG: + LOG_COMMON(DEBUG) << message; + break; + case panda::Logger::PandaLog2MobileLog::INFO: + LOG_COMMON(INFO) << message; + break; + case panda::Logger::PandaLog2MobileLog::WARN: + LOG_COMMON(WARN) << message; + break; + case panda::Logger::PandaLog2MobileLog::ERROR: + LOG_COMMON(ERROR) << message; + break; + case panda::Logger::PandaLog2MobileLog::FATAL: + LOG_COMMON(FATAL) << message; + break; + default: + LOG_COMMON(DEBUG) << message; + break; } - - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_INFO, tag, stream_.str().c_str()); + return 0; +} + +void Log::Initialize(const LogOptions &options) +{ + // For ArkTS runtime log + level_ = options.level; + components_ = options.component; + + // For runtime core log + panda::base_options::Options baseOptions(""); + baseOptions.SetLogLevel(LevelToString(level_)); + baseOptions.SetLogComponents({ "all" }); + panda::Logger::Initialize(baseOptions); + panda::Logger::SetMobileLogPrintEntryPointByPtr(reinterpret_cast(Log::PrintLogger)); +} + +#ifdef ENABLE_ANLOG +const char *tag = "ArkCompiler"; +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_VERBOSE, tag, stream_.str().c_str()); +} + +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_DEBUG, tag, stream_.str().c_str()); +} + +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_INFO, tag, stream_.str().c_str()); +} + +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_WARN, tag, stream_.str().c_str()); +} + +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_ERROR, tag, stream_.str().c_str()); +} + +template<> +PUBLIC_API AndroidLog::~AndroidLog() +{ + __android_log_write(ANDROID_LOG_FATAL, tag, stream_.str().c_str()); + std::abort(); +} +#endif + +// Orders of magnitudes. Note: The upperbound of uint64_t is 16E (16 * (1024 ^ 6)) +const char* g_orderOfMagnitude[] = { "", "K", "M", "G", "T", "P", "E" }; + +// Orders of magnitudes. Note: The upperbound of uint64_t is 16E (16 * (1024 ^ 6)) +const char* g_orderOfMagnitudeFromNano[] = { "n", "u", "m", nullptr }; + +// number of digits in a pretty format segment (100,000,000 each has three digits) +constexpr int NUM_DIGITS_PER_SEGMENT = 3; + +std::string Pretty(uint64_t number) noexcept +{ + std::string orig = std::to_string(number); + int pos = static_cast(orig.length()) - NUM_DIGITS_PER_SEGMENT; + while (pos > 0) { + orig.insert(pos, ","); + pos -= NUM_DIGITS_PER_SEGMENT; } - - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_WARN, tag, stream_.str().c_str()); + return orig; +} + +// Useful for informatic units, such as KiB, MiB, GiB, ... +std::string PrettyOrderInfo(uint64_t number, const char* unit) +{ + size_t order = 0; + const uint64_t factor = 1024; + + while (number > factor) { + number /= factor; + order += 1; } - - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_ERROR, tag, stream_.str().c_str()); + + const char* prefix = g_orderOfMagnitude[order]; + const char* infix = order > 0 ? "i" : ""; // 1KiB = 1024B, but there is no "1iB" + + return std::to_string(number) + prefix + infix + unit; +} + +// Useful for scientific units where number is in nanos: ns, us, ms, s +std::string PrettyOrderMathNano(uint64_t number, const char* unit) +{ + size_t order = 0; + const uint64_t factor = 1000; // show in us if under 10ms + + while (number > factor && g_orderOfMagnitudeFromNano[order] != nullptr) { + number /= factor; + order += 1; } - - template<> - PUBLIC_API AndroidLog::~AndroidLog() - { - __android_log_write(ANDROID_LOG_FATAL, tag, stream_.str().c_str()); - std::abort(); + + const char* prefix = g_orderOfMagnitudeFromNano[order]; + if (prefix == nullptr) { + prefix = ""; } - #endif -} // namespace panda \ No newline at end of file + + return std::to_string(number) + prefix + unit; +} +} // namespace common \ No newline at end of file diff --git a/common_components/log/log.h b/common_components/log/log.h index 5bdb12e592f266e1ad7ac4c9c4eb5fd98c00e1d4..a48cac107e08b607f204ddbd1bf39080634d39c7 100644 --- a/common_components/log/log.h +++ b/common_components/log/log.h @@ -16,6 +16,9 @@ #ifndef COMMON_COMPONENTS_LOG_LOG_H #define COMMON_COMPONENTS_LOG_LOG_H +#include +#include + #include "common_components/log/log_base.h" #ifdef ENABLE_HILOG @@ -45,7 +48,7 @@ #define OHOS_HITRACE_COUNT(level, name, count) #endif -namespace panda { +namespace common { class PUBLIC_API Log { public: static void Initialize(const LogOptions &options); @@ -199,18 +202,18 @@ private: #endif #if defined(ENABLE_HILOG) -#define ARK_LOG(level, component) panda::Log::LogIsLoggable(Level::level, component) && \ - panda::HiLog() +#define ARK_LOG(level, component) common::Log::LogIsLoggable(Level::level, component) && \ + common::HiLog() #elif defined(ENABLE_ANLOG) -#define ARK_LOG(level, component) panda::AndroidLog<(Level::level)>() +#define ARK_LOG(level, component) common::AndroidLog<(Level::level)>() #else #if defined(OHOS_UNIT_TEST) #define ARK_LOG(level, component) ((Level::level >= Level::INFO) || \ - panda::Log::LogIsLoggable(Level::level, component)) && \ - panda::StdLog<(Level::level), (component)>() + common::Log::LogIsLoggable(Level::level, component)) && \ + common::StdLog<(Level::level), (component)>() #else -#define ARK_LOG(level, component) panda::Log::LogIsLoggable(Level::level, component) && \ - panda::StdLog<(Level::level), (component)>() +#define ARK_LOG(level, component) common::Log::LogIsLoggable(Level::level, component) && \ + common::StdLog<(Level::level), (component)>() #endif #endif @@ -225,6 +228,10 @@ private: #define CHECKF(cond) (UNLIKELY_CC(!(cond))) && LOG_COMMON(FATAL) << "Check failed: " << #cond #define LOGF_CHECK(cond) LOGF_IF(!(cond)) +#define DLOG(type, format...) (void)(0) +#define VLOG(type, format...) (void)(0) +#define COMMON_PHASE_TIMER(...) (void)(0) + #ifndef NDEBUG #define ASSERT_LOGF(cond, msg) LOGF_IF(!(cond)) << (msg) #else // NDEBUG @@ -244,5 +251,8 @@ private: } \ } while (false) -} // namespace panda +std::string Pretty(uint64_t number) noexcept; +std::string PrettyOrderInfo(uint64_t number, const char* unit); +std::string PrettyOrderMathNano(uint64_t number, const char* unit); +} // namespace common #endif // COMMON_COMPONENTS_LOG_LOG_H diff --git a/common_components/log/log_base.h b/common_components/log/log_base.h index 5375a86ada744937e63c57555d9555dfb74cd0b6..00806123ccfeee9763e1a3df85c14df69719ea25 100644 --- a/common_components/log/log_base.h +++ b/common_components/log/log_base.h @@ -51,7 +51,7 @@ enum class Component: uint64_t { ALL = 0xFFFFFFFFULL, }; -namespace panda { +namespace common { #ifdef ENABLE_HILOG #if ECMASCRIPT_ENABLE_VERBOSE_LEVEL_LOG @@ -66,7 +66,7 @@ struct LogOptions { Level level; ComponentMark component; }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_LOG_LOG_BASE_H \ No newline at end of file diff --git a/common_components/common_runtime/src/mutator/mutator.cpp b/common_components/mutator/mutator.cpp similarity index 95% rename from common_components/common_runtime/src/mutator/mutator.cpp rename to common_components/mutator/mutator.cpp index e6f42b6ed7009e3d12909a7a886f40c061ca7bc3..4aa11508475ab450d54c0bd0347adbd0c2f37f23 100755 --- a/common_components/common_runtime/src/mutator/mutator.cpp +++ b/common_components/mutator/mutator.cpp @@ -18,17 +18,17 @@ #include #include "common_components/base_runtime/hooks.h" -#include "common_components/common_runtime/src/common/type_def.h" +#include "common_components/common/type_def.h" #if defined(_WIN64) #define NOGDI #include #endif -#include "common_components/common_runtime/src/heap/allocator/region_manager.h" -#include "common_components/common_runtime/src/heap/collector/trace_collector.h" -#include "common_components/common_runtime/src/common/scoped_object_access.h" -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/heap/allocator/region_manager.h" +#include "common_components/heap/collector/trace_collector.h" +#include "common_components/common/scoped_object_access.h" +#include "common_components/mutator/mutator_manager.h" -namespace panda { +namespace common { ThreadLocalData *GetThreadLocalData() { uintptr_t tlDataAddr = reinterpret_cast(ThreadLocal::GetThreadLocalData()); @@ -285,4 +285,4 @@ void PreRunManagedCode(Mutator* mutator, int layers, ThreadLocalData* threadData mutator->SetMutatorPhase(Heap::GetHeap().GetGCPhase()); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/mutator/mutator.h b/common_components/mutator/mutator.h similarity index 94% rename from common_components/common_runtime/src/mutator/mutator.h rename to common_components/mutator/mutator.h index e0ba2455356ddbece06d055bca3d51fa98c9c626..6d455b9b387ab8b7cfc86b9ab52b03ceae07417e 100755 --- a/common_components/common_runtime/src/mutator/mutator.h +++ b/common_components/mutator/mutator.h @@ -12,22 +12,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_MUTATOR_H -#define ARK_COMMON_MUTATOR_H + +#ifndef COMMON_COMPONENTS_MUTATOR_MUTATOR_H +#define COMMON_COMPONENTS_MUTATOR_MUTATOR_H #include -#include "common_components/common_runtime/src/heap/allocator/allocator.h" -#include "common_components/common_runtime/src/heap/collector/gc_infos.h" -#include "common_components/common_runtime/src/mutator/thread_local.h" -#include "common_components/common_runtime/src/mutator/satb_buffer.h" +#include "common_components/heap/allocator/allocator.h" +#include "common_components/heap/collector/gc_infos.h" +#include "common_components/mutator/thread_local.h" +#include "common_components/mutator/satb_buffer.h" #ifdef _WIN64 -#include "common_components/common_runtime/src/os/windows/unwind_win.h" +#include "common_components/os/windows/unwind_win.h" #endif #include "common_interfaces/thread/mutator_base.h" #include "common_interfaces/thread/thread_holder.h" -namespace panda { +namespace common { class Mutator { public: using SuspensionType = MutatorBase::SuspensionType; @@ -81,7 +82,7 @@ public: { tid_ = ThreadLocal::GetThreadLocalData()->tid; if (tid_ == 0) { - tid_ = static_cast(panda::GetTid()); + tid_ = static_cast(GetTid()); ThreadLocal::GetThreadLocalData()->tid = tid_; } } @@ -311,7 +312,7 @@ private: ThreadHolder *holder_; friend MutatorBase; - friend panda::ThreadHolder; + friend ThreadHolder; }; // This function is mainly used to initialize the context of mutator. @@ -319,6 +320,6 @@ private: void PreRunManagedCode(Mutator* mutator, int layers, ThreadLocalData* threadData); ThreadLocalData *GetThreadLocalData(); -} // namespace panda +} // namespace common -#endif // ARK_COMMON_MUTATOR_H +#endif // COMMON_COMPONENTS_MUTATOR_MUTATOR_H diff --git a/common_components/common_runtime/src/mutator/mutator.inline.h b/common_components/mutator/mutator.inline.h similarity index 84% rename from common_components/common_runtime/src/mutator/mutator.inline.h rename to common_components/mutator/mutator.inline.h index 4f112678917228e8a1dd8a1817e81231606dfea0..f84e79c41763fd36d20b08b1ed44338e7015e273 100755 --- a/common_components/common_runtime/src/mutator/mutator.inline.h +++ b/common_components/mutator/mutator.inline.h @@ -13,13 +13,13 @@ * limitations under the License. */ -#ifndef ARK_COMMON_MUTATOR_INLINE_H -#define ARK_COMMON_MUTATOR_INLINE_H +#ifndef COMMON_COMPONENTS_MUTATOR_MUTATOR_INLINE_H +#define COMMON_COMPONENTS_MUTATOR_MUTATOR_INLINE_H -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/mutator/mutator_manager.h" #include "common_interfaces/thread/mutator_base-inl.h" -namespace panda { +namespace common { inline void Mutator::DoEnterSaferegion() { mutatorBase_.DoEnterSaferegion(); @@ -46,6 +46,6 @@ __attribute__((always_inline)) inline bool Mutator::TransitionToCpuProfile(bool { return mutatorBase_.TransitionToCpuProfile(bySelf); } -} // namespace panda +} // namespace common -#endif // ARK_COMMON_MUTATOR_INLINE_H +#endif // COMMON_COMPONENTS_MUTATOR_MUTATOR_INLINE_H diff --git a/common_components/common_runtime/src/mutator/mutator_manager.cpp b/common_components/mutator/mutator_manager.cpp similarity index 96% rename from common_components/common_runtime/src/mutator/mutator_manager.cpp rename to common_components/mutator/mutator_manager.cpp index 32eacc23be2a690223930b2a827581eb50a8bf07..e4a1961a0b64cd8103bc14260a5bfed07b651fef 100755 --- a/common_components/common_runtime/src/mutator/mutator_manager.cpp +++ b/common_components/mutator/mutator_manager.cpp @@ -12,17 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/mutator/mutator_manager.h" #include -#include "common_components/common_runtime/src/base/time_utils.h" -#include "common_components/common_runtime/src/heap/collector/finalizer_processor.h" -#include "common_components/common_runtime/src/heap/collector/trace_collector.h" -#include "common_components/common_runtime/src/heap/heap.h" -#include "common_components/common_runtime/src/mutator/mutator.inline.h" +#include "common_components/base/time_utils.h" +#include "common_components/heap/collector/finalizer_processor.h" +#include "common_components/heap/collector/trace_collector.h" +#include "common_components/heap/heap.h" +#include "common_components/mutator/mutator.inline.h" -namespace panda { +namespace common { bool IsRuntimeThread() { if (static_cast(ThreadLocal::GetThreadType()) >= static_cast(ThreadType::GC_THREAD)) { @@ -270,7 +270,7 @@ void MutatorManager::StartTheWorld() noexcept #if defined(_WIN64) || defined(__APPLE__) WakeAllMutators(); #else - (void)panda::Futex(GetStwFutexWord(), FUTEX_WAKE, INT_MAX); + (void)Futex(GetStwFutexWord(), FUTEX_WAKE, INT_MAX); #endif MutatorManagementWUnlock(); @@ -463,4 +463,4 @@ void MutatorManager::DumpAllGcInfos() } #endif -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/mutator/mutator_manager.h b/common_components/mutator/mutator_manager.h similarity index 93% rename from common_components/common_runtime/src/mutator/mutator_manager.h rename to common_components/mutator/mutator_manager.h index 9da53b8d45a7d0ede83ef48d2ed2a2438fc0d667..58e29eb3e8727634eec7a09c8fdd80bb434b7cee 100755 --- a/common_components/common_runtime/src/mutator/mutator_manager.h +++ b/common_components/mutator/mutator_manager.h @@ -12,26 +12,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_MUTATOR_MANAGER_H -#define ARK_COMMON_MUTATOR_MANAGER_H + +#ifndef COMMON_COMPONENTS_MUTATOR_MUTATOR_MANAGER_H +#define COMMON_COMPONENTS_MUTATOR_MUTATOR_MANAGER_H #include #include #include #include -#include "common_components/common_runtime/src/base/atomic_spin_lock.h" -#include "common_components/common_runtime/src/base/globals.h" -#include "common_components/common_runtime/src/base/rw_lock.h" -#include "common_components/common_runtime/src/common/page_allocator.h" -#include "common_components/common_runtime/src/mutator/mutator.h" +#include "common_components/base/atomic_spin_lock.h" +#include "common_components/base/globals.h" +#include "common_components/base/rw_lock.h" +#include "common_components/common/page_allocator.h" +#include "common_components/mutator/mutator.h" #if defined(__linux__) || defined(PANDA_TARGET_OHOS) || defined(__APPLE__) -#include "common_components/common_runtime/src/mutator/safepoint_page_manager.h" +#include "common_components/mutator/safepoint_page_manager.h" #endif -#include "common_components/common_runtime/src/mutator/thread_local.h" +#include "common_components/mutator/thread_local.h" #include "common_components/log/log.h" -namespace panda { +namespace common { const uint64_t WAIT_LOCK_INTERVAL = 5000; // 5us const uint64_t WAIT_LOCK_TIMEOUT = 30; // seconds const uint32_t MAX_TIMEOUT_TIMES = 1; @@ -280,5 +281,6 @@ public: __attribute__((always_inline)) ~ScopedSTWLock() { MutatorManager::Instance().UnlockStopTheWorld(); } }; -} // namespace panda -#endif +} // namespace common + +#endif // COMMON_COMPONENTS_MUTATOR_MUTATOR_MANAGER_H diff --git a/common_components/common_runtime/src/mutator/safepoint_page_manager.h b/common_components/mutator/safepoint_page_manager.h similarity index 67% rename from common_components/common_runtime/src/mutator/safepoint_page_manager.h rename to common_components/mutator/safepoint_page_manager.h index 1d3ff0560da05415b3afc086417153c1963f4a41..88423ba3eeb134bb2b8a0c81a938004d8a226d6c 100755 --- a/common_components/common_runtime/src/mutator/safepoint_page_manager.h +++ b/common_components/mutator/safepoint_page_manager.h @@ -12,16 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_SAFEPOINT_PAGE_MANAGER_H -#define ARK_COMMON_SAFEPOINT_PAGE_MANAGER_H + +#ifndef COMMON_COMPONENTS_MUTATOR_SAFEPOINT_PAGE_MANAGER_H +#define COMMON_COMPONENTS_MUTATOR_SAFEPOINT_PAGE_MANAGER_H #include -#include "common_components/common_runtime/src/base/globals.h" -#include "common_components/common_runtime/src/base/sys_call.h" +#include "common_components/base/globals.h" +#include "common_components/base/sys_call.h" #include "securec.h" -namespace panda { +namespace common { class SafepointPageManager { public: SafepointPageManager() {} @@ -29,22 +30,22 @@ public: void Init() { readablePage_ = reinterpret_cast( - mmap(nullptr, panda::ARK_COMMON_PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + mmap(nullptr, COMMON_PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); unreadablePage_ = reinterpret_cast( - mmap(nullptr, panda::ARK_COMMON_PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + mmap(nullptr, COMMON_PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); unreadablePageForRawData_ = reinterpret_cast( - mmap(nullptr, panda::ARK_COMMON_PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + mmap(nullptr, COMMON_PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); LOGF_CHECK((readablePage_ != MAP_FAILED && unreadablePage_ != MAP_FAILED && unreadablePageForRawData_ != MAP_FAILED)) << "allocate safepoint page failed!"; } ~SafepointPageManager() { - LOGE_IF(UNLIKELY_CC(munmap(readablePage_, panda::ARK_COMMON_PAGE_SIZE) != EOK)) << + LOGE_IF(UNLIKELY_CC(munmap(readablePage_, COMMON_PAGE_SIZE) != EOK)) << "munmap failed in SafepointPageManager readablePage destruction, errno: " << errno; - LOGE_IF(UNLIKELY_CC(munmap(unreadablePage_, panda::ARK_COMMON_PAGE_SIZE) != EOK)) << + LOGE_IF(UNLIKELY_CC(munmap(unreadablePage_, COMMON_PAGE_SIZE) != EOK)) << "munmap failed in SafepointPageManager unreadablePage destruction, errno: " << errno; - LOGE_IF(UNLIKELY_CC(munmap(unreadablePageForRawData_, panda::ARK_COMMON_PAGE_SIZE) != EOK)) << + LOGE_IF(UNLIKELY_CC(munmap(unreadablePageForRawData_, COMMON_PAGE_SIZE) != EOK)) << "munmap failed in SafepointPageManager unreadablePageForRawData destruction, errno: " << errno; } @@ -60,5 +61,6 @@ private: uint8_t* unreadablePage_ = nullptr; uint8_t* unreadablePageForRawData_ = nullptr; }; -} // namespace panda -#endif // ARK_COMMON_SAFEPOINT_PAGE_MANAGER_H +} // namespace common + +#endif // COMMON_COMPONENTS_MUTATOR_SAFEPOINT_PAGE_MANAGER_H diff --git a/common_components/common_runtime/src/mutator/satb_buffer.cpp b/common_components/mutator/satb_buffer.cpp similarity index 80% rename from common_components/common_runtime/src/mutator/satb_buffer.cpp rename to common_components/mutator/satb_buffer.cpp index 9ccf7347c713e718d070ce5119e154734948fa71..db033cc73bbcf20845071d46dbca3353000ea7a2 100755 --- a/common_components/common_runtime/src/mutator/satb_buffer.cpp +++ b/common_components/mutator/satb_buffer.cpp @@ -13,12 +13,12 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/mutator/satb_buffer.h" -#include "common_components/common_runtime/src/heap/allocator/region_space.h" +#include "common_components/mutator/satb_buffer.h" +#include "common_components/heap/allocator/region_space.h" -#include "common_components/common_runtime/src/base/immortal_wrapper.h" +#include "common_components/base/immortal_wrapper.h" -namespace panda { +namespace common { static ImmortalWrapper g_instance; SatbBuffer& SatbBuffer::Instance() noexcept { return *g_instance; } @@ -36,4 +36,4 @@ bool SatbBuffer::ShouldEnqueue(const BaseObject* obj) } return !RegionSpace::EnqueueObject(obj); } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/mutator/satb_buffer.h b/common_components/mutator/satb_buffer.h similarity index 94% rename from common_components/common_runtime/src/mutator/satb_buffer.h rename to common_components/mutator/satb_buffer.h index f099ef51c0ead392631fb5d79855f13ef719966f..040a7d3aeed7d491e94c30059941c81184ebe0dc 100755 --- a/common_components/common_runtime/src/mutator/satb_buffer.h +++ b/common_components/mutator/satb_buffer.h @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_SATB_BUFFER_H -#define ARK_COMMON_SATB_BUFFER_H -#include "common_components/common_runtime/src/common/page_pool.h" -#include "common_components/common_runtime/src/common/mark_work_stack.h" +#ifndef COMMON_COMPONENTS_MUTATOR_SATB_BUFFER_H +#define COMMON_COMPONENTS_MUTATOR_SATB_BUFFER_H + +#include "common_components/common/page_pool.h" +#include "common_components/common/mark_work_stack.h" #include "common_components/log/log.h" -namespace panda { +namespace common { // snapshot at the beginning buffer // mainly used to buffer modified field of mutator write class SatbBuffer { @@ -189,8 +190,8 @@ public: } if (node == nullptr) { // there is no free nodes in the freeNodes list - Page* page = GetPages(panda::ARK_COMMON_PAGE_SIZE); - TreapNode* list = ConstructFreeNodeList(page, panda::ARK_COMMON_PAGE_SIZE); + Page* page = GetPages(COMMON_PAGE_SIZE); + TreapNode* list = ConstructFreeNodeList(page, COMMON_PAGE_SIZE); if (list == nullptr) { return; } @@ -221,7 +222,7 @@ public: } if (freeNodes_.head_ == nullptr) { - size_t initalBytes = INITIAL_PAGES * panda::ARK_COMMON_PAGE_SIZE; + size_t initalBytes = INITIAL_PAGES * COMMON_PAGE_SIZE; Page* page = GetPages(initalBytes); TreapNode* list = ConstructFreeNodeList(page, initalBytes); freeNodes_.head_ = list; @@ -306,6 +307,6 @@ private: LockedList freeNodes_; LockedList retiredNodes_; // has been filled by mutator, ready for scan }; -} // namespace panda +} // namespace common -#endif // ARK_COMMON_SATB_BUFFER_H +#endif // COMMON_COMPONENTS_MUTATOR_SATB_BUFFER_H diff --git a/common_components/common_runtime/src/mutator/thread_local.cpp b/common_components/mutator/thread_local.cpp similarity index 75% rename from common_components/common_runtime/src/mutator/thread_local.cpp rename to common_components/mutator/thread_local.cpp index 824e12f6ba2e848813e7bb52a583def51856d076..bb892c22db54c73c66cf5a538a64d8a9c411bfde 100755 --- a/common_components/common_runtime/src/mutator/thread_local.cpp +++ b/common_components/mutator/thread_local.cpp @@ -13,16 +13,16 @@ * limitations under the License. */ -#include "common_components/common_runtime/src/mutator/thread_local.h" +#include "common_components/mutator/thread_local.h" -#include "common_components/common_runtime/src/heap/allocator/alloc_buffer.h" -#include "common_components/common_runtime/src/base/globals.h" +#include "common_components/heap/allocator/alloc_buffer.h" +#include "common_components/base/globals.h" -namespace panda { +namespace common { PUBLIC_API thread_local ThreadLocalData threadLocalData; ThreadLocalData* ThreadLocal::GetThreadLocalData() { return &threadLocalData; } -} // namespace panda +} // namespace common diff --git a/common_components/common_runtime/src/mutator/thread_local.h b/common_components/mutator/thread_local.h similarity index 93% rename from common_components/common_runtime/src/mutator/thread_local.h rename to common_components/mutator/thread_local.h index d5173a93ecc11ced5ab5489956633097a78d401b..a7c3df2f58a2c853390287afd01b8ae091243c0e 100755 --- a/common_components/common_runtime/src/mutator/thread_local.h +++ b/common_components/mutator/thread_local.h @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ARK_COMMON_THREAD_LOCAL_H -#define ARK_COMMON_THREAD_LOCAL_H + +#ifndef COMMON_COMPONENTS_MUTATOR_THREAD_LOCAL_H +#define COMMON_COMPONENTS_MUTATOR_THREAD_LOCAL_H #include -namespace panda { +namespace common { class AllocationBuffer; class Mutator; @@ -85,5 +86,6 @@ public: GetThreadLocalData()->schedule = reinterpret_cast(schedule); } }; -} // namespace panda -#endif // ARK_COMMON_THREAD_LOCAL_H +} // namespace common + +#endif // COMMON_COMPONENTS_MUTATOR_THREAD_LOCAL_H diff --git a/common_components/objects/base_object.cpp b/common_components/objects/base_object.cpp index c83ed071c682119b6f207fe21961aa559bb6a4e1..e73ca3dd4c884f15d8200173b309fcf441b5effa 100755 --- a/common_components/objects/base_object.cpp +++ b/common_components/objects/base_object.cpp @@ -15,7 +15,7 @@ #include "common_interfaces/objects/base_object.h" -namespace panda { +namespace common { #ifdef USE_CMC_GC BaseObjectOperator BaseObject::operator_; @@ -29,4 +29,4 @@ void BaseObject::RegisterStatic(BaseObjectOperatorInterfaces *staticObjOp) operator_.staticObjOp_ = staticObjOp; } #endif -} // namespace panda +} // namespace common diff --git a/common_components/objects/base_string.cpp b/common_components/objects/base_string.cpp index fffa9d9c584508b389326c3997860fedd42d4b05..3979df3612f4e1362e6a677e60c1a126f4eb9053 100644 --- a/common_components/objects/base_string.cpp +++ b/common_components/objects/base_string.cpp @@ -16,13 +16,13 @@ #include #include -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "common_interfaces/objects/base_string.h" -#include "ecmascript/platform/ecma_string_hash.h" -#include "ecmascript/platform/ecma_string_hash_helper.h" +#include "common_components/platform/string_hash.h" +#include "common_components/platform/string_hash_helper.h" -namespace panda { +namespace common { constexpr size_t LOW_3BITS = 0x7; constexpr size_t LOW_4BITS = 0xF; constexpr size_t LOW_5BITS = 0x1F; @@ -35,40 +35,40 @@ namespace panda { constexpr size_t OFFSET_10POS = 10; constexpr size_t OFFSET_6POS = 6; - size_t utf_utils::DebuggerConvertRegionUtf16ToUtf8(const uint16_t* utf16In, uint8_t* utf8Out, size_t utf16Len, - size_t utf8Len, size_t start, bool modify, bool isWriteBuffer) + size_t UtfUtils::DebuggerConvertRegionUtf16ToUtf8(const uint16_t* utf16In, uint8_t* utf8Out, size_t utf16Len, + size_t utf8Len, size_t start, bool modify, bool isWriteBuffer) { - return ecmascript::base::utf_helper::DebuggerConvertRegionUtf16ToUtf8(utf16In, utf8Out, utf16Len, utf8Len, - start, modify, isWriteBuffer); + return common::utf_helper::DebuggerConvertRegionUtf16ToUtf8(utf16In, utf8Out, utf16Len, utf8Len, + start, modify, isWriteBuffer); } - size_t utf_utils::Utf8ToUtf16Size(const uint8_t* utf8, size_t utf8Len) + size_t UtfUtils::Utf8ToUtf16Size(const uint8_t* utf8, size_t utf8Len) { - return ecmascript::base::utf_helper::Utf8ToUtf16Size(utf8, utf8Len); + return common::utf_helper::Utf8ToUtf16Size(utf8, utf8Len); } - size_t utf_utils::Utf16ToUtf8Size(const uint16_t* utf16, uint32_t length, bool modify, bool isGetBufferSize, - bool cesu8) + size_t UtfUtils::Utf16ToUtf8Size(const uint16_t* utf16, uint32_t length, bool modify, bool isGetBufferSize, + bool cesu8) { - return ecmascript::base::utf_helper::Utf16ToUtf8Size(utf16, length, modify, isGetBufferSize, cesu8); + return common::utf_helper::Utf16ToUtf8Size(utf16, length, modify, isGetBufferSize, cesu8); } - size_t utf_utils::ConvertRegionUtf8ToUtf16(const uint8_t* utf8In, uint16_t* utf16Out, size_t utf8Len, - size_t utf16Len) + size_t UtfUtils::ConvertRegionUtf8ToUtf16(const uint8_t* utf8In, uint16_t* utf16Out, size_t utf8Len, + size_t utf16Len) { - return ecmascript::base::utf_helper::ConvertRegionUtf8ToUtf16(utf8In, utf16Out, utf8Len, utf16Len); + return common::utf_helper::ConvertRegionUtf8ToUtf16(utf8In, utf16Out, utf8Len, utf16Len); } - size_t utf_utils::ConvertRegionUtf16ToLatin1(const uint16_t* utf16In, uint8_t* latin1Out, size_t utf16Len, - size_t latin1Len) + size_t UtfUtils::ConvertRegionUtf16ToLatin1(const uint16_t* utf16In, uint8_t* latin1Out, size_t utf16Len, + size_t latin1Len) { - return ecmascript::base::utf_helper::ConvertRegionUtf16ToLatin1(utf16In, latin1Out, utf16Len, latin1Len); + return common::utf_helper::ConvertRegionUtf16ToLatin1(utf16In, latin1Out, utf16Len, latin1Len); } - size_t utf_utils::ConvertRegionUtf16ToUtf8(const uint16_t* utf16In, uint8_t* utf8Out, size_t utf16Len, - size_t utf8Len, size_t start, bool modify, bool isWriteBuffer, bool cesu) + size_t UtfUtils::ConvertRegionUtf16ToUtf8(const uint16_t* utf16In, uint8_t* utf8Out, size_t utf16Len, + size_t utf8Len, size_t start, bool modify, bool isWriteBuffer, bool cesu) { - return ecmascript::base::utf_helper::ConvertRegionUtf16ToUtf8( + return common::utf_helper::ConvertRegionUtf16ToUtf8( utf16In, utf8Out, utf16Len, utf8Len, start, modify, isWriteBuffer, cesu); } @@ -79,14 +79,14 @@ namespace panda { uint32_t BaseString::ComputeHashForData(const T* data, size_t size, uint32_t hashSeed) { - if (size <= static_cast(ecmascript::EcmaStringHash::MIN_SIZE_FOR_UNROLLING)) { + if (size <= static_cast(StringHash::MIN_SIZE_FOR_UNROLLING)) { uint32_t hash = hashSeed; for (uint32_t i = 0; i < size; i++) { - hash = (hash << static_cast(ecmascript::EcmaStringHash::HASH_SHIFT)) - hash + data[i]; + hash = (hash << static_cast(StringHash::HASH_SHIFT)) - hash + data[i]; } return hash; } - return ecmascript::EcmaStringHashHelper::ComputeHashForDataPlatform(data, size, hashSeed); + return StringHashHelper::ComputeHashForDataPlatform(data, size, hashSeed); } template @@ -101,11 +101,11 @@ namespace panda { if (canBeCompress) { return ComputeHashForData(utf8Data, utf8Len, 0); } - auto utf16Len = panda::utf_utils::Utf8ToUtf16Size(utf8Data, utf8Len); + auto utf16Len = UtfUtils::Utf8ToUtf16Size(utf8Data, utf8Len); std::vector tmpBuffer(utf16Len); - [[maybe_unused]] auto len = panda::utf_utils::ConvertRegionUtf8ToUtf16(utf8Data, tmpBuffer.data(), utf8Len, - utf16Len); - ASSERT(len == utf16Len); + [[maybe_unused]] auto len = UtfUtils::ConvertRegionUtf8ToUtf16(utf8Data, tmpBuffer.data(), utf8Len, + utf16Len); + DCHECK_CC(len == utf16Len); return ComputeHashForData(tmpBuffer.data(), utf16Len, 0); } @@ -242,7 +242,7 @@ namespace panda { bool BaseString::CanBeCompressed(const BaseString* string) { - ASSERT(string->IsLineString()); + DCHECK_CC(string->IsLineString()); if (string->IsUtf8()) { return CanBeCompressed(string->GetDataUtf8(), string->GetLength()); } @@ -304,7 +304,7 @@ namespace panda { return false; } // \0 is not considered ASCII in Ecma-Modified-UTF8 [only modify '\u0000'] - return data <= panda::utf_utils::UTF8_1B_MAX; + return data <= UtfUtils::UTF8_1B_MAX; } @@ -312,7 +312,7 @@ namespace panda { template int32_t BaseString::IndexOf(Span& lhsSp, Span& rhsSp, int32_t pos, int32_t max) { - ASSERT(rhsSp.size() > 0); + DCHECK_CC(rhsSp.size() > 0); auto first = static_cast(rhsSp[0]); for (int32_t i = pos; i <= max; i++) { if (static_cast(lhsSp[i]) != first) { @@ -357,7 +357,7 @@ namespace panda { int32_t BaseString::LastIndexOf(Span& lhsSp, Span& rhsSp, int32_t pos) { int rhsSize = static_cast(rhsSp.size()); - ASSERT(rhsSize > 0); + DCHECK_CC(rhsSize > 0); auto first = rhsSp[0]; for (int32_t i = pos; i >= 0; i--) { if (lhsSp[i] != first) { @@ -423,7 +423,7 @@ namespace panda { bool IsSubStringAtSpan(Span& lhsSp, Span& rhsSp, uint32_t offset) { int rhsSize = static_cast(rhsSp.size()); - ASSERT(rhsSize + offset <= lhsSp.size()); + DCHECK_CC(rhsSize + offset <= lhsSp.size()); for (int i = 0; i < rhsSize; ++i) { auto left = static_cast(lhsSp[offset + static_cast(i)]); auto right = static_cast(rhsSp[i]); @@ -462,4 +462,4 @@ namespace panda { std::u16string u16str = std::wstring_convert, char16_t>{}.from_bytes(str); return u16str; } -} // namespace panda::ecmascript +} // namespace common diff --git a/common_components/objects/string_table/hashtriemap-inl.h b/common_components/objects/string_table/hashtriemap-inl.h index ef67d93279e4be942172889c9d9ea04b56ffae87..51d706a9cd4b921c04ad3a35ee5651833c687451 100644 --- a/common_components/objects/string_table/hashtriemap-inl.h +++ b/common_components/objects/string_table/hashtriemap-inl.h @@ -20,12 +20,12 @@ #include "common_interfaces/objects/readonly_handle.h" #include "common_interfaces/objects/base_string.h" -namespace panda { -namespace ecmascript { +namespace panda::ecmascript { class TaggedObject; class EcmaStringTable; } +namespace common { // Expand to get oldEntry and newEntry, with hash conflicts from 32 bits up to // hashShift and Generate a subtree of indirect nodes to hold two new entries. template @@ -594,7 +594,7 @@ BaseString* HashTrieMap::StoreOrLoad(ThreadHolder* holder, template bool HashTrieMap::CheckWeakRef(const WeakRootVisitor& visitor, Entry* entry) { - ecmascript::TaggedObject* object = reinterpret_cast(entry->Value()); + panda::ecmascript::TaggedObject* object = reinterpret_cast(entry->Value()); auto fwd = visitor(object); if (fwd == nullptr) { LOG_COMMON(VERBOSE) << "StringTable: delete string " << std::hex << object; diff --git a/common_components/objects/string_table/hashtriemap.h b/common_components/objects/string_table/hashtriemap.h index b3990598546bd911eda2c6a82b1b7b4e417c9e2b..4a55af6cae1da60c002feae5f202c9c9e339f425 100644 --- a/common_components/objects/string_table/hashtriemap.h +++ b/common_components/objects/string_table/hashtriemap.h @@ -20,12 +20,12 @@ #include "common_interfaces/objects/readonly_handle.h" #include "common_interfaces/objects/base_string.h" -namespace panda { -namespace ecmascript { +namespace panda::ecmascript { class TaggedObject; class EcmaStringTable; } +namespace common { template class HashTrieMap { friend class panda::ecmascript::EcmaStringTable; @@ -34,7 +34,7 @@ public: #ifdef USE_CMC_GC using WeakRefFieldVisitor = std::function&)>; #endif - using WeakRootVisitor = std::function; + using WeakRootVisitor = std::function; static constexpr uint32_t N_CHILDREN_LOG2 = 3U; static constexpr uint32_t TOTAL_HASH_BITS = 32U; diff --git a/ecmascript/platform/arm64/ecma_string_hash_internal.h b/common_components/platform/arm64/string_hash_internal.h similarity index 76% rename from ecmascript/platform/arm64/ecma_string_hash_internal.h rename to common_components/platform/arm64/string_hash_internal.h index f2625e8dd9281482d497cf7775e2354fa2b3f17c..699fdec49da7c0554ba209e3dc7afbeebbac0386 100644 --- a/ecmascript/platform/arm64/ecma_string_hash_internal.h +++ b/common_components/platform/arm64/string_hash_internal.h @@ -13,18 +13,19 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_ARM64_H -#define ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_ARM64_H +#ifndef COMMON_COMPONENTS_PLATFORM_STRING_HASH_ARM64_H +#define COMMON_COMPONENTS_PLATFORM_STRING_HASH_ARM64_H #include #include -#include "ecmascript/base/config.h" -#include "ecmascript/platform/ecma_string_hash.h" -namespace panda::ecmascript { -class EcmaStringHashInternal { -friend class EcmaStringHashHelper; +#include "common_components/base/config.h" +#include "common_components/platform/string_hash.h" + +namespace common { +class StringHashInternal { +friend class StringHashHelper; private: #if ENABLE_NEXT_OPTIMIZATION template @@ -46,33 +47,33 @@ private: * at last, totolHash = hash[0] + hash[1] + hash[2] + hash[3]; */ static_assert(std::is_same_v || std::is_same_v); - constexpr size_t blockSize = EcmaStringHash::BLOCK_SIZE; - constexpr size_t loopSize = EcmaStringHash::SIMD_U8_LOOP_SIZE; + constexpr size_t blockSize = StringHash::BLOCK_SIZE; + constexpr size_t loopSize = StringHash::SIMD_U8_LOOP_SIZE; uint32_t hash[blockSize] = {}; uint32_t index = 0; uint32_t remainder = size & (blockSize - 1); switch (remainder) { #define CASE(N) case (N): \ - hash[blockSize - (N)] = data[index++] * EcmaStringHash::MULTIPLIER[blockSize - (N)]; [[fallthrough]] - CASE(EcmaStringHash::SIZE_3); - CASE(EcmaStringHash::SIZE_2); - CASE(EcmaStringHash::SIZE_1); + hash[blockSize - (N)] = data[index++] * StringHash::MULTIPLIER[blockSize - (N)]; [[fallthrough]] + CASE(StringHash::SIZE_3); + CASE(StringHash::SIZE_2); + CASE(StringHash::SIZE_1); #undef CASE default: break; } - hash[0] += hashSeed * EcmaStringHash::MULTIPLIER[blockSize - 1 - remainder]; + hash[0] += hashSeed * StringHash::MULTIPLIER[blockSize - 1 - remainder]; uint32x4_t dataVec; uint32x4_t hashVec; - uint32x4_t multiplierVec = vld1q_u32(EcmaStringHash::MULTIPLIER); - uint32x4_t scaleVec = vdupq_n_u32(EcmaStringHash::BLOCK_MULTIPLY); + uint32x4_t multiplierVec = vld1q_u32(StringHash::MULTIPLIER); + uint32x4_t scaleVec = vdupq_n_u32(StringHash::BLOCK_MULTIPLY); if constexpr (std::is_same_v) { // process 4 elements with for loop if (size-index) % 8 = 4 if ((size - index) % loopSize == blockSize) { for (size_t i = 0; i < blockSize; i++) { - hash[i] = hash[i] * EcmaStringHash::BLOCK_MULTIPLY + data[index++] * EcmaStringHash::MULTIPLIER[i]; + hash[i] = hash[i] * StringHash::BLOCK_MULTIPLY + data[index++] * StringHash::MULTIPLIER[i]; } } hashVec = vld1q_u32(hash); @@ -98,12 +99,12 @@ private: static uint32_t ComputeHashForDataOfLongString(const T *data, size_t size, uint32_t hashSeed) { - constexpr uint32_t hashShift = static_cast(EcmaStringHash::HASH_SHIFT); - constexpr uint32_t blockSize = static_cast(EcmaStringHash::BLOCK_SIZE); + constexpr uint32_t hashShift = static_cast(StringHash::HASH_SHIFT); + constexpr uint32_t blockSize = static_cast(StringHash::BLOCK_SIZE); uint32_t hash[blockSize] = {0}; uint32_t index = 0; uint32x4_t hashVec = vld1q_u32(hash); - uint32x4_t multiplier_vec = vdupq_n_u32(static_cast(EcmaStringHash::HASH_MULTIPLY)); + uint32x4_t multiplier_vec = vdupq_n_u32(static_cast(StringHash::HASH_MULTIPLY)); uint32x4_t dataVec; for (; index + blockSize <= size; index += blockSize) { dataVec[0] = data[index]; @@ -124,5 +125,5 @@ private: } #endif }; -} // namespace panda::ecmascript -#endif // ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_ARM64_H \ No newline at end of file +} // namespace common +#endif // COMMON_COMPONENTS_PLATFORM_STRING_HASH_ARM64_H \ No newline at end of file diff --git a/ecmascript/platform/common/ecma_string_hash_internal.h b/common_components/platform/common/string_hash_internal.h similarity index 70% rename from ecmascript/platform/common/ecma_string_hash_internal.h rename to common_components/platform/common/string_hash_internal.h index 44902dbb7542efb0ae95c70e4fca816c4619dc67..c1456274ba3fa5b13d7c4921c083c3ca21ebe1cc 100644 --- a/ecmascript/platform/common/ecma_string_hash_internal.h +++ b/common_components/platform/common/string_hash_internal.h @@ -13,43 +13,44 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_COMMON_H -#define ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_COMMON_H +#ifndef COMMON_COMPONENTS_PLATFORM_STRING_HASH_COMMON_H +#define COMMON_COMPONENTS_PLATFORM_STRING_HASH_COMMON_H #include -#include "ecmascript/base/config.h" -#include "ecmascript/platform/ecma_string_hash.h" -namespace panda::ecmascript { -class EcmaStringHashInternal { -friend class EcmaStringHashHelper; +#include "common_components/base/config.h" +#include "common_components/platform/string_hash.h" + +namespace common { +class StringHashInternal { +friend class StringHashHelper; private: #if ENABLE_NEXT_OPTIMIZATION template static uint32_t ComputeHashForDataOfLongString(const T *data, size_t size, uint32_t hashSeed) { - constexpr uint32_t blockSize = EcmaStringHash::BLOCK_SIZE; - constexpr uint32_t scale = EcmaStringHash::BLOCK_MULTIPLY; + constexpr uint32_t blockSize = StringHash::BLOCK_SIZE; + constexpr uint32_t scale = StringHash::BLOCK_MULTIPLY; uint32_t hash[blockSize] = {}; uint32_t index = 0; uint32_t remainder = size & (blockSize - 1); switch (remainder) { #define CASE(N) case (N): \ - hash[blockSize - (N)] = data[index++] * EcmaStringHash::MULTIPLIER[blockSize - (N)]; [[fallthrough]] - CASE(EcmaStringHash::SIZE_3); - CASE(EcmaStringHash::SIZE_2); - CASE(EcmaStringHash::SIZE_1); + hash[blockSize - (N)] = data[index++] * StringHash::MULTIPLIER[blockSize - (N)]; [[fallthrough]] + CASE(StringHash::SIZE_3); + CASE(StringHash::SIZE_2); + CASE(StringHash::SIZE_1); #undef CASE default: break; } - hash[0] += hashSeed * EcmaStringHash::MULTIPLIER[blockSize - 1 - remainder]; + hash[0] += hashSeed * StringHash::MULTIPLIER[blockSize - 1 - remainder]; uint32_t dataMul[blockSize] = {}; for (; index < size; index += blockSize) { for (size_t i = 0; i < blockSize; i++) { - dataMul[i] = data[index + i] * EcmaStringHash::MULTIPLIER[i]; + dataMul[i] = data[index + i] * StringHash::MULTIPLIER[i]; hash[i] = hash[i] * scale + dataMul[i]; } } @@ -64,8 +65,8 @@ private: static uint32_t ComputeHashForDataOfLongString(const T *data, size_t size, uint32_t hashSeed) { - constexpr uint32_t hashShift = static_cast(EcmaStringHash::HASH_SHIFT); - constexpr uint32_t blockSize = static_cast(EcmaStringHash::BLOCK_SIZE); + constexpr uint32_t hashShift = static_cast(StringHash::HASH_SHIFT); + constexpr uint32_t blockSize = static_cast(StringHash::BLOCK_SIZE); uint32_t hash[blockSize] = {0}; uint32_t index = 0; for (; index + blockSize <= size; index += blockSize) { @@ -85,5 +86,5 @@ private: } #endif }; -} // namespace panda::ecmascript -#endif // ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_COMMON_H \ No newline at end of file +} // namespace common +#endif // COMMON_COMPONENTS_PLATFORM_STRING_HASH_COMMON_H \ No newline at end of file diff --git a/common_components/platform/cpu.h b/common_components/platform/cpu.h index ad15fa734df5c350deb22ecdabb7de9aa941185c..e5b9afc315b1de34dd071ae93e0e9839e8607f13 100644 --- a/common_components/platform/cpu.h +++ b/common_components/platform/cpu.h @@ -19,10 +19,10 @@ #include #include -namespace panda { +namespace common { uint32_t NumberOfCpuCore(); size_t PhysicalSize(); -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_PLATFORM_OS_H \ No newline at end of file diff --git a/common_components/platform/os.h b/common_components/platform/os.h index c288272a8f6786aee705e4fe1006b974811ad396..e0633448ee60bce485330902d607be3b0f112e6f 100644 --- a/common_components/platform/os.h +++ b/common_components/platform/os.h @@ -19,8 +19,8 @@ #include #include -namespace panda::os { +namespace common::os { int PrctlSetVMA(const void *p, const size_t size, const char *tag); -} // namespace panda +} // namespace common::os #endif // COMMON_COMPONENTS_PLATFORM_OS_H diff --git a/ecmascript/platform/ecma_string_hash.h b/common_components/platform/string_hash.h similarity index 83% rename from ecmascript/platform/ecma_string_hash.h rename to common_components/platform/string_hash.h index eab65f9c7744ced9bb6dae3380c6991ea74bf56d..81c5bc104d66cc7710c90ebcd954da36d95e7ac9 100644 --- a/ecmascript/platform/ecma_string_hash.h +++ b/common_components/platform/string_hash.h @@ -13,13 +13,14 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_H -#define ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_H +#ifndef COMMON_COMPONENTS_PLATFORM_STRING_HASH_H +#define COMMON_COMPONENTS_PLATFORM_STRING_HASH_H +#include #include -namespace panda::ecmascript { - class EcmaStringHash { +namespace common { + class StringHash { public: static constexpr size_t BLOCK_SIZE = 4; static constexpr size_t SIMD_U8_LOOP_SIZE = 8; @@ -35,5 +36,5 @@ namespace panda::ecmascript { static constexpr size_t SIZE_2 = 2; static constexpr size_t SIZE_3 = 3; }; -} // namespace panda::ecmascript -#endif // ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_H +} // namespace common +#endif // COMMON_COMPONENTS_PLATFORM_STRING_HASH_H diff --git a/ecmascript/platform/ecma_string_hash_helper.h b/common_components/platform/string_hash_helper.h similarity index 62% rename from ecmascript/platform/ecma_string_hash_helper.h rename to common_components/platform/string_hash_helper.h index d2d86d3af16c804cb762278c6077d5343524f1ab..a285766abbc723f74782a0295ad8e6fa69f1ccd0 100644 --- a/ecmascript/platform/ecma_string_hash_helper.h +++ b/common_components/platform/string_hash_helper.h @@ -13,26 +13,27 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_HELPER_H -#define ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_HELPER_H +#ifndef COMMON_COMPONENTS_PLATFORM_STRING_HASH_HELPER_H +#define COMMON_COMPONENTS_PLATFORM_STRING_HASH_HELPER_H #include -#include "ecmascript/platform/ecma_string_hash.h" + +#include "common_components/platform/string_hash.h" #if defined(PANDA_TARGET_ARM64) && !defined(PANDA_TARGET_MACOS) -#include "ecmascript/platform/arm64/ecma_string_hash_internal.h" +#include "common_components/platform/arm64/string_hash_internal.h" #else -#include "ecmascript/platform/common/ecma_string_hash_internal.h" +#include "common_components/platform/common/string_hash_internal.h" #endif -namespace panda::ecmascript { -class EcmaStringHashHelper { +namespace common { +class StringHashHelper { public: template static uint32_t ComputeHashForDataPlatform(const T *data, size_t size, uint32_t hashSeed) { - return EcmaStringHashInternal::ComputeHashForDataOfLongString(data, size, hashSeed); + return StringHashInternal::ComputeHashForDataOfLongString(data, size, hashSeed); } }; -} // namespace panda::ecmascript -#endif // ECMASCRIPT_PLATFORM_ECMA_STRING_HASH_HELPER_H +} // namespace common +#endif // COMMON_COMPONENTS_PLATFORM_STRING_HASH_HELPER_H diff --git a/common_components/platform/unix/linux/cpu.cpp b/common_components/platform/unix/linux/cpu.cpp index 0233cac60963cc6f6fef8d395acee8ab5017c602..4fd4e404d7fe7d863bbd507de5e202ee2357cdc8 100644 --- a/common_components/platform/unix/linux/cpu.cpp +++ b/common_components/platform/unix/linux/cpu.cpp @@ -17,7 +17,7 @@ #include -namespace panda { +namespace common { uint32_t NumberOfCpuCore() { return static_cast(sysconf(_SC_NPROCESSORS_ONLN)); @@ -29,5 +29,5 @@ size_t PhysicalSize() auto pageSize = sysconf(_SC_PAGE_SIZE); return pages * pageSize; } -} // namespace panda +} // namespace common \ No newline at end of file diff --git a/common_components/platform/unix/linux/os.cpp b/common_components/platform/unix/linux/os.cpp index 9fd84c8af88e89051194a6585eefd331fb178dbc..8a2dd8fcf477dd97a4384b9661efed2898a1e940 100644 --- a/common_components/platform/unix/linux/os.cpp +++ b/common_components/platform/unix/linux/os.cpp @@ -25,10 +25,10 @@ #define PR_SET_VMA_ANON_NAME 0 #endif -namespace panda::os { +namespace common::os { int PrctlSetVMA(const void *p, const size_t size, const char *tag) { return prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, tag); } -} // namespace panda +} // namespace common::os \ No newline at end of file diff --git a/common_components/platform/unix/mac/cpu.cpp b/common_components/platform/unix/mac/cpu.cpp index 1ef2137eb802fd8c857481a448c30a327d57166e..19ff06104541449109420e7db4826142b22ccb64 100644 --- a/common_components/platform/unix/mac/cpu.cpp +++ b/common_components/platform/unix/mac/cpu.cpp @@ -22,7 +22,7 @@ #include "common_components/log/log.h" -namespace panda { +namespace common { uint32_t NumberOfCpuCore() { return static_cast(sysconf(_SC_NPROCESSORS_ONLN)); @@ -41,4 +41,4 @@ size_t PhysicalSize() } return static_cast(size); } -} // namespace panda +} // namespace common diff --git a/common_components/platform/unix/mac/os.cpp b/common_components/platform/unix/mac/os.cpp index 14f2b203b8661f953aa504a560baa543977564e3..77260dc5551e9fffc062825c72a92c1a9c81afd1 100644 --- a/common_components/platform/unix/mac/os.cpp +++ b/common_components/platform/unix/mac/os.cpp @@ -15,10 +15,10 @@ #include "common_components/platform/os.h" -namespace panda::os { +namespace common::os { int PrctlSetVMA(const void *, const size_t, const char *) { return -1; } -} // namespace panda +} // namespace common::os \ No newline at end of file diff --git a/common_components/platform/windows/cpu.cpp b/common_components/platform/windows/cpu.cpp index 10f91c7c0a64d080e22c432a25ad7c698a94d8a0..ab0aae0f2add4b7983e09bb4bb454639a4490f40 100644 --- a/common_components/platform/windows/cpu.cpp +++ b/common_components/platform/windows/cpu.cpp @@ -18,7 +18,7 @@ #include #include -namespace panda { +namespace common { uint32_t NumberOfCpuCore() { SYSTEM_INFO info; @@ -34,5 +34,5 @@ size_t PhysicalSize() DWORDLONG physSize = status.ullTotalPhys; return physSize; } -} // namespace panda +} // namespace common \ No newline at end of file diff --git a/common_components/platform/windows/os.cpp b/common_components/platform/windows/os.cpp index 14f2b203b8661f953aa504a560baa543977564e3..77260dc5551e9fffc062825c72a92c1a9c81afd1 100644 --- a/common_components/platform/windows/os.cpp +++ b/common_components/platform/windows/os.cpp @@ -15,10 +15,10 @@ #include "common_components/platform/os.h" -namespace panda::os { +namespace common::os { int PrctlSetVMA(const void *, const size_t, const char *) { return -1; } -} // namespace panda +} // namespace common::os \ No newline at end of file diff --git a/common_components/serialize/serialize_utils.cpp b/common_components/serialize/serialize_utils.cpp index cb180ec948b40278d78913d7d37816bcf2ef116c..d0df7df7f857b233106654cf115f3ecdd04eaf4c 100755 --- a/common_components/serialize/serialize_utils.cpp +++ b/common_components/serialize/serialize_utils.cpp @@ -15,10 +15,10 @@ #include "common_components/serialize/serialize_utils.h" -#include "common_components/common_runtime/src/heap/allocator/region_desc.h" +#include "common_components/heap/allocator/region_desc.h" #include "common_interfaces/base_runtime.h" -namespace panda { +namespace common { SerializedObjectSpace SerializeUtils::GetSerializeObjectSpace(uintptr_t obj) { RegionDesc *info = RegionDesc::GetRegionDescAt(obj); @@ -50,4 +50,4 @@ size_t SerializeUtils::GetRegionSize() { return BaseRuntime::GetInstance()->GetHeapParam().regionSize * KB; } -} // namespace panda +} // namespace common diff --git a/common_components/serialize/serialize_utils.h b/common_components/serialize/serialize_utils.h index c991c93ee6a84c2995956f8be221fc2cb58cad7e..8e51c85ae3e4efc50b3e0e20b737d850d41b70d3 100644 --- a/common_components/serialize/serialize_utils.h +++ b/common_components/serialize/serialize_utils.h @@ -19,7 +19,7 @@ #include #include -namespace panda { +namespace common { enum class SerializedObjectSpace : uint8_t { REGULAR_SPACE, @@ -34,5 +34,5 @@ public: static SerializedObjectSpace GetSerializeObjectSpace(uintptr_t obj); static size_t GetRegionSize(); }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_SERIALIZE_UTILS_H diff --git a/common_components/taskpool/runner.cpp b/common_components/taskpool/runner.cpp index c030ca62e9b28cddb866f8e7c82d607f1c803283..42ee009a6fb06d52be7dc476161aecaec918cb97 100644 --- a/common_components/taskpool/runner.cpp +++ b/common_components/taskpool/runner.cpp @@ -15,13 +15,14 @@ #include "common_components/taskpool/runner.h" +#include "libpandabase/os/thread.h" #ifdef ENABLE_QOS #include "qos.h" #endif -namespace panda { -Runner::Runner(uint32_t threadNum, const std::function prologueHook, - const std::function epilogueHook) +namespace common { +Runner::Runner(uint32_t threadNum, const std::function prologueHook, + const std::function epilogueHook) : totalThreadNum_(threadNum), prologueHook_(prologueHook), epilogueHook_(epilogueHook) @@ -110,7 +111,7 @@ void Runner::SetQosPriority([[maybe_unused]] PriorityMode mode) void Runner::RecordThreadId() { std::lock_guard guard(mtx_); - gcThreadId_.emplace_back(os::thread::GetCurrentThreadId()); + gcThreadId_.emplace_back(panda::os::thread::GetCurrentThreadId()); } void Runner::SetRunTask(uint32_t threadId, Task *task) @@ -121,8 +122,8 @@ void Runner::SetRunTask(uint32_t threadId, Task *task) void Runner::Run(uint32_t threadId) { - os::thread::native_handle_type thread = os::thread::GetNativeHandle(); - os::thread::SetThreadName(thread, "OS_GC_Thread"); + native_handle_type thread = panda::os::thread::GetNativeHandle(); + panda::os::thread::SetThreadName(thread, "OS_GC_Thread"); PrologueHook(thread); RecordThreadId(); while (std::unique_ptr task = taskQueue_.PopTask()) { @@ -132,4 +133,4 @@ void Runner::Run(uint32_t threadId) } EpilogueHook(thread); } -} // namespace panda +} // namespace common diff --git a/common_components/taskpool/runner.h b/common_components/taskpool/runner.h index 474e3f1cd8e9d9381c2467e25a6bd4143800d675..a9c1ad4e9697092d09966b7fdb5be0e34bcc9f36 100644 --- a/common_components/taskpool/runner.h +++ b/common_components/taskpool/runner.h @@ -25,13 +25,12 @@ #include "common_components/taskpool/task_queue.h" #include "common_interfaces/base/common.h" -#include "libpandabase/macros.h" -#include "libpandabase/os/thread.h" -namespace panda { +namespace common { static constexpr uint32_t MIN_TASKPOOL_THREAD_NUM = 3; static constexpr uint32_t MAX_TASKPOOL_THREAD_NUM = 5; static constexpr uint32_t DEFAULT_TASKPOOL_THREAD_NUM = 0; +using native_handle_type = std::thread::native_handle_type; enum class PriorityMode { STW, @@ -42,12 +41,12 @@ enum class PriorityMode { class Runner { public: explicit Runner(uint32_t threadNum, - const std::function prologueHook, - const std::function epilogueHook); + const std::function prologueHook, + const std::function epilogueHook); ~Runner() = default; - NO_COPY_SEMANTIC(Runner); - NO_MOVE_SEMANTIC(Runner); + NO_COPY_SEMANTIC_CC(Runner); + NO_MOVE_SEMANTIC_CC(Runner); void PostTask(std::unique_ptr task) { @@ -80,13 +79,13 @@ public: return false; } - void PrologueHook(os::thread::native_handle_type thread) + void PrologueHook(native_handle_type thread) { if (prologueHook_ != nullptr) { prologueHook_(thread); } } - void EpilogueHook(os::thread::native_handle_type thread) + void EpilogueHook(native_handle_type thread) { if (epilogueHook_ != nullptr) { epilogueHook_(thread); @@ -106,8 +105,8 @@ private: std::mutex mtx_; std::mutex mtxPool_; - std::function prologueHook_; - std::function epilogueHook_; + std::function prologueHook_; + std::function epilogueHook_; }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_TASKPOOL_RUNNER_H diff --git a/common_components/taskpool/task.h b/common_components/taskpool/task.h index 1fe5d26e4e8e983a6b283a1305f45d964ffbf9ba..507dd823a5b6302d5175a32a6beb98896bfa566f 100644 --- a/common_components/taskpool/task.h +++ b/common_components/taskpool/task.h @@ -19,9 +19,9 @@ #include #include -#include "libpandabase/macros.h" +#include "common_interfaces/base/common.h" -namespace panda { +namespace common { enum class TaskType : uint8_t { PGO_SAVE_TASK, PGO_RESET_OUT_PATH_TASK, @@ -39,8 +39,8 @@ public: virtual ~Task() = default; virtual bool Run(uint32_t threadIndex) = 0; - NO_COPY_SEMANTIC(Task); - NO_MOVE_SEMANTIC(Task); + NO_COPY_SEMANTIC_CC(Task); + NO_MOVE_SEMANTIC_CC(Task); virtual TaskType GetTaskType() const { @@ -71,8 +71,8 @@ class TaskPackMonitor { public: explicit TaskPackMonitor(int running, int maxRunning) : running_(running), maxRunning_(maxRunning) { - ASSERT(running_ >= 0); - ASSERT(running_ <= maxRunning_); + DCHECK_CC(running_ >= 0); + DCHECK_CC(running_ <= maxRunning_); } ~TaskPackMonitor() = default; @@ -87,7 +87,7 @@ public: bool TryAddNewOne() { std::lock_guard guard(mutex_); - ASSERT(running_ >= 0); + DCHECK_CC(running_ >= 0); if (running_ < maxRunning_) { ++running_; return true; @@ -103,13 +103,13 @@ public: } } - NO_COPY_SEMANTIC(TaskPackMonitor); - NO_MOVE_SEMANTIC(TaskPackMonitor); + NO_COPY_SEMANTIC_CC(TaskPackMonitor); + NO_MOVE_SEMANTIC_CC(TaskPackMonitor); private: int running_ {0}; int maxRunning_ {0}; std::condition_variable cv_; std::mutex mutex_; }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_TASKPOOL_TASK_H diff --git a/common_components/taskpool/task_queue.cpp b/common_components/taskpool/task_queue.cpp index d9ada02d4e8be5cbead433f2fc3d8ee479cd692a..0f542db94260d7dc867bbb74387941582f678517 100644 --- a/common_components/taskpool/task_queue.cpp +++ b/common_components/taskpool/task_queue.cpp @@ -15,11 +15,11 @@ #include "common_components/taskpool/task_queue.h" -namespace panda { +namespace common { void TaskQueue::PostTask(std::unique_ptr task) { std::lock_guard guard(mtx_); - ASSERT(!terminate_); + DCHECK_CC(!terminate_); tasks_.push_back(std::move(task)); cv_.notify_one(); } @@ -27,7 +27,7 @@ void TaskQueue::PostTask(std::unique_ptr task) void TaskQueue::PostDelayedTask(std::unique_ptr task, uint64_t delayMilliseconds) { std::lock_guard guard(mtx_); - ASSERT(!terminate_); + DCHECK_CC(!terminate_); auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMilliseconds); delayedTasks_.insert({deadline, std::move(task)}); cv_.notify_one(); @@ -93,7 +93,7 @@ void TaskQueue::ForEachTask(const std::function &f) void TaskQueue::MoveExpiredTask(std::unique_lock &lock) { - ASSERT(!mtx_.try_lock()); + DCHECK_CC(!mtx_.try_lock()); while (!delayedTasks_.empty()) { auto it = delayedTasks_.begin(); auto currentTime = std::chrono::steady_clock::now(); @@ -107,7 +107,7 @@ void TaskQueue::MoveExpiredTask(std::unique_lock &lock) void TaskQueue::WaitForTask(std::unique_lock &lock) { - ASSERT(!mtx_.try_lock()); + DCHECK_CC(!mtx_.try_lock()); if (!delayedTasks_.empty()) { auto it = delayedTasks_.begin(); auto currentTime = std::chrono::steady_clock::now(); @@ -120,4 +120,4 @@ void TaskQueue::WaitForTask(std::unique_lock &lock) cv_.wait(lock); } } -} // namespace panda +} // namespace common diff --git a/common_components/taskpool/task_queue.h b/common_components/taskpool/task_queue.h index dcd26e9d15222860c79fe587aaf33f83265fb5aa..bfdbe5109688dd3d661d3a6a2ad91cf0add7f844 100644 --- a/common_components/taskpool/task_queue.h +++ b/common_components/taskpool/task_queue.h @@ -27,17 +27,17 @@ #include #include "common_components/taskpool/task.h" -#include "libpandabase/macros.h" +#include "common_interfaces/base/common.h" -namespace panda { +namespace common { using SteadyTimePoint = std::chrono::steady_clock::time_point; class TaskQueue { public: TaskQueue() = default; ~TaskQueue() = default; - NO_COPY_SEMANTIC(TaskQueue); - NO_MOVE_SEMANTIC(TaskQueue); + NO_COPY_SEMANTIC_CC(TaskQueue); + NO_MOVE_SEMANTIC_CC(TaskQueue); void PostTask(std::unique_ptr task); void PostDelayedTask(std::unique_ptr task, uint64_t delayMilliseconds); @@ -66,5 +66,5 @@ private: std::mutex mtx_; std::condition_variable cv_; }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_TASKPOOL_TASK_QUEUE_H diff --git a/common_components/taskpool/taskpool.cpp b/common_components/taskpool/taskpool.cpp index 60dd259de5aaa94733d46fe774c7aff3906496b8..99e16eba9ed5cc3545b0b6abcbf5dabd72462ed2 100644 --- a/common_components/taskpool/taskpool.cpp +++ b/common_components/taskpool/taskpool.cpp @@ -17,7 +17,7 @@ #include "common_components/platform/cpu.h" -namespace panda { +namespace common { Taskpool *Taskpool::GetCurrentTaskpool() { static Taskpool *taskpool = new Taskpool(); @@ -25,8 +25,8 @@ Taskpool *Taskpool::GetCurrentTaskpool() } void Taskpool::Initialize(int threadNum, - std::function prologueHook, - const std::function epilogueHook) + std::function prologueHook, + const std::function epilogueHook) { std::lock_guard guard(mutex_); if (isInitialized_++ <= 0) { @@ -75,4 +75,4 @@ void Taskpool::ForEachTask(const std::function &f) } runner_->ForEachTask(f); } -} // namespace panda +} // namespace common diff --git a/common_components/taskpool/taskpool.h b/common_components/taskpool/taskpool.h index d7f24d66dbc0ba4b7590ee9abaf4605fc4c3a5eb..95b1f0420a8fee9da858380baec182e46f32ab03 100644 --- a/common_components/taskpool/taskpool.h +++ b/common_components/taskpool/taskpool.h @@ -21,9 +21,8 @@ #include "common_components/taskpool/runner.h" #include "common_interfaces/base/common.h" -#include "libpandabase/macros.h" -namespace panda { +namespace common { class PUBLIC_API Taskpool { public: PUBLIC_API static Taskpool *GetCurrentTaskpool(); @@ -36,17 +35,17 @@ public: isInitialized_ = 0; } - NO_COPY_SEMANTIC(Taskpool); - NO_MOVE_SEMANTIC(Taskpool); + NO_COPY_SEMANTIC_CC(Taskpool); + NO_MOVE_SEMANTIC_CC(Taskpool); void Initialize(int threadNum = DEFAULT_TASKPOOL_THREAD_NUM, - std::function prologueHook = nullptr, - const std::function epilogueHook = nullptr); + std::function prologueHook = nullptr, + const std::function epilogueHook = nullptr); void Destroy(int32_t id); void PostTask(std::unique_ptr task) const { - ASSERT(isInitialized_ > 0); + DCHECK_CC(isInitialized_ > 0); if (isInitialized_ > 0) { runner_->PostTask(std::move(task)); } @@ -54,7 +53,7 @@ public: void PostDelayedTask(std::unique_ptr task, uint64_t delayMilliseconds) const { - ASSERT(isInitialized_ > 0); + DCHECK_CC(isInitialized_ > 0); if (isInitialized_ > 0) { runner_->PostDelayedTask(std::move(task), delayMilliseconds); } @@ -87,5 +86,5 @@ private: volatile int isInitialized_ = 0; std::mutex mutex_; }; -} // namespace panda +} // namespace common #endif // COMMON_COMPONENTS_TASKPOOL_TASKPOOL_H diff --git a/common_components/thread/thread_holder.cpp b/common_components/thread/thread_holder.cpp index fa35b296a40617770bdf1180353097c317839676..ed4c80f5ed7ff915d912f3f7c65ba66b481d7dea 100755 --- a/common_components/thread/thread_holder.cpp +++ b/common_components/thread/thread_holder.cpp @@ -16,13 +16,13 @@ #include "common_interfaces/thread/thread_holder-inl.h" #include "common_components/base_runtime/hooks.h" -#include "common_components/common_runtime/src/mutator/mutator.h" -#include "common_components/common_runtime/src/mutator/thread_local.h" +#include "common_components/mutator/mutator.h" +#include "common_components/mutator/thread_local.h" #include "common_interfaces/base_runtime.h" #include "common_interfaces/thread/base_thread.h" #include "common_interfaces/thread/thread_holder_manager.h" -namespace panda { +namespace common { thread_local ThreadHolder *currentThreadHolder = nullptr; ThreadHolder *ThreadHolder::CreateAndRegisterNewThreadHolder(void *vm) @@ -31,7 +31,7 @@ ThreadHolder *ThreadHolder::CreateAndRegisterNewThreadHolder(void *vm) LOG_COMMON(FATAL) << "CreateAndRegisterNewThreadHolder fail"; return nullptr; } - Mutator* mutator = panda::Mutator::NewMutator(); + Mutator* mutator = Mutator::NewMutator(); CHECK_CC(mutator != nullptr); mutator->SetEcmaVMPtr(vm); ThreadHolder *holder = mutator->GetThreadHolder(); @@ -154,4 +154,4 @@ ThreadHolder::TryBindMutatorScope::~TryBindMutatorScope() holder_ = nullptr; } } -} // namespace panda +} // namespace common diff --git a/common_components/thread/thread_holder_manager.cpp b/common_components/thread/thread_holder_manager.cpp index f2c6fa98d911675ff09837373521751b5405a273..0f52af45a7ac1eadfc891e3355256c197c63c08a 100755 --- a/common_components/thread/thread_holder_manager.cpp +++ b/common_components/thread/thread_holder_manager.cpp @@ -17,18 +17,16 @@ #include -#include "common_components/common_runtime/src/mutator/mutator_manager.h" +#include "common_components/mutator/mutator_manager.h" #include "common_components/log/log.h" #include "common_interfaces/thread/thread_holder-inl.h" -namespace panda { -using MutatorManager = panda::MutatorManager; - +namespace common { void ThreadHolderManager::RegisterThreadHolder([[maybe_unused]] ThreadHolder *holder) { Mutator *mutator = static_cast(holder->GetMutator()); - auto& mutator_manager = panda::MutatorManager::Instance(); + auto& mutator_manager = MutatorManager::Instance(); mutator_manager.MutatorManagementRLock(); { @@ -44,7 +42,7 @@ void ThreadHolderManager::BindMutator(ThreadHolder *holder) { Mutator *mutator = static_cast(holder->GetMutator()); - auto& mutator_manager = panda::MutatorManager::Instance(); + auto& mutator_manager = MutatorManager::Instance(); mutator_manager.MutatorManagementRLock(); mutator_manager.BindMutator(*mutator); @@ -56,7 +54,7 @@ void ThreadHolderManager::UnbindMutator(ThreadHolder *holder) { Mutator *mutator = static_cast(holder->GetMutator()); - auto& mutator_manager = panda::MutatorManager::Instance(); + auto& mutator_manager = MutatorManager::Instance(); mutator_manager.MutatorManagementRLock(); mutator_manager.UnbindMutator(*mutator); @@ -69,7 +67,7 @@ void ThreadHolderManager::UnregisterThreadHolder(ThreadHolder *holder) { Mutator *mutator = static_cast(holder->GetMutator()); - auto& mutator_manager = panda::MutatorManager::Instance(); + auto& mutator_manager = MutatorManager::Instance(); mutator_manager.MutatorManagementRLock(); { @@ -114,4 +112,4 @@ void ThreadHolderManager::ResumeAllImpl(ThreadHolder *current) { MutatorManager::Instance().StartTheWorld(); } -} // namespace panda +} // namespace common diff --git a/ecmascript/base/config.h b/ecmascript/base/config.h index 7c8e540ef48776973f59192675f543bf7e05d076..abc95dd014fcf6a4f44f74bdfa62f18c0640a61c 100644 --- a/ecmascript/base/config.h +++ b/ecmascript/base/config.h @@ -16,6 +16,8 @@ #ifndef ECMASCRIPT_BASE_CONFIG_H #define ECMASCRIPT_BASE_CONFIG_H +#include "common_components/base/config.h" + namespace panda::ecmascript { #define ARK_INLINE __attribute__((always_inline)) #define ARK_NOINLINE __attribute__((noinline)) @@ -43,18 +45,6 @@ namespace panda::ecmascript { #define ECMASCRIPT_ENABLE_TRACE_DEFINEFUNC 0 #define ECMASCRIPT_ENABLE_LAZY_DEOPT_TRACE 0 -#if defined (NEXT_OPTIMIZATION_MACRO) -#define ENABLE_NEXT_OPTIMIZATION 1 -#else -#define ENABLE_NEXT_OPTIMIZATION 0 -#endif - -#if ENABLE_NEXT_OPTIMIZATION - #define NEXT_OPTIMIZATION_BOOL true -#else - #define NEXT_OPTIMIZATION_BOOL false -#endif - #ifndef NDEBUG #define ECMASCRIPT_ENABLE_INTERPRETER_LOG 1 #define ECMASCRIPT_ENABLE_RUNTIME_STAT 1 diff --git a/ecmascript/base/json_helper.cpp b/ecmascript/base/json_helper.cpp index 6c8258b6f45873ef2f72a79d8fb84886e00441ac..42e809eda3988d12751593ad013cb62161afca90 100644 --- a/ecmascript/base/json_helper.cpp +++ b/ecmascript/base/json_helper.cpp @@ -14,7 +14,7 @@ */ #include "ecmascript/base/json_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" namespace panda::ecmascript::base { @@ -108,10 +108,10 @@ bool JsonHelper::IsFastValueToQuotedString(const CString& str) void JsonHelper::AppendQuotedValueToC16String(const Span &sp, uint32_t &index, C16String &output) { auto ch = sp[index]; - if (utf_helper::IsUTF16Surrogate(ch)) { + if (common::utf_helper::IsUTF16Surrogate(ch)) { // utf-16 to quoted string - if (ch <= utf_helper::DECODE_LEAD_HIGH) { - if (index + 1 < sp.size() && utf_helper::IsUTF16LowSurrogate(sp[index + 1])) { + if (ch <= common::utf_helper::DECODE_LEAD_HIGH) { + if (index + 1 < sp.size() && common::utf_helper::IsUTF16LowSurrogate(sp[index + 1])) { AppendChar(output, ch); AppendChar(output, sp[index + 1]); ++index; @@ -204,9 +204,9 @@ void JsonHelper::AppendValueToQuotedString(const CString& str, CString& output) static_cast(str[i + 1]) <= ALONE_SURROGATE_3B_SECOND_END && // 1: 1th character after ch static_cast(str[i + 2]) >= ALONE_SURROGATE_3B_THIRD_START && // 2: 2nd character after ch static_cast(str[i + 2]) <= ALONE_SURROGATE_3B_THIRD_END) { // 2: 2nd character after ch - auto unicodeRes = utf_helper::ConvertUtf8ToUnicodeChar( + auto unicodeRes = common::utf_helper::ConvertUtf8ToUnicodeChar( reinterpret_cast(str.c_str() + i), 3); // 3: Parse 3 characters - ASSERT(unicodeRes.first != utf_helper::INVALID_UTF8); + ASSERT(unicodeRes.first != common::utf_helper::INVALID_UTF8); AppendUnicodeEscape(static_cast(unicodeRes.first), output); i += 2; // 2 : Skip 2 characters break; diff --git a/ecmascript/base/json_parser.h b/ecmascript/base/json_parser.h index a6bcd75dea751e65e70e55a359a43b71da503851..ca59df253e4be0babf1c1ae5b575a49214d00875 100644 --- a/ecmascript/base/json_parser.h +++ b/ecmascript/base/json_parser.h @@ -22,7 +22,6 @@ #include "ecmascript/base/builtins_base.h" #include "ecmascript/base/number_helper.h" #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/ecma_string.h" #include "ecmascript/js_array.h" diff --git a/ecmascript/base/json_stringifier.cpp b/ecmascript/base/json_stringifier.cpp index 4ee0aa3be89b68bc1a6105656aa4154c169ad66f..5f096b88b99eb74c732914370a672f1edc6ea9b1 100644 --- a/ecmascript/base/json_stringifier.cpp +++ b/ecmascript/base/json_stringifier.cpp @@ -167,7 +167,7 @@ bool JsonStringifier::CalculateStringGap(const JSHandle &primString) if (gapLen > 0) { uint32_t gapLength = gapLen; if (gapLen > GAP_MAX_LEN) { - if (gapString.at(GAP_MAX_LEN - 1) == static_cast(utf_helper::UTF8_2B_FIRST)) { + if (gapString.at(GAP_MAX_LEN - 1) == static_cast(common::utf_helper::UTF8_2B_FIRST)) { gapLength = GAP_MAX_LEN + 1; } else { gapLength = GAP_MAX_LEN; diff --git a/ecmascript/base/number_helper.cpp b/ecmascript/base/number_helper.cpp index 0714b02629e97c473b741723065bcb3fb92072cc..269702f291147a5caf11b60f7e3e73911ea11337 100644 --- a/ecmascript/base/number_helper.cpp +++ b/ecmascript/base/number_helper.cpp @@ -98,7 +98,7 @@ bool NumberHelper::GotoNonspace(uint8_t **ptr, const uint8_t *end) ++size; utf8Bit >>= 1UL; } - if (base::utf_helper::ConvertRegionUtf8ToUtf16(*ptr, &c, end - *ptr, 1) <= 0) { + if (common::utf_helper::ConvertRegionUtf8ToUtf16(*ptr, &c, end - *ptr, 1) <= 0) { return true; } } diff --git a/ecmascript/base/string_helper.h b/ecmascript/base/string_helper.h index 7f26fc97eb21e0ecf8f7c223f7068d9b5759e405..e029fe18b10cd5f5ad0a3abe456cc80476b32e0b 100644 --- a/ecmascript/base/string_helper.h +++ b/ecmascript/base/string_helper.h @@ -24,9 +24,10 @@ #include #include -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/mem/c_containers.h" #include "ecmascript/mem/c_string.h" +#include "libpandabase/utils/span.h" #include "securec.h" #include "unicode/unistr.h" @@ -272,10 +273,10 @@ public: c &= UTF8_FIRST_CODE[l - 1]; for (int i = 0; i < l; i++) { b = *p++; - if (b < utf_helper::UTF8_2B_SECOND || b >= utf_helper::UTF8_2B_FIRST) { + if (b < common::utf_helper::UTF8_2B_SECOND || b >= common::utf_helper::UTF8_2B_FIRST) { return INVALID_UNICODE_FROM_UTF8; } - c = (c << 6) | (b & utf_helper::UTF8_2B_THIRD); // 6: Maximum Unicode range + c = (c << 6) | (b & common::utf_helper::UTF8_2B_THIRD); // 6: Maximum Unicode range } if (c < UTF8_MIN_CODE[l - 1]) { return INVALID_UNICODE_FROM_UTF8; diff --git a/ecmascript/base/tests/number_helper_test.cpp b/ecmascript/base/tests/number_helper_test.cpp index 64efcfc57cb78226130868d9c57dfd9c9750d042..ddc0b7796fe43aeb82be0fbcf465457c222f3bf2 100644 --- a/ecmascript/base/tests/number_helper_test.cpp +++ b/ecmascript/base/tests/number_helper_test.cpp @@ -350,7 +350,7 @@ HWTEST_F_L0(NumberHelperTest, IsEmptyString_004) { // 160 belong to empty string uint16_t c = 160; - utf_helper::Utf8Char d = utf_helper::ConvertUtf16ToUtf8(c, 0, true); + common::utf_helper::Utf8Char d = common::utf_helper::ConvertUtf16ToUtf8(c, 0, true); EXPECT_EQ(d.ch.at(1), 160); uint8_t b = d.ch.at(1); EXPECT_TRUE(NumberHelper::IsEmptyString(&b, &b + 1)); diff --git a/ecmascript/base/tests/string_helper_test.cpp b/ecmascript/base/tests/string_helper_test.cpp index 4aa109d55527e7e45ddca01784029955a91b87a2..a5573d23939627f6aa7e72713e474b4a6cabc31e 100644 --- a/ecmascript/base/tests/string_helper_test.cpp +++ b/ecmascript/base/tests/string_helper_test.cpp @@ -14,13 +14,13 @@ */ #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/global_env.h" #include "ecmascript/tests/test_helper.h" using namespace panda::ecmascript; using namespace panda::ecmascript::base; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace panda::test { class StringHelperTest : public BaseTestWithScope { diff --git a/ecmascript/base/tests/utf_helper_test.cpp b/ecmascript/base/tests/utf_helper_test.cpp index 8f885c25b609348579f87bdae476d8c35ca1b2af..6db10c9a6f9a7b1b0941c587298535bec8aaaaf5 100644 --- a/ecmascript/base/tests/utf_helper_test.cpp +++ b/ecmascript/base/tests/utf_helper_test.cpp @@ -13,12 +13,12 @@ * limitations under the License. */ -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/tests/test_helper.h" using namespace panda::ecmascript; using namespace panda::ecmascript::base; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace panda::test { class UtfHelperTest : public BaseTestWithScope { @@ -73,13 +73,13 @@ HWTEST_F_L0(UtfHelperTest, UTF16Decode) uint16_t trail = 0xDF21; EXPECT_TRUE(lead >= DECODE_LEAD_LOW && lead <= DECODE_LEAD_HIGH); EXPECT_TRUE(trail >= DECODE_TRAIL_LOW && trail <= DECODE_TRAIL_HIGH); - uint32_t codePoint = utf_helper::UTF16Decode(lead, trail); + uint32_t codePoint = common::utf_helper::UTF16Decode(lead, trail); EXPECT_EQ(codePoint, 0x64321U); lead = 0xD85D; trail = 0xDFCC; EXPECT_TRUE(lead >= DECODE_LEAD_LOW && lead <= DECODE_LEAD_HIGH); EXPECT_TRUE(trail >= DECODE_TRAIL_LOW && trail <= DECODE_TRAIL_HIGH); - codePoint = utf_helper::UTF16Decode(lead, trail); + codePoint = common::utf_helper::UTF16Decode(lead, trail); EXPECT_EQ(codePoint, 0x277CCU); } @@ -94,20 +94,20 @@ HWTEST_F_L0(UtfHelperTest, IsValidUTF8) const std::vector utfDataOneBitVaild1 = {0x00}; const std::vector utfDataOneBitVaild2 = {BIT_MASK_1 - 0x01}; const std::vector utfDataOneBitInvaild = {BIT_MASK_1}; - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataOneBitVaild1)); - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataOneBitVaild2)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataOneBitInvaild)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataOneBitVaild1)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataOneBitVaild2)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataOneBitInvaild)); // 110xxxxx 10xxxxxx, min:128, max:2047 const std::vector utfDataTwoBitVaild1 = {BIT_MASK_2 + 0x02, BIT_MASK_1}; const std::vector utfDataTwoBitVaild2 = {BIT_MASK_3 - 0x01, BIT_MASK_2 - 0x01}; const std::vector utfDataTwoBitInvaild1 = {BIT_MASK_2, BIT_MASK_2}; const std::vector utfDataTwoBitInvaild2 = {BIT_MASK_3, BIT_MASK_1}; const std::vector utfDataTwoBitInvaild3 = {BIT_MASK_2, BIT_MASK_1}; - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataTwoBitVaild1)); - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataTwoBitVaild2)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataTwoBitInvaild1)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataTwoBitInvaild2)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataTwoBitInvaild3)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataTwoBitVaild1)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataTwoBitVaild2)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataTwoBitInvaild1)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataTwoBitInvaild2)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataTwoBitInvaild3)); // 1110xxxx 10xxxxxx 10xxxxxx, min:2048, max:65535 const std::vector utfDataThreeBitVaild1 = {BIT_MASK_3, BIT_MASK_1 + 0x20, BIT_MASK_1}; const std::vector utfDataThreeBitVaild2 = {BIT_MASK_4 - 0x01, BIT_MASK_2 - 0x01, BIT_MASK_2 - 0x01}; @@ -117,14 +117,14 @@ HWTEST_F_L0(UtfHelperTest, IsValidUTF8) const std::vector utfDataThreeBitInvaild3 = {BIT_MASK_4, BIT_MASK_1, BIT_MASK_1}; const std::vector utfDataThreeBitInvaild4 = {BIT_MASK_4, BIT_MASK_2, BIT_MASK_2}; const std::vector utfDataThreeBitInvaild5 = {BIT_MASK_3, BIT_MASK_1, BIT_MASK_1}; - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataThreeBitVaild1)); - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataThreeBitVaild2)); - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataThreeBitVaild3)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataThreeBitInvaild1)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataThreeBitInvaild2)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataThreeBitInvaild3)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataThreeBitInvaild4)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataThreeBitInvaild5)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataThreeBitVaild1)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataThreeBitVaild2)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataThreeBitVaild3)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataThreeBitInvaild1)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataThreeBitInvaild2)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataThreeBitInvaild3)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataThreeBitInvaild4)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataThreeBitInvaild5)); // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx, min:65536, max:1114111(0x10FFFF) const std::vector utfDataFourBitVaild1 = {BIT_MASK_4, BIT_MASK_1 + 0x10, BIT_MASK_1, BIT_MASK_1}; const std::vector utfDataFourBitVaild3 = {BIT_MASK_4 + 0x01, BIT_MASK_1, BIT_MASK_1, BIT_MASK_1}; @@ -136,15 +136,15 @@ HWTEST_F_L0(UtfHelperTest, IsValidUTF8) const std::vector utfDataFourBitInvaild6 = {BIT_MASK_4, BIT_MASK_1, BIT_MASK_1, BIT_MASK_1}; const std::vector utfDataFourBitInvaild7 = {BIT_MASK_5 - 0x01, BIT_MASK_2 - 0x01, BIT_MASK_2 - 0x01, BIT_MASK_2 - 0x01}; - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataFourBitVaild1)); - EXPECT_TRUE(utf_helper::IsValidUTF8(utfDataFourBitVaild3)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild1)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild2)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild3)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild4)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild5)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild6)); - EXPECT_FALSE(utf_helper::IsValidUTF8(utfDataFourBitInvaild7)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataFourBitVaild1)); + EXPECT_TRUE(common::utf_helper::IsValidUTF8(utfDataFourBitVaild3)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild1)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild2)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild3)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild4)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild5)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild6)); + EXPECT_FALSE(common::utf_helper::IsValidUTF8(utfDataFourBitInvaild7)); } /* @@ -199,15 +199,15 @@ HWTEST_F_L0(UtfHelperTest, ConvertUtf16ToUtf8_001) uint16_t utf16Data1 = 0x00; Utf8Char utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); Utf8Char utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0xD800 >> 12), - UTF8_3B_SECOND | (static_cast(0xD800 >> 6) & utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0xD800) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0xD800 >> 6) & MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0xD800) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); utf16Data0 = 0xDFFF; utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0xDFFF >> 12), - UTF8_3B_SECOND | (static_cast(0xDFFF >> 6) & utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0xDFFF) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0xDFFF >> 6) & MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0xDFFF) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); } @@ -220,29 +220,29 @@ HWTEST_F_L0(UtfHelperTest, ConvertUtf16ToUtf8_002) uint16_t utf16Data1 = 0x00; Utf8Char utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); Utf8Char utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0x800 >> 12), - UTF8_3B_SECOND | (static_cast(0x800 >> 6) & utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0x800) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0x800 >> 6) & MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0x800) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); utf16Data0 = 0xD7FF; utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0xD7FF>>12), - UTF8_3B_SECOND | (static_cast(0xD7FF >> 6) & utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0xD7FF) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0xD7FF >> 6) & MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0xD7FF) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); utf16Data0 = 0xE000; utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0xE000 >> 12), - UTF8_3B_SECOND | (static_cast(0xE000 >> 6)& utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0xE000) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0xE000 >> 6)& MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0xE000) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); utf16Data0 = 0xFFFF; utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); utf8CharTemp = {3, {UTF8_3B_FIRST | static_cast(0xFFFF >> 12), - UTF8_3B_SECOND | (static_cast(0xFFFF >> 6)& utf::MASK_6BIT), - UTF8_3B_THIRD | (static_cast(0xFFFF) & utf::MASK_6BIT)}}; + UTF8_3B_SECOND | (static_cast(0xFFFF >> 6)& MASK_6BIT), + UTF8_3B_THIRD | (static_cast(0xFFFF) & MASK_6BIT)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); } @@ -256,9 +256,9 @@ HWTEST_F_L0(UtfHelperTest, ConvertUtf16ToUtf8_003) Utf8Char utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); uint32_t codePoint = CombineTwoU16(utf16Data0, utf16Data1); Utf8Char utf8CharTemp = {4, {static_cast((codePoint >> 18) | UTF8_4B_FIRST), - static_cast(((codePoint >> 12) & utf::MASK_6BIT) | utf::MASK1), - static_cast(((codePoint >> 6) & utf::MASK_6BIT) | utf::MASK1), - static_cast((codePoint & utf::MASK_6BIT) | utf::MASK1)}}; + static_cast(((codePoint >> 12) & MASK_6BIT) | MASK1), + static_cast(((codePoint >> 6) & MASK_6BIT) | MASK1), + static_cast((codePoint & MASK_6BIT) | MASK1)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); } @@ -270,9 +270,9 @@ HWTEST_F_L0(UtfHelperTest, ConvertUtf16ToUtf8_003) Utf8Char utf8Char = ConvertUtf16ToUtf8(utf16Data0, utf16Data1, false); uint32_t codePoint = CombineTwoU16(utf16Data0, utf16Data1); Utf8Char utf8CharTemp = {4, {static_cast((codePoint >> 18) | UTF8_4B_FIRST), - static_cast(((codePoint >> 12)& utf::MASK_6BIT)| utf::MASK1), - static_cast(((codePoint >> 6)& utf::MASK_6BIT) | utf::MASK1), - static_cast((codePoint & utf::MASK_6BIT) | utf::MASK1)}}; + static_cast(((codePoint >> 12)& MASK_6BIT)| MASK1), + static_cast(((codePoint >> 6)& MASK_6BIT) | MASK1), + static_cast((codePoint & MASK_6BIT) | MASK1)}}; EXPECT_EQ(utf8Char.n, utf8CharTemp.n); EXPECT_EQ(utf8Char.ch, utf8CharTemp.ch); utf8CharTemp = {4, {0xf1, 0xa4, 0x8c, 0xa1}}; diff --git a/ecmascript/builtins/builtins_ark_tools.cpp b/ecmascript/builtins/builtins_ark_tools.cpp index 8328ebfe7dad2dc7d1b9d86a323c05df3eb117f7..83fe369812ff8a1ad0c89ac4fa90e3e9375ad2e6 100644 --- a/ecmascript/builtins/builtins_ark_tools.cpp +++ b/ecmascript/builtins/builtins_ark_tools.cpp @@ -276,7 +276,7 @@ JSTaggedValue BuiltinsArkTools::CurrentEnvIsGlobal(EcmaRuntimeCallInfo *info) JSTaggedValue BuiltinsArkTools::ForceFullGC(EcmaRuntimeCallInfo *info) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::FULL); + common::BaseRuntime::RequestGC(common::GcType::FULL); return JSTaggedValue::True(); #endif ASSERT(info); diff --git a/ecmascript/builtins/builtins_global.cpp b/ecmascript/builtins/builtins_global.cpp index 6eebf8bc9ff98c5af5e1a831eeabeeb74556f609..b7ddbce6bde37ca106267aa4ee5576eb65bdb612 100644 --- a/ecmascript/builtins/builtins_global.cpp +++ b/ecmascript/builtins/builtins_global.cpp @@ -15,7 +15,7 @@ #include "ecmascript/builtins/builtins_global.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/builtins/builtins_global_uri-inl.h" #include "ecmascript/containers/containers_errors.h" #include "ecmascript/ecma_string-inl.h" @@ -237,7 +237,7 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle= base::utf_helper::DECODE_TRAIL_LOW && cc <= base::utf_helper::DECODE_TRAIL_HIGH) { + if (cc >= common::utf_helper::DECODE_TRAIL_LOW && cc <= common::utf_helper::DECODE_TRAIL_HIGH) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(string.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } @@ -251,7 +251,7 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle base::utf_helper::DECODE_LEAD_HIGH) { + if (cc < common::utf_helper::DECODE_LEAD_LOW || cc > common::utf_helper::DECODE_LEAD_HIGH) { vv = cc; } else { k++; @@ -260,11 +260,11 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle base::utf_helper::DECODE_TRAIL_HIGH) { + if (kc < common::utf_helper::DECODE_TRAIL_LOW || kc > common::utf_helper::DECODE_TRAIL_HIGH) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(string.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } - vv = base::utf_helper::UTF16Decode(cc, kc); + vv = common::utf_helper::UTF16Decode(cc, kc); } // iv. Let Octets be the array of octets resulting by applying the UTF-8 transformation to V, @@ -329,7 +329,7 @@ uint16_t BuiltinsGlobal::GetValueFromHexString(const JSHandle &strin uint16_t ret = 0; for (uint32_t i = 0; i < size; ++i) { uint16_t ch = stringAcc.Get(i); - size_t val = base::utf_helper::HexChar16Value(ch); + size_t val = common::utf_helper::HexChar16Value(ch); ret = ((ret << 4U) | val) & BIT_MASK_4F; // NOLINT 4: means shift left by 4 } return ret; @@ -626,12 +626,12 @@ JSTaggedValue BuiltinsGlobal::UTF16EncodeCodePoint(JSThread *thread, judgURIFunc const std::vector &oct, const JSHandle &str, uint32_t &start, int32_t &k, std::u16string &sStr) { - if (!base::utf_helper::IsValidUTF8(oct)) { + if (!common::utf_helper::IsValidUTF8(oct)) { CString errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } uint32_t vv = StringHelper::Utf8ToU32String(oct); - if (vv < base::utf_helper::DECODE_SECOND_FACTOR) { + if (vv < common::utf_helper::DECODE_SECOND_FACTOR) { if (!IsInURISet(vv)) { sStr = StringHelper::Utf16ToU16String(reinterpret_cast(&vv), 1); } else { @@ -641,10 +641,10 @@ JSTaggedValue BuiltinsGlobal::UTF16EncodeCodePoint(JSThread *thread, judgURIFunc EcmaStringAccessor(substr).ToStdString(StringConvertedUsage::LOGICOPERATION)); } } else { - uint16_t lv = (((vv - base::utf_helper::DECODE_SECOND_FACTOR) & BIT16_MASK) + - base::utf_helper::DECODE_TRAIL_LOW); - uint16_t hv = ((((vv - base::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & BIT16_MASK) + // NOLINT - base::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits + uint16_t lv = (((vv - common::utf_helper::DECODE_SECOND_FACTOR) & BIT16_MASK) + + common::utf_helper::DECODE_TRAIL_LOW); + uint16_t hv = ((((vv - common::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & BIT16_MASK) + // NOLINT + common::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits sStr = StringHelper::Append(StringHelper::Utf16ToU16String(&hv, 1), StringHelper::Utf16ToU16String(&lv, 1)); } @@ -955,10 +955,10 @@ JSTaggedValue BuiltinsGlobal::Unescape(EcmaRuntimeCallInfo *msg) bool c4IsHexDigits = IsHexDigits(c4); bool c5IsHexDigits = IsHexDigits(c5); #else // ENABLE_NEXT_OPTIMIZATION - bool c2IsHexDigits = base::utf_helper::IsHexDigits(c2); - bool c3IsHexDigits = base::utf_helper::IsHexDigits(c3); - bool c4IsHexDigits = base::utf_helper::IsHexDigits(c4); - bool c5IsHexDigits = base::utf_helper::IsHexDigits(c5); + bool c2IsHexDigits = common::utf_helper::IsHexDigits(c2); + bool c3IsHexDigits = common::utf_helper::IsHexDigits(c3); + bool c4IsHexDigits = common::utf_helper::IsHexDigits(c4); + bool c5IsHexDigits = common::utf_helper::IsHexDigits(c5); #endif // ENABLE_NEXT_OPTIMIZATION bool isHexDigits = c2IsHexDigits && c3IsHexDigits && c4IsHexDigits && c5IsHexDigits; if (isHexDigits) { @@ -974,8 +974,8 @@ JSTaggedValue BuiltinsGlobal::Unescape(EcmaRuntimeCallInfo *msg) bool c1IsHexDigits = IsHexDigits(c1); bool c2IsHexDigits = IsHexDigits(c2); #else // ENABLE_NEXT_OPTIMIZATION - bool c1IsHexDigits = base::utf_helper::IsHexDigits(c1); - bool c2IsHexDigits = base::utf_helper::IsHexDigits(c2); + bool c1IsHexDigits = common::utf_helper::IsHexDigits(c1); + bool c2IsHexDigits = common::utf_helper::IsHexDigits(c2); #endif // ENABLE_NEXT_OPTIMIZATION bool isHexDigits = c1IsHexDigits && c2IsHexDigits; if (isHexDigits) { diff --git a/ecmascript/builtins/builtins_global.h b/ecmascript/builtins/builtins_global.h index 2c153733b4a191ff9ced8bcba8b628e70e7975b3..bf831924a372182e39539c396f15dde1c24a9cab 100644 --- a/ecmascript/builtins/builtins_global.h +++ b/ecmascript/builtins/builtins_global.h @@ -241,12 +241,12 @@ private: Placement placement = Placement::START); static bool IsUTF16HighSurrogate(uint16_t ch) { - return base::utf_helper::DECODE_LEAD_LOW <= ch && ch <= base::utf_helper::DECODE_LEAD_HIGH; + return common::utf_helper::DECODE_LEAD_LOW <= ch && ch <= common::utf_helper::DECODE_LEAD_HIGH; } static bool IsUTF16LowSurrogate(uint16_t ch) { - return base::utf_helper::DECODE_TRAIL_LOW <= ch && ch <= base::utf_helper::DECODE_TRAIL_HIGH; + return common::utf_helper::DECODE_TRAIL_LOW <= ch && ch <= common::utf_helper::DECODE_TRAIL_HIGH; } // 11.1.3 Static Semantics: UTF16SurrogatePairToCodePoint ( lead, trail ) diff --git a/ecmascript/builtins/builtins_global_uri.cpp b/ecmascript/builtins/builtins_global_uri.cpp index b0e495d0455e1c97be74f82ef3dd5c49d270f31b..55c47cf9893fa92048a72305b06ed65ea8040b66 100644 --- a/ecmascript/builtins/builtins_global_uri.cpp +++ b/ecmascript/builtins/builtins_global_uri.cpp @@ -14,7 +14,7 @@ */ #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/builtins/builtins_global.h" #include "ecmascript/builtins/builtins_global_uri.h" #include "ecmascript/ecma_string-inl.h" @@ -25,8 +25,8 @@ using StringHelper = base::StringHelper; #if ENABLE_NEXT_OPTIMIZATION void BuiltinsGlobal::AppendPercentEncodedByte(std::u16string &sStr, uint8_t byte, uint8_t &len) { - sStr[++len] = base::utf_helper::GetHexChar16((byte >> 4) & BIT_MASK); // 4: high 4 bits - sStr[++len] = base::utf_helper::GetHexChar16(byte & BIT_MASK); // low 4 bits + sStr[++len] = common::utf_helper::GetHexChar16((byte >> 4) & BIT_MASK); // 4: high 4 bits + sStr[++len] = common::utf_helper::GetHexChar16(byte & BIT_MASK); // low 4 bits ++len; } @@ -101,7 +101,7 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle= base::utf_helper::DECODE_TRAIL_LOW && cc <= base::utf_helper::DECODE_TRAIL_HIGH) { + if (cc >= common::utf_helper::DECODE_TRAIL_LOW && cc <= common::utf_helper::DECODE_TRAIL_HIGH) { JSTaggedValue strVal = isTreeString ? string.GetTaggedValue() : str.GetTaggedValue(); errorMsg = "DecodeURI: invalid character: " + ConvertToString(strVal); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); @@ -116,7 +116,7 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle base::utf_helper::DECODE_LEAD_HIGH) { + if (cc < common::utf_helper::DECODE_LEAD_LOW || cc > common::utf_helper::DECODE_LEAD_HIGH) { vv = cc; } else { k++; @@ -126,12 +126,12 @@ JSTaggedValue BuiltinsGlobal::Encode(JSThread *thread, const JSHandle base::utf_helper::DECODE_TRAIL_HIGH) { + if (kc < common::utf_helper::DECODE_TRAIL_LOW || kc > common::utf_helper::DECODE_TRAIL_HIGH) { JSTaggedValue strVal = isTreeString ? string.GetTaggedValue() : str.GetTaggedValue(); errorMsg = "DecodeURI: invalid character: " + ConvertToString(strVal); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } - vv = base::utf_helper::UTF16Decode(cc, kc); + vv = common::utf_helper::UTF16Decode(cc, kc); } // iv. Encode V and append it to resStr @@ -263,11 +263,11 @@ JSTaggedValue BuiltinsGlobal::DecodePercentEncoding(JSThread *thread, const JSHa } uint16_t frontChar = GetCodeUnit(sp, k + 1, strLen); uint16_t behindChar = GetCodeUnit(sp, k + 2, strLen); // 2: means plus 2 - if (!(base::utf_helper::IsHexDigits(frontChar) && base::utf_helper::IsHexDigits(behindChar))) { + if (!(common::utf_helper::IsHexDigits(frontChar) && common::utf_helper::IsHexDigits(behindChar))) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } - uint8_t bb = base::utf_helper::GetValueFromTwoHex(frontChar, behindChar); + uint8_t bb = common::utf_helper::GetValueFromTwoHex(frontChar, behindChar); k += 2; // 2: means plus 2 if ((bb & BIT_MASK_ONE) == 0) { HandleSingleByteCharacter(thread, bb, str, start, k, resStr, IsInURISet); @@ -341,11 +341,11 @@ JSTaggedValue BuiltinsGlobal::DecodePercentEncoding(JSThread *thread, int32_t &n } uint16_t frontChart = GetCodeUnit(sp, k + 1, strLen); uint16_t behindChart = GetCodeUnit(sp, k + 2, strLen); // 2: means plus 2 - if (!(base::utf_helper::IsHexDigits(frontChart) && base::utf_helper::IsHexDigits(behindChart))) { + if (!(common::utf_helper::IsHexDigits(frontChart) && common::utf_helper::IsHexDigits(behindChart))) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } - bb = base::utf_helper::GetValueFromTwoHex(frontChart, behindChart); + bb = common::utf_helper::GetValueFromTwoHex(frontChart, behindChart); // e. If the two most significant bits in B are not 10, throw a URIError exception. if (!((bb & BIT_MASK_TWO) == BIT_MASK_ONE)) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); @@ -362,12 +362,12 @@ JSTaggedValue BuiltinsGlobal::UTF16EncodeCodePoint(JSThread *thread, judgURIFunc const std::vector &oct, const JSHandle &str, uint32_t &start, int32_t &k, std::u16string &resStr) { - if (!base::utf_helper::IsValidUTF8(oct)) { + if (!common::utf_helper::IsValidUTF8(oct)) { CString errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } uint32_t vv = StringHelper::Utf8ToU32String(oct); - if (vv < base::utf_helper::DECODE_SECOND_FACTOR) { + if (vv < common::utf_helper::DECODE_SECOND_FACTOR) { if (!IsInURISet(vv)) { resStr.append(StringHelper::Utf16ToU16String(reinterpret_cast(&vv), 1)); } else { @@ -377,10 +377,10 @@ JSTaggedValue BuiltinsGlobal::UTF16EncodeCodePoint(JSThread *thread, judgURIFunc EcmaStringAccessor(substr).ToStdString(StringConvertedUsage::LOGICOPERATION))); } } else { - uint16_t lv = (((vv - base::utf_helper::DECODE_SECOND_FACTOR) & BIT16_MASK) + - base::utf_helper::DECODE_TRAIL_LOW); - uint16_t hv = ((((vv - base::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & BIT16_MASK) + // NOLINT - base::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits + uint16_t lv = (((vv - common::utf_helper::DECODE_SECOND_FACTOR) & BIT16_MASK) + + common::utf_helper::DECODE_TRAIL_LOW); + uint16_t hv = ((((vv - common::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & BIT16_MASK) + // NOLINT + common::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits resStr.push_back(static_cast(hv)); resStr.push_back(static_cast(lv)); } diff --git a/ecmascript/builtins/builtins_string.cpp b/ecmascript/builtins/builtins_string.cpp index d163b527f6941fd1e07ff11d6079e31390c2e348..5fd2e22466df235d745d031e60997ea0eba5212c 100644 --- a/ecmascript/builtins/builtins_string.cpp +++ b/ecmascript/builtins/builtins_string.cpp @@ -311,14 +311,15 @@ JSTaggedValue BuiltinsString::CodePointAt(EcmaRuntimeCallInfo *argv) return JSTaggedValue::Undefined(); } uint16_t first = EcmaStringAccessor(thisFlat).Get(pos); - if (first < base::utf_helper::DECODE_LEAD_LOW || first > base::utf_helper::DECODE_LEAD_HIGH || pos + 1 == thisLen) { + if (first < common::utf_helper::DECODE_LEAD_LOW || first > common::utf_helper::DECODE_LEAD_HIGH || + pos + 1 == thisLen) { return GetTaggedInt(first); } uint16_t second = EcmaStringAccessor(thisFlat).Get(pos + 1); - if (second < base::utf_helper::DECODE_TRAIL_LOW || second > base::utf_helper::DECODE_TRAIL_HIGH) { + if (second < common::utf_helper::DECODE_TRAIL_LOW || second > common::utf_helper::DECODE_TRAIL_HIGH) { return GetTaggedInt(first); } - uint32_t res = base::utf_helper::UTF16Decode(first, second); + uint32_t res = common::utf_helper::UTF16Decode(first, second); return GetTaggedInt(res); } diff --git a/ecmascript/builtins/builtins_string.h b/ecmascript/builtins/builtins_string.h index 79c5e60ab41b5a5da449fe31bf5fe0cba8b6fa3c..e4f82556d604d3314a9b47b93c4436d3c32ec47b 100644 --- a/ecmascript/builtins/builtins_string.h +++ b/ecmascript/builtins/builtins_string.h @@ -293,11 +293,11 @@ private: uint32_t thisLength, uint32_t seperatorLength, uint32_t lim = UINT32_MAX - 1); static bool IsUTF16HighSurrogate(uint16_t ch) { - return base::utf_helper::DECODE_LEAD_LOW <= ch && ch <= base::utf_helper::DECODE_LEAD_HIGH; + return common::utf_helper::DECODE_LEAD_LOW <= ch && ch <= common::utf_helper::DECODE_LEAD_HIGH; } static bool IsUTF16LowSurrogate(uint16_t ch) { - return base::utf_helper::DECODE_TRAIL_LOW <= ch && ch <= base::utf_helper::DECODE_TRAIL_HIGH; + return common::utf_helper::DECODE_TRAIL_LOW <= ch && ch <= common::utf_helper::DECODE_TRAIL_HIGH; } static uint32_t UTF16SurrogatePairToCodePoint(uint16_t lead, uint16_t trail); // 21.1.3.17.1 diff --git a/ecmascript/builtins/builtins_string_iterator.cpp b/ecmascript/builtins/builtins_string_iterator.cpp index ab1eee5676d73fac05b1ca9f615cfecdcb244e4a..50a70afb5718223951d3e15ca1b5a3993d7ddc7e 100644 --- a/ecmascript/builtins/builtins_string_iterator.cpp +++ b/ecmascript/builtins/builtins_string_iterator.cpp @@ -67,8 +67,8 @@ JSTaggedValue BuiltinsStringIterator::NextInternal(JSThread *thread, JSHandle 0xDBFF or position+1 = len, let resultString be the string consisting of the // single code unit first. ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - if (position + 1 == len || first < base::utf_helper::DECODE_LEAD_LOW || - first > base::utf_helper::DECODE_LEAD_HIGH) { + if (position + 1 == len || first < common::utf_helper::DECODE_LEAD_LOW || + first > common::utf_helper::DECODE_LEAD_HIGH) { if (EcmaStringAccessor::CanBeCompressed(&first, 1)) { JSHandle singleCharTable(thread, thread->GetSingleCharTable()); result.Update(singleCharTable->GetStringFromSingleCharTable(first)); @@ -83,7 +83,7 @@ JSTaggedValue BuiltinsStringIterator::NextInternal(JSThread *thread, JSHandle()).Get(position + 1); - if (second < base::utf_helper::DECODE_TRAIL_LOW || second > base::utf_helper::DECODE_TRAIL_HIGH) { + if (second < common::utf_helper::DECODE_TRAIL_LOW || second > common::utf_helper::DECODE_TRAIL_HIGH) { std::vector resultString {first, 0x0}; result.Update(factory->NewFromUtf16NotCompress(resultString.data(), 1).GetTaggedValue()); } else { diff --git a/ecmascript/compiler/BUILD.gn b/ecmascript/compiler/BUILD.gn index 385eaddb8eeb071b8275708c335074ea6375d618..f7b6ada090efdc21e049b3c18d4e5b440d0feffa 100644 --- a/ecmascript/compiler/BUILD.gn +++ b/ecmascript/compiler/BUILD.gn @@ -12,6 +12,11 @@ # limitations under the License. import("//arkcompiler/ets_runtime/js_runtime_config.gni") + +declare_args() { + skip_gen_stub = false +} + if (defined(timeout)) { _timeout_ = timeout } else { @@ -589,6 +594,15 @@ action("gen_stub_file") { rebase_path(root_out_dir_with_host_toolchain) + "/thirdparty/bounds_checking_function:" + rebase_path(llvm_lib_dir), ] + + # Use with caution. It can only be used when the IR(stub.an) logic is not modified. + if (skip_gen_stub) { + args += [ + "--skip", + "true", + ] + } + outputs = [ "$stub_file_gen_dir/stub.an" ] if (is_ohos) { outputs += [ "$stub_file_gen_dir/stub_code_comment.zip" ] diff --git a/ecmascript/compiler/builtins/builtins_string_stub_builder.cpp b/ecmascript/compiler/builtins/builtins_string_stub_builder.cpp index 097c22a0e69badf9caf632b4c2085298f68c6a82..7808c6798c514630e718b12794881ac795c1f528 100644 --- a/ecmascript/compiler/builtins/builtins_string_stub_builder.cpp +++ b/ecmascript/compiler/builtins/builtins_string_stub_builder.cpp @@ -253,15 +253,15 @@ void BuiltinsStringStubBuilder::CodePointAt(GateRef glue, GateRef thisValue, Gat GateRef first = StringAt(glue, stringInfoGate, *pos); GateRef posVal = *pos; GateRef firstIsValid = LogicOrBuilder(env) - .Or(Int32UnsignedLessThan(first, Int32(base::utf_helper::DECODE_LEAD_LOW))) - .Or(Int32UnsignedGreaterThan(first, Int32(base::utf_helper::DECODE_LEAD_HIGH))) + .Or(Int32UnsignedLessThan(first, Int32(common::utf_helper::DECODE_LEAD_LOW))) + .Or(Int32UnsignedGreaterThan(first, Int32(common::utf_helper::DECODE_LEAD_HIGH))) .Or(Int32Equal(Int32Add(posVal, Int32(1)), GetLengthFromString(thisValue))) .Done(); BRANCH(firstIsValid, &returnFirst, &getNextChar); Bind(&getNextChar); GateRef second = StringAt(glue, stringInfoGate, Int32Add(*pos, Int32(1))); - GateRef secondIsValid = BitOr(Int32UnsignedLessThan(second, Int32(base::utf_helper::DECODE_TRAIL_LOW)), - Int32UnsignedGreaterThan(second, Int32(base::utf_helper::DECODE_TRAIL_HIGH))); + GateRef secondIsValid = BitOr(Int32UnsignedLessThan(second, Int32(common::utf_helper::DECODE_TRAIL_LOW)), + Int32UnsignedGreaterThan(second, Int32(common::utf_helper::DECODE_TRAIL_HIGH))); BRANCH(secondIsValid, &returnFirst, slowPath); Bind(&returnFirst); res->WriteVariable(IntToTaggedPtr(first)); @@ -1706,7 +1706,7 @@ GateRef BuiltinsStringStubBuilder::GetUtf16Data(GateRef stringData, GateRef inde GateRef BuiltinsStringStubBuilder::IsASCIICharacter(GateRef data) { - return Int32UnsignedLessThan(Int32Sub(data, Int32(1)), Int32(base::utf_helper::UTF8_1B_MAX)); + return Int32UnsignedLessThan(Int32Sub(data, Int32(1)), Int32(common::utf_helper::UTF8_1B_MAX)); } GateRef BuiltinsStringStubBuilder::GetUtf8Data(GateRef stringData, GateRef index) diff --git a/ecmascript/compiler/mcr_circuit_builder.cpp b/ecmascript/compiler/mcr_circuit_builder.cpp index d493d3ac7b1cf54a63e94bcf8f835e28ec2303ae..8744f63d402e0bd6dbee83c7f13556a7471886e3 100644 --- a/ecmascript/compiler/mcr_circuit_builder.cpp +++ b/ecmascript/compiler/mcr_circuit_builder.cpp @@ -2155,7 +2155,7 @@ GateRef CircuitBuilder::BuildTypedArrayIterator(GateRef gate, const GateMetaData GateRef CircuitBuilder::IsASCIICharacter(GateRef gate) { - return Int32UnsignedLessThan(Int32Sub(gate, Int32(1)), Int32(base::utf_helper::UTF8_1B_MAX)); + return Int32UnsignedLessThan(Int32Sub(gate, Int32(1)), Int32(common::utf_helper::UTF8_1B_MAX)); } GateRef CircuitBuilder::MigrateFromRawValueToHeapValues(GateRef object, GateRef needCOW, GateRef isIntKind) diff --git a/ecmascript/compiler/stub_compiler.cpp b/ecmascript/compiler/stub_compiler.cpp index 5ccf5b1a9c8d378c8286173ca6e1f4919cd7482c..e9ca9be8640b63cf525280826fd945dd3cb8c7b4 100644 --- a/ecmascript/compiler/stub_compiler.cpp +++ b/ecmascript/compiler/stub_compiler.cpp @@ -187,7 +187,7 @@ int main(const int argc, const char **argv) return 1; } - panda::Log::Initialize(runtimeOptions.GetLogOptions()); + common::Log::Initialize(runtimeOptions.GetLogOptions()); std::string triple = runtimeOptions.GetTargetTriple(); std::string stubFile = runtimeOptions.GetStubFile(); size_t optLevel = runtimeOptions.GetOptLevel(); diff --git a/ecmascript/daemon/daemon_thread.cpp b/ecmascript/daemon/daemon_thread.cpp index 33b0b42db65df3cc92e9c0f2460407f0e5274637..1f6bb3508910cd632bb0dd767b649de239833eeb 100644 --- a/ecmascript/daemon/daemon_thread.cpp +++ b/ecmascript/daemon/daemon_thread.cpp @@ -55,7 +55,7 @@ void DaemonThread::StartRunning() ASSERT(tasks_.empty()); ASSERT(GetThreadId() == 0); thread_ = std::make_unique([this] {this->Run();}); - Taskpool::GetCurrentTaskpool()->Initialize(); + common::Taskpool::GetCurrentTaskpool()->Initialize(); } void DaemonThread::EnsureRunning() @@ -89,7 +89,7 @@ void DaemonThread::WaitFinished() CheckAndPostTask(TerminateDaemonTask(nullptr)); thread_->join(); thread_.reset(); - Taskpool::GetCurrentTaskpool()->Destroy(GetThreadId()); + common::Taskpool::GetCurrentTaskpool()->Destroy(GetThreadId()); } #ifndef USE_CMC_GC ASSERT(!IsInRunningState()); diff --git a/ecmascript/dfx/hprof/heap_profiler.cpp b/ecmascript/dfx/hprof/heap_profiler.cpp index 130a2fa2f2e5f083f5746605924fbfbab508b225..e71665036f2725fbb7385b58b53ce05b520f211b 100755 --- a/ecmascript/dfx/hprof/heap_profiler.cpp +++ b/ecmascript/dfx/hprof/heap_profiler.cpp @@ -352,7 +352,7 @@ bool HeapProfiler::DumpHeapSnapshot(Stream *stream, const DumpSnapShotOption &du { if (dumpOption.isFullGC) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::FULL); + common::BaseRuntime::RequestGC(common::GcType::FULL); #else [[maybe_unused]] bool heapClean = ForceFullGC(vm_); ForceSharedGC(); @@ -417,7 +417,7 @@ bool HeapProfiler::StartHeapTracking(double timeInterval, bool isVmMode, Stream bool traceAllocation, bool newThread) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::FULL); + common::BaseRuntime::RequestGC(common::GcType::FULL); #else vm_->CollectGarbage(TriggerGCType::OLD_GC); ForceSharedGC(); @@ -454,7 +454,7 @@ bool HeapProfiler::UpdateHeapTracking(Stream *stream) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::FULL); + common::BaseRuntime::RequestGC(common::GcType::FULL); #else vm_->CollectGarbage(TriggerGCType::OLD_GC); ForceSharedGC(); @@ -493,7 +493,7 @@ bool HeapProfiler::StopHeapTracking(Stream *stream, Progress *progress, bool new } { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::FULL); + common::BaseRuntime::RequestGC(common::GcType::FULL); #else ForceSharedGC(); #endif diff --git a/ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp b/ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp index 331d1194eaa58b33e2274e004fc01acc8a26dadb..9c754c4ef5caa410b6cc38dea0118f914547271f 100644 --- a/ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp +++ b/ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp @@ -314,8 +314,8 @@ void HeapSnapshotJSONSerializer::SerializeString(CString *str, StreamWriter *wri len++; } auto [unicode, bytes] = - base::utf_helper::ConvertUtf8ToUnicodeChar(reinterpret_cast(s), len); - if (unicode == base::utf_helper::INVALID_UTF8) { + common::utf_helper::ConvertUtf8ToUnicodeChar(reinterpret_cast(s), len); + if (unicode == common::utf_helper::INVALID_UTF8) { LOG_ECMA(WARN) << "HeapSnapshotJSONSerializer::SerializeString, str is not utf-8"; writer->WriteChar('?'); s++; diff --git a/ecmascript/dynamic_object_accessor.cpp b/ecmascript/dynamic_object_accessor.cpp index 565c982d071c2f542544ea2a0361cbb98729402f..d851084886824bf9789a26eeafe9dbad2f616f89 100644 --- a/ecmascript/dynamic_object_accessor.cpp +++ b/ecmascript/dynamic_object_accessor.cpp @@ -26,7 +26,7 @@ DynamicObjectAccessor DynamicObjectAccessor::dynObjectAccessor_; void DynamicObjectAccessor::Initialize() { - BaseObjectDispatcher::GetDispatcher().RegisterDynamicObjectAccessor(&dynObjectAccessor_); + common::BaseObjectDispatcher::GetDispatcher().RegisterDynamicObjectAccessor(&dynObjectAccessor_); } bool DynamicObjectAccessor::HasProperty(ThreadHolder *thread, BaseObject *obj, char *name) diff --git a/ecmascript/dynamic_object_accessor.h b/ecmascript/dynamic_object_accessor.h index 57093e548fa7945495f7994535a6d456e5272801..5bf4d0f70b3461d2424338858dddbaf0d5f22d53 100644 --- a/ecmascript/dynamic_object_accessor.h +++ b/ecmascript/dynamic_object_accessor.h @@ -20,7 +20,10 @@ #include "common_interfaces/objects/base_object_accessor.h" namespace panda::ecmascript { -class DynamicObjectAccessor : public DynamicObjectAccessorInterface { +using common::ThreadHolder; +using common::BaseObject; + +class DynamicObjectAccessor : public common::DynamicObjectAccessorInterface { public: static void Initialize(); diff --git a/ecmascript/dynamic_object_descriptor.cpp b/ecmascript/dynamic_object_descriptor.cpp index 938ef9910c139de65320d86a9ab3812f8e2f51e5..0e870e7fad0029e67ab7421d024abec126fbaa3d 100644 --- a/ecmascript/dynamic_object_descriptor.cpp +++ b/ecmascript/dynamic_object_descriptor.cpp @@ -23,7 +23,7 @@ DynamicObjectDescriptor DynamicObjectDescriptor::dynObjectDescriptor_; void DynamicObjectDescriptor::Initialize() { - BaseObjectDispatcher::GetDispatcher().RegisterDynamicObjectDescriptor(&dynObjectDescriptor_); + common::BaseObjectDispatcher::GetDispatcher().RegisterDynamicObjectDescriptor(&dynObjectDescriptor_); } std::pair DynamicObjectDescriptor::GetProperty(ThreadHolder *thread, BaseObject *obj, diff --git a/ecmascript/dynamic_object_descriptor.h b/ecmascript/dynamic_object_descriptor.h index a17966793229dc71f3c9a100637a6bd9838fdb8f..3e4391e7d824c7257a5955fc784722a226bc30ab 100644 --- a/ecmascript/dynamic_object_descriptor.h +++ b/ecmascript/dynamic_object_descriptor.h @@ -21,7 +21,7 @@ #include "ecmascript/ic/ic_handler.h" namespace panda::ecmascript { -class DynamicObjectDescriptor : public DynamicObjectDescriptorInterface { +class DynamicObjectDescriptor : public common::DynamicObjectDescriptorInterface { public: static void Initialize(); diff --git a/ecmascript/dynamic_type_converter.cpp b/ecmascript/dynamic_type_converter.cpp index d8fd7d9d91ac4dbe77176f1e462f15308c84f565..e78bd6185fd9244cba0443554235df2dc6f10910 100644 --- a/ecmascript/dynamic_type_converter.cpp +++ b/ecmascript/dynamic_type_converter.cpp @@ -26,10 +26,10 @@ DynamicTypeConverter DynamicTypeConverter::dynTypeConverter_; void DynamicTypeConverter::Initialize() { - BaseObjectDispatcher::GetDispatcher().RegisterDynamicTypeConverter(&dynTypeConverter_); + common::BaseObjectDispatcher::GetDispatcher().RegisterDynamicTypeConverter(&dynTypeConverter_); } -JSTaggedValue DynamicTypeConverter::WrapTagged(ThreadHolder *thread, PandaType value) +JSTaggedValue DynamicTypeConverter::WrapTagged(ThreadHolder *thread, BaseType value) { JSTaggedValue result; std::visit( @@ -47,11 +47,11 @@ JSTaggedValue DynamicTypeConverter::WrapTagged(ThreadHolder *thread, PandaType v result = JSTaggedValue(static_cast(arg)); } else if constexpr (std::is_floating_point_v) { result = JSTaggedValue(static_cast(arg)); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { result = JSTaggedValue::Undefined(); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { result = JSTaggedValue::Null(); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { BigInt* bigInt = *BigInt::CreateBigint(thread->GetJSThread(), arg.length); bigInt->SetSign(arg.sign); for (uint32_t i = 0; i < arg.length; i++) { @@ -71,7 +71,7 @@ JSTaggedValue DynamicTypeConverter::WrapTagged(ThreadHolder *thread, PandaType v return result; } -PandaType DynamicTypeConverter::UnWrapTagged(JSTaggedValue value) +BaseType DynamicTypeConverter::UnWrapTagged(JSTaggedValue value) { if (value.IsBoolean()) { return value.ToBoolean(); @@ -80,12 +80,12 @@ PandaType DynamicTypeConverter::UnWrapTagged(JSTaggedValue value) } else if (value.IsDouble()) { return static_cast(value.GetDouble()); } else if (value.IsUndefined()) { - return BaseUndefined(); + return common::BaseUndefined(); } else if (value.IsNull()) { - return BaseNull(); + return common::BaseNull(); } else if (value.IsBigInt()) { BigInt *bigInt = BigInt::Cast(value.GetTaggedObject()); - BaseBigInt baseBigInt; + common::BaseBigInt baseBigInt; baseBigInt.length = bigInt->GetLength(); baseBigInt.sign = bigInt->GetSign(); baseBigInt.data.resize(baseBigInt.length); diff --git a/ecmascript/dynamic_type_converter.h b/ecmascript/dynamic_type_converter.h index e6ccb8ec05802d0be7d854a8e5dc6ba71b3edb2a..a2af4148d7966f722eda278706324b7b03a8cba7 100644 --- a/ecmascript/dynamic_type_converter.h +++ b/ecmascript/dynamic_type_converter.h @@ -20,13 +20,16 @@ #include "common_interfaces/objects/base_type_converter.h" namespace panda::ecmascript { -class DynamicTypeConverter : public DynamicTypeConverterInterface { +using common::BaseType; +using common::ThreadHolder; + +class DynamicTypeConverter : public common::DynamicTypeConverterInterface { public: static void Initialize(); - JSTaggedValue PUBLIC_API WrapTagged(ThreadHolder *thread, PandaType value) override; + JSTaggedValue PUBLIC_API WrapTagged(ThreadHolder *thread, BaseType value) override; - PandaType PUBLIC_API UnWrapTagged(JSTaggedValue value) override; + BaseType PUBLIC_API UnWrapTagged(JSTaggedValue value) override; private: static DynamicTypeConverter dynTypeConverter_; diff --git a/ecmascript/ecma_string-inl.h b/ecmascript/ecma_string-inl.h index 52074da6d253739047c15eefe0938cefcf6298c6..e14b3a198ea18a5afc650598159181f64b8c444f 100644 --- a/ecmascript/ecma_string-inl.h +++ b/ecmascript/ecma_string-inl.h @@ -43,8 +43,8 @@ inline EcmaString *EcmaString::CreateFromUtf8(const EcmaVM *vm, const uint8_t *u if (utf8Len == 0) { return vm->GetFactory()->GetEmptyString().GetObject(); } - auto allocator = [vm, type](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm, type](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); return EcmaString::AllocLineString(vm, size, type)->ToBaseString(); }; BaseString *str = BaseString::CreateFromUtf8(std::move(allocator), utf8Data, utf8Len, canBeCompress); @@ -59,8 +59,8 @@ inline EcmaString *EcmaString::CreateFromUtf8CompressedSubString(const EcmaVM *v return vm->GetFactory()->GetEmptyString().GetObject(); } - auto allocator = [vm, type](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm, type](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); return EcmaString::AllocLineString(vm, size, type)->ToBaseString(); }; BaseString *str = BaseString::CreateFromUtf8CompressedSubString(std::move(allocator), string, offset, utf8Len); @@ -112,8 +112,8 @@ inline EcmaString *EcmaString::CreateFromUtf16(const EcmaVM *vm, const uint16_t return vm->GetFactory()->GetEmptyString().GetObject(); } - auto allocator = [vm, type](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm, type](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); return EcmaString::AllocLineString(vm, size, type)->ToBaseString(); }; BaseString *str = BaseString::CreateFromUtf16(std::move(allocator), utf16Data, utf16Len, canBeCompress); @@ -123,8 +123,8 @@ inline EcmaString *EcmaString::CreateFromUtf16(const EcmaVM *vm, const uint16_t /* static */ inline EcmaString *EcmaString::CreateLineString(const EcmaVM *vm, size_t length, bool compressed) { - auto allocator = [vm](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); EcmaString* string = vm->GetFactory()->AllocLineStringObject(size); return string; }; @@ -135,8 +135,8 @@ inline EcmaString *EcmaString::CreateLineString(const EcmaVM *vm, size_t length, /* static */ inline EcmaString *EcmaString::CreateLineStringNoGC(const EcmaVM *vm, size_t length, bool compressed) { - auto allocator = [vm](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); EcmaString* string = vm->GetFactory()->AllocLineStringObjectNoGC(size); return string; @@ -169,8 +169,8 @@ inline EcmaString* EcmaString::AllocLineString(const EcmaVM* vm, size_t size, Me inline EcmaString *EcmaString::CreateLineStringWithSpaceType(const EcmaVM *vm, size_t length, bool compressed, MemSpaceType type) { - auto allocator = [vm, type](size_t size, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::LINE_STRING && "Can only allocate line string"); + auto allocator = [vm, type](size_t size, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::LINE_STRING && "Can only allocate line string"); ASSERT(IsSMemSpace(type)); return AllocLineString(vm, size, type); }; @@ -181,8 +181,8 @@ inline EcmaString *EcmaString::CreateLineStringWithSpaceType(const EcmaVM *vm, s inline SlicedEcmaString* EcmaString::CreateSlicedString(const EcmaVM* vm, JSHandle parent, MemSpaceType type) { - auto allocator = [vm, type](size_t, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::SLICED_STRING && "Can only allocate sliced string"); + auto allocator = [vm, type](size_t, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::SLICED_STRING && "Can only allocate sliced string"); EcmaString* string = vm->GetFactory()->AllocSlicedStringObject(type); return string; }; @@ -220,8 +220,8 @@ inline EcmaString *EcmaString::CreateTreeString(const EcmaVM *vm, JSThread *thread = nullptr; GetDebuggerThread(vm, &thread); - auto allocator = [vm](size_t, CommonType stringType) -> BaseObject* { - ASSERT(stringType == CommonType::TREE_STRING && "Can only allocate tree string"); + auto allocator = [vm](size_t, common::CommonType stringType) -> BaseObject* { + ASSERT(stringType == common::CommonType::TREE_STRING && "Can only allocate tree string"); EcmaString* string = vm->GetFactory()->AllocTreeStringObject(); return string; }; diff --git a/ecmascript/ecma_string.cpp b/ecmascript/ecma_string.cpp index 03d12961173a120992f39fa9f1d570d875cdff40..4dc434b27c975f0f0f2d9925a49c03c923457784 100755 --- a/ecmascript/ecma_string.cpp +++ b/ecmascript/ecma_string.cpp @@ -222,28 +222,28 @@ int32_t EcmaString::Compare(const EcmaVM *vm, const JSHandle &left, if (!lhs.IsUtf16() && !rhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf8(), lhsCount); Span rhsSp(rhs.GetDataUtf8(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); + int32_t charDiff = common::CompareStringSpan(lhsSp, rhsSp, minCount); if (charDiff != 0) { return charDiff; } } else if (!lhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf8(), lhsCount); Span rhsSp(rhs.GetDataUtf16(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); + int32_t charDiff = common::CompareStringSpan(lhsSp, rhsSp, minCount); if (charDiff != 0) { return charDiff; } } else if (!rhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf16(), rhsCount); Span rhsSp(rhs.GetDataUtf8(), lhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); + int32_t charDiff = common::CompareStringSpan(lhsSp, rhsSp, minCount); if (charDiff != 0) { return charDiff; } } else { Span lhsSp(lhs.GetDataUtf16(), lhsCount); Span rhsSp(rhs.GetDataUtf16(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); + int32_t charDiff = common::CompareStringSpan(lhsSp, rhsSp, minCount); if (charDiff != 0) { return charDiff; } @@ -269,19 +269,19 @@ bool EcmaString::IsSubStringAt(const EcmaVM *vm, const JSHandle& lef if (!lhs.IsUtf16() && !rhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf8(), lhsCount); Span rhsSp(rhs.GetDataUtf8(), rhsCount); - return IsSubStringAtSpan(lhsSp, rhsSp, offset); + return common::IsSubStringAtSpan(lhsSp, rhsSp, offset); } else if (!lhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf8(), lhsCount); Span rhsSp(rhs.GetDataUtf16(), rhsCount); - return IsSubStringAtSpan(lhsSp, rhsSp, offset); + return common::IsSubStringAtSpan(lhsSp, rhsSp, offset); } else if (!rhs.IsUtf16()) { Span lhsSp(lhs.GetDataUtf16(), lhsCount); Span rhsSp(rhs.GetDataUtf8(), rhsCount); - return IsSubStringAtSpan(lhsSp, rhsSp, offset); + return common::IsSubStringAtSpan(lhsSp, rhsSp, offset); } else { Span lhsSp(lhs.GetDataUtf16(), lhsCount); Span rhsSp(rhs.GetDataUtf16(), rhsCount); - return IsSubStringAtSpan(lhsSp, rhsSp, offset); + return common::IsSubStringAtSpan(lhsSp, rhsSp, offset); } return false; } diff --git a/ecmascript/ecma_string.h b/ecmascript/ecma_string.h index 326fdbf7c0978ff95ac45f80023db25fd461bb28..0a5313d8c0714b9d2cdc0af8609f78bd0ce73a44 100755 --- a/ecmascript/ecma_string.h +++ b/ecmascript/ecma_string.h @@ -20,7 +20,11 @@ #include #include -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" +#include "common_interfaces/objects/string/line_string.h" +#include "common_interfaces/objects/string/sliced_string.h" +#include "common_interfaces/objects/string/tree_string.h" +#include "common_interfaces/objects/string/base_string-inl1.h" #include "ecmascript/common.h" #include "ecmascript/ecma_macros.h" #include "ecmascript/js_hclass.h" @@ -28,10 +32,6 @@ #include "ecmascript/mem/barriers.h" #include "ecmascript/mem/space.h" #include "ecmascript/mem/tagged_object.h" -#include "common_interfaces/objects/string/line_string.h" -#include "common_interfaces/objects/string/sliced_string.h" -#include "common_interfaces/objects/string/tree_string.h" -#include "common_interfaces/objects/string/base_string-inl1.h" #include "libpandabase/macros.h" #include "securec.h" #include "unicode/locid.h" @@ -51,6 +51,11 @@ class TreeEcmaString; class SlicedEcmaString; class FlatStringInfo; +using ::common::BaseString; +using ::common::LineString; +using ::common::SlicedString; +using ::common::TreeString; + // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define ECMA_STRING_CHECK_LENGTH_AND_TRHOW(vm, length) \ if ((length) >= BaseString::MAX_STRING_LENGTH) { \ @@ -289,9 +294,9 @@ private: CVector tmpBuf; const uint8_t *data = EcmaString::GetUtf8DataFlat(this, tmpBuf); buf.reserve(strLen); - auto utf16Len = base::utf_helper::ConvertRegionUtf8ToUtf16(data, buf.data(), strLen, strLen); + auto utf16Len = common::utf_helper::ConvertRegionUtf8ToUtf16(data, buf.data(), strLen, strLen); #if !defined(NDEBUG) - auto calculatedLen = base::utf_helper::Utf8ToUtf16Size(data, strLen); + auto calculatedLen = common::utf_helper::Utf8ToUtf16Size(data, strLen); ASSERT_PRINT(utf16Len == calculatedLen, "Bad utf8 to utf16 conversion!"); #endif str = Span(buf.data(), utf16Len); @@ -1118,7 +1123,7 @@ public: return false; } // \0 is not considered ASCII in Ecma-Modified-UTF8 [only modify '\u0000'] - return data <= base::utf_helper::UTF8_1B_MAX; + return data <= common::utf_helper::UTF8_1B_MAX; } bool IsFlat() const diff --git a/ecmascript/ecma_string_table.cpp b/ecmascript/ecma_string_table.cpp index c23e46fd34017b760f77f342fbd0866e35954f1d..647fe2a03edab91da15d3127e77da3def3b3d3ab 100644 --- a/ecmascript/ecma_string_table.cpp +++ b/ecmascript/ecma_string_table.cpp @@ -25,9 +25,9 @@ void EcmaStringTableCleaner::PostSweepWeakRefTask(const WeakRootVisitor &visitor { StartSweepWeakRefTask(); iter_ = std::make_shared>(0U); - const uint32_t postTaskCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + const uint32_t postTaskCount = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); for (uint32_t i = 0U; i < postTaskCount; ++i) { - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(iter_, this, visitor)); + common::Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(iter_, this, visitor)); } } diff --git a/ecmascript/ecma_string_table.h b/ecmascript/ecma_string_table.h index eead712bda81b7d96b2e0bed771745a66874d367..7e170e93f2f3834b5acb325b8ca3fa29c13f8fa1 100644 --- a/ecmascript/ecma_string_table.h +++ b/ecmascript/ecma_string_table.h @@ -66,10 +66,10 @@ private: return (cleaner->PendingTaskCount_.fetch_sub(1U, std::memory_order_relaxed) == 1U); } - class SweepWeakRefTask : public Task { + class SweepWeakRefTask : public common::Task { public: SweepWeakRefTask(IteratorPtr iter, EcmaStringTableCleaner *cleaner, const WeakRootVisitor &visitor) - : Task(0), iter_(iter), cleaner_(cleaner), visitor_(visitor) + : common::Task(0), iter_(iter), cleaner_(cleaner), visitor_(visitor) { } ~SweepWeakRefTask() = default; @@ -149,8 +149,8 @@ public: EcmaString *TryGetInternString(const JSHandle &string); #ifdef USE_CMC_GC - void IterWeakRoot(const WeakRefFieldVisitor &visitor); - void IterWeakRoot(const WeakRefFieldVisitor &visitor, uint32_t index); + void IterWeakRoot(const common::WeakRefFieldVisitor &visitor); + void IterWeakRoot(const common::WeakRefFieldVisitor &visitor, uint32_t index); #endif void SweepWeakRef(const WeakRootVisitor &visitor); void SweepWeakRef(const WeakRootVisitor &visitor, uint32_t index); @@ -177,7 +177,7 @@ private: // This should only call in Debugger Signal, and need to fix and remove EcmaString *GetOrInternStringThreadUnsafe(EcmaVM *vm, const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress); - HashTrieMap stringTable_; + common::HashTrieMap stringTable_; EcmaStringTableCleaner *cleaner_; friend class SnapshotProcessor; @@ -239,10 +239,10 @@ private: return (cleaner->PendingTaskCount_.fetch_sub(1U, std::memory_order_relaxed) == 1U); } - class SweepWeakRefTask : public Task { + class SweepWeakRefTask : public common::Task { public: SweepWeakRefTask(IteratorPtr iter, EcmaStringTableCleaner* cleaner, const WeakRootVisitor& visitor) - : Task(0), iter_(iter), cleaner_(cleaner), visitor_(visitor) {} + : common::Task(0), iter_(iter), cleaner_(cleaner), visitor_(visitor) {} ~SweepWeakRefTask() = default; bool Run(uint32_t threadIndex) override; diff --git a/ecmascript/ecma_string_table_optimization.cpp b/ecmascript/ecma_string_table_optimization.cpp index de6632662f0bd20d9222fee4818996ad6a02af82..a8bd9ef8cf706838f12c75dbeae527b0ac76e6ad 100644 --- a/ecmascript/ecma_string_table_optimization.cpp +++ b/ecmascript/ecma_string_table_optimization.cpp @@ -27,9 +27,9 @@ void EcmaStringTableCleaner::PostSweepWeakRefTask(const WeakRootVisitor &visitor { StartSweepWeakRefTask(); iter_ = std::make_shared>(0U); - const uint32_t postTaskCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + const uint32_t postTaskCount = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); for (uint32_t i = 0U; i < postTaskCount; ++i) { - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(iter_, this, visitor)); + common::Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(iter_, this, visitor)); } } @@ -44,7 +44,7 @@ void EcmaStringTableCleaner::ProcessSweepWeakRef(IteratorPtr &iter, EcmaStringTa const WeakRootVisitor &visitor) { uint32_t index = 0U; - while ((index = GetNextIndexId(iter)) < HashTrieMap::INDIRECT_SIZE) { + while ((index = GetNextIndexId(iter)) < common::HashTrieMap::INDIRECT_SIZE) { cleaner->stringTable_->SweepWeakRef(visitor, index); if (ReduceCountAndCheckFinish(cleaner)) { cleaner->SignalSweepWeakRefTask(); @@ -56,7 +56,7 @@ void EcmaStringTableCleaner::StartSweepWeakRefTask() { // No need lock here, only the daemon thread will reset the state. sweepWeakRefFinished_ = false; - PendingTaskCount_.store(HashTrieMap::INDIRECT_SIZE, std::memory_order_relaxed); + PendingTaskCount_.store(common::HashTrieMap::INDIRECT_SIZE, std::memory_order_relaxed); } void EcmaStringTableCleaner::WaitSweepWeakRefTask() @@ -113,7 +113,7 @@ EcmaString *EcmaStringTable::GetOrInternFlattenString(EcmaVM *vm, EcmaString *st } JSThread *thread = vm->GetJSThread(); JSHandle stringHandle(thread, string); - BaseString* result = stringTable_.StoreOrLoad>( + BaseString* result = stringTable_.StoreOrLoad>( vm->GetJSThread(), std::move(readBarrier), hashcode, loadResult, stringHandle); ASSERT(result != nullptr); return EcmaString::FromBaseString(result); @@ -133,7 +133,7 @@ EcmaString *EcmaStringTable::GetOrInternStringFromCompressedSubString(EcmaVM *vm } BaseString *result = stringTable_.StoreOrLoad( vm->GetJSThread(), hashcode, loadResult, - [vm, string, offset, utf8Len, hashcode]()->ReadOnlyHandle { + [vm, string, offset, utf8Len, hashcode]()->common::ReadOnlyHandle { EcmaString *str = EcmaStringAccessor::CreateFromUtf8CompressedSubString(vm, string, offset, utf8Len, MemSpaceType::SHARED_OLD_SPACE); str->SetRawHashcode(hashcode); @@ -179,7 +179,7 @@ EcmaString *EcmaStringTable::GetOrInternString(EcmaVM *vm, EcmaString *string) return EcmaString::FromBaseString(loadResult.value); } JSHandle strFlatHandle(thread, strFlat); - BaseString* result = stringTable_.StoreOrLoad>( + BaseString* result = stringTable_.StoreOrLoad>( vm->GetJSThread(), std::move(readBarrier), hashcode, loadResult, strFlatHandle); ASSERT(result != nullptr); return EcmaString::FromBaseString(result); @@ -276,7 +276,7 @@ EcmaString* EcmaStringTable::GetOrInternString(EcmaVM* vm, const uint8_t* utf8Da return EcmaString::FromBaseString(loadResult.value); } JSHandle strHandle(thread, str); - BaseString* result = stringTable_.StoreOrLoad>( + BaseString* result = stringTable_.StoreOrLoad>( vm->GetJSThread(), std::move(readBarrier), hashcode, loadResult, strHandle); ASSERT(result != nullptr); return EcmaString::FromBaseString(result); @@ -390,8 +390,9 @@ void EcmaStringTable::SweepWeakRef(const WeakRootVisitor &visitor) { // No need lock here, only shared gc will sweep string table, meanwhile other // threads are suspended. - HashTrieMap::Indirect *root_node = stringTable_.root_.load(std::memory_order_relaxed); - if (root_node == nullptr) { + common::HashTrieMap::Indirect *rootNode = + stringTable_.root_.load(std::memory_order_relaxed); + if (rootNode == nullptr) { return; } for (uint32_t index = 0; index < stringTable_.INDIRECT_SIZE; ++index) { @@ -402,8 +403,9 @@ void EcmaStringTable::SweepWeakRef(const WeakRootVisitor &visitor) void EcmaStringTable::SweepWeakRef(const WeakRootVisitor &visitor, uint32_t index) { ASSERT(index >= 0 && index < stringTable_.INDIRECT_SIZE); - HashTrieMap::Indirect *root_node = stringTable_.root_.load(std::memory_order_relaxed); - stringTable_.ClearNodeFromGC(root_node, index, visitor); + common::HashTrieMap::Indirect *rootNode = + stringTable_.root_.load(std::memory_order_relaxed); + stringTable_.ClearNodeFromGC(rootNode, index, visitor); } bool EcmaStringTable::CheckStringTableValidity() @@ -491,7 +493,7 @@ EcmaString *EcmaStringTable::GetOrInternStringThreadUnsafe(EcmaVM *vm, const uin return EcmaString::FromBaseString(result); } #ifdef USE_CMC_GC -void EcmaStringTable::IterWeakRoot(const WeakRefFieldVisitor& visitor) +void EcmaStringTable::IterWeakRoot(const common::WeakRefFieldVisitor& visitor) { // No need lock here, only shared gc will sweep string table, meanwhile other threads are suspended. for (uint32_t index = 0; index < stringTable_.INDIRECT_SIZE; ++index) { @@ -499,11 +501,12 @@ void EcmaStringTable::IterWeakRoot(const WeakRefFieldVisitor& visitor) } } -void EcmaStringTable::IterWeakRoot(const WeakRefFieldVisitor &visitor, uint32_t index) +void EcmaStringTable::IterWeakRoot(const common::WeakRefFieldVisitor &visitor, uint32_t index) { ASSERT(index >= 0 && index < stringTable_.INDIRECT_SIZE); - HashTrieMap::Indirect *root_node = stringTable_.root_.load(std::memory_order_relaxed); - stringTable_.ClearNodeFromGC(root_node, index, visitor); + common::HashTrieMap::Indirect *rootNode = + stringTable_.root_.load(std::memory_order_relaxed); + stringTable_.ClearNodeFromGC(rootNode, index, visitor); } #endif #endif diff --git a/ecmascript/ecma_vm.cpp b/ecmascript/ecma_vm.cpp index ed6a4242b64d93e4aba3bd841b95ac68d3897a62..9b21525cc99591b371694ab265089dd365d2e2dd 100644 --- a/ecmascript/ecma_vm.cpp +++ b/ecmascript/ecma_vm.cpp @@ -178,7 +178,7 @@ void EcmaVM::PostFork() heap_->SetHeapMode(HeapMode::SHARE); GetAssociatedJSThread()->PostFork(); DaemonThread::GetInstance()->StartRunning(); - Taskpool::GetCurrentTaskpool()->Initialize(); + common::Taskpool::GetCurrentTaskpool()->Initialize(); heap_->GetWorkManager()->InitializeInPostFork(); auto sHeap = SharedHeap::GetInstance(); sHeap->GetWorkManager()->InitializeInPostFork(); @@ -319,7 +319,7 @@ bool EcmaVM::Initialize() ECMA_BYTRACE_NAME(HITRACE_LEVEL_MAX, HITRACE_TAG_ARK, "EcmaVM::Initialize", ""); stringTable_ = Runtime::GetInstance()->GetEcmaStringTable(); InitializePGOProfiler(); - Taskpool::GetCurrentTaskpool()->Initialize(); + common::Taskpool::GetCurrentTaskpool()->Initialize(); #ifndef PANDA_TARGET_WINDOWS RuntimeStubs::Initialize(thread_); #endif @@ -389,7 +389,7 @@ EcmaVM::~EcmaVM() { #ifdef USE_CMC_GC thread_->GetThreadHolder()->TransferToNative(); - BaseRuntime::WaitForGCFinish(); + common::BaseRuntime::WaitForGCFinish(); thread_->GetThreadHolder()->TransferToRunning(); #endif if (isJitCompileVM_) { @@ -435,7 +435,7 @@ EcmaVM::~EcmaVM() // clear c_address: c++ pointer delete ClearBufferData(); heap_->WaitAllTasksFinished(); - Taskpool::GetCurrentTaskpool()->Destroy(thread_->GetThreadId()); + common::Taskpool::GetCurrentTaskpool()->Destroy(thread_->GetThreadId()); #if ECMASCRIPT_ENABLE_FUNCTION_CALL_TIMER DumpCallTimeInfo(); @@ -675,7 +675,7 @@ void EcmaVM::CheckThread() const UNREACHABLE(); } DaemonThread *dThread = DaemonThread::GetInstance(); - if (!Taskpool::GetCurrentTaskpool()->IsInThreadPool(std::this_thread::get_id()) && + if (!common::Taskpool::GetCurrentTaskpool()->IsInThreadPool(std::this_thread::get_id()) && !(dThread != nullptr && dThread->GetThreadId() == JSThread::GetCurrentThreadId()) && thread_->CheckMultiThread()) { LOG_FULL(FATAL) << "Fatal: ecma_vm cannot run in multi-thread!" @@ -871,13 +871,13 @@ void EcmaVM::ClearBufferData() void EcmaVM::CollectGarbage(TriggerGCType gcType, panda::ecmascript::GCReason reason) const { #ifdef USE_CMC_GC - GcType type = GcType::ASYNC; + common::GcType type = common::GcType::ASYNC; if (gcType == TriggerGCType::FULL_GC || gcType == TriggerGCType::SHARED_FULL_GC || gcType == TriggerGCType::APPSPAWN_FULL_GC || gcType == TriggerGCType::APPSPAWN_SHARED_FULL_GC || reason == GCReason::ALLOCATION_FAILED) { - type = GcType::FULL; + type = common::GcType::FULL; } - BaseRuntime::RequestGC(type); + common::BaseRuntime::RequestGC(type); return; #endif heap_->CollectGarbage(gcType, reason); diff --git a/ecmascript/jit/jit.cpp b/ecmascript/jit/jit.cpp index e993937dae3230bce22144d8179bd35a3326cbcc..d6a1cc8337f18a70a372d2f57f3ffceb3f282427 100644 --- a/ecmascript/jit/jit.cpp +++ b/ecmascript/jit/jit.cpp @@ -381,9 +381,9 @@ void Jit::DeleteJitCompilerTask(void *compiler) jitResources_->DeleteJitCompilerTask(compiler); } -void Jit::ClearTask(const std::function &checkClear) +void Jit::ClearTask(const std::function &checkClear) { - JitTaskpool::GetCurrentTaskpool()->ForEachTask([&checkClear](Task *task) { + JitTaskpool::GetCurrentTaskpool()->ForEachTask([&checkClear](common::Task *task) { JitTask::AsyncTask *asyncTask = static_cast(task); if (checkClear(asyncTask)) { asyncTask->Terminated(); @@ -393,7 +393,7 @@ void Jit::ClearTask(const std::function &checkClear) void Jit::ClearTaskWithVm(EcmaVM *vm) { - ClearTask([vm](Task *task) { + ClearTask([vm](common::Task *task) { JitTask::AsyncTask *asyncTask = static_cast(task); return vm == asyncTask->GetHostVM(); }); @@ -443,9 +443,9 @@ void Jit::ChangeTaskPoolState(bool inBackground) { if (fastJitEnable_ || baselineJitEnable_) { if (inBackground) { - JitTaskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::BACKGROUND); + JitTaskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::BACKGROUND); } else { - JitTaskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::FOREGROUND); + JitTaskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::FOREGROUND); } } } diff --git a/ecmascript/jit/jit.h b/ecmascript/jit/jit.h index edcad51a8fad8634b7bb0a002d5ebd7e99a0e7d9..b86f2a9ceb55600f616e53fe441d6cac64bbbc21 100644 --- a/ecmascript/jit/jit.h +++ b/ecmascript/jit/jit.h @@ -80,7 +80,7 @@ public: void RequestInstallCode(std::shared_ptr jitTask); void InstallTasks(JSThread *jsThread); - void ClearTask(const std::function &checkClear); + void ClearTask(const std::function &checkClear); void ClearTaskWithVm(EcmaVM *vm); void Destroy(); uint32_t GetRunningTaskCnt(EcmaVM *vm); diff --git a/ecmascript/jit/jit_task.cpp b/ecmascript/jit/jit_task.cpp index 4cf62ad6b3345fd3f19ca84094451ff971355247..7f3668789560122cbe3aa6db36784605503e8e92 100644 --- a/ecmascript/jit/jit_task.cpp +++ b/ecmascript/jit/jit_task.cpp @@ -264,7 +264,7 @@ static void FillHeapConstantTable(JSHandle &machineCodeObj, const M JSHandle heapObj = heapConstantTableInCodeDesc[i]; heapConstantTableAddr[i] = heapObj->GetRawData(); #ifdef USE_CMC_GC - BaseRuntime::WriteBarrier(nullptr, nullptr, (void*)heapObj->GetRawData()); + common::BaseRuntime::WriteBarrier(nullptr, nullptr, (void*)heapObj->GetRawData()); #else Region *heapObjRegion = Region::ObjectAddressToRange(heapObj->GetRawData()); Region *curMachineCodeObjRegion = diff --git a/ecmascript/jit/jit_task.h b/ecmascript/jit/jit_task.h index f6695cba6dc76ecca7dae69d3914237e56ecd6cb..642438cfcbda252fd39027e14d7c02d6fef67161 100644 --- a/ecmascript/jit/jit_task.h +++ b/ecmascript/jit/jit_task.h @@ -40,7 +40,7 @@ enum RunState : uint8_t { FINISH }; -class JitTaskpool : public Taskpool { +class JitTaskpool : public common::Taskpool { public: PUBLIC_API static JitTaskpool *GetCurrentTaskpool(); JitTaskpool() = default; @@ -70,7 +70,7 @@ public: void Initialize(bool needInitJitFort) { - Taskpool::Initialize(0, [needInitJitFort](os::thread::native_handle_type thread) { + common::Taskpool::Initialize(0, [needInitJitFort](os::thread::native_handle_type thread) { os::thread::SetThreadName(thread, "OS_JIT_Thread"); constexpr int32_t priorityVal = 5; // 5: The priority can be set within range [-20, 19] os::thread::SetPriority(os::thread::GetCurrentThreadId(), priorityVal); @@ -88,7 +88,7 @@ public: void Destroy() { WaitForJitTaskPoolReady(); - Taskpool::Destroy(threadId_); + common::Taskpool::Destroy(threadId_); } private: @@ -244,9 +244,9 @@ public: return sustainingJSHandle_.get(); } - class AsyncTask : public Task { + class AsyncTask : public common::Task { public: - explicit AsyncTask(std::shared_ptrjitTask, int32_t id) : Task(id), jitTask_(jitTask) { } + explicit AsyncTask(std::shared_ptrjitTask, int32_t id) : common::Task(id), jitTask_(jitTask) { } virtual ~AsyncTask() override = default; bool Run(uint32_t threadIndex) override; @@ -265,7 +265,7 @@ public: void Terminated() { - Task::Terminated(); + common::Task::Terminated(); } void ReleaseSustainingJSHandle() diff --git a/ecmascript/js_handle.h b/ecmascript/js_handle.h index 0d9b6a58197e8d4ffe64e78a5049e464fc6d8283..cdf5d17c6b4f6ef5dd167e4de76ad75eb350e8a0 100644 --- a/ecmascript/js_handle.h +++ b/ecmascript/js_handle.h @@ -182,15 +182,15 @@ public: } template - operator ReadOnlyHandle() + operator common::ReadOnlyHandle() { - return ReadOnlyHandle(address_); + return common::ReadOnlyHandle(address_); } template - operator const ReadOnlyHandle() const + operator const common::ReadOnlyHandle() const { - return ReadOnlyHandle(address_); + return common::ReadOnlyHandle(address_); } private: inline explicit JSHandle(const JSTaggedType *slot) : address_(reinterpret_cast(slot)) {} diff --git a/ecmascript/js_hclass.h b/ecmascript/js_hclass.h index e73ea0ff48062c7f6dfba99b7c4cb9c274960340..14bf5fc711848d35abf3cf770a5bf1b6c8b7ed79 100644 --- a/ecmascript/js_hclass.h +++ b/ecmascript/js_hclass.h @@ -348,11 +348,11 @@ enum class JSType : uint8_t { JSTYPE_DECL, }; -static_assert(static_cast(JSType::LINE_STRING) == static_cast(CommonType::LINE_STRING) && +static_assert(static_cast(JSType::LINE_STRING) == static_cast(common::CommonType::LINE_STRING) && "line string type should be same with common type"); -static_assert(static_cast(JSType::SLICED_STRING) == static_cast(CommonType::SLICED_STRING) && +static_assert(static_cast(JSType::SLICED_STRING) == static_cast(common::CommonType::SLICED_STRING) && "sliced string type should be same with common type"); -static_assert(static_cast(JSType::TREE_STRING) == static_cast(CommonType::TREE_STRING) && +static_assert(static_cast(JSType::TREE_STRING) == static_cast(common::CommonType::TREE_STRING) && "tree string type should be same with common type"); struct TransitionResult { diff --git a/ecmascript/js_runtime_options.cpp b/ecmascript/js_runtime_options.cpp index 053661ec7a2ba61dd9ec8f3ff7bfbaf47e546f16..87866ac90585934aabbec113c8e130b938460a88 100644 --- a/ecmascript/js_runtime_options.cpp +++ b/ecmascript/js_runtime_options.cpp @@ -1699,9 +1699,9 @@ void JSRuntimeOptions::ParseAsmInterOption() JSRuntimeOptions::JSRuntimeOptions() { #ifdef USE_CMC_GC - param_ = BaseRuntimeParam::DefaultRuntimeParam(); + param_ = common::BaseRuntimeParam::DefaultRuntimeParam(); #else - param_ = RuntimeParam(); + param_ = common::RuntimeParam(); #endif } diff --git a/ecmascript/js_runtime_options.h b/ecmascript/js_runtime_options.h index 6e234bb2dcea82e7698f101ffcab9730bd88b82e..bda4eea431457a8a8f21805bf51f1c2f62711a75 100644 --- a/ecmascript/js_runtime_options.h +++ b/ecmascript/js_runtime_options.h @@ -252,9 +252,9 @@ public: DEFAULT_COPY_SEMANTIC(JSRuntimeOptions); DEFAULT_MOVE_SEMANTIC(JSRuntimeOptions); - LogOptions GetLogOptions() const + common::LogOptions GetLogOptions() const { - LogOptions option; + common::LogOptions option; // For ArkTS runtime log if (WasSetLogFatal()) { option.level = Level::FATAL; @@ -279,7 +279,7 @@ public: return option; } - RuntimeParam GetRuntimeParam() const + common::RuntimeParam GetRuntimeParam() const { return param_; } @@ -2503,7 +2503,7 @@ private: std::string jitMethodDichotomy_ {"disable"}; std::string jitMethodPath_ {"method_compiled_by_jit.cfg"}; size_t heapSize_ = {0}; - RuntimeParam param_; + common::RuntimeParam param_; }; } // namespace panda::ecmascript diff --git a/ecmascript/js_tagged_value.h b/ecmascript/js_tagged_value.h index f0120ce2af67f4a13155949997f041a6af02b5de..f1dd3992ac38481f1ea87ef84cb9ec8baa764297 100644 --- a/ecmascript/js_tagged_value.h +++ b/ecmascript/js_tagged_value.h @@ -21,7 +21,6 @@ #include "ecmascript/mem/c_string.h" #include "ecmascript/mem/mem_common.h" #include "ecmascript/js_tagged_value_internals.h" -#include "libpandabase/mem/mem.h" namespace panda::ecmascript { class JSArray; diff --git a/ecmascript/js_thread.cpp b/ecmascript/js_thread.cpp index 9048f435e4703100ea0f9ba623d3e63cc22b1232..b2152b58c3c811cbf4f22640820504466cbf4ec4 100644 --- a/ecmascript/js_thread.cpp +++ b/ecmascript/js_thread.cpp @@ -967,7 +967,7 @@ bool JSThread::CheckSafepoint() #ifndef NDEBUG if (vm_->GetJSOptions().EnableForceGC()) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::SYNC); // Trigger Full CMC here + common::BaseRuntime::RequestGC(common::GcType::SYNC); // Trigger Full CMC here #else vm_->CollectGarbage(TriggerGCType::FULL_GC); #endif diff --git a/ecmascript/js_thread.h b/ecmascript/js_thread.h index 673d320ab26986c1404fa02ff4b2e86117e4ae65..ace958e3d7dea3ab53f2dd4f8ecc9acb92f58f85 100644 --- a/ecmascript/js_thread.h +++ b/ecmascript/js_thread.h @@ -102,15 +102,14 @@ enum ThreadType : uint8_t { #ifdef USE_CMC_GC -using BaseThread = panda::BaseThread; -using BaseThreadType = panda::BaseThreadType; -using ThreadHolder = panda::ThreadHolder; -using ThreadFlag = panda::ThreadFlag; -using ThreadState = panda::ThreadState; -using ThreadStateAndFlags = panda::ThreadStateAndFlags; -using CommonRootVisitor = panda::CommonRootVisitor; -static constexpr uint32_t THREAD_STATE_OFFSET = panda::THREAD_STATE_OFFSET; -static constexpr uint32_t THREAD_FLAGS_MASK = panda::THREAD_FLAGS_MASK; +using BaseThread = common::BaseThread; +using BaseThreadType = common::BaseThreadType; +using ThreadHolder = common::ThreadHolder; +using ThreadFlag = common::ThreadFlag; +using ThreadState = common::ThreadState; +using ThreadStateAndFlags = common::ThreadStateAndFlags; +static constexpr uint32_t THREAD_STATE_OFFSET = common::THREAD_STATE_OFFSET; +static constexpr uint32_t THREAD_FLAGS_MASK = common::THREAD_FLAGS_MASK; #else enum ThreadFlag : uint16_t { NO_FLAGS = 0 << 0, @@ -212,7 +211,7 @@ public: using ReadBarrierStateBit = SharedMarkStatusBits::NextFlag; #endif #ifdef USE_CMC_GC - using CMCGCPhaseBits = BitField; + using CMCGCPhaseBits = BitField; #endif using CheckSafePointBit = BitField; using VMNeedSuspensionBit = BitField; @@ -617,12 +616,12 @@ public: #endif #ifdef USE_CMC_GC - GCPhase GetCMCGCPhase() const + common::GCPhase GetCMCGCPhase() const { return CMCGCPhaseBits::Decode(glueData_.sharedGCStateBitField_); } - void SetCMCGCPhase(GCPhase gcPhase) + void SetCMCGCPhase(common::GCPhase gcPhase) { CMCGCPhaseBits::Set(gcPhase, &glueData_.sharedGCStateBitField_); } @@ -1692,7 +1691,7 @@ public: } // to impl - void Visit(CommonRootVisitor visitor) + void Visit(common::CommonRootVisitor visitor) { visitor(nullptr); } diff --git a/ecmascript/jspandafile/js_pandafile.cpp b/ecmascript/jspandafile/js_pandafile.cpp index 7243a19dc7c7fd6dadb12363a43d01f001d2ece2..5f6ff39ba0e0335a396116d0470524227aa7f06f 100644 --- a/ecmascript/jspandafile/js_pandafile.cpp +++ b/ecmascript/jspandafile/js_pandafile.cpp @@ -416,7 +416,7 @@ void JSPandaFile::GetClassAndMethodIndexes(std::vectorGetTotalThreadNum() + 1) * ASYN_TRANSLATE_CLSSS_COUNT; + uint32_t minCount = (common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1) * ASYN_TRANSLATE_CLSSS_COUNT; if (numClasses_ - classIndex_ < minCount) { cnts = ASYN_TRANSLATE_CLSSS_MIN_COUNT; } @@ -465,7 +465,7 @@ void JSPandaFile::TranslateClass(JSThread *thread, const CString &methodName) void JSPandaFile::PostInitializeMethodTask(JSThread *thread, const std::shared_ptr &methodNamePtr) { IncreaseTaskCount(); - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(thread->GetThreadId(), thread, this, methodNamePtr)); } @@ -508,7 +508,7 @@ void JSPandaFile::SetAllMethodLiteralToMap() void JSPandaFile::TranslateClasses(JSThread *thread, const CString &methodName) { const std::shared_ptr methodNamePtr = std::make_shared(methodName); - for (uint32_t i = 0; i < Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); i++) { + for (uint32_t i = 0; i < common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); i++) { PostInitializeMethodTask(thread, methodNamePtr); } TranslateClass(thread, methodName); diff --git a/ecmascript/jspandafile/js_pandafile.h b/ecmascript/jspandafile/js_pandafile.h index 0e40ee82f394b56695b82aed4171090d6ad7deed..17fd966bd5cacefe35092d9e6e1bbd5fe0d21451 100644 --- a/ecmascript/jspandafile/js_pandafile.h +++ b/ecmascript/jspandafile/js_pandafile.h @@ -98,11 +98,11 @@ public: JSPandaFile(const panda_file::File *pf, const CString &descriptor, CreateMode state = CreateMode::RUNTIME); ~JSPandaFile(); - class TranslateClassesTask : public Task { + class TranslateClassesTask : public common::Task { public: TranslateClassesTask(int32_t id, JSThread *thread, JSPandaFile *jsPandaFile, const std::shared_ptr &methodNamePtr) - : Task(id), thread_(thread), jsPandaFile_(jsPandaFile), methodNamePtr_(methodNamePtr) {}; + : common::Task(id), thread_(thread), jsPandaFile_(jsPandaFile), methodNamePtr_(methodNamePtr) {}; ~TranslateClassesTask() override = default; bool Run(uint32_t threadIndex) override; diff --git a/ecmascript/mem/barriers-inl.h b/ecmascript/mem/barriers-inl.h index 44267cd15189660d68af285bea18f1ca4b82b25d..1b3ceebdb4f13c0904d21f7339f50bc91f6be8c3 100644 --- a/ecmascript/mem/barriers-inl.h +++ b/ecmascript/mem/barriers-inl.h @@ -31,7 +31,7 @@ template static ARK_INLINE void WriteBarrier(const JSThread *thread, void *obj, size_t offset, JSTaggedType value) { #ifdef USE_CMC_GC - BaseRuntime::WriteBarrier(obj, (void *)((long)obj + offset), (void*)value); + common::BaseRuntime::WriteBarrier(obj, (void *)((long)obj + offset), (void*)value); // Ignore barrier for cmc gc allocation return; #endif diff --git a/ecmascript/mem/barriers.cpp b/ecmascript/mem/barriers.cpp index 834b51136ef7273c93b9535a63c1b15a14268c91..20ba1efc6033b87d3e04a5dd8eba5064c651c91c 100644 --- a/ecmascript/mem/barriers.cpp +++ b/ecmascript/mem/barriers.cpp @@ -116,7 +116,7 @@ ARK_NOINLINE bool BatchBitSet([[maybe_unused]] const JSThread* thread, Region* o void Barriers::CMCWriteBarrier(const JSThread *thread, void *obj, size_t offset, JSTaggedType value) { (void)thread; - BaseRuntime::WriteBarrier(obj, (void *)((uintptr_t)obj + offset), (void*)value); + common::BaseRuntime::WriteBarrier(obj, (void *)((uintptr_t)obj + offset), (void*)value); return; } @@ -129,7 +129,7 @@ void Barriers::CMCArrayCopyWriteBarrier(const JSThread *thread, void* src, void* for (size_t i = 0; i < count; i++) { uintptr_t offset = i * sizeof(uintptr_t); uintptr_t value = srcPtr[i]; - BaseRuntime::WriteBarrier(dst, (void *)((uintptr_t)dst + offset), (void*)value); + common::BaseRuntime::WriteBarrier(dst, (void *)((uintptr_t)dst + offset), (void*)value); } return; } diff --git a/ecmascript/mem/barriers.h b/ecmascript/mem/barriers.h index 150c658716ac0e9c81caf1075dc31bff5f6b3a96..f7df9d80670860204f4ae9586b164c75855b9375 100644 --- a/ecmascript/mem/barriers.h +++ b/ecmascript/mem/barriers.h @@ -20,7 +20,6 @@ #include "ecmascript/js_tagged_value.h" #include "ecmascript/mem/mark_word.h" #include "ecmascript/mem/mem_common.h" -#include "libpandabase/mem/mem.h" #ifdef USE_CMC_GC #include "common_interfaces/base_runtime.h" #endif @@ -102,12 +101,12 @@ public: #ifdef USE_CMC_GC #ifdef ENABLE_CMC_RB_DFX JSTaggedValue value(reinterpret_cast( - BaseRuntime::ReadBarrier(const_cast(obj), (void*) (ToUintPtr(obj) + offset)))); + common::BaseRuntime::ReadBarrier(const_cast(obj), (void*) (ToUintPtr(obj) + offset)))); value.RemoveReadBarrierDFXTag(); return value.GetRawData(); #else - return reinterpret_cast(BaseRuntime::ReadBarrier(const_cast(obj), - (void*)(ToUintPtr(obj) + offset))); + return reinterpret_cast(common::BaseRuntime::ReadBarrier(const_cast(obj), + (void*)(ToUintPtr(obj) + offset))); #endif #endif } @@ -124,11 +123,11 @@ public: if (value.IsHeapObject()) { #ifdef USE_CMC_GC #ifdef ENABLE_CMC_RB_DFX - JSTaggedValue value(reinterpret_cast(BaseRuntime::ReadBarrier((void*)slotAddress))); + JSTaggedValue value(reinterpret_cast(common::BaseRuntime::ReadBarrier((void*)slotAddress))); value.RemoveReadBarrierDFXTag(); return value.GetRawData(); #else - return reinterpret_cast(BaseRuntime::ReadBarrier((void*)slotAddress)); + return reinterpret_cast(common::BaseRuntime::ReadBarrier((void*)slotAddress)); #endif #endif } @@ -152,8 +151,8 @@ public: return value.GetRawData(); #else return reinterpret_cast( - BaseRuntime::AtomicReadBarrier(const_cast(obj), (void*)(ToUintPtr(obj) + offset), - std::memory_order_acquire)); + common::BaseRuntime::AtomicReadBarrier(const_cast(obj), (void*)(ToUintPtr(obj) + offset), + std::memory_order_acquire)); #endif #endif } diff --git a/ecmascript/mem/cmc_gc/hooks.cpp b/ecmascript/mem/cmc_gc/hooks.cpp index 7283898db817c6354a0f768d1425c3b5273ac286..675d8872ef7a98a77358e0954925989b515808e7 100644 --- a/ecmascript/mem/cmc_gc/hooks.cpp +++ b/ecmascript/mem/cmc_gc/hooks.cpp @@ -25,20 +25,21 @@ #include "ecmascript/runtime.h" #include "objects/base_type.h" -namespace panda { -using ecmascript::ObjectXRay; -using ecmascript::FreeObject; -using ecmascript::ObjectSlot; +namespace common { +using panda::ecmascript::ObjectXRay; +using panda::ecmascript::FreeObject; +using panda::ecmascript::ObjectSlot; +using panda::ecmascript::JSThread; -class CMCRootVisitor final : public ecmascript::RootVisitor { +class CMCRootVisitor final : public panda::ecmascript::RootVisitor { public: inline explicit CMCRootVisitor(const RefFieldVisitor &visitor): visitor_(visitor) {}; ~CMCRootVisitor() override = default; - inline void VisitRoot([[maybe_unused]] ecmascript::Root type, + inline void VisitRoot([[maybe_unused]] panda::ecmascript::Root type, ObjectSlot slot) override { - ecmascript::JSTaggedValue value(slot.GetTaggedType()); + panda::ecmascript::JSTaggedValue value(slot.GetTaggedType()); if (value.IsHeapObject()) { ASSERT(!value.IsWeak()); @@ -46,11 +47,11 @@ public: } } - inline void VisitRangeRoot([[maybe_unused]] ecmascript::Root type, + inline void VisitRangeRoot([[maybe_unused]] panda::ecmascript::Root type, ObjectSlot start, ObjectSlot end) override { for (ObjectSlot slot = start; slot < end; slot++) { - ecmascript::JSTaggedValue value(slot.GetTaggedType()); + panda::ecmascript::JSTaggedValue value(slot.GetTaggedType()); if (value.IsHeapObject()) { ASSERT(!value.IsWeak()); @@ -59,12 +60,12 @@ public: } } - inline void VisitBaseAndDerivedRoot([[maybe_unused]] ecmascript::Root type, + inline void VisitBaseAndDerivedRoot([[maybe_unused]] panda::ecmascript::Root type, [[maybe_unused]] ObjectSlot base, [[maybe_unused]] ObjectSlot derived, [[maybe_unused]] uintptr_t baseOldObject) override { - ecmascript::JSTaggedValue baseVal(base.GetTaggedType()); + panda::ecmascript::JSTaggedValue baseVal(base.GetTaggedType()); if (baseVal.IsHeapObject()) { derived.Update(base.GetTaggedType() + derived.GetTaggedType() - baseOldObject); } @@ -74,14 +75,14 @@ private: const RefFieldVisitor &visitor_; }; -class CMCWeakVisitor final : public ecmascript::WeakVisitor { +class CMCWeakVisitor final : public panda::ecmascript::WeakVisitor { public: - inline explicit CMCWeakVisitor(const WeakRefFieldVisitor &visitor) : visitor_(visitor) {}; + inline explicit CMCWeakVisitor(const common::WeakRefFieldVisitor &visitor) : visitor_(visitor) {}; ~CMCWeakVisitor() override = default; - inline bool VisitRoot([[maybe_unused]] ecmascript::Root type, ObjectSlot slot) override + inline bool VisitRoot([[maybe_unused]] panda::ecmascript::Root type, ObjectSlot slot) override { - ecmascript::JSTaggedValue value(slot.GetTaggedType()); + panda::ecmascript::JSTaggedValue value(slot.GetTaggedType()); if (value.IsHeapObject()) { ASSERT(!value.IsWeak()); return visitor_(reinterpret_cast &>(*(slot.GetRefFieldAddr()))); @@ -90,19 +91,19 @@ public: } private: - const WeakRefFieldVisitor &visitor_; + const common::WeakRefFieldVisitor &visitor_; }; void VisitDynamicRoots(const RefFieldVisitor &visitorFunc, bool isMark) { - ecmascript::VMRootVisitType type = isMark ? ecmascript::VMRootVisitType::MARK : - ecmascript::VMRootVisitType::UPDATE_ROOT; + panda::ecmascript::VMRootVisitType type = isMark ? panda::ecmascript::VMRootVisitType::MARK : + panda::ecmascript::VMRootVisitType::UPDATE_ROOT; CMCRootVisitor visitor(visitorFunc); OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::VisitSharedRoot", ""); // MarkSharedModule - ecmascript::SharedModuleManager::GetInstance()->Iterate(visitor); + panda::ecmascript::SharedModuleManager::GetInstance()->Iterate(visitor); - ecmascript::Runtime *runtime = ecmascript::Runtime::GetInstance(); + panda::ecmascript::Runtime *runtime = panda::ecmascript::Runtime::GetInstance(); // MarkSerializeRoots runtime->IterateSerializeRoot(visitor); @@ -120,21 +121,21 @@ void VisitDynamicRoots(const RefFieldVisitor &visitorFunc, bool isMark) }); } -void VisitDynamicWeakRoots(const WeakRefFieldVisitor &visitorFunc) +void VisitDynamicWeakRoots(const common::WeakRefFieldVisitor &visitorFunc) { OHOS_HITRACE(HITRACE_LEVEL_MAX, "CMCGC::VisitDynamicWeakRoots", ""); CMCWeakVisitor visitor(visitorFunc); - ecmascript::SharedHeap::GetInstance()->IteratorNativePointerList(visitor); + panda::ecmascript::SharedHeap::GetInstance()->IteratorNativePointerList(visitor); - ecmascript::Runtime *runtime = ecmascript::Runtime::GetInstance(); + panda::ecmascript::Runtime *runtime = panda::ecmascript::Runtime::GetInstance(); runtime->GetEcmaStringTable()->IterWeakRoot(visitorFunc); runtime->IteratorNativeDeleteInSharedGC(visitor); runtime->GCIterateThreadList([&](JSThread *thread) { auto vm = thread->GetEcmaVM(); - const_cast(vm->GetHeap())->IteratorNativePointerList(visitor); + const_cast(vm->GetHeap())->IteratorNativePointerList(visitor); thread->ClearVMCachedConstantPool(); thread->IterateWeakEcmaGlobalStorage(visitor); }); @@ -166,29 +167,29 @@ void SynchronizeGCPhaseToJSThread(void *jsThread, GCPhase gcPhase) void SweepThreadLocalJitFort() { - ecmascript::Runtime* runtime = ecmascript::Runtime::GetInstance(); + panda::ecmascript::Runtime* runtime = panda::ecmascript::Runtime::GetInstance(); runtime->GCIterateThreadList([&](JSThread* thread) { if (thread->IsJSThread()) { auto vm = thread->GetEcmaVM(); - const_cast(vm->GetHeap())->GetMachineCodeSpace()->Sweep(); + const_cast(vm->GetHeap())->GetMachineCodeSpace()->Sweep(); } }); } void FillFreeObject(void *object, size_t size) { - ecmascript::FreeObject::FillFreeObject(ecmascript::SharedHeap::GetInstance(), + panda::ecmascript::FreeObject::FillFreeObject(panda::ecmascript::SharedHeap::GetInstance(), reinterpret_cast(object), size); } void JSGCCallback(void *ecmaVM) { - ecmascript::EcmaVM *vm = reinterpret_cast(ecmaVM); + panda::ecmascript::EcmaVM *vm = reinterpret_cast(ecmaVM); ASSERT(vm != nullptr); - ecmascript::JSThread *thread = vm->GetAssociatedJSThread(); + JSThread *thread = vm->GetAssociatedJSThread(); if (thread != nullptr && thread->ReadyForGCIterating()) { - ecmascript::Heap *heap = const_cast(vm->GetHeap()); + panda::ecmascript::Heap *heap = const_cast(vm->GetHeap()); heap->ProcessGCCallback(); } } @@ -196,13 +197,13 @@ void JSGCCallback(void *ecmaVM) void SetBaseAddress(uintptr_t base) { // Please be careful about reentrant - ASSERT(ecmascript::TaggedStateWord::BASE_ADDRESS == 0); - ecmascript::TaggedStateWord::BASE_ADDRESS = base; + ASSERT(panda::ecmascript::TaggedStateWord::BASE_ADDRESS == 0); + panda::ecmascript::TaggedStateWord::BASE_ADDRESS = base; } void JitFortUnProt(size_t size, void* base) { - ecmascript::PageMap(size, PAGE_PROT_READWRITE, 0, base, PAGE_FLAG_MAP_FIXED); + panda::ecmascript::PageMap(size, PAGE_PROT_READWRITE, 0, base, PAGE_FLAG_MAP_FIXED); } bool IsMachineCodeObject(uintptr_t objPtr) diff --git a/ecmascript/mem/concurrent_marker.cpp b/ecmascript/mem/concurrent_marker.cpp index e7e8304e31ccdf6f78766068c380ba817af153e4..d2c11e5923f71c5563d298b6934459b47beaa300 100644 --- a/ecmascript/mem/concurrent_marker.cpp +++ b/ecmascript/mem/concurrent_marker.cpp @@ -38,7 +38,7 @@ ConcurrentMarker::ConcurrentMarker(Heap *heap, EnableConcurrentMarkType type) bool ConcurrentMarker::TryIncreaseTaskCounts() { - size_t taskPoolSize = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + size_t taskPoolSize = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); { LockHolder holder(taskCountMutex_); // total counts of running concurrent mark tasks should be less than taskPoolSize diff --git a/ecmascript/mem/concurrent_sweeper.cpp b/ecmascript/mem/concurrent_sweeper.cpp index ef3a83ef8df4a51627c4e35d5094e39a786e4578..0cb69cc8c91c09584b7d9a09f33f2509d5891e87 100644 --- a/ecmascript/mem/concurrent_sweeper.cpp +++ b/ecmascript/mem/concurrent_sweeper.cpp @@ -32,12 +32,12 @@ void ConcurrentSweeper::PostTask(bool fullGC) if (ConcurrentSweepEnabled()) { auto tid = heap_->GetJSThread()->GetThreadId(); if (!fullGC) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(tid, this, OLD_SPACE, startSpaceType_)); } - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(tid, this, NON_MOVABLE, startSpaceType_)); - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(tid, this, MACHINE_CODE_SPACE, startSpaceType_)); } } diff --git a/ecmascript/mem/concurrent_sweeper.h b/ecmascript/mem/concurrent_sweeper.h index 1dc483032e6b1c4f08fbc66158cfb45ac357c204..be85f3b1f4fd32444fa1ac8aa12265ef1258aa3b 100644 --- a/ecmascript/mem/concurrent_sweeper.h +++ b/ecmascript/mem/concurrent_sweeper.h @@ -91,10 +91,10 @@ public: return enableType_ == EnableConcurrentSweepType::CONFIG_DISABLE; } private: - class SweeperTask : public Task { + class SweeperTask : public common::Task { public: SweeperTask(int32_t id, ConcurrentSweeper *sweeper, MemSpaceType type, MemSpaceType startSpaceType) - : Task(id), sweeper_(sweeper), type_(type), startSpaceType_(startSpaceType) {}; + : common::Task(id), sweeper_(sweeper), type_(type), startSpaceType_(startSpaceType) {}; ~SweeperTask() override = default; bool Run(uint32_t threadIndex) override; diff --git a/ecmascript/mem/dynamic_object_operator.cpp b/ecmascript/mem/dynamic_object_operator.cpp index 677ac483eb959b28eac769ef482ff46655902233..784cc1f7d05356e00099b7d0729938f3e2153f9b 100644 --- a/ecmascript/mem/dynamic_object_operator.cpp +++ b/ecmascript/mem/dynamic_object_operator.cpp @@ -45,7 +45,7 @@ void RefFieldObjectVisitor::VisitObjectRangeImpl(BaseObject *root, uintptr_t sta void RefFieldObjectVisitor::VisitObjectHClassImpl(BaseObject *hclass) { - visitor_(reinterpret_cast&>(hclass)); + visitor_(reinterpret_cast&>(hclass)); } void RefFieldObjectVisitor::VisitAllRefFields(TaggedObject *obj) @@ -56,7 +56,7 @@ void RefFieldObjectVisitor::VisitAllRefFields(TaggedObject *obj) void RefFieldObjectVisitor::visit(ObjectSlot slot) { - visitor_(reinterpret_cast&>(*(slot.GetRefFieldAddr()))); + visitor_(reinterpret_cast&>(*(slot.GetRefFieldAddr()))); } } // namespace panda::ecmascript diff --git a/ecmascript/mem/dynamic_object_operator.h b/ecmascript/mem/dynamic_object_operator.h index d53df08a33eb9e48b89827641b66ec758a63ebe2..cd6864d0d503b97bd6b527bf05ba1a5ef49defdf 100644 --- a/ecmascript/mem/dynamic_object_operator.h +++ b/ecmascript/mem/dynamic_object_operator.h @@ -26,7 +26,7 @@ namespace panda::ecmascript { class RefFieldObjectVisitor final : public BaseObjectVisitor { public: - inline explicit RefFieldObjectVisitor(const RefFieldVisitor &visitor): visitor_(visitor) {}; + inline explicit RefFieldObjectVisitor(const common::RefFieldVisitor &visitor): visitor_(visitor) {}; ~RefFieldObjectVisitor() override = default; void VisitObjectRangeImpl(BaseObject *root, uintptr_t start, uintptr_t end, @@ -59,7 +59,7 @@ class RefFieldObjectVisitor final : public BaseObjectVisitorGetClass()->IsHClass(); } - void ForEachRefField(const BaseObject *object, const RefFieldVisitor &visitor) const override + void ForEachRefField(const BaseObject *object, const common::RefFieldVisitor &visitor) const override { auto freeObject = FreeObject::Cast(reinterpret_cast(object)); if (!freeObject->IsFreeObject()) { diff --git a/ecmascript/mem/full_gc.cpp b/ecmascript/mem/full_gc.cpp index 3849b6f0935b15085deb5ed2fe22790aafd186e3..87c73a6a0e4c3616d047d80cf3015562928d4bcd 100644 --- a/ecmascript/mem/full_gc.cpp +++ b/ecmascript/mem/full_gc.cpp @@ -128,7 +128,7 @@ void FullGC::Sweep() // process weak reference uint32_t totalThreadCount = 1; // 1 : mainthread if (heap_->IsParallelGCEnabled()) { - totalThreadCount += Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + totalThreadCount += common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); } for (uint32_t i = 0; i < totalThreadCount; i++) { ProcessQueue *queue = workManager_->GetWorkNodeHolder(i)->GetWeakReferenceQueue(); diff --git a/ecmascript/mem/heap-inl.h b/ecmascript/mem/heap-inl.h index 2eb02fea6ccae3cd88aebe5b114e841e48603119..1520d128639f691bbc746246c3e35a32d5600ee9 100644 --- a/ecmascript/mem/heap-inl.h +++ b/ecmascript/mem/heap-inl.h @@ -210,7 +210,7 @@ TaggedObject *Heap::AllocateYoungOrHugeObject(JSHClass *hclass) TaggedObject *Heap::AllocateYoungOrHugeObject(size_t size) { #ifdef USE_CMC_GC - return reinterpret_cast(HeapAllocator::Allocate(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::Allocate(size, common::LanguageType::DYNAMIC)); #else size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); TaggedObject *object = nullptr; @@ -237,7 +237,7 @@ TaggedObject *Heap::AllocateYoungOrHugeObject(size_t size) TaggedObject *Heap::AllocateInYoungSpace(size_t size) { #ifdef USE_CMC_GC - return reinterpret_cast(HeapAllocator::Allocate(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::Allocate(size, common::LanguageType::DYNAMIC)); #else return reinterpret_cast(activeSemiSpace_->Allocate(size)); #endif @@ -268,7 +268,7 @@ uintptr_t Heap::AllocateYoungSync(size_t size) { #ifdef USE_CMC_GC // check sync - return HeapAllocator::Allocate(size, LanguageType::DYNAMIC); + return common::HeapAllocator::Allocate(size, common::LanguageType::DYNAMIC); #else return activeSemiSpace_->AllocateSync(size); #endif @@ -310,7 +310,7 @@ TaggedObject *Heap::TryAllocateYoungGeneration(JSHClass *hclass, size_t size) return nullptr; } #ifdef USE_CMC_GC - auto object = reinterpret_cast(HeapAllocator::Allocate(size, LanguageType::DYNAMIC)); + auto object = reinterpret_cast(common::HeapAllocator::Allocate(size, common::LanguageType::DYNAMIC)); #else auto object = reinterpret_cast(activeSemiSpace_->Allocate(size)); #endif @@ -336,9 +336,11 @@ TaggedObject *Heap::AllocateOldOrHugeObject(size_t size) #ifdef USE_CMC_GC if (size > MAX_REGULAR_HEAP_OBJECT_SIZE) { - object = reinterpret_cast(HeapAllocator::AllocateInHuge(size, LanguageType::DYNAMIC)); + object = reinterpret_cast(common::HeapAllocator::AllocateInHuge( + size, common::LanguageType::DYNAMIC)); } else { - object = reinterpret_cast(HeapAllocator::AllocateInOld(size, LanguageType::DYNAMIC)); + object = reinterpret_cast(common::HeapAllocator::AllocateInOld( + size, common::LanguageType::DYNAMIC)); } #else if (size > MAX_REGULAR_HEAP_OBJECT_SIZE) { @@ -401,7 +403,8 @@ TaggedObject *Heap::AllocateReadOnlyOrHugeObject(JSHClass *hclass, size_t size) TaggedObject* Heap::AllocateReadOnlyOrHugeObject(size_t size) { #ifdef USE_CMC_GC - return reinterpret_cast(HeapAllocator::AllocateInReadOnly(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::AllocateInReadOnly( + size, common::LanguageType::DYNAMIC)); #else return reinterpret_cast(readOnlySpace_->Allocate(size)); #endif @@ -428,7 +431,8 @@ TaggedObject *Heap::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_t size object = AllocateHugeObject(hclass, size); } else { #ifdef USE_CMC_GC - object = reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + object = reinterpret_cast(common::HeapAllocator::AllocateInNonmove( + size, common::LanguageType::DYNAMIC)); #else object = reinterpret_cast(nonMovableSpace_->CheckAndAllocate(size)); CHECK_OBJ_AND_THROW_OOM_ERROR(object, size, nonMovableSpace_, "Heap::AllocateNonMovableOrHugeObject"); @@ -445,7 +449,8 @@ TaggedObject *Heap::AllocateClassClass(JSHClass *hclass, size_t size) { size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); #ifdef USE_CMC_GC - auto object = reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + auto object = reinterpret_cast( + common::HeapAllocator::AllocateInNonmove(size, common::LanguageType::DYNAMIC)); #else auto object = reinterpret_cast(nonMovableSpace_->Allocate(size)); #endif @@ -465,7 +470,8 @@ TaggedObject *SharedHeap::AllocateClassClass(JSThread *thread, JSHClass *hclass, size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); #ifdef USE_CMC_GC // check why shareheap allocate in readonly - auto object = reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + auto object = reinterpret_cast( + common::HeapAllocator::AllocateInNonmove(size, common::LanguageType::DYNAMIC)); #else auto object = reinterpret_cast(sReadOnlySpace_->Allocate(thread, size)); #endif @@ -483,7 +489,8 @@ TaggedObject *SharedHeap::AllocateClassClass(JSThread *thread, JSHClass *hclass, TaggedObject *Heap::AllocateHugeObject(size_t size) { #ifdef USE_CMC_GC - return reinterpret_cast(HeapAllocator::AllocateInHuge(size, LanguageType::DYNAMIC)); + return reinterpret_cast( + common::HeapAllocator::AllocateInHuge(size, common::LanguageType::DYNAMIC)); #else // Check whether it is necessary to trigger Old GC before expanding to avoid OOM risk. CheckAndTriggerOldGC(size); @@ -547,8 +554,10 @@ TaggedObject *Heap::AllocateMachineCodeObject(JSHClass *hclass, size_t size, Mac ASSERT(!GetEcmaVM()->GetJSOptions().GetEnableJitFort()); object = (size > MAX_REGULAR_HEAP_OBJECT_SIZE) ? #ifdef USE_CMC_GC - reinterpret_cast(HeapAllocator::AllocateInHuge(size, LanguageType::DYNAMIC)) : - reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + reinterpret_cast(common::HeapAllocator::AllocateInHuge( + size, common::LanguageType::DYNAMIC)) : + reinterpret_cast(common::HeapAllocator::AllocateInNonmove( + size, common::LanguageType::DYNAMIC)); #else reinterpret_cast(AllocateHugeMachineCodeObject(size)) : reinterpret_cast(machineCodeSpace_->Allocate(size)); @@ -578,7 +587,8 @@ TaggedObject *Heap::AllocateMachineCodeObject(JSHClass *hclass, size_t size, Mac object = (size > MAX_REGULAR_HEAP_OBJECT_SIZE) ? #ifdef USE_CMC_GC reinterpret_cast(AllocateHugeMachineCodeObject(size, desc)) : - reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + reinterpret_cast(common::HeapAllocator::AllocateInNonmove( + size, common::LanguageType::DYNAMIC)); #else reinterpret_cast(AllocateHugeMachineCodeObject(size, desc)) : reinterpret_cast(machineCodeSpace_->Allocate(size, desc, true)); @@ -609,7 +619,8 @@ uintptr_t Heap::AllocateSnapshotSpace(size_t size) TaggedObject *Heap::AllocateSharedNonMovableSpaceFromTlab(JSThread *thread, size_t size) { #ifdef USE_CMC_GC - return reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::AllocateInNonmove( + size, common::LanguageType::DYNAMIC)); #endif ASSERT(!thread->IsJitThread()); @@ -651,7 +662,7 @@ TaggedObject *Heap::AllocateSharedOldSpaceFromTlab(JSThread *thread, size_t size { #ifdef USE_CMC_GC // will invoked by asm interpreter stub AllocateInSOld - return reinterpret_cast(HeapAllocator::AllocateInOld(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::AllocateInOld(size, common::LanguageType::DYNAMIC)); #endif ASSERT(!thread->IsJitThread()); @@ -913,9 +924,8 @@ TaggedObject *SharedHeap::AllocateNonMovableOrHugeObject(JSThread *thread, JSHCl } #ifdef USE_CMC_GC - TaggedObject *object = thread->IsJitThread() ? nullptr - : reinterpret_cast( - HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + TaggedObject *object = thread->IsJitThread() ? nullptr : reinterpret_cast( + common::HeapAllocator::AllocateInNonmove(size, common::LanguageType::DYNAMIC)); object->SetClass(thread, hclass); #else TaggedObject *object = thread->IsJitThread() ? nullptr : @@ -944,9 +954,8 @@ TaggedObject *SharedHeap::AllocateNonMovableOrHugeObject(JSThread *thread, size_ } #ifdef USE_CMC_GC - TaggedObject *object = thread->IsJitThread() ? nullptr - : reinterpret_cast( - HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + TaggedObject *object = thread->IsJitThread() ? nullptr : reinterpret_cast( + common::HeapAllocator::AllocateInNonmove(size, common::LanguageType::DYNAMIC)); #else TaggedObject *object = thread->IsJitThread() ? nullptr : const_cast(thread->GetEcmaVM()->GetHeap())->AllocateSharedNonMovableSpaceFromTlab(thread, size); @@ -977,7 +986,8 @@ TaggedObject *SharedHeap::AllocateOldOrHugeObject(JSThread *thread, JSHClass *hc } #ifdef USE_CMC_GC - TaggedObject *object = reinterpret_cast(HeapAllocator::AllocateInOld(size, LanguageType::DYNAMIC)); + TaggedObject *object = reinterpret_cast(common::HeapAllocator::AllocateInOld( + size, common::LanguageType::DYNAMIC)); object->SetClass(thread, hclass); #else TaggedObject *object = thread->IsJitThread() ? nullptr : @@ -1006,7 +1016,7 @@ TaggedObject *SharedHeap::AllocateOldOrHugeObject(JSThread *thread, size_t size) #ifdef USE_CMC_GC TaggedObject *object = thread->IsJitThread() ? nullptr : - reinterpret_cast(HeapAllocator::AllocateInOld(size, LanguageType::DYNAMIC)); + reinterpret_cast(common::HeapAllocator::AllocateInOld(size, common::LanguageType::DYNAMIC)); #else TaggedObject *object = thread->IsJitThread() ? nullptr : const_cast(thread->GetEcmaVM()->GetHeap())->AllocateSharedOldSpaceFromTlab(thread, size); @@ -1024,7 +1034,7 @@ TaggedObject *SharedHeap::AllocateInSOldSpace(JSThread *thread, size_t size) #ifdef USE_CMC_GC (void)thread; ASSERT(!thread->IsJitThread()); - return reinterpret_cast(HeapAllocator::AllocateInOld(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::AllocateInOld(size, common::LanguageType::DYNAMIC)); #else // jit thread no heap bool allowGC = !thread->IsJitThread(); @@ -1064,7 +1074,7 @@ TaggedObject *SharedHeap::AllocateHugeObject(JSThread *thread, size_t size) { #ifdef USE_CMC_GC (void)thread; - return reinterpret_cast(HeapAllocator::AllocateInHuge(size, LanguageType::DYNAMIC)); + return reinterpret_cast(common::HeapAllocator::AllocateInHuge(size, common::LanguageType::DYNAMIC)); #else // Check whether it is necessary to trigger Shared GC before expanding to avoid OOM risk. CheckHugeAndTriggerSharedGC(thread, size); @@ -1103,7 +1113,8 @@ TaggedObject *SharedHeap::AllocateReadOnlyOrHugeObject(JSThread *thread, JSHClas } #ifdef USE_CMC_GC - auto object = reinterpret_cast(HeapAllocator::AllocateInNonmove(size, LanguageType::DYNAMIC)); + auto object = reinterpret_cast( + common::HeapAllocator::AllocateInNonmove(size, common::LanguageType::DYNAMIC)); #else auto object = reinterpret_cast(sReadOnlySpace_->Allocate(thread, size)); CHECK_SOBJ_AND_THROW_OOM_ERROR(thread, object, size, sReadOnlySpace_, "SharedHeap::AllocateReadOnlyOrHugeObject"); @@ -1164,13 +1175,13 @@ template void SharedHeap::CollectGarbage(JSThread *thread) { #ifdef USE_CMC_GC - GcType type = GcType::ASYNC; + common::GcType type = common::GcType::ASYNC; if constexpr (gcType == TriggerGCType::FULL_GC || gcType == TriggerGCType::SHARED_FULL_GC || gcType == TriggerGCType::APPSPAWN_FULL_GC || gcType == TriggerGCType::APPSPAWN_SHARED_FULL_GC || gcReason == GCReason::ALLOCATION_FAILED) { - type = GcType::FULL; + type = common::GcType::FULL; } - BaseRuntime::RequestGC(type); + common::BaseRuntime::RequestGC(type); return; #endif ASSERT(gcType == TriggerGCType::SHARED_GC || gcType == TriggerGCType::SHARED_PARTIAL_GC || diff --git a/ecmascript/mem/heap.cpp b/ecmascript/mem/heap.cpp index f0c51d91b2efd8d96684a56315f15509d90c12b1..e44d6dfb07fbb62e9adb03b8f1f53dadd30e0128 100644 --- a/ecmascript/mem/heap.cpp +++ b/ecmascript/mem/heap.cpp @@ -321,7 +321,7 @@ void SharedHeap::Destroy() void SharedHeap::PostInitialization(const GlobalEnvConstants *globalEnvConstants, const JSRuntimeOptions &option) { globalEnvConstants_ = globalEnvConstants; - uint32_t totalThreadNum = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + uint32_t totalThreadNum = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); maxMarkTaskCount_ = totalThreadNum - 1; sWorkManager_ = new SharedGCWorkManager(this, totalThreadNum + 1); sharedGCMarker_ = new SharedGCMarker(sWorkManager_); @@ -339,7 +339,7 @@ void SharedHeap::PostInitialization(const GlobalEnvConstants *globalEnvConstants void SharedHeap::PostGCMarkingTask(SharedParallelMarkPhase sharedTaskPhase) { IncreaseTaskCount(); - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(dThread_->GetThreadId(), + common::Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(dThread_->GetThreadId(), this, sharedTaskPhase)); } @@ -534,7 +534,7 @@ void SharedHeap::Reclaim(TriggerGCType gcType) if (parallelGC_) { clearTaskFinished_ = false; - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(dThread_->GetThreadId(), this, gcType)); } else { ReclaimRegions(gcType); @@ -571,7 +571,7 @@ void SharedHeap::DisableParallelGC(JSThread *thread) void SharedHeap::EnableParallelGC(JSRuntimeOptions &option) { - uint32_t totalThreadNum = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + uint32_t totalThreadNum = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); maxMarkTaskCount_ = totalThreadNum - 1; parallelGC_ = option.EnableParallelGC(); if (auto workThreadNum = sWorkManager_->GetTotalThreadNum(); @@ -939,7 +939,7 @@ void Heap::Initialize() hugeObjectSpace_ = new HugeObjectSpace(this, heapRegionAllocator_, oldSpaceCapacity, oldSpaceCapacity); hugeMachineCodeSpace_ = new HugeMachineCodeSpace(this, heapRegionAllocator_, oldSpaceCapacity, oldSpaceCapacity); - maxEvacuateTaskCount_ = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + maxEvacuateTaskCount_ = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); maxMarkTaskCount_ = std::min(ecmaVm_->GetJSOptions().GetGcThreadNum(), maxEvacuateTaskCount_ - 1); @@ -957,7 +957,7 @@ void Heap::Initialize() #if ECMASCRIPT_DISABLE_CONCURRENT_MARKING concurrentMarkerEnabled = false; #endif - workManager_ = new WorkManager(this, Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1); + workManager_ = new WorkManager(this, common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1); fullGC_ = new FullGC(this); partialGC_ = new PartialGC(this); @@ -1230,7 +1230,7 @@ void Heap::Resume(TriggerGCType gcType) isCSetClearing_.store(true, std::memory_order_release); } clearTaskFinished_ = false; - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(GetJSThread()->GetThreadId(), this, gcType)); } else { ReclaimRegions(gcType); @@ -1266,13 +1266,13 @@ void Heap::DisableParallelGC() maxMarkTaskCount_ = 0; sweeper_->ConfigConcurrentSweep(false); concurrentMarker_->ConfigConcurrentMark(false); - Taskpool::GetCurrentTaskpool()->Destroy(GetJSThread()->GetThreadId()); + common::Taskpool::GetCurrentTaskpool()->Destroy(GetJSThread()->GetThreadId()); } void Heap::EnableParallelGC() { parallelGC_ = ecmaVm_->GetJSOptions().EnableParallelGC(); - maxEvacuateTaskCount_ = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + maxEvacuateTaskCount_ = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); if (auto totalThreadNum = workManager_->GetTotalThreadNum(); totalThreadNum != maxEvacuateTaskCount_ + 1) { LOG_ECMA_MEM(WARN) << "TheadNum mismatch, totalThreadNum(workerManager): " << totalThreadNum << ", " @@ -1520,13 +1520,13 @@ void Heap::CollectGarbageImpl(TriggerGCType gcType, GCReason reason) void Heap::CollectGarbage(TriggerGCType gcType, GCReason reason) { #ifdef USE_CMC_GC - GcType type = GcType::ASYNC; + common::GcType type = common::GcType::ASYNC; if (gcType == TriggerGCType::FULL_GC || gcType == TriggerGCType::SHARED_FULL_GC || gcType == TriggerGCType::APPSPAWN_FULL_GC || gcType == TriggerGCType::APPSPAWN_SHARED_FULL_GC || reason == GCReason::ALLOCATION_FAILED) { - type = GcType::FULL; + type = common::GcType::FULL; } - BaseRuntime::RequestGC(type); + common::BaseRuntime::RequestGC(type); return; #endif CollectGarbageImpl(gcType, reason); @@ -2320,7 +2320,7 @@ void Heap::WaitConcurrentMarkingFinished() void Heap::PostParallelGCTask(ParallelGCTaskPhase gcTask) { IncreaseTaskCount(); - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(GetJSThread()->GetThreadId(), this, gcTask)); } @@ -2339,7 +2339,7 @@ void Heap::ChangeGCParams(bool inBackground) SetMemGrowingType(MemGrowingType::CONSERVATIVE); LOG_GC(DEBUG) << "Heap Growing Type CONSERVATIVE"; } - Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::BACKGROUND); + common::Taskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::BACKGROUND); } else { LOG_GC(INFO) << "app is not inBackground"; if (GetMemGrowingType() != MemGrowingType::PRESSURE) { @@ -2349,9 +2349,9 @@ void Heap::ChangeGCParams(bool inBackground) concurrentMarker_->EnableConcurrentMarking(EnableConcurrentMarkType::ENABLE); sweeper_->EnableConcurrentSweep(EnableConcurrentSweepType::ENABLE); maxMarkTaskCount_ = std::min(ecmaVm_->GetJSOptions().GetGcThreadNum(), - Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() - 1); - maxEvacuateTaskCount_ = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); - Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::FOREGROUND); + common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() - 1); + maxEvacuateTaskCount_ = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum(); + common::Taskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::FOREGROUND); } } @@ -2448,7 +2448,7 @@ void Heap::NotifyFinishColdStart(bool isMainThread) // restrain GC from 2s to 8s uint64_t delayTimeInMs = FINISH_STARTUP_TIMEPOINT_MS - startupDurationInMs_; - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(GetJSThread()->GetThreadId(), this), delayTimeInMs); } @@ -2467,7 +2467,7 @@ void Heap::NotifyFinishColdStartSoon() startupDurationInMs_ = std::max(startupDurationInMs_, static_cast(MIN_CONFIGURABLE_STARTUP_DURATION_MS)); startupDurationInMs_ = std::min(startupDurationInMs_, static_cast(MAX_CONFIGURABLE_STARTUP_DURATION_MS)); #endif - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(GetJSThread()->GetThreadId(), this), startupDurationInMs_); } @@ -2677,7 +2677,7 @@ void Heap::CleanCallback() { auto &concurrentCallbacks = this->GetEcmaVM()->GetConcurrentNativePointerCallbacks(); if (!concurrentCallbacks.empty()) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(thread_->GetThreadId(), concurrentCallbacks) ); } diff --git a/ecmascript/mem/heap.h b/ecmascript/mem/heap.h index 833493f505ce9c5842717b2d5f1d82a571e7a94c..4f9628ae5f773392bd775494981f7bbfe908e3ff 100644 --- a/ecmascript/mem/heap.h +++ b/ecmascript/mem/heap.h @@ -481,10 +481,10 @@ public: void ResetLargeCapacity(); - class ParallelMarkTask : public Task { + class ParallelMarkTask : public common::Task { public: ParallelMarkTask(int32_t id, SharedHeap *heap, SharedParallelMarkPhase taskPhase) - : Task(id), sHeap_(heap), taskPhase_(taskPhase) {}; + : common::Task(id), sHeap_(heap), taskPhase_(taskPhase) {}; ~ParallelMarkTask() override = default; bool Run(uint32_t threadIndex) override; @@ -496,10 +496,10 @@ public: SharedParallelMarkPhase taskPhase_; }; - class AsyncClearTask : public Task { + class AsyncClearTask : public common::Task { public: AsyncClearTask(int32_t id, SharedHeap *heap, TriggerGCType type) - : Task(id), sHeap_(heap), gcType_(type) {} + : common::Task(id), sHeap_(heap), gcType_(type) {} ~AsyncClearTask() override = default; bool Run(uint32_t threadIndex) override; @@ -1745,10 +1745,10 @@ private: } bool CheckOngoingConcurrentMarkingImpl(ThreadType threadType, int threadIndex, [[maybe_unused]] const char* traceName); - class ParallelGCTask : public Task { + class ParallelGCTask : public common::Task { public: ParallelGCTask(int32_t id, Heap *heap, ParallelGCTaskPhase taskPhase) - : Task(id), heap_(heap), taskPhase_(taskPhase) {}; + : common::Task(id), heap_(heap), taskPhase_(taskPhase) {}; ~ParallelGCTask() override = default; bool Run(uint32_t threadIndex) override; @@ -1760,10 +1760,10 @@ private: ParallelGCTaskPhase taskPhase_; }; - class AsyncClearTask : public Task { + class AsyncClearTask : public common::Task { public: AsyncClearTask(int32_t id, Heap *heap, TriggerGCType type) - : Task(id), heap_(heap), gcType_(type) {} + : common::Task(id), heap_(heap), gcType_(type) {} ~AsyncClearTask() override = default; bool Run(uint32_t threadIndex) override; @@ -1774,10 +1774,10 @@ private: TriggerGCType gcType_; }; - class FinishColdStartTask : public Task { + class FinishColdStartTask : public common::Task { public: FinishColdStartTask(int32_t id, Heap *heap) - : Task(id), heap_(heap) {} + : common::Task(id), heap_(heap) {} ~FinishColdStartTask() override = default; bool Run(uint32_t threadIndex) override; @@ -1787,10 +1787,10 @@ private: Heap *heap_; }; - class FinishGCRestrainTask : public Task { + class FinishGCRestrainTask : public common::Task { public: FinishGCRestrainTask(int32_t id, Heap *heap) - : Task(id), heap_(heap) {} + : common::Task(id), heap_(heap) {} ~FinishGCRestrainTask() override = default; bool Run(uint32_t threadIndex) override; @@ -1800,9 +1800,9 @@ private: Heap *heap_; }; - class DeleteCallbackTask : public Task { + class DeleteCallbackTask : public common::Task { public: - DeleteCallbackTask(int32_t id, std::vector &callbacks) : Task(id) + DeleteCallbackTask(int32_t id, std::vector &callbacks) : common::Task(id) { std::swap(callbacks, nativePointerCallbacks_); } diff --git a/ecmascript/mem/jit_fort_memdesc.h b/ecmascript/mem/jit_fort_memdesc.h index a9bc42c04a5fb5bfb315c1fbcfe13c149b227ee1..5422823b6c6d75ceee858af825f8ba0fd937fc88 100644 --- a/ecmascript/mem/jit_fort_memdesc.h +++ b/ecmascript/mem/jit_fort_memdesc.h @@ -17,8 +17,9 @@ #define ECMASCRIPT_MEM_JIT_FORT_MEMDESC_H #include + +#include "common_components/base/asan_interface.h" #include "ecmascript/js_tagged_value.h" -#include "ecmascript/base/asan_interface.h" #include "ecmascript/platform/mutex.h" namespace panda::ecmascript { diff --git a/ecmascript/mem/mem_map_allocator.cpp b/ecmascript/mem/mem_map_allocator.cpp index 46ea2c9d9d3b9b1230d6c99d1d696c2f5b1c3e1d..a2e6aa0f706caabfbe7f1057950fcc4e74e77009 100644 --- a/ecmascript/mem/mem_map_allocator.cpp +++ b/ecmascript/mem/mem_map_allocator.cpp @@ -19,7 +19,6 @@ #include "ecmascript/mem/tagged_state_word.h" #include "ecmascript/platform/os.h" #include "ecmascript/platform/parameters.h" -#include "libpandabase/mem/mem.h" namespace panda::ecmascript { MemMapAllocator *MemMapAllocator::GetInstance() @@ -336,7 +335,7 @@ void MemMapAllocator::Free(void *mem, size_t size, bool isRegular, bool isCompre void MemMapAllocator::AdapterSuitablePoolCapacity(bool isLargeHeap) { - size_t physicalSize = PhysicalSize(); + size_t physicalSize = common::PhysicalSize(); uint64_t poolSize; if (isLargeHeap) { poolSize = LARGE_HEAP_POOL_SIZE; diff --git a/ecmascript/mem/parallel_evacuator-inl.h b/ecmascript/mem/parallel_evacuator-inl.h index 5ca803cf8156101f949ba5e37dadd11738f77d0b..834872cd89740f21eb49d357e8f2826747407603 100644 --- a/ecmascript/mem/parallel_evacuator-inl.h +++ b/ecmascript/mem/parallel_evacuator-inl.h @@ -366,7 +366,7 @@ int ParallelEvacuator::CalculateEvacuationThreadNum() uint32_t count = evacuateWorkloadSet_.GetWorkloadCount(); uint32_t regionPerThread = 8; uint32_t maxThreadNum = std::min(heap_->GetMaxEvacuateTaskCount(), - Taskpool::GetCurrentTaskpool()->GetTotalThreadNum()); + common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum()); return static_cast(std::min(std::max(1U, count / regionPerThread), maxThreadNum)); } @@ -376,7 +376,7 @@ int ParallelEvacuator::CalculateUpdateThreadNum() double regionPerThread = 1.0 / 4; count = std::pow(count, regionPerThread); uint32_t maxThreadNum = std::min(heap_->GetMaxEvacuateTaskCount(), - Taskpool::GetCurrentTaskpool()->GetTotalThreadNum()); + common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum()); return static_cast(std::min(std::max(1U, count), maxThreadNum)); } diff --git a/ecmascript/mem/parallel_evacuator.cpp b/ecmascript/mem/parallel_evacuator.cpp index bdeb548c3d2e371d56d45f6b0b5b1063ee9c8e63..81ba6b9a2e1629a72fe12d544a183fe48e94f204 100644 --- a/ecmascript/mem/parallel_evacuator.cpp +++ b/ecmascript/mem/parallel_evacuator.cpp @@ -65,7 +65,7 @@ void ParallelEvacuator::SweepNewToOldRegions() void ParallelEvacuator::UpdateTrackInfo() { - for (uint32_t i = 0; i <= MAX_TASKPOOL_THREAD_NUM; i++) { + for (uint32_t i = 0; i <= common::MAX_TASKPOOL_THREAD_NUM; i++) { auto &trackInfoSet = ArrayTrackInfoSet(i); for (auto &each : trackInfoSet) { auto trackInfoVal = JSTaggedValue(each); @@ -122,7 +122,7 @@ void ParallelEvacuator::EvacuateSpace() ASSERT(parallel_ >= 0); evacuateTaskNum_ = static_cast(parallel_); for (uint32_t i = 1; i <= evacuateTaskNum_; i++) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(heap_->GetJSThread()->GetThreadId(), i, this)); } } else { @@ -159,7 +159,7 @@ bool ParallelEvacuator::EvacuateSpace(TlabAllocator *allocator, uint32_t threadI void ParallelEvacuator::UpdateRecordWeakReferenceInParallel(uint32_t idOrder) { - auto totalThreadCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; + auto totalThreadCount = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; for (uint32_t i = idOrder; i < totalThreadCount; i += (evacuateTaskNum_ + 1)) { ProcessQueue *queue = heap_->GetWorkManager()->GetWorkNodeHolder(i)->GetWeakReferenceQueue(); while (true) { @@ -285,7 +285,7 @@ void ParallelEvacuator::UpdateReference() LockHolder holder(mutex_); parallel_ = CalculateUpdateThreadNum(); for (int i = 0; i < parallel_; i++) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(heap_->GetJSThread()->GetThreadId(), this)); } } @@ -611,7 +611,7 @@ void ParallelEvacuator::WorkloadSet::Clear() } ParallelEvacuator::EvacuationTask::EvacuationTask(int32_t id, uint32_t idOrder, ParallelEvacuator *evacuator) - : Task(id), idOrder_(idOrder), evacuator_(evacuator) + : common::Task(id), idOrder_(idOrder), evacuator_(evacuator) { allocator_ = new TlabAllocator(evacuator->heap_); } diff --git a/ecmascript/mem/parallel_evacuator.h b/ecmascript/mem/parallel_evacuator.h index 3c9a2f7e1b0979b89174c4172b52747c6209137c..4147ba38b3a2da857701defca30519e1e766356f 100644 --- a/ecmascript/mem/parallel_evacuator.h +++ b/ecmascript/mem/parallel_evacuator.h @@ -86,7 +86,7 @@ private: ParallelEvacuator *evacuator_ {nullptr}; }; - class EvacuationTask : public Task { + class EvacuationTask : public common::Task { public: EvacuationTask(int32_t id, uint32_t idOrder, ParallelEvacuator *evacuator); ~EvacuationTask() override; @@ -101,9 +101,9 @@ private: TlabAllocator *allocator_ {nullptr}; }; - class UpdateReferenceTask : public Task { + class UpdateReferenceTask : public common::Task { public: - UpdateReferenceTask(int32_t id, ParallelEvacuator *evacuator) : Task(id), evacuator_(evacuator) {}; + UpdateReferenceTask(int32_t id, ParallelEvacuator *evacuator) : common::Task(id), evacuator_(evacuator) {} ~UpdateReferenceTask() override = default; bool Run(uint32_t threadIndex) override; @@ -268,7 +268,7 @@ private: TlabAllocator *allocator_ {nullptr}; uintptr_t waterLine_ = 0; - std::unordered_set arrayTrackInfoSets_[MAX_TASKPOOL_THREAD_NUM + 1]; + std::unordered_set arrayTrackInfoSets_[common::MAX_TASKPOOL_THREAD_NUM + 1]; bool hasNewToOldRegions_ {false}; uint32_t evacuateTaskNum_ = 0; std::atomic_int parallel_ = 0; diff --git a/ecmascript/mem/partial_gc.cpp b/ecmascript/mem/partial_gc.cpp index 14bc33019a6ebcc8f79f577580982cdb64c392b3..c0a1a025b8004f08191b99a2e593832b53bb451c 100644 --- a/ecmascript/mem/partial_gc.cpp +++ b/ecmascript/mem/partial_gc.cpp @@ -54,7 +54,7 @@ void PartialGC::RunPhases() bool needAjustGCThreadPrio = heap_->GetGCType() == TriggerGCType::OLD_GC || heap_->GetNewSpace()->GetCommittedSize() >= heap_->GetNewSpace()->GetMaximumCapacity(); if (mainThreadInForeground && needAjustGCThreadPrio) { - Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::STW); + common::Taskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::STW); } markingInProgress_ = heap_->CheckOngoingConcurrentMarking(); LOG_GC(DEBUG) << "markingInProgress_" << markingInProgress_; @@ -74,7 +74,7 @@ void PartialGC::RunPhases() } Finish(); if (mainThreadInForeground && needAjustGCThreadPrio) { - Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::FOREGROUND); + common::Taskpool::GetCurrentTaskpool()->SetThreadPriority(common::PriorityMode::FOREGROUND); } } diff --git a/ecmascript/mem/region.h b/ecmascript/mem/region.h index 4643cba9dd9bc9c446d1102425c8c2a2293bdecd..d45f310203fd5b9814941d042f4a7a9b9fe49b2c 100644 --- a/ecmascript/mem/region.h +++ b/ecmascript/mem/region.h @@ -18,8 +18,8 @@ #include +#include "common_components/base/asan_interface.h" #include "ecmascript/base/aligned_struct.h" -#include "ecmascript/base/asan_interface.h" #include "ecmascript/js_tagged_value.h" #include "ecmascript/mem/free_object_list.h" #include "ecmascript/mem/gc_bitset.h" diff --git a/ecmascript/mem/shared_heap/shared_concurrent_sweeper.cpp b/ecmascript/mem/shared_heap/shared_concurrent_sweeper.cpp index 11986966fe2c0d6988362cf1c3cb8bd9337fe024..d9cae60c87e6c1c3e862fa0b2284e47d88e31e16 100644 --- a/ecmascript/mem/shared_heap/shared_concurrent_sweeper.cpp +++ b/ecmascript/mem/shared_heap/shared_concurrent_sweeper.cpp @@ -31,10 +31,10 @@ void SharedConcurrentSweeper::PostTask(bool isFullGC) auto tid = DaemonThread::GetInstance()->GetThreadId(); if (ConcurrentSweepEnabled()) { if (!isFullGC) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(tid, this, SHARED_OLD_SPACE, isFullGC)); } - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(tid, this, SHARED_NON_MOVABLE, isFullGC)); } else { if (!isFullGC_) { diff --git a/ecmascript/mem/shared_heap/shared_concurrent_sweeper.h b/ecmascript/mem/shared_heap/shared_concurrent_sweeper.h index 106a240a1fc0d910c18f9c75c0301fea049f1748..fbde801f10fa99520c904f9e62622bf748957ec1 100644 --- a/ecmascript/mem/shared_heap/shared_concurrent_sweeper.h +++ b/ecmascript/mem/shared_heap/shared_concurrent_sweeper.h @@ -74,10 +74,10 @@ public: return enableType_ == EnableConcurrentSweepType::CONFIG_DISABLE; } private: - class SweeperTask : public Task { + class SweeperTask : public common::Task { public: SweeperTask(int32_t id, SharedConcurrentSweeper *sweeper, MemSpaceType type, bool isFullGC) - : Task(id), sweeper_(sweeper), type_(type), isFullGC_(isFullGC) {}; + : common::Task(id), sweeper_(sweeper), type_(type), isFullGC_(isFullGC) {}; ~SweeperTask() override = default; bool Run(uint32_t threadIndex) override; diff --git a/ecmascript/mem/shared_heap/shared_full_gc.cpp b/ecmascript/mem/shared_heap/shared_full_gc.cpp index 1f241fb27e3cd000f7cd18fbed6e25aa535ded84..41d91ef035cb37c1a5e813c4d4c3377fcb455f5a 100644 --- a/ecmascript/mem/shared_heap/shared_full_gc.cpp +++ b/ecmascript/mem/shared_heap/shared_full_gc.cpp @@ -141,7 +141,7 @@ void SharedFullGC::Finish() void SharedFullGC::UpdateRecordWeakReference() { - auto totalThreadCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; + auto totalThreadCount = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; for (uint32_t i = 0; i < totalThreadCount; i++) { ProcessQueue *queue = sHeap_->GetWorkManager()->GetWeakReferenceQueue(i); diff --git a/ecmascript/mem/shared_heap/shared_gc.cpp b/ecmascript/mem/shared_heap/shared_gc.cpp index 3e74f1039fcfd730b52a62265fe401dad8ad8e93..ecc5005c61df213e2b398729ba06a686b7597c53 100644 --- a/ecmascript/mem/shared_heap/shared_gc.cpp +++ b/ecmascript/mem/shared_heap/shared_gc.cpp @@ -172,7 +172,7 @@ void SharedGC::Finish() void SharedGC::UpdateRecordWeakReference() { - auto totalThreadCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; + auto totalThreadCount = common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; for (uint32_t i = 0; i < totalThreadCount; i++) { ProcessQueue *queue = sHeap_->GetWorkManager()->GetWeakReferenceQueue(i); diff --git a/ecmascript/mem/shared_heap/shared_gc_evacuator.cpp b/ecmascript/mem/shared_heap/shared_gc_evacuator.cpp index d58c09d8ca4e88fc061778ba15e62ef59f0829c7..6f856389814aa957e49b4330089a3b14181a25b5 100644 --- a/ecmascript/mem/shared_heap/shared_gc_evacuator.cpp +++ b/ecmascript/mem/shared_heap/shared_gc_evacuator.cpp @@ -78,7 +78,7 @@ void SharedGCEvacuator::UpdateReference() parallel_ = CalculateUpdateThreadNum(); auto dTid = DaemonThread::GetInstance()->GetThreadId(); for (int i = 0; i < parallel_; i++) { - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(dTid, this)); + common::Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(dTid, this)); } } runtime->IterateSharedRoot(rootVisitor_); @@ -129,7 +129,7 @@ int SharedGCEvacuator::CalculateUpdateThreadNum() uint32_t count = workloads_.size(); constexpr double RATIO = 1.0 / 4; count = std::pow(count, RATIO); - return static_cast(std::min(std::max(1U, count), Taskpool::GetCurrentTaskpool()->GetTotalThreadNum())); + return static_cast(std::min(std::max(1U, count), common::Taskpool::GetCurrentTaskpool()->GetTotalThreadNum())); } bool SharedGCEvacuator::UpdateObjectSlot(ObjectSlot slot) diff --git a/ecmascript/mem/shared_heap/shared_gc_evacuator.h b/ecmascript/mem/shared_heap/shared_gc_evacuator.h index 137582ae92882f448df5c7a52d02a1f1f2290fd2..5374f83fa836f2e250af23a0fce8c7fc1fcae81f 100644 --- a/ecmascript/mem/shared_heap/shared_gc_evacuator.h +++ b/ecmascript/mem/shared_heap/shared_gc_evacuator.h @@ -112,9 +112,9 @@ private: void Process(bool isMain) override; }; - class UpdateReferenceTask : public Task { + class UpdateReferenceTask : public common::Task { public: - UpdateReferenceTask(int32_t id, SharedGCEvacuator *evacuator) : Task(id), evacuator_(evacuator) {}; + UpdateReferenceTask(int32_t id, SharedGCEvacuator *evacuator) : common::Task(id), evacuator_(evacuator) {}; ~UpdateReferenceTask() override = default; NO_COPY_SEMANTIC(UpdateReferenceTask); NO_MOVE_SEMANTIC(UpdateReferenceTask); diff --git a/ecmascript/mem/slots.h b/ecmascript/mem/slots.h index 73b7af1ca6148e3ff13afcaff5a57b19a0d7c892..32fb387e06ce832a766281b7f22468f9da24674b 100644 --- a/ecmascript/mem/slots.h +++ b/ecmascript/mem/slots.h @@ -18,7 +18,6 @@ #include "ecmascript/js_tagged_value.h" #include "ecmascript/mem/mem.h" -#include "libpandabase/mem/mem.h" namespace panda::ecmascript { enum class SlotStatus : bool { diff --git a/ecmascript/mem/space.cpp b/ecmascript/mem/space.cpp index 290e88a6c518ebf30a641e0f543a81b5c6ea046f..8aa6a000d9321789c60e5a6118c1b8cca025aeba 100644 --- a/ecmascript/mem/space.cpp +++ b/ecmascript/mem/space.cpp @@ -138,8 +138,8 @@ void* HugeMachineCodeSpace::AllocateFort(size_t objectSize, JSThread *thread, vo size_t mutableSize = AlignUp(objectSize - desc->instructionsSize, PageSize()); size_t fortSize = AlignUp(desc->instructionsSize, PageSize()); size_t allocSize = mutableSize + fortSize; - uintptr_t machineCodeObj = - reinterpret_cast(HeapAllocator::AllocateLargeJitFortRegion(allocSize, LanguageType::DYNAMIC)); + uintptr_t machineCodeObj = reinterpret_cast( + common::HeapAllocator::AllocateLargeJitFortRegion(allocSize, common::LanguageType::DYNAMIC)); assert(machineCodeObj != 0); if (heap_->OldSpaceExceedCapacity(fortSize)) { LOG_ECMA_MEM(INFO) << "Committed size " << committedSize_ << " of huge object space is too big."; diff --git a/ecmascript/mem/tagged_object-inl.h b/ecmascript/mem/tagged_object-inl.h index 2455936f30bd447ccddf114324a4f3bb9f99cad0..c3435f362e8c6fb0d52be7edbea8390cc00d5268 100644 --- a/ecmascript/mem/tagged_object-inl.h +++ b/ecmascript/mem/tagged_object-inl.h @@ -41,7 +41,7 @@ inline void TaggedObject::TransitionClassWithoutBarrier(JSHClass *hclass) inline void TaggedObject::SetFreeObjectClass(JSHClass *hclass) { ASSERT(hclass->IsFreeObject()); - StateWordType state = static_cast(ToUintPtr(hclass)); + common::StateWordType state = static_cast(ToUintPtr(hclass)); reinterpret_cast(this)->SynchronizedSetGCStateWord(state); } @@ -79,7 +79,7 @@ inline bool TaggedObject::IsInSharedHeap() const #else inline void TaggedObject::SetClassWithoutBarrier(JSHClass *hclass) { - SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass)); + SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass)); } inline void TaggedObject::TransitionClassWithoutBarrier(JSHClass *hclass) diff --git a/ecmascript/mem/tagged_object.h b/ecmascript/mem/tagged_object.h index f12f78b61bb9a22cf10e475c26ff7debf871da35..fe8eb14330fbcbbb6b223236abb84e29ccc5f5c9 100644 --- a/ecmascript/mem/tagged_object.h +++ b/ecmascript/mem/tagged_object.h @@ -16,9 +16,10 @@ #ifndef ECMASCRIPT_TAGGED_OBJECT_HEADER_H #define ECMASCRIPT_TAGGED_OBJECT_HEADER_H +#include "common_interfaces/base/mem.h" +#include "common_interfaces/objects/base_object.h" #include "ecmascript/mem/mark_word.h" #include "ecmascript/mem/shared_heap/shared_value_helper.h" -#include "common_interfaces/objects/base_object.h" #include "ecmascript/mem/tagged_state_word.h" namespace panda::ecmascript { @@ -27,6 +28,10 @@ template class JSHandle; class JSThread; +using ::common::BaseObject; +using ::common::ToUintPtr; +using ::common::ToVoidPtr; + class TaggedObject : public BaseObject { public: static TaggedObject *Cast(const BaseObject *header) diff --git a/ecmascript/mem/tagged_state_word.h b/ecmascript/mem/tagged_state_word.h index 0b35b29d90506f860aac2b1380d50ee9d1579f36..d02c2fe9a7447b83d65f0c67de477dc9cc53098e 100644 --- a/ecmascript/mem/tagged_state_word.h +++ b/ecmascript/mem/tagged_state_word.h @@ -29,9 +29,9 @@ class TaggedStateWord { public: // Little endian struct GCStateWord { - StateWordType address_ : 48; - StateWordType padding_ : 12; - StateWordType remainded_ : 4; + common::StateWordType address_ : 48; + common::StateWordType padding_ : 12; + common::StateWordType remainded_ : 4; }; struct ClassStateWord { @@ -40,8 +40,8 @@ public: ClassWordType remainded_ : 4; }; - inline void SynchronizedSetGCStateWord(StateWordType address, StateWordType padding = 0, - StateWordType remainded = 0) + inline void SynchronizedSetGCStateWord(common::StateWordType address, common::StateWordType padding = 0, + common::StateWordType remainded = 0) { GCStateWord newState; newState.address_ = address; @@ -98,8 +98,8 @@ private: friend class TaggedObject; }; static_assert(sizeof(TaggedStateWord) == sizeof(uint64_t), "Excepts 8 bytes"); -static_assert(BaseStateWord::PADDING_WIDTH == 60, "Excepts 60 bits"); -static_assert(BaseStateWord::FORWARD_WIDTH == 2, "Excepts 2 bits"); -static_assert(BaseStateWord::LANGUAGE_WIDTH == 2, "Excepts 2 bits"); +static_assert(common::BaseStateWord::PADDING_WIDTH == 60, "Excepts 60 bits"); +static_assert(common::BaseStateWord::FORWARD_WIDTH == 2, "Excepts 2 bits"); +static_assert(common::BaseStateWord::LANGUAGE_WIDTH == 2, "Excepts 2 bits"); } // namespace panda::ecmascript #endif // ECMASCRIPT_TAGGED_OBJECT_STATE_WORD_H diff --git a/ecmascript/mem/visitor.h b/ecmascript/mem/visitor.h index 4fe7aa9d49b582b1cb57d7dbef19ec884a115c30..5fa64b8efd0efaa8505047b0e0ced0ebd1b62f52 100644 --- a/ecmascript/mem/visitor.h +++ b/ecmascript/mem/visitor.h @@ -21,7 +21,6 @@ #include "common_interfaces/heap/heap_visitor.h" #include "ecmascript/mem/slots.h" #include "ecmascript/mem/tagged_object.h" -#include "libpandabase/mem/mem.h" namespace panda::ecmascript { enum class Root { diff --git a/ecmascript/mem/work_manager.h b/ecmascript/mem/work_manager.h index 2ea8732eb0cffcecb33dd7392ac55b52e1dd4ee4..19374daefdef51e8aedccc5663daac845102ebd1 100644 --- a/ecmascript/mem/work_manager.h +++ b/ecmascript/mem/work_manager.h @@ -43,14 +43,14 @@ enum ParallelGCTaskPhase { CONCURRENT_HANDLE_GLOBAL_POOL_TASK, UNIFIED_HANDLE_GLOBAL_POOL_TASK, UNDEFINED_TASK, - TASK_LAST // Count of different Task phase + TASK_LAST // Count of different common::Task phase }; enum SharedParallelMarkPhase { SHARED_MARK_TASK, SHARED_COMPRESS_TASK, SHARED_UNDEFINED_TASK, - SHARED_TASK_LAST // Count of different Task phase + SHARED_TASK_LAST // Count of different common::Task phase }; class WorkNode { @@ -278,7 +278,7 @@ private: Heap *heap_; uint32_t threadNum_; - std::array works_; + std::array works_; GlobalWorkStack workStack_ {}; ParallelGCTaskPhase parallelGCTaskPhase_ {ParallelGCTaskPhase::UNDEFINED_TASK}; std::atomic initialized_ {false}; @@ -345,8 +345,8 @@ private: SharedHeap *sHeap_; uint32_t threadNum_; - std::array works_; - std::array *, MAX_TASKPOOL_THREAD_NUM + 1> continuousQueue_; + std::array works_; + std::array *, common::MAX_TASKPOOL_THREAD_NUM + 1> continuousQueue_; GlobalWorkStack workStack_; std::atomic initialized_ {false}; SharedParallelMarkPhase sharedTaskPhase_; diff --git a/ecmascript/napi/include/jsnapi.h b/ecmascript/napi/include/jsnapi.h index dcb41fc7e1af475910824245b051303ff6be5682..fba47cd3da1bbb764055d1327534ef894299fe09 100644 --- a/ecmascript/napi/include/jsnapi.h +++ b/ecmascript/napi/include/jsnapi.h @@ -140,7 +140,7 @@ using LOG_PRINT = int (*)(int id, int level, const char *tag, const char *fmt, c class PUBLIC_API RuntimeOption { public: enum class PUBLIC_API GC_TYPE : uint8_t { EPSILON, GEN_GC, STW }; - using LOG_LEVEL = panda::LOG_LEVEL; + using LOG_LEVEL = common::LOG_LEVEL; // This enum should follow the same value as defined in the BMS subsystem. // Refer to the specification in aot-guide_zh.md. diff --git a/ecmascript/napi/jsnapi_expo.cpp b/ecmascript/napi/jsnapi_expo.cpp index a5c950193fb8e5d5add6a8d5f24d5d85c47e09df..eaa519f41051fcc87b3a84b2b11126a3c5d341c6 100644 --- a/ecmascript/napi/jsnapi_expo.cpp +++ b/ecmascript/napi/jsnapi_expo.cpp @@ -4709,7 +4709,7 @@ EcmaVM *JSNApi::CreateJSVM(const RuntimeOption &option) runtimeOptions.SetEnablePGOProfiler(option.GetEnableProfile()); runtimeOptions.SetPGOProfilerPath(option.GetProfileDir()); // Dfx - runtimeOptions.SetLogLevel(Log::LevelToString(Log::ConvertFromRuntime(option.GetLogLevel()))); + runtimeOptions.SetLogLevel(common::Log::LevelToString(common::Log::ConvertFromRuntime(option.GetLogLevel()))); runtimeOptions.SetEnableArkTools(option.GetEnableArkTools()); runtimeOptions.SetLargeHeap(option.GetLargeHeap()); return CreateEcmaVM(runtimeOptions); @@ -4768,12 +4768,12 @@ void JSNApi::TriggerGC(const EcmaVM *vm, ecmascript::GCReason reason, TRIGGER_GC } #endif #ifdef USE_CMC_GC - GcType type = GcType::ASYNC; + common::GcType type = common::GcType::ASYNC; if (gcType == TRIGGER_GC_TYPE::FULL_GC || gcType == TRIGGER_GC_TYPE::SHARED_FULL_GC || reason == ecmascript::GCReason::ALLOCATION_FAILED) { - type = GcType::FULL; + type = common::GcType::FULL; } - panda::BaseRuntime::RequestGC(type); + common::BaseRuntime::RequestGC(type); #else // add ALL_GC_TYPE here for toolchain auto sHeap = ecmascript::SharedHeap::GetInstance(); switch (gcType) { @@ -5670,8 +5670,8 @@ void JSNApi::PostFork(EcmaVM *vm, const RuntimeOption &option) ecmascript::pgo::PGOProfilerManager::GetInstance()->SetBundleName(option.GetBundleName()); ecmascript::pgo::PGOProfilerManager::GetInstance()->SetMaxAotMethodSize(jsOption.GetMaxAotMethodSize()); JSRuntimeOptions runtimeOptions; - runtimeOptions.SetLogLevel(Log::LevelToString(Log::ConvertFromRuntime(option.GetLogLevel()))); - Log::Initialize(runtimeOptions.GetLogOptions()); + runtimeOptions.SetLogLevel(common::Log::LevelToString(common::Log::ConvertFromRuntime(option.GetLogLevel()))); + common::Log::Initialize(runtimeOptions.GetLogOptions()); // 1. system switch 2. an file dir exits 3. whitelist 4. escape mechanism bool enableAOT = jsOption.GetEnableAOT() && diff --git a/ecmascript/napi/test/ffi_workload.cpp b/ecmascript/napi/test/ffi_workload.cpp index 1a5980ceea1b7f10889b81658c1428c8fdc206ca..cb40ea24c250f945ad5e666e6447f065e7002c33 100644 --- a/ecmascript/napi/test/ffi_workload.cpp +++ b/ecmascript/napi/test/ffi_workload.cpp @@ -124,7 +124,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetJSThread(); diff --git a/ecmascript/napi/test/jsnapi_first_tests.cpp b/ecmascript/napi/test/jsnapi_first_tests.cpp index 1b1fb0268792bdcd45299e3863239b99e28abad4..11785c91213997dc15ef4d64f578ee909275022c 100644 --- a/ecmascript/napi/test/jsnapi_first_tests.cpp +++ b/ecmascript/napi/test/jsnapi_first_tests.cpp @@ -88,7 +88,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetJSThread(); @@ -2261,7 +2261,7 @@ HWTEST_F_L0(JSNApiTests, PrintExceptionInfo) LocalScope scope(vm_); std::thread t1([&](){ RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto *vm = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm != nullptr) << "Cannot create Runtime"; JSNApi::PrintExceptionInfo(vm); diff --git a/ecmascript/napi/test/jsnapi_sample.cpp b/ecmascript/napi/test/jsnapi_sample.cpp index 533ad3b501c40407651a798a9eec3afc39d5e22f..e173266df6820ac3f77f770e4591fed51e538f0b 100644 --- a/ecmascript/napi/test/jsnapi_sample.cpp +++ b/ecmascript/napi/test/jsnapi_sample.cpp @@ -53,7 +53,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); thread_ = vm_->GetJSThread(); vm_->SetEnableForceGC(true); diff --git a/ecmascript/napi/test/jsnapi_second_tests.cpp b/ecmascript/napi/test/jsnapi_second_tests.cpp index 2ab70fde7d68b29482dc2c814a11efe667f65d97..0817635f91979a5072bd292cf9de62a759cb7987 100644 --- a/ecmascript/napi/test/jsnapi_second_tests.cpp +++ b/ecmascript/napi/test/jsnapi_second_tests.cpp @@ -94,7 +94,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetJSThread(); @@ -1768,7 +1768,7 @@ HWTEST_F_L0(JSNApiTests, PrintExceptionInfo) LocalScope scope(vm_); std::thread t1([&]() { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto *vm2 = JSNApi::CreateJSVM(option); auto *thread = vm2->GetJSThread(); thread->SetException(JSTaggedValue::Exception()); diff --git a/ecmascript/napi/test/jsnapi_sendable_tests.cpp b/ecmascript/napi/test/jsnapi_sendable_tests.cpp index 33e16f8ab4115f6f5605749f50008140bee91f0b..e55594d86375e44e3997f2c5085f1f68fa0bd90b 100644 --- a/ecmascript/napi/test/jsnapi_sendable_tests.cpp +++ b/ecmascript/napi/test/jsnapi_sendable_tests.cpp @@ -38,7 +38,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetJSThread(); diff --git a/ecmascript/napi/test/jsnapi_third_tests.cpp b/ecmascript/napi/test/jsnapi_third_tests.cpp index 0fb3dd6f684dc2c5db0db8a2f1bd5c656db75ac8..5aaf8c633ff5529733ba6d7e7bf9589864e6df7e 100644 --- a/ecmascript/napi/test/jsnapi_third_tests.cpp +++ b/ecmascript/napi/test/jsnapi_third_tests.cpp @@ -86,7 +86,7 @@ public: void SetUp() override { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetJSThread(); @@ -369,7 +369,7 @@ HWTEST_F_L0(JSNApiTests, JSNApi_CreateJSVM_DestroyJSVM) std::thread t1([&](){ EcmaVM *vm1_ = nullptr; RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm1_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm1_ != nullptr) << "Cannot create Runtime"; vm1_->SetEnableForceGC(true); diff --git a/ecmascript/object_factory-inl.h b/ecmascript/object_factory-inl.h index 48f415178549a7176b117cb3c48d7b93326dea84..343091a60c57230662db96b879b7aa45608dfc2a 100644 --- a/ecmascript/object_factory-inl.h +++ b/ecmascript/object_factory-inl.h @@ -43,7 +43,7 @@ EcmaString *ObjectFactory::AllocLineStringObjectNoGC(size_t size) object->SetClass(thread_, JSHClass::Cast(thread_->GlobalConstants()->GetLineStringClass().GetTaggedObject())); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetLineStringClass(); - object->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + object->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return EcmaString::Cast(object); } @@ -55,7 +55,7 @@ EcmaString *ObjectFactory::AllocNonMovableLineStringObject(size_t size) thread_, JSHClass::Cast(thread_->GlobalConstants()->GetLineStringClass().GetTaggedObject()), size)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetLineStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } @@ -67,7 +67,7 @@ EcmaString *ObjectFactory::AllocLineStringObject(size_t size) thread_, JSHClass::Cast(thread_->GlobalConstants()->GetLineStringClass().GetTaggedObject()), size)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetLineStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } @@ -79,7 +79,7 @@ EcmaString *ObjectFactory::AllocOldSpaceLineStringObject(size_t size) thread_, JSHClass::Cast(thread_->GlobalConstants()->GetLineStringClass().GetTaggedObject()), size)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetLineStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } @@ -91,7 +91,7 @@ EcmaString *ObjectFactory::AllocReadOnlyLineStringObject(size_t size) thread_, JSHClass::Cast(thread_->GlobalConstants()->GetLineStringClass().GetTaggedObject()), size)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetLineStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } @@ -104,7 +104,7 @@ EcmaString *ObjectFactory::AllocSlicedStringObject(MemSpaceType type) JSHClass::Cast(thread_->GlobalConstants()->GetSlicedStringClass().GetTaggedObject()), type)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetSlicedStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } @@ -117,7 +117,7 @@ EcmaString *ObjectFactory::AllocTreeStringObject() TreeString::SIZE)); #ifdef USE_CMC_GC JSTaggedValue hclass = thread_->GlobalConstants()->GetTreeStringClass(); - str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); + str->SetFullBaseClassWithoutBarrier(reinterpret_cast(hclass.GetTaggedObject())); #endif return str; } diff --git a/ecmascript/object_factory.cpp b/ecmascript/object_factory.cpp index 85229f306056413fdefe346cce181a1c7c915f9c..66432f71eaeb337516473388627ed1663674f792 100644 --- a/ecmascript/object_factory.cpp +++ b/ecmascript/object_factory.cpp @@ -3627,7 +3627,7 @@ void ObjectFactory::NewObjectHook() const !heap_->InSensitiveStatus() && heap_->TriggerCollectionOnNewObjectEnabled()) { if (vm_->GetJSOptions().ForceFullGC()) { #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::ASYNC); + common::BaseRuntime::RequestGC(common::GcType::ASYNC); #else vm_->CollectGarbage(TriggerGCType::YOUNG_GC); vm_->CollectGarbage(TriggerGCType::OLD_GC); diff --git a/ecmascript/patch/patch_loader.cpp b/ecmascript/patch/patch_loader.cpp index 1b4c20c181a64734ab2ec9eda8711d690ec324fb..1110dd453fc0b9e640bd3f092ea1037186811121 100644 --- a/ecmascript/patch/patch_loader.cpp +++ b/ecmascript/patch/patch_loader.cpp @@ -288,7 +288,7 @@ void PatchLoader::UpdateJSFunction(JSThread *thread, PatchInfo &patchInfo) } }; #ifdef USE_CMC_GC - BaseRuntime::ForEachObj(heapVisitor, false); + common::BaseRuntime::ForEachObj(heapVisitor, false); #else const Heap *heap = thread->GetEcmaVM()->GetHeap(); heap->GetSweeper()->EnsureAllTaskFinished(); @@ -332,7 +332,7 @@ void PatchLoader::UpdateModuleForColdPatch(JSThread *thread, EntityId methodId, } }; #ifdef USE_CMC_GC - BaseRuntime::ForEachObj(heapVisitor, false); + common::BaseRuntime::ForEachObj(heapVisitor, false); #else const Heap *heap = thread->GetEcmaVM()->GetHeap(); heap->GetSweeper()->EnsureAllTaskFinished(); diff --git a/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp b/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp index 35826394df27df075c2c87145de8fa7138542fa9..bfff28b86ec6329bc2ace80d98b8765475f94ba5 100644 --- a/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp +++ b/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp @@ -161,7 +161,7 @@ void PGOProfilerEncoder::AddChecksum(std::fstream& fileStream) void PGOProfilerEncoder::TerminateSaveTask() { - Taskpool::GetCurrentTaskpool()->TerminateTask(GLOBAL_TASK_ID, TaskType::PGO_SAVE_TASK); + common::Taskpool::GetCurrentTaskpool()->TerminateTask(common::GLOBAL_TASK_ID, common::TaskType::PGO_SAVE_TASK); } void PGOProfilerEncoder::PostSaveTask(const std::string& path, @@ -170,7 +170,8 @@ void PGOProfilerEncoder::PostSaveTask(const std::string& path, { LOG_PGO(INFO) << "dispatch save task, path: " << path; auto encoder = std::make_shared(path, mode); - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(encoder, pgoInfo, GLOBAL_TASK_ID)); + common::Taskpool::GetCurrentTaskpool()->PostTask( + std::make_unique(encoder, pgoInfo, common::GLOBAL_TASK_ID)); } void PGOProfilerEncoder::StartSaveTask(const std::shared_ptr info, const SaveTask* task) diff --git a/ecmascript/pgo_profiler/pgo_profiler_encoder.h b/ecmascript/pgo_profiler/pgo_profiler_encoder.h index d24499f83c7450392c34d7b21d3c618374b8a54a..3b3e735104dd94686ab37391bc778e25d605774b 100644 --- a/ecmascript/pgo_profiler/pgo_profiler_encoder.h +++ b/ecmascript/pgo_profiler/pgo_profiler_encoder.h @@ -64,12 +64,12 @@ private: friend SaveTask; }; -class SaveTask : public Task { +class SaveTask : public common::Task { public: explicit SaveTask(const std::shared_ptr encoder, const std::shared_ptr pgoInfo, int32_t id) - : Task(id), encoder_(encoder), pgoInfo_(pgoInfo) {}; + : common::Task(id), encoder_(encoder), pgoInfo_(pgoInfo) {}; virtual ~SaveTask() override = default; bool Run([[maybe_unused]] uint32_t threadIndex) override @@ -79,9 +79,9 @@ public: return true; } - TaskType GetTaskType() const override + common::TaskType GetTaskType() const override { - return TaskType::PGO_SAVE_TASK; + return common::TaskType::PGO_SAVE_TASK; } NO_COPY_SEMANTIC(SaveTask); diff --git a/ecmascript/pgo_profiler/pgo_profiler_manager.cpp b/ecmascript/pgo_profiler/pgo_profiler_manager.cpp index aa1d514ceaa5d39a081bc8ac0f30769b6be50900..2d49e27bdff659e1b15aad79efb43c1056fbc257 100644 --- a/ecmascript/pgo_profiler/pgo_profiler_manager.cpp +++ b/ecmascript/pgo_profiler/pgo_profiler_manager.cpp @@ -327,7 +327,7 @@ void PGOProfilerManager::SetDisablePGO(bool state) void PGOProfilerManager::DispatchDumpTask() { - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(GLOBAL_TASK_ID)); + common::Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(common::GLOBAL_TASK_ID)); } bool PGOProfilerManager::IsProfilerDestroyed(PGOProfiler* profiler) @@ -528,7 +528,8 @@ void PGOProfilerManager::PostResetOutPathTask(const std::string& moduleName) if (!hasPostModuleName_.compare_exchange_strong(expected, desired)) { return; } - Taskpool::GetCurrentTaskpool()->PostTask(std::make_unique(moduleName, GLOBAL_TASK_ID)); + common::Taskpool::GetCurrentTaskpool()->PostTask( + std::make_unique(moduleName, common::GLOBAL_TASK_ID)); } bool PGOProfilerManager::IsInitialized() const diff --git a/ecmascript/pgo_profiler/pgo_profiler_manager.h b/ecmascript/pgo_profiler/pgo_profiler_manager.h index 311c674797f526a65de48e9d35b28197b9588116..d3fb6a92ec7f2c3fa6116443edd8ff689d751901 100644 --- a/ecmascript/pgo_profiler/pgo_profiler_manager.h +++ b/ecmascript/pgo_profiler/pgo_profiler_manager.h @@ -116,9 +116,9 @@ private: Mutex dumpTaskMutex_; // protect dispatch dump task }; -class ResetOutPathTask : public Task { +class ResetOutPathTask : public common::Task { public: - ResetOutPathTask(std::string moduleName, int32_t id): Task(id), moduleName_(std::move(moduleName)) {}; + ResetOutPathTask(std::string moduleName, int32_t id): common::Task(id), moduleName_(std::move(moduleName)) {}; virtual ~ResetOutPathTask() override = default; bool Run([[maybe_unused]] uint32_t threadIndex) override @@ -128,9 +128,9 @@ public: return true; } - TaskType GetTaskType() const override + common::TaskType GetTaskType() const override { - return TaskType::PGO_RESET_OUT_PATH_TASK; + return common::TaskType::PGO_RESET_OUT_PATH_TASK; } NO_COPY_SEMANTIC(ResetOutPathTask); @@ -140,9 +140,9 @@ private: std::string moduleName_; }; -class PGODumpTask : public Task { +class PGODumpTask : public common::Task { public: - explicit PGODumpTask(int32_t id): Task(id) {}; + explicit PGODumpTask(int32_t id): common::Task(id) {}; virtual ~PGODumpTask() override = default; bool Run([[maybe_unused]] uint32_t threadIndex) override @@ -152,9 +152,9 @@ public: return true; } - TaskType GetTaskType() const override + common::TaskType GetTaskType() const override { - return TaskType::PGO_DUMP_TASK; + return common::TaskType::PGO_DUMP_TASK; } NO_COPY_SEMANTIC(PGODumpTask); diff --git a/ecmascript/pgo_profiler/pgo_utils.h b/ecmascript/pgo_profiler/pgo_utils.h index 3897f31358af9d6165b80ac53d4439cec360e0e7..cf709d8373f76ef06a7a4f48aaa55b3af26b9b7f 100644 --- a/ecmascript/pgo_profiler/pgo_utils.h +++ b/ecmascript/pgo_profiler/pgo_utils.h @@ -22,7 +22,6 @@ #include #include "libpandafile/file.h" -#include "mem/mem.h" #include "ecmascript/common.h" #include "ecmascript/log_wrapper.h" diff --git a/ecmascript/pgo_profiler/tests/pgo_profiler_test.cpp b/ecmascript/pgo_profiler/tests/pgo_profiler_test.cpp index 79bd16d1113446a77458313828f459bd85a53e7f..783435c65d8eef3c60177c48e9938e3af90dbae8 100644 --- a/ecmascript/pgo_profiler/tests/pgo_profiler_test.cpp +++ b/ecmascript/pgo_profiler/tests/pgo_profiler_test.cpp @@ -139,7 +139,7 @@ protected: RuntimeOption option; option.SetEnableProfile(true); option.SetProfileDir(profDir); - option.SetLogLevel(LOG_LEVEL::INFO); + option.SetLogLevel(common::LOG_LEVEL::INFO); vm_ = JSNApi::CreateJSVM(option); JSNApi::EnableUserUncaughtErrorHandler(vm_); diff --git a/ecmascript/pgo_profiler/tests/pgo_profiler_test_one.cpp b/ecmascript/pgo_profiler/tests/pgo_profiler_test_one.cpp index cbfbce19f1a56bcb971f182594350f152bf44a12..1160fd38c0cd15a374a44f0cdf6921e292b5237a 100644 --- a/ecmascript/pgo_profiler/tests/pgo_profiler_test_one.cpp +++ b/ecmascript/pgo_profiler/tests/pgo_profiler_test_one.cpp @@ -171,7 +171,7 @@ HWTEST_F_L0(PGOProfilerTestOne, WithWorker) mkdir("ark-profiler-worker/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); RuntimeOption option; option.SetEnableProfile(true); - option.SetLogLevel(LOG_LEVEL::INFO); + option.SetLogLevel(common::LOG_LEVEL::INFO); option.SetProfileDir("ark-profiler-worker/"); EcmaVM* vm = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm != nullptr) << "Cannot create Runtime"; @@ -182,7 +182,7 @@ HWTEST_F_L0(PGOProfilerTestOne, WithWorker) std::thread workerThread([vm]() { RuntimeOption workerOption; workerOption.SetEnableProfile(true); - workerOption.SetLogLevel(LOG_LEVEL::INFO); + workerOption.SetLogLevel(common::LOG_LEVEL::INFO); workerOption.SetProfileDir("ark-profiler-worker/"); workerOption.SetIsWorker(); EcmaVM* workerVm = JSNApi::CreateJSVM(workerOption); @@ -215,7 +215,7 @@ HWTEST_F_L0(PGOProfilerTestOne, ForceDump) mkdir("ark-profiler-worker/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); RuntimeOption option; option.SetEnableProfile(true); - option.SetLogLevel(LOG_LEVEL::INFO); + option.SetLogLevel(common::LOG_LEVEL::INFO); option.SetProfileDir("ark-profiler-worker/"); EcmaVM* vm = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm != nullptr) << "Cannot create Runtime"; @@ -227,7 +227,7 @@ HWTEST_F_L0(PGOProfilerTestOne, ForceDump) std::thread workerThread([vm]() { RuntimeOption workerOption; workerOption.SetEnableProfile(true); - workerOption.SetLogLevel(LOG_LEVEL::INFO); + workerOption.SetLogLevel(common::LOG_LEVEL::INFO); workerOption.SetProfileDir("ark-profiler-worker/"); workerOption.SetIsWorker(); EcmaVM* workerVm = JSNApi::CreateJSVM(workerOption); @@ -297,7 +297,7 @@ HWTEST_F_L0(PGOProfilerTestOne, SuspendThenNotifyThenResume) std::thread thread1([state, &mtx, &cv, &gcWaiting]() { RuntimeOption option; option.SetEnableProfile(true); - option.SetLogLevel(LOG_LEVEL::INFO); + option.SetLogLevel(common::LOG_LEVEL::INFO); option.SetProfileDir("ark-profiler-worker/"); EcmaVM* vm = JSNApi::CreateJSVM(option); auto profiler = std::make_shared(vm, true); diff --git a/ecmascript/platform/unix/linux/os.cpp b/ecmascript/platform/unix/linux/os.cpp index 5c0e3843778f57708860c022d14d4ef8f27b7f71..7fac01355409cf866eddb2c882da1060d8f9e777 100644 --- a/ecmascript/platform/unix/linux/os.cpp +++ b/ecmascript/platform/unix/linux/os.cpp @@ -83,7 +83,7 @@ void BindAllCpuCore() cpu_set_t cpuset; CPU_ZERO(&cpuset); - for (size_t i = 0; i < NumberOfCpuCore(); i++) { + for (size_t i = 0; i < common::NumberOfCpuCore(); i++) { CPU_SET(i, &cpuset); } diff --git a/ecmascript/platform/unix/ohos/backtrace.cpp b/ecmascript/platform/unix/ohos/backtrace.cpp index 061f3c98c7c3e31ce88954ff02854cd66b05de2d..e730e1cf1252927bb72be95f8e28b64e3e3cd09e 100644 --- a/ecmascript/platform/unix/ohos/backtrace.cpp +++ b/ecmascript/platform/unix/ohos/backtrace.cpp @@ -21,7 +21,6 @@ #include "ecmascript/base/config.h" #include "ecmascript/platform/mutex.h" -#include "libpandabase/mem/mem.h" #include "securec.h" #include "ecmascript/mem/mem.h" diff --git a/ecmascript/regexp/regexp_parser.cpp b/ecmascript/regexp/regexp_parser.cpp index 2c2d42f85793936438e6ed1483462b98a08919cb..ab2d916d09b2760a7b5c474c58ab584fa6cc6866 100644 --- a/ecmascript/regexp/regexp_parser.cpp +++ b/ecmascript/regexp/regexp_parser.cpp @@ -517,7 +517,7 @@ void RegExpParser::ParseAlternative(bool isBackward) UChar32 c; int32_t length = end_ - pc_ + 1; // NOLINTNEXTLINE(hicpp-signed-bitwise) - auto unicodeChar = base::utf_helper::ConvertUtf8ToUnicodeChar(pc_, length); + auto unicodeChar = common::utf_helper::ConvertUtf8ToUnicodeChar(pc_, length); c = unicodeChar.first; matchedChar = static_cast(c); pc_ += unicodeChar.second; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) @@ -1439,7 +1439,7 @@ uint32_t RegExpParser::ParseClassAtom(RangeSet *atom) size_t u16_size = 0; if (c0_ > INT8_MAX) { // NOLINTNEXTLINE(readability-magic-numbers) pc_ -= 1; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - auto u16_result = base::utf_helper::ConvertUtf8ToUtf16Pair(pc_, true); + auto u16_result = common::utf_helper::ConvertUtf8ToUtf16Pair(pc_, true); value = u16_result.first; u16_size = u16_result.second; Advance(u16_size + 1); diff --git a/ecmascript/runtime.cpp b/ecmascript/runtime.cpp index 551618a07fb0dcd0405141dfefee6770fd53aeca..e1c7053a63a79a572d110807d203a6fb13073155 100644 --- a/ecmascript/runtime.cpp +++ b/ecmascript/runtime.cpp @@ -41,14 +41,14 @@ bool Runtime::firstVmCreated_ = false; Mutex *Runtime::vmCreationLock_ = new Mutex(); Runtime *Runtime::instance_ = nullptr; #ifdef USE_CMC_GC -BaseRuntime *Runtime::baseInstance_ = nullptr; +common::BaseRuntime *Runtime::baseInstance_ = nullptr; #endif Runtime::Runtime() { #ifdef USE_CMC_GC if (baseInstance_ == nullptr) { - baseInstance_ = BaseRuntime::GetInstance(); + baseInstance_ = common::BaseRuntime::GetInstance(); } #endif } @@ -78,7 +78,7 @@ void Runtime::CreateIfFirstVm(const JSRuntimeOptions &options) { LockHolder lock(*vmCreationLock_); if (!firstVmCreated_) { - Log::Initialize(options.GetLogOptions()); + common::Log::Initialize(options.GetLogOptions()); EcmaVM::InitializeIcuData(options); MemMapAllocator::GetInstance()->Initialize(ecmascript::DEFAULT_REGION_SIZE, options.GetLargeHeap()); PGOProfilerManager::GetInstance()->Initialize(options.GetPGOProfilerPath(), @@ -88,9 +88,9 @@ void Runtime::CreateIfFirstVm(const JSRuntimeOptions &options) instance_->SetEnableLargeHeap(options.GetLargeHeap()); SharedHeap::CreateNewInstance(); #ifdef USE_CMC_GC - // Init BaseRuntime before daemon thread because creating mutator may access gcphase in heap + // Init common::BaseRuntime before daemon thread because creating mutator may access gcphase in heap LOG_ECMA(INFO) << "start run with cmc gc"; - BaseRuntime::GetInstance()->Init(options.GetRuntimeParam()); + common::BaseRuntime::GetInstance()->Init(options.GetRuntimeParam()); #endif DaemonThread::CreateNewInstance(); firstVmCreated_ = true; @@ -167,8 +167,8 @@ void Runtime::DestroyIfLastVm() SharedHeap::GetInstance()->WaitAllTasksFinishedAfterAllJSThreadEliminated(); DaemonThread::DestroyInstance(); #ifdef USE_CMC_GC - // Finish BaseRuntime after daemon thread because it will unregister mutator - BaseRuntime::GetInstance()->Fini(); + // Finish common::BaseRuntime after daemon thread because it will unregister mutator + common::BaseRuntime::GetInstance()->Fini(); #endif SharedHeap::DestroyInstance(); AnFileDataManager::GetInstance()->SafeDestroyAllData(); @@ -176,8 +176,8 @@ void Runtime::DestroyIfLastVm() PGOProfilerManager::GetInstance()->Destroy(); SharedModuleManager::GetInstance()->Destroy(); #ifdef USE_CMC_GC - // Destroy BaseRuntime after daemon thread because it will unregister mutator - BaseRuntime::DestroyInstance(); + // Destroy common::BaseRuntime after daemon thread because it will unregister mutator + common::BaseRuntime::DestroyInstance(); // reset Base address offset TaggedStateWord::BASE_ADDRESS = 0; #endif @@ -251,7 +251,7 @@ void Runtime::ResumeAll(JSThread *current) void Runtime::SuspendAllThreadsImpl(JSThread *current) { #ifdef USE_CMC_GC - BaseRuntime::GetInstance()->GetThreadHolderManager().SuspendAll(current->GetThreadHolder()); + common::BaseRuntime::GetInstance()->GetThreadHolderManager().SuspendAll(current->GetThreadHolder()); #else SuspendBarrier barrier; for (uint32_t iterCount = 1U;; ++iterCount) { @@ -313,7 +313,7 @@ void Runtime::SuspendAllThreadsImpl(JSThread *current) void Runtime::ResumeAllThreadsImpl(JSThread *current) { #ifdef USE_CMC_GC - BaseRuntime::GetInstance()->GetThreadHolderManager().ResumeAll(current->GetThreadHolder()); + common::BaseRuntime::GetInstance()->GetThreadHolderManager().ResumeAll(current->GetThreadHolder()); #else LockHolder lock(threadsLock_); if (suspendNewCount_ > 0) { diff --git a/ecmascript/runtime.h b/ecmascript/runtime.h index c675d00392bc369931a81f0435355885309d2635..34c809f27f196a209e4283037bb3a9b5ad474264 100644 --- a/ecmascript/runtime.h +++ b/ecmascript/runtime.h @@ -344,7 +344,7 @@ private: static Mutex *vmCreationLock_; static Runtime *instance_; #ifdef USE_CMC_GC - static BaseRuntime *baseInstance_; + static common::BaseRuntime *baseInstance_; #endif // for string cache diff --git a/ecmascript/runtime_lock.h b/ecmascript/runtime_lock.h index 48a4a3ea7b4b73c51b7949c58c1e7d563c337d73..4d1e7d925ddd98801c6b1f5409aa2379d945c84b 100644 --- a/ecmascript/runtime_lock.h +++ b/ecmascript/runtime_lock.h @@ -30,7 +30,7 @@ static inline void RuntimeLock(JSThread *thread, Mutex &mtx) } #ifndef NDEBUG #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::ASYNC); // Trigger CMC FULL GC + common::BaseRuntime::RequestGC(common::GcType::ASYNC); // Trigger CMC FULL GC #else SharedHeap::GetInstance()->CollectGarbage(thread); #endif diff --git a/ecmascript/serializer/base_deserializer.cpp b/ecmascript/serializer/base_deserializer.cpp index 22697b698bbb88e1431199253065bcf87fa0ddc0..11252b7ed91e0cc8fa42a6ee91b2c600bb84f447 100644 --- a/ecmascript/serializer/base_deserializer.cpp +++ b/ecmascript/serializer/base_deserializer.cpp @@ -391,7 +391,7 @@ uintptr_t BaseDeserializer::RelocateObjectAddr(SerializedObjectSpace space, size #ifdef USE_CMC_GC case SerializedObjectSpace::REGULAR_SPACE: { if (currentRegularObjectAddr_ + objSize > - currentRegularRegionBeginAddr_ + SerializeUtils::GetRegionSize()) { + currentRegularRegionBeginAddr_ + common::SerializeUtils::GetRegionSize()) { ASSERT(regularRegionIndex_ < regionVector_.size()); currentRegularObjectAddr_ = regionVector_[regularRegionIndex_++]; currentRegularRegionBeginAddr_ = currentRegularObjectAddr_; @@ -401,7 +401,8 @@ uintptr_t BaseDeserializer::RelocateObjectAddr(SerializedObjectSpace space, size break; } case SerializedObjectSpace::PIN_SPACE: { - if (currentPinObjectAddr_ + objSize > currentPinRegionBeginAddr_ + SerializeUtils::GetRegionSize()) { + if (currentPinObjectAddr_ + objSize > + currentPinRegionBeginAddr_ + common::SerializeUtils::GetRegionSize()) { ASSERT(pinRegionIndex_ < regionVector_.size()); currentPinObjectAddr_ = regionVector_[pinRegionIndex_++]; currentPinRegionBeginAddr_ = currentPinObjectAddr_; @@ -412,7 +413,7 @@ uintptr_t BaseDeserializer::RelocateObjectAddr(SerializedObjectSpace space, size } case SerializedObjectSpace::LARGE_SPACE: { // no gc for this allocate - res = HeapAllocator::AllocateLargeRegion(objSize); + res = common::HeapAllocator::AllocateLargeRegion(objSize); if (res == 0) { DeserializeFatalOutOfMemory(objSize, false, false); } @@ -641,8 +642,8 @@ void BaseDeserializer::AllocateToDifferentSpaces() #ifdef USE_CMC_GC void BaseDeserializer::AllocateToRegularSpace(size_t regularSpaceSize) { - if (regularSpaceSize <= SerializeUtils::GetRegionSize()) { - currentRegularObjectAddr_ = HeapAllocator::AllocateNoGC(regularSpaceSize); + if (regularSpaceSize <= common::SerializeUtils::GetRegionSize()) { + currentRegularObjectAddr_ = common::HeapAllocator::AllocateNoGC(regularSpaceSize); } else { currentRegularObjectAddr_ = AllocateMultiCMCRegion(regularSpaceSize, regularRegionIndex_, RegionType::RegularRegion); @@ -654,8 +655,8 @@ void BaseDeserializer::AllocateToRegularSpace(size_t regularSpaceSize) } void BaseDeserializer::AllocateToPinSpace(size_t pinSpaceSize) { - if (pinSpaceSize <= SerializeUtils::GetRegionSize()) { - currentPinObjectAddr_ = HeapAllocator::AllocatePinNoGC(pinSpaceSize); + if (pinSpaceSize <= common::SerializeUtils::GetRegionSize()) { + currentPinObjectAddr_ = common::HeapAllocator::AllocatePinNoGC(pinSpaceSize); } else { currentPinObjectAddr_ = AllocateMultiCMCRegion(pinSpaceSize, pinRegionIndex_, RegionType::PinRegion); } @@ -667,7 +668,7 @@ void BaseDeserializer::AllocateToPinSpace(size_t pinSpaceSize) uintptr_t BaseDeserializer::AllocateMultiCMCRegion(size_t spaceObjSize, size_t ®ionIndex, RegionType regionType) { - size_t regionSize = SerializeUtils::GetRegionSize(); + size_t regionSize = common::SerializeUtils::GetRegionSize(); ASSERT(spaceObjSize > regionSize); regionIndex = regionVector_.size(); size_t regionAlignedSize = AlignUp(spaceObjSize, regionSize); @@ -683,9 +684,9 @@ uintptr_t BaseDeserializer::AllocateMultiCMCRegion(size_t spaceObjSize, size_t & while (regionNum > 0) { uintptr_t regionAddr = 0U; if (regionType == RegionType::RegularRegion) { - regionAddr = HeapAllocator::AllocateRegion(); + regionAddr = common::HeapAllocator::AllocateRegion(); } else { - regionAddr = HeapAllocator::AllocatePinnedRegion(); + regionAddr = common::HeapAllocator::AllocatePinnedRegion(); } if (regionAddr == 0U) { LOG_ECMA(FATAL) << "Deserialize allocate multi cmc region fail"; diff --git a/ecmascript/serializer/base_serializer.cpp b/ecmascript/serializer/base_serializer.cpp index 8e421914bec49734af63d5aad0af442d9e31881b..99740d4a9bc25b7858e1c8e33cd24f141830201a 100644 --- a/ecmascript/serializer/base_serializer.cpp +++ b/ecmascript/serializer/base_serializer.cpp @@ -23,7 +23,7 @@ namespace panda::ecmascript { SerializedObjectSpace BaseSerializer::GetSerializedObjectSpace(TaggedObject *object) const { #ifdef USE_CMC_GC - SerializedObjectSpace spaceType = SerializeUtils::GetSerializeObjectSpace(ToUintPtr(object)); + SerializedObjectSpace spaceType = common::SerializeUtils::GetSerializeObjectSpace(ToUintPtr(object)); if (spaceType == SerializedObjectSpace::OTHER) { LOG_ECMA(FATAL) << "unsupported space type"; } diff --git a/ecmascript/serializer/serialize_data.h b/ecmascript/serializer/serialize_data.h index 3907da716ae564e091f1e6c714a8d96475ecc012..a1e971ef215b20523f06cbf7c85167a9e8ef860d 100644 --- a/ecmascript/serializer/serialize_data.h +++ b/ecmascript/serializer/serialize_data.h @@ -86,6 +86,8 @@ enum class SerializedObjectSpace : uint8_t { SHARED_NON_MOVABLE_SPACE, SHARED_HUGE_SPACE, }; +#else +using common::SerializedObjectSpace; #endif enum class SerializeType : uint8_t { @@ -132,7 +134,7 @@ public: static size_t AlignUpRegionAvailableSize(size_t size) { #ifdef USE_CMC_GC - size_t regionSize = SerializeUtils::GetRegionSize(); + size_t regionSize = common::SerializeUtils::GetRegionSize(); if (size == 0) { return regionSize; } diff --git a/ecmascript/shared_mm/shared_mm.cpp b/ecmascript/shared_mm/shared_mm.cpp index b409f0e74cb483a2d9e07fefab6e1141f74365ca..199ef2df07266d441439811c13bb6c321d62d39f 100644 --- a/ecmascript/shared_mm/shared_mm.cpp +++ b/ecmascript/shared_mm/shared_mm.cpp @@ -18,7 +18,6 @@ #if ECMASCRIPT_ENABLE_ZAP_MEM #include "securec.h" #endif -#include "libpandabase/mem/mem.h" namespace panda::ecmascript { static constexpr size_t MALLOC_SIZE_LIMIT = 2147483648; // Max internal memory used by the VM declared in options diff --git a/ecmascript/shared_object_factory.cpp b/ecmascript/shared_object_factory.cpp index 04544c86211b4ceaeae2293e5cdb53dc91d301d5..24408782b815cabc8447e072756e910f3038aa86 100644 --- a/ecmascript/shared_object_factory.cpp +++ b/ecmascript/shared_object_factory.cpp @@ -34,7 +34,7 @@ void ObjectFactory::NewSObjectHook() const return; } #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::ASYNC); + common::BaseRuntime::RequestGC(common::GcType::ASYNC); #else if (count++ % frequency == 0) { if (count % (CONCURRENT_MARK_FREQUENCY_FACTOR * frequency) == 0) { diff --git a/ecmascript/stubs/runtime_optimized_stubs-inl.h b/ecmascript/stubs/runtime_optimized_stubs-inl.h index 9c2ce3cf597cf564876bb811a8f28a52b895b1c1..1fcfd6c835210fd4bcab9b35610e7305a7ef56dd 100644 --- a/ecmascript/stubs/runtime_optimized_stubs-inl.h +++ b/ecmascript/stubs/runtime_optimized_stubs-inl.h @@ -49,17 +49,17 @@ JSTaggedValue RuntimeStubs::DecodePercentEncoding(JSThread *thread, int32_t &n, uint16_t frontChart = GetCodeUnit(sp, k + 1, strLen); uint16_t behindChart = GetCodeUnit(sp, k + 2, strLen); // 2: means plus 2 - if (!(base::utf_helper::IsHexDigits(frontChart) && base::utf_helper::IsHexDigits(behindChart))) { + if (!(common::utf_helper::IsHexDigits(frontChart) && common::utf_helper::IsHexDigits(behindChart))) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } #if !ENABLE_NEXT_OPTIMIZATION bb = GetValueFromTwoHex(frontChart, behindChart); #else - bb = base::utf_helper::GetValueFromTwoHex(frontChart, behindChart); + bb = common::utf_helper::GetValueFromTwoHex(frontChart, behindChart); #endif // e. If the two most significant bits in B are not 10, throw a URIError exception. - if (!((bb & base::utf_helper::BIT_MASK_2) == base::utf_helper::BIT_MASK_1)) { + if (!((bb & common::utf_helper::BIT_MASK_2) == common::utf_helper::BIT_MASK_1)) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } @@ -73,30 +73,30 @@ JSTaggedValue RuntimeStubs::DecodePercentEncoding(JSThread *thread, int32_t &n, JSTaggedValue RuntimeStubs::UTF16EncodeCodePoint(JSThread *thread, const std::vector &oct, const JSHandle &str, std::u16string &resStr) { - if (!base::utf_helper::IsValidUTF8(oct)) { + if (!common::utf_helper::IsValidUTF8(oct)) { CString errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } uint32_t vv = base::StringHelper::Utf8ToU32String(oct); - if (vv < base::utf_helper::DECODE_SECOND_FACTOR) { + if (vv < common::utf_helper::DECODE_SECOND_FACTOR) { #if !ENABLE_NEXT_OPTIMIZATION resStr = base::StringHelper::Utf16ToU16String(reinterpret_cast(&vv), 1); } else { - uint16_t lv = (((vv - base::utf_helper::DECODE_SECOND_FACTOR) & base::utf_helper::BIT16_MASK) + - base::utf_helper::DECODE_TRAIL_LOW); + uint16_t lv = (((vv - common::utf_helper::DECODE_SECOND_FACTOR) & common::utf_helper::BIT16_MASK) + + common::utf_helper::DECODE_TRAIL_LOW); // NOLINT - uint16_t hv = ((((vv - base::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & base::utf_helper::BIT16_MASK) + - base::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits + uint16_t hv = ((((vv - common::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & common::utf_helper::BIT16_MASK) + + common::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits resStr = base::StringHelper::Append(base::StringHelper::Utf16ToU16String(&hv, 1), base::StringHelper::Utf16ToU16String(&lv, 1)); #else resStr.append(base::StringHelper::Utf16ToU16String(reinterpret_cast(&vv), 1)); } else { - uint16_t lv = (((vv - base::utf_helper::DECODE_SECOND_FACTOR) & base::utf_helper::BIT16_MASK) + - base::utf_helper::DECODE_TRAIL_LOW); + uint16_t lv = (((vv - common::utf_helper::DECODE_SECOND_FACTOR) & common::utf_helper::BIT16_MASK) + + common::utf_helper::DECODE_TRAIL_LOW); // NOLINT - uint16_t hv = ((((vv - base::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & base::utf_helper::BIT16_MASK) + - base::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits + uint16_t hv = ((((vv - common::utf_helper::DECODE_SECOND_FACTOR) >> 10U) & common::utf_helper::BIT16_MASK) + + common::utf_helper::DECODE_LEAD_LOW); // 10: means shift left by 10 digits resStr.push_back(static_cast(hv)); resStr.push_back(static_cast(lv)); #endif @@ -119,19 +119,19 @@ JSTaggedValue RuntimeStubs::DecodePercentEncoding(JSThread *thread, const JSHand } uint16_t frontChar = GetCodeUnit(sp, k + 1, strLen); uint16_t behindChar = GetCodeUnit(sp, k + 2, strLen); // 2: means plus 2 - if (!(base::utf_helper::IsHexDigits(frontChar) && base::utf_helper::IsHexDigits(behindChar))) { + if (!(common::utf_helper::IsHexDigits(frontChar) && common::utf_helper::IsHexDigits(behindChar))) { errorMsg = "DecodeURI: invalid character: " + ConvertToString(str.GetTaggedValue()); THROW_URI_ERROR_AND_RETURN(thread, errorMsg.c_str(), JSTaggedValue::Exception()); } #if !ENABLE_NEXT_OPTIMIZATION uint8_t bb = GetValueFromTwoHex(frontChar, behindChar); k += 2; // 2: means plus 2 - if ((bb & base::utf_helper::BIT_MASK_1) == 0) { + if ((bb & common::utf_helper::BIT_MASK_1) == 0) { resStr = base::StringHelper::Utf8ToU16String(&bb, 1); #else - uint8_t bb = base::utf_helper::GetValueFromTwoHex(frontChar, behindChar); + uint8_t bb = common::utf_helper::GetValueFromTwoHex(frontChar, behindChar); k += 2; // 2: means plus 2 - if ((bb & base::utf_helper::BIT_MASK_1) == 0) { + if ((bb & common::utf_helper::BIT_MASK_1) == 0) { resStr.push_back(bb); #endif } else { @@ -158,7 +158,7 @@ JSTaggedValue RuntimeStubs::DecodePercentEncoding(JSThread *thread, const JSHand // b. Let H be ((((V – 0x10000) >> 10) & 0x3FF) + 0xD800). // c. Let S be the String containing the two code units H and L. int32_t n = 0; - while ((((static_cast(bb) << static_cast(n)) & base::utf_helper::BIT_MASK_1) != 0)) { + while ((((static_cast(bb) << static_cast(n)) & common::utf_helper::BIT_MASK_1) != 0)) { n++; if (n > 4) { // 4 : 4 means less than 4 break; @@ -269,7 +269,7 @@ uint8_t RuntimeStubs::GetValueFromTwoHex(uint8_t front, uint8_t behind) size_t idxf = base::StringHelper::FindFromU8ToUpper(hexString, &front); size_t idxb = base::StringHelper::FindFromU8ToUpper(hexString, &behind); - uint8_t res = ((idxf << 4U) | idxb) & base::utf_helper::BIT_MASK_FF; // NOLINT 4: means shift left by 4 digits + uint8_t res = ((idxf << 4U) | idxb) & common::utf_helper::BIT_MASK_FF; // NOLINT 4: means shift left by 4 digits return res; } #endif // ENABLE_NEXT_OPTIMIZATION diff --git a/ecmascript/stubs/runtime_stubs.cpp b/ecmascript/stubs/runtime_stubs.cpp index 99b9d9569fecae21ca25d131e64db0aa18824e51..a9fa33ebbeeaa0daa2d2cdbb10a05d60379f2692 100644 --- a/ecmascript/stubs/runtime_stubs.cpp +++ b/ecmascript/stubs/runtime_stubs.cpp @@ -668,7 +668,7 @@ DEF_RUNTIME_STUBS(ForceGC) return JSTaggedValue::Hole().GetRawData(); } #ifdef USE_CMC_GC - BaseRuntime::RequestGC(GcType::SYNC); + common::BaseRuntime::RequestGC(common::GcType::SYNC); #else thread->GetEcmaVM()->CollectGarbage(TriggerGCType::FULL_GC); #endif diff --git a/ecmascript/tests/dynamic_type_converter_test.cpp b/ecmascript/tests/dynamic_type_converter_test.cpp index 25e7902b10aea006f255d31e49803f686ec14ec6..42f0bc44ede81c251856090099749bf7d9f439f5 100644 --- a/ecmascript/tests/dynamic_type_converter_test.cpp +++ b/ecmascript/tests/dynamic_type_converter_test.cpp @@ -39,7 +39,7 @@ static JSHandle JSObjectCreate(JSThread *thread) /** * @tc.name: WrapTagged_Test0 - * @tc.desc: Convert PandaType to DynamicType by converter. + * @tc.desc: Convert BaseType to DynamicType by converter. * @tc.type: FUNC * @tc.require: */ @@ -49,46 +49,46 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test0) ThreadHolder *threadHolder = thread->GetThreadHolder(); // 1. Test monostate (empty variant) { - PandaType value = std::monostate{}; + BaseType value = std::monostate{}; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsHole()); } // 2. Test boolean types { - PandaType value = true; + BaseType value = true; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsTrue()); } { - PandaType value = false; + BaseType value = false; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsFalse()); } // 3. Test all integer types // int8_t { - PandaType value = static_cast(42); + BaseType value = static_cast(42); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsInt()); EXPECT_EQ(result.GetInt(), 42); } // uint8_t { - PandaType value = static_cast(255); + BaseType value = static_cast(255); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsInt()); EXPECT_EQ(result.GetInt(), 255); } // int16_t { - PandaType value = static_cast(32767); + BaseType value = static_cast(32767); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsInt()); EXPECT_EQ(result.GetInt(), 32767); } // uint16_t { - PandaType value = static_cast(65535); + BaseType value = static_cast(65535); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsInt()); EXPECT_EQ(result.GetInt(), 65535); @@ -97,7 +97,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test0) /** * @tc.name: WrapTagged_Test1 - * @tc.desc: Convert PandaType to DynamicType by converter. + * @tc.desc: Convert BaseType to DynamicType by converter. * @tc.type: FUNC * @tc.require: */ @@ -107,39 +107,39 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test1) ThreadHolder *threadHolder = thread->GetThreadHolder(); // int32_t { - PandaType value = static_cast(2147483647); + BaseType value = static_cast(2147483647); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsInt()); EXPECT_EQ(result.GetInt(), 2147483647); } // uint32_t (special case) { - PandaType value = static_cast(4294967295); + BaseType value = static_cast(4294967295); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsDouble()); } // 4. Test floating point types { - PandaType value = 3.14f; + BaseType value = 3.14f; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsDouble()); EXPECT_FLOAT_EQ(result.GetDouble(), 3.14f); } { - PandaType value = 2.71828; + BaseType value = 2.71828; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsDouble()); EXPECT_DOUBLE_EQ(result.GetDouble(), 2.71828); } // 5. Test 64-bit integers (converted to double) { - PandaType value = static_cast(9223372036854775807LL); + BaseType value = static_cast(9223372036854775807LL); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsDouble()); EXPECT_DOUBLE_EQ(result.GetDouble(), 9223372036854775807.0); } { - PandaType value = static_cast(18446744073709551615ULL); + BaseType value = static_cast(18446744073709551615ULL); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsDouble()); EXPECT_DOUBLE_EQ(result.GetDouble(), 18446744073709551615.0); @@ -148,7 +148,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test1) /** * @tc.name: WrapTagged_Test2 - * @tc.desc: Convert PandaType to DynamicType by converter. + * @tc.desc: Convert BaseType to DynamicType by converter. * @tc.type: FUNC * @tc.require: */ @@ -158,22 +158,22 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test2) ThreadHolder *threadHolder = thread->GetThreadHolder(); // 6. Test undefined and null { - PandaType value = BaseUndefined{}; + BaseType value = common::BaseUndefined{}; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsUndefined()); } { - PandaType value = BaseNull{}; + BaseType value = common::BaseNull{}; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsNull()); } // 7. Test BigInt with new struct definition { - BaseBigInt bigIntValue; + common::BaseBigInt bigIntValue; bigIntValue.length = 3; bigIntValue.sign = true; // Negative value bigIntValue.data = {0x12345678, 0x9ABCDEF0, 0x13579BDF}; - PandaType value = bigIntValue; + BaseType value = bigIntValue; JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsBigInt()); @@ -190,7 +190,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test2) // 8. Test object type { JSHandle obj = JSObjectCreate(thread); - PandaType value = static_cast(obj.GetTaggedValue().GetTaggedObject()); + BaseType value = static_cast(obj.GetTaggedValue().GetTaggedObject()); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_EQ(result, obj.GetTaggedValue()); } @@ -199,7 +199,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test2) uint8_t arrayU8[] = {"xyz123!@#"}; size_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; EcmaString *str = EcmaStringAccessor::CreateFromUtf8(instance, &arrayU8[0], lengthEcmaStrU8, true); - PandaType value = str->ToBaseString(); + BaseType value = str->ToBaseString(); JSTaggedValue result = dynTypeConverter_.WrapTagged(threadHolder, value); EXPECT_TRUE(result.IsString()); @@ -212,7 +212,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, WrapTagged_Test2) /** * @tc.name: UnWrapTagged0 - * @tc.desc: Convert DynamicType to PandaType by converter. + * @tc.desc: Convert DynamicType to BaseType by converter. * @tc.type: FUNC * @tc.require: */ @@ -258,7 +258,7 @@ HWTEST_F_L0(DynamicTypeConverterTest, UnWrapTagged_Test0) /** * @tc.name: UnWrapTagged1 - * @tc.desc: Convert DynamicType to PandaType by converter. + * @tc.desc: Convert DynamicType to BaseType by converter. * @tc.type: FUNC * @tc.require: */ @@ -269,13 +269,13 @@ HWTEST_F_L0(DynamicTypeConverterTest, UnWrapTagged_Test1) { JSTaggedValue undefinedValue = JSTaggedValue::Undefined(); auto result = dynTypeConverter_.UnWrapTagged(undefinedValue); - EXPECT_TRUE(std::holds_alternative(result)); + EXPECT_TRUE(std::holds_alternative(result)); } /* Null type tests */ { JSTaggedValue nullValue = JSTaggedValue::Null(); auto result = dynTypeConverter_.UnWrapTagged(nullValue); - EXPECT_TRUE(std::holds_alternative(result)); + EXPECT_TRUE(std::holds_alternative(result)); } /* BigInt type tests */ { @@ -290,8 +290,8 @@ HWTEST_F_L0(DynamicTypeConverterTest, UnWrapTagged_Test1) JSTaggedValue bigIntValue(bigInt); auto result = dynTypeConverter_.UnWrapTagged(bigIntValue); - EXPECT_TRUE(std::holds_alternative(result)); - const BaseBigInt& baseBigInt = std::get(result); + EXPECT_TRUE(std::holds_alternative(result)); + const common::BaseBigInt& baseBigInt = std::get(result); EXPECT_EQ(baseBigInt.length, length); EXPECT_EQ(baseBigInt.sign, sign); diff --git a/ecmascript/tests/ecma_string_hash_test.cpp b/ecmascript/tests/ecma_string_hash_test.cpp index 4159406fef10a17ff5e5148cfbd59de39ecf9e1e..7d863af6e161c1180473c2334b39daf9ab9dbb72 100644 --- a/ecmascript/tests/ecma_string_hash_test.cpp +++ b/ecmascript/tests/ecma_string_hash_test.cpp @@ -16,9 +16,10 @@ #include "ecmascript/tests/test_helper.h" #include "ecmascript/ecma_string.h" -#include "ecmascript/platform/ecma_string_hash.h" +#include "common_components/platform/string_hash.h" using namespace panda::ecmascript; +using namespace common; namespace panda::test { class EcmaStringHashTest : public BaseTestWithScope { @@ -28,7 +29,7 @@ public: { uint32_t hash = hashSeed; for (size_t i = 0; i < size; i++) { - hash = hash * EcmaStringHash::HASH_MULTIPLY + data[i]; + hash = hash * StringHash::HASH_MULTIPLY + data[i]; } return hash; } diff --git a/ecmascript/tests/ecma_string_table_test.cpp b/ecmascript/tests/ecma_string_table_test.cpp index 636f10b0ef88efbbc554ea361b26c03ff0a04d23..6801fe006d749469e5c02062b4744d0dca983759 100644 --- a/ecmascript/tests/ecma_string_table_test.cpp +++ b/ecmascript/tests/ecma_string_table_test.cpp @@ -143,7 +143,7 @@ HWTEST_F_L0(EcmaStringTableTest, GetOrInternString_CheckStringTable) */ HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_ConcurrentAccess) { - auto *map = new HashTrieMap(); + auto *map = new common::HashTrieMap(); const int thread_count = 8; std::atomic counter {0}; @@ -190,7 +190,7 @@ HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_ConcurrentAccess) HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_InsertNewKey) { EcmaVM* vm = thread->GetEcmaVM(); - auto* map = new HashTrieMap(); + auto* map = new common::HashTrieMap(); uint32_t key = 0x12345678; JSHandle value(thread, *vm->GetFactory()->NewFromASCII("test_value")); auto readBarrier = [](const void* obj, size_t offset)-> TaggedObject* { @@ -220,7 +220,7 @@ HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_InsertNewKey) HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_StoreExistingKey) { EcmaVM *vm = thread->GetEcmaVM(); - auto *map = new HashTrieMap(); + auto *map = new common::HashTrieMap(); uint32_t key = 0x12345678; JSHandle original(thread, *vm->GetFactory()->NewFromASCII("original")); JSHandle origina2(thread, *vm->GetFactory()->NewFromASCII("origina2")); @@ -255,7 +255,7 @@ HWTEST_F_L0(EcmaStringTableTest, LoadOrStore_StoreExistingKey) HWTEST_F_L0(EcmaStringTableTest, Expand_HashCollisionHandling) { EcmaVM *vm = thread->GetEcmaVM(); - auto *map = new HashTrieMap(); + auto *map = new common::HashTrieMap(); uint32_t key1 = 0x11111111; uint32_t key2 = 0x11110000; uint32_t key3 = 0x11110010; @@ -304,13 +304,13 @@ HWTEST_F_L0(EcmaStringTableTest, Expand_HashCollisionHandling) └── Entry [key=286331153, value=0x2bafc81e38] */ // Verify structure after expansion - HashTrieMap::Indirect *root = map->GetRoot().load(); + common::HashTrieMap::Indirect *root = map->GetRoot().load(); ASSERT_TRUE(root->children_[0x0].load() != nullptr); // Check first collision level - HashTrieMap::Indirect *level1 = root->children_[0x0].load()->AsIndirect(); + common::HashTrieMap::Indirect *level1 = root->children_[0x0].load()->AsIndirect(); ASSERT_TRUE(level1->children_[0x0].load() != nullptr); ASSERT_TRUE(level1->children_[0x2].load() != nullptr); - HashTrieMap::Entry *entry = level1->children_[0x2].load()->AsEntry(); + common::HashTrieMap::Entry *entry = level1->children_[0x2].load()->AsEntry(); // Verify overflow ASSERT_TRUE(entry->Overflow().load() != nullptr); delete map; diff --git a/ecmascript/tests/ecma_vm_test.cpp b/ecmascript/tests/ecma_vm_test.cpp index c50a86ec00356eca3905256d79bfbfb134542465..c493c3be51ae81ed9c8cb85254b385b09cf200fc 100644 --- a/ecmascript/tests/ecma_vm_test.cpp +++ b/ecmascript/tests/ecma_vm_test.cpp @@ -20,6 +20,7 @@ #include #include using namespace panda::ecmascript; +using namespace common; namespace panda::test { class EcmaVMTest : public BaseTestWithOutScope { @@ -86,7 +87,7 @@ public: HWTEST_F_L0(EcmaVMTest, CreateEcmaVMInTwoWays) { RuntimeOption options; - options.SetLogLevel(LOG_LEVEL::ERROR); + options.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM::SetMultiThreadCheck(true); EcmaVM *ecmaVm1 = JSNApi::CreateJSVM(options); EXPECT_TRUE(ecmaVm1->GetMultiThreadCheck()); @@ -148,7 +149,7 @@ HWTEST_F_L0(EcmaVMTest, CreateEcmaVMInTwoWays) HWTEST_F_L0(EcmaVMTest, DumpExceptionObject) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *ecmaVm = JSNApi::CreateJSVM(option); auto thread = ecmaVm->GetJSThread(); int arkProperties = thread->GetEcmaVM()->GetJSOptions().GetArkProperties(); diff --git a/ecmascript/tests/gc_taskpool_test.cpp b/ecmascript/tests/gc_taskpool_test.cpp index fe7f805421152f2ee0f05fa5ec50d590a3e975f7..5dd6316defa385a6c1770f2b5c918e4c9d430c36 100644 --- a/ecmascript/tests/gc_taskpool_test.cpp +++ b/ecmascript/tests/gc_taskpool_test.cpp @@ -16,17 +16,17 @@ #include "common_components/taskpool/taskpool.h" #include "ecmascript/tests/ecma_test_common.h" +using namespace common; using namespace panda; - using namespace panda::ecmascript; namespace panda::test { class GCTest : public BaseTestWithScope { public: - class DummyTask : public Task { + class DummyTask : public common::Task { public: DummyTask(int32_t id, uint64_t executionMilliseconds) - : Task(id), executionMilliseconds_(executionMilliseconds) {} + : common::Task(id), executionMilliseconds_(executionMilliseconds) {} ~DummyTask() override = default; bool Run([[maybe_unused]] uint32_t threadIndex) override { @@ -40,10 +40,10 @@ public: uint64_t executionMilliseconds_; }; - class DummyDelayedTask : public Task { + class DummyDelayedTask : public common::Task { public: DummyDelayedTask(int32_t id, uint64_t executionMilliseconds, SteadyTimePoint deadline) - : Task(id), executionMilliseconds_(executionMilliseconds), deadline_(deadline) {} + : common::Task(id), executionMilliseconds_(executionMilliseconds), deadline_(deadline) {} ~DummyDelayedTask() override = default; bool Run([[maybe_unused]] uint32_t threadIndex) override { @@ -66,7 +66,7 @@ HWTEST_F_L0(GCTest, TaskpoolTest1) auto heap = const_cast(thread->GetEcmaVM()->GetHeap()); uint64_t executionMilliseconds = 100; for (uint32_t i = 0; i < 10; i++) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds)); } std::this_thread::sleep_for(std::chrono::seconds(10)); @@ -79,7 +79,7 @@ HWTEST_F_L0(GCTest, TaskpoolTest2) uint64_t delayMilliseconds = 300; for (uint32_t i = 0; i < 10; i++) { auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMilliseconds); - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds, deadline), delayMilliseconds); } @@ -93,7 +93,7 @@ HWTEST_F_L0(GCTest, TaskpoolTest3) uint64_t delayMilliseconds = 300; for (uint32_t i = 0; i < 10; i++) { auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMilliseconds); - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds, deadline), delayMilliseconds); } @@ -107,12 +107,12 @@ HWTEST_F_L0(GCTest, TaskpoolTest4) uint64_t delayMilliseconds = 300; for (uint32_t i = 0; i < 10; i++) { auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMilliseconds); - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds, deadline), delayMilliseconds); } for (uint32_t i = 0; i < 10; i++) { - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds)); } std::this_thread::sleep_for(std::chrono::seconds(10)); @@ -124,11 +124,11 @@ HWTEST_F_L0(GCTest, TaskpoolTest5) uint64_t hugeJobExecutionMilliseconds = 3000; uint64_t executionMilliseconds = 100; uint64_t delayMilliseconds = 300; - Taskpool::GetCurrentTaskpool()->PostTask( + common::Taskpool::GetCurrentTaskpool()->PostTask( std::make_unique(heap->GetJSThread()->GetThreadId(), hugeJobExecutionMilliseconds)); for (uint32_t i = 0; i < 10; i++) { auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMilliseconds); - Taskpool::GetCurrentTaskpool()->PostDelayedTask( + common::Taskpool::GetCurrentTaskpool()->PostDelayedTask( std::make_unique(heap->GetJSThread()->GetThreadId(), executionMilliseconds, deadline), delayMilliseconds); } diff --git a/ecmascript/tests/js_thread_state_test.cpp b/ecmascript/tests/js_thread_state_test.cpp index a8be8146e25b03322bcc4ac2f9dfdfe43471a77b..99706631f87b5a612acc6e8dc760d1c70f259c89 100644 --- a/ecmascript/tests/js_thread_state_test.cpp +++ b/ecmascript/tests/js_thread_state_test.cpp @@ -34,7 +34,7 @@ public: { panda::ecmascript::JSRuntimeOptions runtimeOptions; runtimeOptions.SetLogLevel("error"); - Log::Initialize(runtimeOptions.GetLogOptions()); + common::Log::Initialize(runtimeOptions.GetLogOptions()); } static void NewVMThreadEntry(EcmaVM *newVm, diff --git a/ecmascript/tests/read_only_space_test.cpp b/ecmascript/tests/read_only_space_test.cpp index 38ba7be02386f5f9960a74ca68d45c9df2351521..5e30d624a9d5fa9a1dc3b3240998077c0145f79e 100644 --- a/ecmascript/tests/read_only_space_test.cpp +++ b/ecmascript/tests/read_only_space_test.cpp @@ -26,7 +26,7 @@ #include "ecmascript/tests/test_helper.h" #ifdef USE_CMC_GC #include "../runtime_core/common_interfaces/base_runtime.h" -#include "common_components/common_runtime/src/heap_manager.h" +#include "common_components/heap/heap_manager.h" #endif #include #include @@ -48,7 +48,7 @@ public: { panda::ecmascript::JSRuntimeOptions runtimeOptions; runtimeOptions.SetLogLevel("error"); - Log::Initialize(runtimeOptions.GetLogOptions()); + common::Log::Initialize(runtimeOptions.GetLogOptions()); } ObjectFactory *factory {nullptr}; @@ -91,7 +91,7 @@ HWTEST_F_L0(ReadOnlySpaceTest, ReadOnlyTest) #ifndef USE_CMC_GC heap->GetReadOnlySpace()->SetReadOnly(); #else - auto heapManager = BaseRuntime::GetInstance()->GetHeapManager(); + auto heapManager = common::BaseRuntime::GetInstance()->GetHeapManager(); heapManager.SetReadOnlyToROSpace(); #endif if (ReadOnlyTestManager::RegisterSignal() == -1) { @@ -123,7 +123,7 @@ HWTEST_F_L0(ReadOnlySpaceTest, AllocateTest) auto *region = Region::ObjectAddressToRange(object); EXPECT_TRUE(region->InReadOnlySpace()); #else - auto heapManager = BaseRuntime::GetInstance()->GetHeapManager(); + auto heapManager = common::BaseRuntime::GetInstance()->GetHeapManager(); EXPECT_TRUE(heapManager.IsInROSpace(object)); #endif } @@ -161,9 +161,9 @@ HWTEST_F_L0(ReadOnlySpaceTest, GCTest) auto *region = Region::ObjectAddressToRange(object); EXPECT_TRUE(region->InReadOnlySpace()); #else - auto baseRuntime = BaseRuntime::GetInstance(); + auto baseRuntime = common::BaseRuntime::GetInstance(); auto heapManager = baseRuntime->GetHeapManager(); - baseRuntime->RequestGC(GcType::FULL); + baseRuntime->RequestGC(common::GcType::FULL); EXPECT_TRUE(heapManager.IsInROSpace(object)); #endif } @@ -178,7 +178,7 @@ HWTEST_F_L0(ReadOnlySpaceTest, ForkTest) #else auto *object = heap->AllocateReadOnlyOrHugeObject( JSHClass::Cast(thread->GlobalConstants()->GetBigIntClass().GetTaggedObject())); - auto baseRuntime = BaseRuntime::GetInstance(); + auto baseRuntime = common::BaseRuntime::GetInstance(); auto heapManager = baseRuntime->GetHeapManager(); #endif JSNApi::PreFork(vm); @@ -191,7 +191,7 @@ HWTEST_F_L0(ReadOnlySpaceTest, ForkTest) auto *region = Region::ObjectAddressToRange(string.GetObject()); EXPECT_TRUE(region->InSharedHeap()); #else - baseRuntime->RequestGC(GcType::FULL); + baseRuntime->RequestGC(common::GcType::FULL); EXPECT_TRUE(heapManager.IsInROSpace(object)); } else { int status; diff --git a/ecmascript/tests/test_helper.h b/ecmascript/tests/test_helper.h index 3755df0ca44b033f8b346bf9a264bb67c7a39881..410d4de6ef5ee27ea8ecf79c3d8c4cf83f61a598 100644 --- a/ecmascript/tests/test_helper.h +++ b/ecmascript/tests/test_helper.h @@ -73,7 +73,7 @@ public: } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = reinterpret_cast(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } diff --git a/libark_jsruntime.map b/libark_jsruntime.map index d8d08f98429b9bd3af2e60a980ebad67b07c2a5a..b378680d208b6127f5bf6304eeec49efa590e55e 100644 --- a/libark_jsruntime.map +++ b/libark_jsruntime.map @@ -17,9 +17,6 @@ panda::ecmascript::COMMON_HELP_HEAD_MSG*; panda::ecmascript::HELP_OPTION_MSG*; panda::ecmascript::COMPILER_HELP_HEAD_MSG*; - - panda::MutatorBase::*; - panda::ArkCrashHolder*; panda::ArrayBufferRef::*; @@ -98,20 +95,21 @@ panda::JsiNativeScope::*; panda::JsiFastNativeScope::*; panda::JSExecutionScope::*; - panda::BaseRuntime::*; - panda::VisitDynamicRoots*; - panda::VisitDynamicWeakRoots*; - panda::BaseObject::*; - panda::VisitJSThread*; - panda::SynchronizeGCPhaseToJSThread*; - panda::FillFreeObject*; - panda::SetBaseAddress*; - panda::JSGCCallback*; + common::BaseRuntime::*; + common::VisitDynamicRoots*; + common::VisitDynamicWeakRoots*; + common::BaseObject::*; + common::VisitJSThread*; + common::SynchronizeGCPhaseToJSThread*; + common::FillFreeObject*; + common::SetBaseAddress*; + common::JSGCCallback*; + common::MutatorBase::*; + common::Log::*; + common::AndroidLog*; + common::ThreadHolder::*; panda::ecmascript::AotCrashInfo*; - panda::Log::*; - panda::AndroidLog*; - panda::ecmascript::ThreadHolder::*; panda::ecmascript::Method::*; panda::ecmascript::JSPandaFileManager::*; panda::ecmascript::DebugInfoExtractor::*; @@ -349,7 +347,7 @@ panda::ecmascript::Unlink*; panda::ecmascript::filesystem::CreateEmptyFile*; panda::ecmascript::base::ArrayHelper::GetLength*; - panda::ecmascript::base::utf_helper::ConvertRegionUtf16ToUtf8*; + common::utf_helper::ConvertRegionUtf16ToUtf8*; panda::ecmascript::base::NumberHelper::DoubleInRangeInt32*; panda::ecmascript::base::NumberHelper::StringToBigInt*; panda::ecmascript::base::NumberHelper::TruncateDouble*; diff --git a/script/run_ark_executable.py b/script/run_ark_executable.py index c4cc5bdd9b04a3d32528424519aa888e3759230a..aeb90e18484368b85e499fd0722fc023ab5410c2 100755 --- a/script/run_ark_executable.py +++ b/script/run_ark_executable.py @@ -101,7 +101,7 @@ def parse_args() -> object: parser.add_argument('--L', help='qemu lib path') parser.add_argument('--arkjsvmpath', help='ark_js_vm_path') parser.add_argument('--test-abc-path', help='abc path') - parser.add_argument('--empty', help='do nothing') + parser.add_argument('--skip', type=bool, default=False, help='skip execute') args = parser.parse_args() return args @@ -119,6 +119,7 @@ def process_open(args: object) -> [str, object]: else: # get env-path from response file recursively [cmd, env_path] = get_command_and_env_path(args) + args.env_path = env_path if args.qemu_binary_path: # process for running executable with qemu subp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -142,7 +143,7 @@ def generate_stub_code_comment(out_str:str): zip_file.writestr('stub_code_comment.txt', memory_file.getvalue()) -def check_expect_output(cmd: str, returncode: str, out_str: str, err_str: str, expect_output: str, start_time: float): +def check_expect_output(cmd: str, returncode: str, out_str: str, err_str: str, expect_output: str, start_time: float, env_path: str): """Check if return code matches expected output.""" if returncode != expect_output: print(">>>>> ret <<<<<") @@ -153,10 +154,10 @@ def check_expect_output(cmd: str, returncode: str, out_str: str, err_str: str, e print(err_str) print(">>>>> Expect return: [" + expect_output \ + "]\n>>>>> But got: [" + returncode + "]") - raise RuntimeError("Run [" + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) + raise RuntimeError("Run [LD_LIBRARY_PATH=" + env_path + " " + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) -def check_expect_sub_output(cmd: str, returncode: str, out_str: str, err_str: str, expect_sub_output: str, start_time: float): +def check_expect_sub_output(cmd: str, returncode: str, out_str: str, err_str: str, expect_sub_output: str, start_time: float, env_path: str): """Check if output contains expected substring.""" if out_str.find(expect_sub_output) == -1 or returncode != "0": print(">>>>> ret <<<<<") @@ -165,10 +166,10 @@ def check_expect_sub_output(cmd: str, returncode: str, out_str: str, err_str: st print(err_str) print(">>>>> Expect contain: [" + expect_sub_output \ + "]\n>>>>> But got: [" + out_str + "]") - raise RuntimeError("Run [" + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) + raise RuntimeError("Run [LD_LIBRARY_PATH=" + env_path + " " + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) -def check_expect_sub_error(cmd: str, returncode: str, out_str: str, err_str: str, expect_sub_error: str, start_time: float): +def check_expect_sub_error(cmd: str, returncode: str, out_str: str, err_str: str, expect_sub_error: str, start_time: float, env_path: str): """Check if error output contains expected substring.""" if err_str.find(expect_sub_error) == -1 or returncode == '0': print(">>>>> returnCode <<<<<") @@ -181,10 +182,10 @@ def check_expect_sub_error(cmd: str, returncode: str, out_str: str, err_str: str else: print(">>>>> Expect err : [" + expect_sub_error \ + "]\n>>>>> But got wrong err: [" + err_str + "]") - raise RuntimeError("Run [" + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) + raise RuntimeError("Run [LD_LIBRARY_PATH=" + env_path + " " + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) -def check_expect_file(cmd: str, returncode: str, out_str: str, err_str: str, expect_file: str, start_time: float): +def check_expect_file(cmd: str, returncode: str, out_str: str, err_str: str, expect_file: str, start_time: float, env_path: str): """Check if output matches expected file content.""" with open(expect_file, mode='r') as file: # skip license header @@ -199,13 +200,13 @@ def check_expect_file(cmd: str, returncode: str, out_str: str, err_str: str, exp print(">>>>> Expect {} lines: [{}]\n>>>>> But got {} lines: [{}]".format( expect_output.count('\n'), expect_output, out_str.count('\n'), out_str )) - raise RuntimeError("Run [" + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) + raise RuntimeError("Run [LD_LIBRARY_PATH=" + env_path + " " + cmd + "] failed! used: %.5f seconds" % (time.time() - start_time)) def judge_output(args: object): """Run executable and judge if success or not.""" - if args.empty: + if args.skip: return start_time = time.time() @@ -215,7 +216,7 @@ def judge_output(args: object): try: out, err = subp.communicate(timeout=timeout_limit) except subprocess.TimeoutExpired: - raise RuntimeError('Run [', cmd, '] timeout, timeout_limit = ', timeout_limit, 's') + raise RuntimeError('Run [LD_LIBRARY_PATH=' + args.env_path + " " + cmd + '] timeout, timeout_limit = ', timeout_limit, 's') out_str = out.decode('UTF-8', errors="ignore") err_str = err.decode('UTF-8', errors="ignore") @@ -223,17 +224,17 @@ def judge_output(args: object): returncode = str(subp.returncode) if args.expect_output: - check_expect_output(cmd, returncode, out_str, err_str, args.expect_output, start_time) + check_expect_output(cmd, returncode, out_str, err_str, args.expect_output, start_time, args.env_path) elif args.expect_sub_output: - check_expect_sub_output(cmd, returncode, out_str, err_str, args.expect_sub_output, start_time) + check_expect_sub_output(cmd, returncode, out_str, err_str, args.expect_sub_output, start_time, args.env_path) elif args.expect_sub_error: - check_expect_sub_error(cmd, returncode, out_str, err_str, args.expect_sub_error, start_time) + check_expect_sub_error(cmd, returncode, out_str, err_str, args.expect_sub_error, start_time, args.env_path) elif args.expect_file: - check_expect_file(cmd, returncode, out_str, err_str, args.expect_file, start_time) + check_expect_file(cmd, returncode, out_str, err_str, args.expect_file, start_time, args.env_path) else: - raise RuntimeError("Run [" + cmd + "] with no expect! used: %.5f seconds" % (time.time() - start_time)) + raise RuntimeError("Run [LD_LIBRARY_PATH=" + args.env_path + " " + cmd + "] with no expect! used: %.5f seconds" % (time.time() - start_time)) - print("Run [" + cmd + "] success!") + print("Run [LD_LIBRARY_PATH=" + args.env_path + " " + cmd + "] success!") print("used: %.5f seconds" % (time.time() - start_time)) def compare_line_by_line(expect_output:str, got_output:str): diff --git a/test/fuzztest/arraybufferrefnew_fuzzer/arraybufferrefnew_fuzzer.cpp b/test/fuzztest/arraybufferrefnew_fuzzer/arraybufferrefnew_fuzzer.cpp index 6ca0c83236ea0e2c5b0c6aa339ba5b7cfb6ee0cb..155ae4fda052650400324b8804a6c22d1eb5a2f9 100644 --- a/test/fuzztest/arraybufferrefnew_fuzzer/arraybufferrefnew_fuzzer.cpp +++ b/test/fuzztest/arraybufferrefnew_fuzzer/arraybufferrefnew_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ArrayBufferRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -38,7 +38,7 @@ void ArrayBufferRefNewFuzzTest(const uint8_t* data, size_t size) void ArrayBufferRef_New_IsDetach_Detach_ByteLength_GetBuffer_FuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/arraybufferrefnewwithtwoparameters_fuzzer/arraybufferrefnewwithtwoparameters_fuzzer.cpp b/test/fuzztest/arraybufferrefnewwithtwoparameters_fuzzer/arraybufferrefnewwithtwoparameters_fuzzer.cpp index 0211bcca193e03b277f8e702610eb4c6b7e30466..29d76483119e23d5c2dc188808f08bca9ddb58b5 100644 --- a/test/fuzztest/arraybufferrefnewwithtwoparameters_fuzzer/arraybufferrefnewwithtwoparameters_fuzzer.cpp +++ b/test/fuzztest/arraybufferrefnewwithtwoparameters_fuzzer/arraybufferrefnewwithtwoparameters_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void ArrayBufferRefNewWithTwoParametersFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { @@ -47,7 +47,7 @@ void ArrayBufferRefNewWithTwoParametersFuzzTest(const uint8_t* data, size_t size void ArrayBufferRef_New_IsDetach_Detach_ByteLength_GetBuffer_FuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/arraylist_fuzzer/arraylist_fuzzer.cpp b/test/fuzztest/arraylist_fuzzer/arraylist_fuzzer.cpp index 7052f172e0c20bd2c95f86f2697b44b60b49e9c9..6f394dbddb0a593cc8a801f671c870fead32ed2b 100644 --- a/test/fuzztest/arraylist_fuzzer/arraylist_fuzzer.cpp +++ b/test/fuzztest/arraylist_fuzzer/arraylist_fuzzer.cpp @@ -127,7 +127,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -165,7 +165,7 @@ namespace OHOS { void ArrayListAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -200,7 +200,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -236,7 +236,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -272,7 +272,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -308,7 +308,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -345,7 +345,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -381,7 +381,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -418,7 +418,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -454,7 +454,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -491,7 +491,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -527,7 +527,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -564,7 +564,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -602,7 +602,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -640,7 +640,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -676,7 +676,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -713,7 +713,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -754,7 +754,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -795,7 +795,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -836,7 +836,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -874,7 +874,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -915,7 +915,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -949,7 +949,7 @@ namespace OHOS { void JSValueRefInstanceOfValueFuzzTest([[maybe_unused]] const uint8_t *data, [[maybe_unused]] size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/bigint64arrayrefnew_fuzzer/bigint64arrayrefnew_fuzzer.cpp b/test/fuzztest/bigint64arrayrefnew_fuzzer/bigint64arrayrefnew_fuzzer.cpp index 13bdcbfcce3e8e604bb5c8faa75a44083ae0a2c6..f146bbf1ccf993ce4648001d2f48bbd4dbbfd177 100644 --- a/test/fuzztest/bigint64arrayrefnew_fuzzer/bigint64arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/bigint64arrayrefnew_fuzzer/bigint64arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void BigInt64ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/bigintrefgetwordsarraysize_fuzzer/bigintrefgetwordsarraysize_fuzzer.cpp b/test/fuzztest/bigintrefgetwordsarraysize_fuzzer/bigintrefgetwordsarraysize_fuzzer.cpp index 4c0875870553fc254ed58f893b0afa2c928157f2..77e132e1498d493c5a053e6a5fd28f738e29925c 100644 --- a/test/fuzztest/bigintrefgetwordsarraysize_fuzzer/bigintrefgetwordsarraysize_fuzzer.cpp +++ b/test/fuzztest/bigintrefgetwordsarraysize_fuzzer/bigintrefgetwordsarraysize_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void BigIntRefGetWordsArraySize(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/bigintrefnew_fuzzer/bigintrefnew_fuzzer.cpp b/test/fuzztest/bigintrefnew_fuzzer/bigintrefnew_fuzzer.cpp index de38e1119afc484364bcc5cf590849814fb9c2e7..d3ff487259399f0b06572a1ead0f2b3b556a833d 100644 --- a/test/fuzztest/bigintrefnew_fuzzer/bigintrefnew_fuzzer.cpp +++ b/test/fuzztest/bigintrefnew_fuzzer/bigintrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void BigIntRefNewFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "Parameter out of range."; diff --git a/test/fuzztest/biginttoint64_fuzzer/biginttoint64_fuzzer.cpp b/test/fuzztest/biginttoint64_fuzzer/biginttoint64_fuzzer.cpp index 2265e08a27893c08e6be69288842835a0b28d441..3b5067dd7b9cfeaa8434ca0f0b4725f3493bb00d 100644 --- a/test/fuzztest/biginttoint64_fuzzer/biginttoint64_fuzzer.cpp +++ b/test/fuzztest/biginttoint64_fuzzer/biginttoint64_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void BigIntToInt64FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int64_t input = 0; size_t maxByteLen = 8; diff --git a/test/fuzztest/biginttouint64_fuzzer/biginttouint64_fuzzer.cpp b/test/fuzztest/biginttouint64_fuzzer/biginttouint64_fuzzer.cpp index eee10c712154bcc88c8da215a2b2007fa4e6a1d5..7317ac4fcbb862da9423d437b1168f8078e2bf2a 100644 --- a/test/fuzztest/biginttouint64_fuzzer/biginttouint64_fuzzer.cpp +++ b/test/fuzztest/biginttouint64_fuzzer/biginttouint64_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void BigIntToUint64FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/biguint64arrayrefnew_fuzzer/biguint64arrayrefnew_fuzzer.cpp b/test/fuzztest/biguint64arrayrefnew_fuzzer/biguint64arrayrefnew_fuzzer.cpp index 380d1fe6726399758d1bfa1bec04b9f6e43bde49..b8c319301e2feb5fbcefdcca60c04efb3e51eb6a 100644 --- a/test/fuzztest/biguint64arrayrefnew_fuzzer/biguint64arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/biguint64arrayrefnew_fuzzer/biguint64arrayrefnew_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void BigUint64ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/booleanrefnewbool_fuzzer/booleanrefnewbool_fuzzer.cpp b/test/fuzztest/booleanrefnewbool_fuzzer/booleanrefnewbool_fuzzer.cpp index c3daad3d0a8fe74eff1e264833e7ebd181b419d6..d9d99d6db9c92374f92fa3c71f8d9ca78259f2ec 100644 --- a/test/fuzztest/booleanrefnewbool_fuzzer/booleanrefnewbool_fuzzer.cpp +++ b/test/fuzztest/booleanrefnewbool_fuzzer/booleanrefnewbool_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void BooleanRefNewBoolFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/booleanrefvalue_fuzzer/booleanrefvalue_fuzzer.cpp b/test/fuzztest/booleanrefvalue_fuzzer/booleanrefvalue_fuzzer.cpp index 95316f4c3c0bf6fd22c973eb01e6f58750f519e5..560807ab820df322c28c282bc26218d7be489584 100644 --- a/test/fuzztest/booleanrefvalue_fuzzer/booleanrefvalue_fuzzer.cpp +++ b/test/fuzztest/booleanrefvalue_fuzzer/booleanrefvalue_fuzzer.cpp @@ -32,7 +32,7 @@ constexpr size_t NODE_NUMBERS = 2; void BooleanRefValueFuzzerTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/bufferrefnew_fuzzer/bufferrefnew_fuzzer.cpp b/test/fuzztest/bufferrefnew_fuzzer/bufferrefnew_fuzzer.cpp index f47de807ae93c78240fed5b70013d880b37decbb..353b01be7ea801457ae73c5a143ab5823daf5f6c 100644 --- a/test/fuzztest/bufferrefnew_fuzzer/bufferrefnew_fuzzer.cpp +++ b/test/fuzztest/bufferrefnew_fuzzer/bufferrefnew_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void BufferRefNewFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -41,7 +41,7 @@ void BufferRefMultiParamNewFuzzTest(const uint8_t *data, size_t size) return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); NativePointerCallback deleter = nullptr; BufferRef::New(vm, (void *)data, (int32_t)size, deleter, (void *)data); @@ -51,7 +51,7 @@ void BufferRefMultiParamNewFuzzTest(const uint8_t *data, size_t size) void BufferRefByteLengthFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -65,7 +65,7 @@ void BufferRefByteLengthFuzzTest([[maybe_unused]]const uint8_t *data, size_t siz void BufferRefGetBufferFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -79,7 +79,7 @@ void BufferRefGetBufferFuzzTest([[maybe_unused]]const uint8_t *data, size_t size void BufferToStringCallbackFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/buildjsstacktrace_fuzzer/buildjsstacktrace_fuzzer.cpp b/test/fuzztest/buildjsstacktrace_fuzzer/buildjsstacktrace_fuzzer.cpp index f56a7cbec1fadd26133193cceb3734440ce46dc3..6e6c2b543432d4fa83766012ac5fa23e00c0b4ec 100644 --- a/test/fuzztest/buildjsstacktrace_fuzzer/buildjsstacktrace_fuzzer.cpp +++ b/test/fuzztest/buildjsstacktrace_fuzzer/buildjsstacktrace_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void BuildJsStackTraceFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/buildnativeandJsstacktrace_fuzzer/buildnativeandJsstacktrace_fuzzer.cpp b/test/fuzztest/buildnativeandJsstacktrace_fuzzer/buildnativeandJsstacktrace_fuzzer.cpp index a6d52f93eb92a868b4300b416b2504368a5d0faf..357663e45ec24faa5a119cf0e82f4698a2771d50 100644 --- a/test/fuzztest/buildnativeandJsstacktrace_fuzzer/buildnativeandJsstacktrace_fuzzer.cpp +++ b/test/fuzztest/buildnativeandJsstacktrace_fuzzer/buildnativeandJsstacktrace_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void BuildNativeAndJsStackTraceFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); std::string path(data, data + size); if (size <= 0) { diff --git a/test/fuzztest/builtinsarraybufferallocatearraybuffer_fuzzer/builtinsarraybufferallocatearraybuffer_fuzzer.cpp b/test/fuzztest/builtinsarraybufferallocatearraybuffer_fuzzer/builtinsarraybufferallocatearraybuffer_fuzzer.cpp index 697168c20b5729d12743766610148dd13b67167c..9c52f8ec8299bbf9b3749b542ea4b322b053e88b 100644 --- a/test/fuzztest/builtinsarraybufferallocatearraybuffer_fuzzer/builtinsarraybufferallocatearraybuffer_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybufferallocatearraybuffer_fuzzer/builtinsarraybufferallocatearraybuffer_fuzzer.cpp @@ -33,7 +33,7 @@ namespace OHOS { void BuiltinsArrayBufferAllocateArrayBufferFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybufferarraybufferconstructor_fuzzer/builtinsarraybufferarraybufferconstructor_fuzzer.cpp b/test/fuzztest/builtinsarraybufferarraybufferconstructor_fuzzer/builtinsarraybufferarraybufferconstructor_fuzzer.cpp index 7314983f8e4925b280ae89b5682c851266aef0c8..36793e911beccf7e93847d73737ed214f7a017df 100644 --- a/test/fuzztest/builtinsarraybufferarraybufferconstructor_fuzzer/builtinsarraybufferarraybufferconstructor_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybufferarraybufferconstructor_fuzzer/builtinsarraybufferarraybufferconstructor_fuzzer.cpp @@ -46,7 +46,7 @@ namespace OHOS { void BuiltinsArrayBufferArrayBufferConstructorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybufferclonearraybuffer_fuzzer/builtinsarraybufferclonearraybuffer_fuzzer.cpp b/test/fuzztest/builtinsarraybufferclonearraybuffer_fuzzer/builtinsarraybufferclonearraybuffer_fuzzer.cpp index 1e659155bae4a3056a1567b41832c172e7334857..1ede3e60953a25ad24aaf09d251be9ac439f5db2 100644 --- a/test/fuzztest/builtinsarraybufferclonearraybuffer_fuzzer/builtinsarraybufferclonearraybuffer_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybufferclonearraybuffer_fuzzer/builtinsarraybufferclonearraybuffer_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferCloneArrayBufferFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybufferfastsetvalueinbuffer_fuzzer/builtinsarraybufferfastsetvalueinbuffer_fuzzer.cpp b/test/fuzztest/builtinsarraybufferfastsetvalueinbuffer_fuzzer/builtinsarraybufferfastsetvalueinbuffer_fuzzer.cpp index 61feecab306c841cf5327655df7164f6de68b4d2..a73a17c82ad5b1f008a44a65d4731b5dc5657a94 100644 --- a/test/fuzztest/builtinsarraybufferfastsetvalueinbuffer_fuzzer/builtinsarraybufferfastsetvalueinbuffer_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybufferfastsetvalueinbuffer_fuzzer/builtinsarraybufferfastsetvalueinbuffer_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferFastSetValueInBufferFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer.cpp b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer.cpp index 0b15931a508756f50972e0a4a396ed1474d0a6d2..0cedd7f6eaad4ce58b46b72acb582c2c61446b6b 100644 --- a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer/builtinsarraybuffergetvaluefrombufferforbigint_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { void BuiltinsArrayBufferGetValueFromBufferForBigIntFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer.cpp b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer.cpp index 34f55023ad52300febefd562e4665994b29bce1f..ec82661b408469367755799ea0a723a564b89005 100644 --- a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer/builtinsarraybuffergetvaluefrombufferforfloat_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferGetValueFromBufferForFloatFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer.cpp b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer.cpp index 3b4a179da5792f8ca8635dc9226c61f43cb2b944..db113ac3a5a1e383af2bed687059727d09ed3d9f 100644 --- a/test/fuzztest/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer/builtinsarraybuffergetvaluefrombufferforinteger_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferGetValueFromBufferForIntegerFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybufferisview_fuzzer/builtinsarraybufferisview_fuzzer.cpp b/test/fuzztest/builtinsarraybufferisview_fuzzer/builtinsarraybufferisview_fuzzer.cpp index b4f1e7eb0fbfac3c093c9a2badf0eeb737a8aa66..4dd27be686be72938dfc5cb7c23641b58c813c90 100644 --- a/test/fuzztest/builtinsarraybufferisview_fuzzer/builtinsarraybufferisview_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybufferisview_fuzzer/builtinsarraybufferisview_fuzzer.cpp @@ -46,7 +46,7 @@ namespace OHOS { void BuiltinsArrayBufferIsViewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybuffersetvalueinbufferforbyte_fuzzer/builtinsarraybuffersetvalueinbufferforbyte_fuzzer.cpp b/test/fuzztest/builtinsarraybuffersetvalueinbufferforbyte_fuzzer/builtinsarraybuffersetvalueinbufferforbyte_fuzzer.cpp index 1803e6def79603e478c6c7931daa969be93c0af7..0812f935f0dd48391a96d260c5bdefd956296705 100644 --- a/test/fuzztest/builtinsarraybuffersetvalueinbufferforbyte_fuzzer/builtinsarraybuffersetvalueinbufferforbyte_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybuffersetvalueinbufferforbyte_fuzzer/builtinsarraybuffersetvalueinbufferforbyte_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferSetValueInBufferForByteFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer.cpp b/test/fuzztest/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer.cpp index 3e5ebc7ab03a7b9a270e02599bd393f1d8baa67c..6a8d2a16d985209e6019bdaa5d8a7ffc8aed87df 100644 --- a/test/fuzztest/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer.cpp +++ b/test/fuzztest/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer/builtinsarraybuffersetvalueinbufferforuint8clamped_fuzzer.cpp @@ -34,7 +34,7 @@ namespace OHOS { void BuiltinsArrayBufferSetValueInBufferForUint8ClampedFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h b/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h index e723c663a4381ba37fcbb5be9cb03bb66baeb206..f6d175ae222c0c1b03e84ea7c8bfc2e161f0f0a0 100644 --- a/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h +++ b/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h @@ -84,7 +84,7 @@ public: static void ContainersDequeInsertFrontFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -136,7 +136,7 @@ public: } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -168,7 +168,7 @@ public: static void ContainersDequeGetFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -204,7 +204,7 @@ public: static void ContainersDequeGetLastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -242,7 +242,7 @@ public: static void ContainersDequeInsertEndFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -274,7 +274,7 @@ public: static void ContainersDequeHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -313,7 +313,7 @@ public: static void ContainersDequePopFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -349,7 +349,7 @@ public: static void ContainersDequePopLastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -385,7 +385,7 @@ public: static void ContainersDequeIteratorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashmapcommon_fuzzer/containershashmapcommon_fuzzer.h b/test/fuzztest/containershashmapcommon_fuzzer/containershashmapcommon_fuzzer.h index 76c970d54e5ef74a5f1b1f1b48e9589179a263ee..807737bc9847cf819872d5a4d5b884906dfd7463 100755 --- a/test/fuzztest/containershashmapcommon_fuzzer/containershashmapcommon_fuzzer.h +++ b/test/fuzztest/containershashmapcommon_fuzzer/containershashmapcommon_fuzzer.h @@ -82,7 +82,7 @@ public: JSThread *&thread) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm = JSNApi::CreateJSVM(option); thread = vm->GetAssociatedJSThread(); if (vm == nullptr || thread == nullptr) { diff --git a/test/fuzztest/containershashsetadd_fuzzer/containershashsetadd_fuzzer.cpp b/test/fuzztest/containershashsetadd_fuzzer/containershashsetadd_fuzzer.cpp index 723e391cd2656cd764550634990a4887d77d3bfa..b8cb95498d4bc4c11db8b291f42a035f98d763b8 100644 --- a/test/fuzztest/containershashsetadd_fuzzer/containershashsetadd_fuzzer.cpp +++ b/test/fuzztest/containershashsetadd_fuzzer/containershashsetadd_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetclear_fuzzer/containershashsetclear_fuzzer.cpp b/test/fuzztest/containershashsetclear_fuzzer/containershashsetclear_fuzzer.cpp index da734ab2b0d983f9ff1c81b35e63d3ca772e30c3..387588a61542f5c5fd7beb39985eae55defa6865 100644 --- a/test/fuzztest/containershashsetclear_fuzzer/containershashsetclear_fuzzer.cpp +++ b/test/fuzztest/containershashsetclear_fuzzer/containershashsetclear_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetClearFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetconstructor_fuzzer/containershashsetconstructor_fuzzer.cpp b/test/fuzztest/containershashsetconstructor_fuzzer/containershashsetconstructor_fuzzer.cpp index fe4dd139f5b41bb6b3b20bd7fc47cae25c36c0b2..ea3ada69f7812db5e473c99f14759123b18fb6f6 100644 --- a/test/fuzztest/containershashsetconstructor_fuzzer/containershashsetconstructor_fuzzer.cpp +++ b/test/fuzztest/containershashsetconstructor_fuzzer/containershashsetconstructor_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetConstructorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetentries_fuzzer/containershashsetentries_fuzzer.cpp b/test/fuzztest/containershashsetentries_fuzzer/containershashsetentries_fuzzer.cpp index 732fe77cf1728aaf4bc45089442a17c35a94bb22..ee2d368088ecd08557413b440a57720f9c745e07 100644 --- a/test/fuzztest/containershashsetentries_fuzzer/containershashsetentries_fuzzer.cpp +++ b/test/fuzztest/containershashsetentries_fuzzer/containershashsetentries_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetEntriesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetforeach_fuzzer/containershashsetforeach_fuzzer.cpp b/test/fuzztest/containershashsetforeach_fuzzer/containershashsetforeach_fuzzer.cpp index 4af60e53ce49e0e7637159b0ab8c799950cbb2ea..4ad1dbb23f65894735aa6c2f6e44fd7ddfc02aa5 100644 --- a/test/fuzztest/containershashsetforeach_fuzzer/containershashsetforeach_fuzzer.cpp +++ b/test/fuzztest/containershashsetforeach_fuzzer/containershashsetforeach_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersHashSetForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetgetlength_fuzzer/containershashsetgetlength_fuzzer.cpp b/test/fuzztest/containershashsetgetlength_fuzzer/containershashsetgetlength_fuzzer.cpp index c126e0a204186d358abc6787f30630163ec9738c..4dd19abb9b23f5600178234281090f9ad4596079 100644 --- a/test/fuzztest/containershashsetgetlength_fuzzer/containershashsetgetlength_fuzzer.cpp +++ b/test/fuzztest/containershashsetgetlength_fuzzer/containershashsetgetlength_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetGetLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsethas_fuzzer/containershashsethas_fuzzer.cpp b/test/fuzztest/containershashsethas_fuzzer/containershashsethas_fuzzer.cpp index 87363808d546a9b2ccc229123054da1b6fbbb68d..31ddb2264084a455161f84ef607e13cc61970ecf 100644 --- a/test/fuzztest/containershashsethas_fuzzer/containershashsethas_fuzzer.cpp +++ b/test/fuzztest/containershashsethas_fuzzer/containershashsethas_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetisempty_fuzzer/containershashsetisempty_fuzzer.cpp b/test/fuzztest/containershashsetisempty_fuzzer/containershashsetisempty_fuzzer.cpp index 24f09fd7c4872f9c0984e0adc73e081f1059c3dd..8a47fd334c69e9aa6857dfdc44ff2a9ccdeb38ea 100644 --- a/test/fuzztest/containershashsetisempty_fuzzer/containershashsetisempty_fuzzer.cpp +++ b/test/fuzztest/containershashsetisempty_fuzzer/containershashsetisempty_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetIsEmptyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetremove_fuzzer/containershashsetremove_fuzzer.cpp b/test/fuzztest/containershashsetremove_fuzzer/containershashsetremove_fuzzer.cpp index 0d6b77e426c4292d9df5fbfd2c6a2e18e1d64620..9dca032c77530b1e86b7dcc0ebfa235a91ceb6e9 100644 --- a/test/fuzztest/containershashsetremove_fuzzer/containershashsetremove_fuzzer.cpp +++ b/test/fuzztest/containershashsetremove_fuzzer/containershashsetremove_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containershashsetvalues_fuzzer/containershashsetvalues_fuzzer.cpp b/test/fuzztest/containershashsetvalues_fuzzer/containershashsetvalues_fuzzer.cpp index 195ea72a3eed3fad9d2b06f85dfd5a2e96b4caf7..090c5f6e63d490d0b0a2842b6d2f432d98b7d163 100644 --- a/test/fuzztest/containershashsetvalues_fuzzer/containershashsetvalues_fuzzer.cpp +++ b/test/fuzztest/containershashsetvalues_fuzzer/containershashsetvalues_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersHashSetValuesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmap_fuzzer/containerslightweightmap_fuzzer.cpp b/test/fuzztest/containerslightweightmap_fuzzer/containerslightweightmap_fuzzer.cpp index 8418a545801203bcb4b43d0df457d0aa8fc7167f..b5210d0437a4c6b9a72c469b724dfe01b8ea11eb 100644 --- a/test/fuzztest/containerslightweightmap_fuzzer/containerslightweightmap_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmap_fuzzer/containerslightweightmap_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapat_fuzzer/containerslightweightmapat_fuzzer.cpp b/test/fuzztest/containerslightweightmapat_fuzzer/containerslightweightmapat_fuzzer.cpp index 71e2d38d098ccdbbd9e1579c75a9868dc4d6711a..425a4d2104fb6beaa3d14018c55388d9cd488793 100644 --- a/test/fuzztest/containerslightweightmapat_fuzzer/containerslightweightmapat_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapat_fuzzer/containerslightweightmapat_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapAtFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapclear_fuzzer/containerslightweightmapclear_fuzzer.cpp b/test/fuzztest/containerslightweightmapclear_fuzzer/containerslightweightmapclear_fuzzer.cpp index 2319051cf901d6142753e7bfa990b479d0ef9bc2..d693074883c3f4fe3dda2bc5caa1caa4805f0043 100644 --- a/test/fuzztest/containerslightweightmapclear_fuzzer/containerslightweightmapclear_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapclear_fuzzer/containerslightweightmapclear_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapClearFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapentries_fuzzer/containerslightweightmapentries_fuzzer.cpp b/test/fuzztest/containerslightweightmapentries_fuzzer/containerslightweightmapentries_fuzzer.cpp index 187e329e46f0474a71520e6ba410aff8c3c0ff57..61b2e53c0a94c3f515383405b672386706936ff3 100644 --- a/test/fuzztest/containerslightweightmapentries_fuzzer/containerslightweightmapentries_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapentries_fuzzer/containerslightweightmapentries_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapEntriesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapforeach_fuzzer/containerslightweightmapforeach_fuzzer.cpp b/test/fuzztest/containerslightweightmapforeach_fuzzer/containerslightweightmapforeach_fuzzer.cpp index 27d4819d37a7dd086d8a67d51707f9338911c5da..c97f19d934a947a6538fcef3473d23cd13a59b6f 100644 --- a/test/fuzztest/containerslightweightmapforeach_fuzzer/containerslightweightmapforeach_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapforeach_fuzzer/containerslightweightmapforeach_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmaphasall_fuzzer/containerslightweightmaphasall_fuzzer.cpp b/test/fuzztest/containerslightweightmaphasall_fuzzer/containerslightweightmaphasall_fuzzer.cpp index c80d5682a1e3af35d9f931feb6281be06e51e657..b39b984696e2a7988254f4d9f558e11f21aa7daf 100644 --- a/test/fuzztest/containerslightweightmaphasall_fuzzer/containerslightweightmaphasall_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmaphasall_fuzzer/containerslightweightmaphasall_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapHasAllhFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapisempty_fuzzer/containerslightweightmapisempty_fuzzer.cpp b/test/fuzztest/containerslightweightmapisempty_fuzzer/containerslightweightmapisempty_fuzzer.cpp index 23d6b8fffce82a470c8701c72bb857882478e23d..bbe1151feeef3a49a84e67bdb33ea0e5e99bf7fe 100644 --- a/test/fuzztest/containerslightweightmapisempty_fuzzer/containerslightweightmapisempty_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapisempty_fuzzer/containerslightweightmapisempty_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapIsEmptyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapkeys_fuzzer/containerslightweightmapkeys_fuzzer.cpp b/test/fuzztest/containerslightweightmapkeys_fuzzer/containerslightweightmapkeys_fuzzer.cpp index 0c131d286acdacf76d05ddc614a6114ef9bae7ce..87f639420735e4ee5f245b4214286e284e7cc7bb 100644 --- a/test/fuzztest/containerslightweightmapkeys_fuzzer/containerslightweightmapkeys_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapkeys_fuzzer/containerslightweightmapkeys_fuzzer.cpp @@ -84,7 +84,7 @@ namespace OHOS { void ContainersLightWeightMapKeysFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmaplength_fuzzer/containerslightweightmaplength_fuzzer.cpp b/test/fuzztest/containerslightweightmaplength_fuzzer/containerslightweightmaplength_fuzzer.cpp index 55b382002a52844104cd6b4519604fb891a71f8d..8913dbfedcc9830350e4afddd72b25ba9011b461 100644 --- a/test/fuzztest/containerslightweightmaplength_fuzzer/containerslightweightmaplength_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmaplength_fuzzer/containerslightweightmaplength_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapremove_fuzzer/containerslightweightmapremove_fuzzer.cpp b/test/fuzztest/containerslightweightmapremove_fuzzer/containerslightweightmapremove_fuzzer.cpp index 9a971907bd97439dd640ed546593866924d9c89c..74aacfdb6bdcdfd5bf5320aa70b4ab52649d2b2e 100644 --- a/test/fuzztest/containerslightweightmapremove_fuzzer/containerslightweightmapremove_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapremove_fuzzer/containerslightweightmapremove_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapsetall_fuzzer/containerslightweightmapsetall_fuzzer.cpp b/test/fuzztest/containerslightweightmapsetall_fuzzer/containerslightweightmapsetall_fuzzer.cpp index 2dd52e9deecf9790c42a6877a9108fc9ddb3c911..1deb7d051966e43250e453b2af886c9b88d49e11 100644 --- a/test/fuzztest/containerslightweightmapsetall_fuzzer/containerslightweightmapsetall_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapsetall_fuzzer/containerslightweightmapsetall_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapSetAllFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapsetandget_fuzzer/containerslightweightmapsetandget_fuzzer.cpp b/test/fuzztest/containerslightweightmapsetandget_fuzzer/containerslightweightmapsetandget_fuzzer.cpp index e876db85e43747f805c717a6504d30592b51c3c1..b76f68ad21fed8012eb12a632292312aa30910d3 100644 --- a/test/fuzztest/containerslightweightmapsetandget_fuzzer/containerslightweightmapsetandget_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapsetandget_fuzzer/containerslightweightmapsetandget_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapSetAndGetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmaptostring_fuzzer/containerslightweightmaptostring_fuzzer.cpp b/test/fuzztest/containerslightweightmaptostring_fuzzer/containerslightweightmaptostring_fuzzer.cpp index 39293b97dee76aa1c4d34292908210c8de364efd..2f7fd612934fa71c78ecdc7f7b761653a45d25a8 100644 --- a/test/fuzztest/containerslightweightmaptostring_fuzzer/containerslightweightmaptostring_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmaptostring_fuzzer/containerslightweightmaptostring_fuzzer.cpp @@ -82,7 +82,7 @@ namespace OHOS { void ContainersLightWeightMapToStringFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightmapvalues_fuzzer/containerslightweightmapvalues_fuzzer.cpp b/test/fuzztest/containerslightweightmapvalues_fuzzer/containerslightweightmapvalues_fuzzer.cpp index ebcf3cb9f1ef76c3984ac81764350445ff48979a..d31ae5cf30920b78c585ff871dfff79f22e7cd67 100644 --- a/test/fuzztest/containerslightweightmapvalues_fuzzer/containerslightweightmapvalues_fuzzer.cpp +++ b/test/fuzztest/containerslightweightmapvalues_fuzzer/containerslightweightmapvalues_fuzzer.cpp @@ -84,7 +84,7 @@ namespace OHOS { void ContainersLightWeightMapValuesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightset_fuzzer/containerslightweightset_fuzzer.cpp b/test/fuzztest/containerslightweightset_fuzzer/containerslightweightset_fuzzer.cpp index 8c01ed219f82b2f0130886b01b5254394f7603b1..4812023a9f9c39c67aceb74514b5a0917c24728a 100644 --- a/test/fuzztest/containerslightweightset_fuzzer/containerslightweightset_fuzzer.cpp +++ b/test/fuzztest/containerslightweightset_fuzzer/containerslightweightset_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetadd_fuzzer/containerslightweightsetadd_fuzzer.cpp b/test/fuzztest/containerslightweightsetadd_fuzzer/containerslightweightsetadd_fuzzer.cpp index a9d6e384c3e747c7dd128cf2a2b8626fa16b37fd..c908bf9f8fa0b63b711d18d9fa5e8de9ed5a2a6e 100644 --- a/test/fuzztest/containerslightweightsetadd_fuzzer/containerslightweightsetadd_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetadd_fuzzer/containerslightweightsetadd_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetaddall_fuzzer/containerslightweightsetaddall_fuzzer.cpp b/test/fuzztest/containerslightweightsetaddall_fuzzer/containerslightweightsetaddall_fuzzer.cpp index a36850a787fff231c849dc0e78aeb6edb1435917..9e7ef221b4a32af076de535ac4aeb3c775e103b3 100644 --- a/test/fuzztest/containerslightweightsetaddall_fuzzer/containerslightweightsetaddall_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetaddall_fuzzer/containerslightweightsetaddall_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetclear_fuzzer/containerslightweightsetclear_fuzzer.cpp b/test/fuzztest/containerslightweightsetclear_fuzzer/containerslightweightsetclear_fuzzer.cpp index e57e0fc5804800505ecfd27fc125f7f7e0f9032d..0244e9353b2b04b45491a8d41f3e0396ca4574d8 100644 --- a/test/fuzztest/containerslightweightsetclear_fuzzer/containerslightweightsetclear_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetclear_fuzzer/containerslightweightsetclear_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetentries_fuzzer/containerslightweightsetentries_fuzzer.cpp b/test/fuzztest/containerslightweightsetentries_fuzzer/containerslightweightsetentries_fuzzer.cpp index a710186fa4b849f5b7600a8cfac69050a05f5168..b9c105f4a12d188867da58b6c12a45746c04b635 100644 --- a/test/fuzztest/containerslightweightsetentries_fuzzer/containerslightweightsetentries_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetentries_fuzzer/containerslightweightsetentries_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetequal_fuzzer/containerslightweightsetequal_fuzzer.cpp b/test/fuzztest/containerslightweightsetequal_fuzzer/containerslightweightsetequal_fuzzer.cpp index 2f36bd3a344b51bc82e42499345ab4033d48559b..933471ebb8739c013afb514ce93592837737fa1e 100644 --- a/test/fuzztest/containerslightweightsetequal_fuzzer/containerslightweightsetequal_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetequal_fuzzer/containerslightweightsetequal_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetforeach_fuzzer/containerslightweightsetforeach_fuzzer.cpp b/test/fuzztest/containerslightweightsetforeach_fuzzer/containerslightweightsetforeach_fuzzer.cpp index 8ae52ed3afdc7b8fc400345b358319791635ba5d..0c2cff1b7f9018344e4e1f25229e1728c4122c9c 100644 --- a/test/fuzztest/containerslightweightsetforeach_fuzzer/containerslightweightsetforeach_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetforeach_fuzzer/containerslightweightsetforeach_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetgetindexof_fuzzer/containerslightweightsetgetindexof_fuzzer.cpp b/test/fuzztest/containerslightweightsetgetindexof_fuzzer/containerslightweightsetgetindexof_fuzzer.cpp index c3494d2f21647368fd8d802eb0f2f79e0b21b5f4..53610f0387753d1009755653e07c86a9373a02a8 100644 --- a/test/fuzztest/containerslightweightsetgetindexof_fuzzer/containerslightweightsetgetindexof_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetgetindexof_fuzzer/containerslightweightsetgetindexof_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetgetiteratorobj_fuzzer/containerslightweightsetgetiteratorobj_fuzzer.cpp b/test/fuzztest/containerslightweightsetgetiteratorobj_fuzzer/containerslightweightsetgetiteratorobj_fuzzer.cpp index 410833ba964ca2337600257090ffc118f33f7bd6..383b902978e6ce9b1862389fb611d8b56a67b2a5 100644 --- a/test/fuzztest/containerslightweightsetgetiteratorobj_fuzzer/containerslightweightsetgetiteratorobj_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetgetiteratorobj_fuzzer/containerslightweightsetgetiteratorobj_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetgetsize_fuzzer/containerslightweightsetgetsize_fuzzer.cpp b/test/fuzztest/containerslightweightsetgetsize_fuzzer/containerslightweightsetgetsize_fuzzer.cpp index a6107eaa844c007d3ce04747a85132be520da9d0..b389113aa7108aa1e5e1fd4fd2962c34a5997292 100644 --- a/test/fuzztest/containerslightweightsetgetsize_fuzzer/containerslightweightsetgetsize_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetgetsize_fuzzer/containerslightweightsetgetsize_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetgetvalueat_fuzzer/containerslightweightsetgetvalueat_fuzzer.cpp b/test/fuzztest/containerslightweightsetgetvalueat_fuzzer/containerslightweightsetgetvalueat_fuzzer.cpp index b2101ff69f19f7d004ad0b20e8c286db496af2fb..bdf593b7b0eef44988d341f4eac3bd6bc4cdf5b1 100644 --- a/test/fuzztest/containerslightweightsetgetvalueat_fuzzer/containerslightweightsetgetvalueat_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetgetvalueat_fuzzer/containerslightweightsetgetvalueat_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsethas_fuzzer/containerslightweightsethas_fuzzer.cpp b/test/fuzztest/containerslightweightsethas_fuzzer/containerslightweightsethas_fuzzer.cpp index 4602f5f528be120068b6b6b6e27d51ee014772d3..3950e8ee4edf2afec74562ec881722548d956ba8 100644 --- a/test/fuzztest/containerslightweightsethas_fuzzer/containerslightweightsethas_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsethas_fuzzer/containerslightweightsethas_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsethasall_fuzzer/containerslightweightsethasall_fuzzer.cpp b/test/fuzztest/containerslightweightsethasall_fuzzer/containerslightweightsethasall_fuzzer.cpp index 38da43b17c9c136967bffa132b40d84f0c2a4c02..ebab96cd4b2b56c5649dc348a06e22b3836c5565 100644 --- a/test/fuzztest/containerslightweightsethasall_fuzzer/containerslightweightsethasall_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsethasall_fuzzer/containerslightweightsethasall_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsethashash_fuzzer/containerslightweightsethashash_fuzzer.cpp b/test/fuzztest/containerslightweightsethashash_fuzzer/containerslightweightsethashash_fuzzer.cpp index 8df8b28971b9d57738d96bc97db06ae3c6773b81..a2e714c6efe68d185f3094cda4cad5c14beb3564 100644 --- a/test/fuzztest/containerslightweightsethashash_fuzzer/containerslightweightsethashash_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsethashash_fuzzer/containerslightweightsethashash_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetisempty_fuzzer/containerslightweightsetisempty_fuzzer.cpp b/test/fuzztest/containerslightweightsetisempty_fuzzer/containerslightweightsetisempty_fuzzer.cpp index e0f48d05632862a425697223150d2d60bd79ecd2..2bf15c6501de26f1c75745d209791b5684349e51 100644 --- a/test/fuzztest/containerslightweightsetisempty_fuzzer/containerslightweightsetisempty_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetisempty_fuzzer/containerslightweightsetisempty_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetremove_fuzzer/containerslightweightsetremove_fuzzer.cpp b/test/fuzztest/containerslightweightsetremove_fuzzer/containerslightweightsetremove_fuzzer.cpp index 70d54e57981dc438eb8f475d5262f8f0dfb8b2d9..54e70e86b626e3e1b65f6d5d122fb2dd1979e24f 100644 --- a/test/fuzztest/containerslightweightsetremove_fuzzer/containerslightweightsetremove_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetremove_fuzzer/containerslightweightsetremove_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsettoarray_fuzzer/containerslightweightsettoarray_fuzzer.cpp b/test/fuzztest/containerslightweightsettoarray_fuzzer/containerslightweightsettoarray_fuzzer.cpp index b05cdc14530add458248329c3ff8ac35ed27a2e8..a01854c48617e96bf896b0928ff4929ea58cfb50 100644 --- a/test/fuzztest/containerslightweightsettoarray_fuzzer/containerslightweightsettoarray_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsettoarray_fuzzer/containerslightweightsettoarray_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsettostring_fuzzer/containerslightweightsettostring_fuzzer.cpp b/test/fuzztest/containerslightweightsettostring_fuzzer/containerslightweightsettostring_fuzzer.cpp index 3fb8095d07c2d238d932d2a3c3ccb617acabe4d7..ed5bb45fd47ddc5977ae012c134140405687d708 100644 --- a/test/fuzztest/containerslightweightsettostring_fuzzer/containerslightweightsettostring_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsettostring_fuzzer/containerslightweightsettostring_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslightweightsetvalues_fuzzer/containerslightweightsetvalues_fuzzer.cpp b/test/fuzztest/containerslightweightsetvalues_fuzzer/containerslightweightsetvalues_fuzzer.cpp index 8772c281ecea9b5924a64a49c059581a67987ec6..b061c7a3795b551c210ad965e864edc7494ae5ec 100644 --- a/test/fuzztest/containerslightweightsetvalues_fuzzer/containerslightweightsetvalues_fuzzer.cpp +++ b/test/fuzztest/containerslightweightsetvalues_fuzzer/containerslightweightsetvalues_fuzzer.cpp @@ -79,7 +79,7 @@ namespace OHOS { void ContainersLightWeightSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslinkedlistcommon_fuzzer/containerslinkedlistcommon_fuzzer.h b/test/fuzztest/containerslinkedlistcommon_fuzzer/containerslinkedlistcommon_fuzzer.h index 8ad99b8816468ab444b365a200ec029749110e43..c1d41fba1d328f7fd08f348975bc85bc0a83352d 100644 --- a/test/fuzztest/containerslinkedlistcommon_fuzzer/containerslinkedlistcommon_fuzzer.h +++ b/test/fuzztest/containerslinkedlistcommon_fuzzer/containerslinkedlistcommon_fuzzer.h @@ -107,7 +107,7 @@ public: static void ContainersLinkedListAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -132,7 +132,7 @@ public: static void ContainersLinkedListGetFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -162,7 +162,7 @@ public: static void ContainersLinkedListGetLastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -192,7 +192,7 @@ public: static void ContainersLinkedListAddFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -222,7 +222,7 @@ public: static void ContainersLinkedListClearFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -252,7 +252,7 @@ public: static void ContainersLinkedListCloneFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -282,7 +282,7 @@ public: static void ContainersLinkedListGetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -324,7 +324,7 @@ public: static void ContainersLinkedListGetIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -355,7 +355,7 @@ public: static void ContainersLinkedListGetLastIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -386,7 +386,7 @@ public: static void ContainersLinkedListHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -417,7 +417,7 @@ public: static void ContainersLinkedListInsertFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -448,7 +448,7 @@ public: static void ContainersLinkedListRemoveByIndexFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -489,7 +489,7 @@ public: static void ContainersLinkedListRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -520,7 +520,7 @@ public: static void ContainersLinkedListRemoveFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -550,7 +550,7 @@ public: static void ContainersLinkedListRemoveLastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -580,7 +580,7 @@ public: static void ContainersLinkedListRemoveFirstFoundFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -611,7 +611,7 @@ public: static void ContainersLinkedListRemoveLastFoundFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -642,7 +642,7 @@ public: static void ContainersLinkedListSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -673,7 +673,7 @@ public: static void ContainersLinkedListLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -703,7 +703,7 @@ public: static void ContainersLinkedListConvertToArrayFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -733,7 +733,7 @@ public: static void ContainersLinkedListForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -770,7 +770,7 @@ public: static void ContainersLinkedListGetIteratorObjFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistadd_fuzzer/containerslistadd_fuzzer.cpp b/test/fuzztest/containerslistadd_fuzzer/containerslistadd_fuzzer.cpp index 723184044c2c0b69d10a8d1e41bfdbebe44de859..cb2d30b0ac9013ab811864ba13a1b729bc716104 100644 --- a/test/fuzztest/containerslistadd_fuzzer/containerslistadd_fuzzer.cpp +++ b/test/fuzztest/containerslistadd_fuzzer/containerslistadd_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistclear_fuzzer/containerslistclear_fuzzer.cpp b/test/fuzztest/containerslistclear_fuzzer/containerslistclear_fuzzer.cpp index 0abde171e58da62ece7dae3885c0b4ec83978a7e..5d53294c0d1d6c4740608378607f21e1e6bf402c 100644 --- a/test/fuzztest/containerslistclear_fuzzer/containerslistclear_fuzzer.cpp +++ b/test/fuzztest/containerslistclear_fuzzer/containerslistclear_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistClearFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistconstructor_fuzzer/containerslistconstructor_fuzzer.cpp b/test/fuzztest/containerslistconstructor_fuzzer/containerslistconstructor_fuzzer.cpp index 62d2c2b9d117e5f3b88b8151e6ba2fed279401b1..890f5cee697f0f92a8203177bd6d2c547edf1303 100644 --- a/test/fuzztest/containerslistconstructor_fuzzer/containerslistconstructor_fuzzer.cpp +++ b/test/fuzztest/containerslistconstructor_fuzzer/containerslistconstructor_fuzzer.cpp @@ -80,7 +80,7 @@ namespace OHOS { void ContainerslistConStructorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistconverttoarray_fuzzer/containerslistconverttoarray_fuzzer.cpp b/test/fuzztest/containerslistconverttoarray_fuzzer/containerslistconverttoarray_fuzzer.cpp index 62ae9a889aa11c8099c292c804f9687e66695acf..2877888d078696bb5fa4f3ba3f135cb6842342bb 100644 --- a/test/fuzztest/containerslistconverttoarray_fuzzer/containerslistconverttoarray_fuzzer.cpp +++ b/test/fuzztest/containerslistconverttoarray_fuzzer/containerslistconverttoarray_fuzzer.cpp @@ -68,7 +68,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -106,7 +106,7 @@ namespace OHOS { void ContainerslistConvertToArrayFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistequal_fuzzer/containerslistequal_fuzzer.cpp b/test/fuzztest/containerslistequal_fuzzer/containerslistequal_fuzzer.cpp index 43d43e06f1119be4c405af64e320c2308e632413..1f0101072e362585157ab2db900ec337afb62e04 100644 --- a/test/fuzztest/containerslistequal_fuzzer/containerslistequal_fuzzer.cpp +++ b/test/fuzztest/containerslistequal_fuzzer/containerslistequal_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -104,7 +104,7 @@ namespace OHOS { void ContainerslistEqualFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistforeach_fuzzer/containerslistforeach_fuzzer.cpp b/test/fuzztest/containerslistforeach_fuzzer/containerslistforeach_fuzzer.cpp index 5d0b391ae87888e17481b1c185f5bc2a805a32a4..29d08fe3aafe1560f13db03b0e7c966fa536ef6a 100644 --- a/test/fuzztest/containerslistforeach_fuzzer/containerslistforeach_fuzzer.cpp +++ b/test/fuzztest/containerslistforeach_fuzzer/containerslistforeach_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistget_fuzzer/containerslistget_fuzzer.cpp b/test/fuzztest/containerslistget_fuzzer/containerslistget_fuzzer.cpp index eef9facce70c2e77add55a6c3ef689606854348e..9a00dddbab2fce594b5edb0fa857747543e8916b 100644 --- a/test/fuzztest/containerslistget_fuzzer/containerslistget_fuzzer.cpp +++ b/test/fuzztest/containerslistget_fuzzer/containerslistget_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -104,7 +104,7 @@ namespace OHOS { void ContainerslistGetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistgetindexof_fuzzer/containerslistgetindexof_fuzzer.cpp b/test/fuzztest/containerslistgetindexof_fuzzer/containerslistgetindexof_fuzzer.cpp index fa820189ed91a296a89c6c382b49e2dd3db466ad..d236a24a50bffdada7f80d009209701de39844db 100644 --- a/test/fuzztest/containerslistgetindexof_fuzzer/containerslistgetindexof_fuzzer.cpp +++ b/test/fuzztest/containerslistgetindexof_fuzzer/containerslistgetindexof_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistGetIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistgetiteratorobj_fuzzer/containerslistgetiteratorobj_fuzzer.cpp b/test/fuzztest/containerslistgetiteratorobj_fuzzer/containerslistgetiteratorobj_fuzzer.cpp index 23aefaa08f4a69684fe3da155d32d4f49934a667..b4df06c827e61394f6d486d9cda4b971dff47681 100644 --- a/test/fuzztest/containerslistgetiteratorobj_fuzzer/containerslistgetiteratorobj_fuzzer.cpp +++ b/test/fuzztest/containerslistgetiteratorobj_fuzzer/containerslistgetiteratorobj_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -104,7 +104,7 @@ namespace OHOS { void ContainerslistGetIteratorObjFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistgetlastindexof_fuzzer/containerslistgetlastindexof_fuzzer.cpp b/test/fuzztest/containerslistgetlastindexof_fuzzer/containerslistgetlastindexof_fuzzer.cpp index 8c3afef6cd07f422f70306d9ea63e988bac240f0..71ae2395b5bbf1738dd769a057c14794bd7641d8 100644 --- a/test/fuzztest/containerslistgetlastindexof_fuzzer/containerslistgetlastindexof_fuzzer.cpp +++ b/test/fuzztest/containerslistgetlastindexof_fuzzer/containerslistgetlastindexof_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistGetLastIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistgetsublist_fuzzer/containerslistgetsublist_fuzzer.cpp b/test/fuzztest/containerslistgetsublist_fuzzer/containerslistgetsublist_fuzzer.cpp index 6ba16d3c7a63663589cfed682f92603a21ef45db..0cdba9e14fc7e55938f858bd5af23c690903ac8f 100644 --- a/test/fuzztest/containerslistgetsublist_fuzzer/containerslistgetsublist_fuzzer.cpp +++ b/test/fuzztest/containerslistgetsublist_fuzzer/containerslistgetsublist_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -104,7 +104,7 @@ namespace OHOS { void ContainerslistGetSubListFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslisthas_fuzzer/containerslisthas_fuzzer.cpp b/test/fuzztest/containerslisthas_fuzzer/containerslisthas_fuzzer.cpp index c087604d9a5c46170f083f3e0a928ab5791db858..ff80fa5aa6f3219c648f9faa1c139fb8957b64d9 100644 --- a/test/fuzztest/containerslisthas_fuzzer/containerslisthas_fuzzer.cpp +++ b/test/fuzztest/containerslisthas_fuzzer/containerslisthas_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistinsert_fuzzer/containerslistinsert_fuzzer.cpp b/test/fuzztest/containerslistinsert_fuzzer/containerslistinsert_fuzzer.cpp index 29404f941ea0ed5c0b5f762f1d01ad0500d0d2ca..dd82716dc8aaee43ce9fd1f489f48f06a2afa79b 100644 --- a/test/fuzztest/containerslistinsert_fuzzer/containerslistinsert_fuzzer.cpp +++ b/test/fuzztest/containerslistinsert_fuzzer/containerslistinsert_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistInsertFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistisempty_fuzzer/containerslistisempty_fuzzer.cpp b/test/fuzztest/containerslistisempty_fuzzer/containerslistisempty_fuzzer.cpp index 2309f970a3d4273d2bff01b492c53346d5f77f66..b4f701986d7c20819503a75accee7d1bb5e66007 100644 --- a/test/fuzztest/containerslistisempty_fuzzer/containerslistisempty_fuzzer.cpp +++ b/test/fuzztest/containerslistisempty_fuzzer/containerslistisempty_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistIsemptyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistlength_fuzzer/containerslistlength_fuzzer.cpp b/test/fuzztest/containerslistlength_fuzzer/containerslistlength_fuzzer.cpp index 077c2b01a6651ba6c89f24c50e9bc342f1527e80..eaa20f48631ab106de5ac750b55230334a1ed136 100644 --- a/test/fuzztest/containerslistlength_fuzzer/containerslistlength_fuzzer.cpp +++ b/test/fuzztest/containerslistlength_fuzzer/containerslistlength_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -104,7 +104,7 @@ namespace OHOS { void ContainerslistLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistremove_fuzzer/containerslistremove_fuzzer.cpp b/test/fuzztest/containerslistremove_fuzzer/containerslistremove_fuzzer.cpp index a4744bd7c4f2305ce7c807f1de59682b06c52dc4..17c1c37b049bd788a3734cb4bc54b8935faf0fa0 100644 --- a/test/fuzztest/containerslistremove_fuzzer/containerslistremove_fuzzer.cpp +++ b/test/fuzztest/containerslistremove_fuzzer/containerslistremove_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistremovebyindex_fuzzer/containerslistremovebyindex_fuzzer.cpp b/test/fuzztest/containerslistremovebyindex_fuzzer/containerslistremovebyindex_fuzzer.cpp index 56be0a57cdcaef09c380ffd4d60c6c5a071f28f8..432d1b97e8b3c6ec0baa76cbfbc9136799576333 100644 --- a/test/fuzztest/containerslistremovebyindex_fuzzer/containerslistremovebyindex_fuzzer.cpp +++ b/test/fuzztest/containerslistremovebyindex_fuzzer/containerslistremovebyindex_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistRemoveByIndexFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistset_fuzzer/containerslistset_fuzzer.cpp b/test/fuzztest/containerslistset_fuzzer/containerslistset_fuzzer.cpp index f8efe59ad6fb0e1704cfbb21ac1cb4a2ba94062a..9e1936b101e12a968dc49a368ab4f13e9f370d58 100644 --- a/test/fuzztest/containerslistset_fuzzer/containerslistset_fuzzer.cpp +++ b/test/fuzztest/containerslistset_fuzzer/containerslistset_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerslistsort_fuzzer/containerslistsort_fuzzer.cpp b/test/fuzztest/containerslistsort_fuzzer/containerslistsort_fuzzer.cpp index 949474bb8b0d5559e65c19e2b5c7102a1aaa7866..a1010535e4aaa44fb685618fe2925cc0b23ed4f5 100644 --- a/test/fuzztest/containerslistsort_fuzzer/containerslistsort_fuzzer.cpp +++ b/test/fuzztest/containerslistsort_fuzzer/containerslistsort_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainerslistSortFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp b/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp index 00ab6ebcac6403a8ab4ad09b8f6aa13d0f9d4a7e..14763537ac6d7d00bb18175cb1b66102ad6d805c 100644 --- a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp +++ b/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp @@ -84,7 +84,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -115,7 +115,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -162,7 +162,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -203,7 +203,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -244,7 +244,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -286,7 +286,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -339,7 +339,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -385,7 +385,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -426,7 +426,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -469,7 +469,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -512,7 +512,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -553,7 +553,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -595,7 +595,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -637,7 +637,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -679,7 +679,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -723,7 +723,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -766,7 +766,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -808,7 +808,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersprivatecommon_fuzzer/containersprivatecommon_fuzzer.h b/test/fuzztest/containersprivatecommon_fuzzer/containersprivatecommon_fuzzer.h index 10bbf5f6510689a9811dce9a71053d85d10ae7af..d4b8dc7ab30e70283cfb28bbe958150e2c2e1d6d 100644 --- a/test/fuzztest/containersprivatecommon_fuzzer/containersprivatecommon_fuzzer.h +++ b/test/fuzztest/containersprivatecommon_fuzzer/containersprivatecommon_fuzzer.h @@ -49,7 +49,7 @@ public: static void ContainersPrivateCommonFuzzTest([[maybe_unused]] const uint8_t* data, size_t size, uint8_t tag) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueue_fuzzer/containersqueue_fuzzer.cpp b/test/fuzztest/containersqueue_fuzzer/containersqueue_fuzzer.cpp index bd1c8e1c3e3cd4b2da11dbc530cbdbd9ab9eb66e..680e260478735fd0a798e5ed62fd402aba4e4fa7 100644 --- a/test/fuzztest/containersqueue_fuzzer/containersqueue_fuzzer.cpp +++ b/test/fuzztest/containersqueue_fuzzer/containersqueue_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueueadd_fuzzer/containersqueueadd_fuzzer.cpp b/test/fuzztest/containersqueueadd_fuzzer/containersqueueadd_fuzzer.cpp index 2a6df5c1541a60b8820e11cb5fd396440cb2f68f..30910d648a48c1bb1252494af75e646935c0b1f5 100644 --- a/test/fuzztest/containersqueueadd_fuzzer/containersqueueadd_fuzzer.cpp +++ b/test/fuzztest/containersqueueadd_fuzzer/containersqueueadd_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueueAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueueforeach_fuzzer/containersqueueforeach_fuzzer.cpp b/test/fuzztest/containersqueueforeach_fuzzer/containersqueueforeach_fuzzer.cpp index 2be3013fda7d9c4566bf7d54c8ec7290bfdfa18a..864730a8135320aaaa7146ed357917b4c55d41c7 100644 --- a/test/fuzztest/containersqueueforeach_fuzzer/containersqueueforeach_fuzzer.cpp +++ b/test/fuzztest/containersqueueforeach_fuzzer/containersqueueforeach_fuzzer.cpp @@ -86,7 +86,7 @@ namespace OHOS { void ContainersQueueForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueuegetfirst_fuzzer/containersqueuegetfirst_fuzzer.cpp b/test/fuzztest/containersqueuegetfirst_fuzzer/containersqueuegetfirst_fuzzer.cpp index cd14087525e1acf7fd8990bbc16a9742dc05add9..c7ba4b3cbf52cef2530ef82328da32d24ecfdd3d 100644 --- a/test/fuzztest/containersqueuegetfirst_fuzzer/containersqueuegetfirst_fuzzer.cpp +++ b/test/fuzztest/containersqueuegetfirst_fuzzer/containersqueuegetfirst_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueueGetFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueuegetiteratorobj_fuzzer/containersqueuegetiteratorobj_fuzzer.cpp b/test/fuzztest/containersqueuegetiteratorobj_fuzzer/containersqueuegetiteratorobj_fuzzer.cpp index 00d03c57de1fc9f0593bb1a76b609c54ac8ae646..ae062752b06bf449833cb75eba340ce451b78445 100644 --- a/test/fuzztest/containersqueuegetiteratorobj_fuzzer/containersqueuegetiteratorobj_fuzzer.cpp +++ b/test/fuzztest/containersqueuegetiteratorobj_fuzzer/containersqueuegetiteratorobj_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueueGetIteratorObjFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueuegetsize_fuzzer/containersqueuegetsize_fuzzer.cpp b/test/fuzztest/containersqueuegetsize_fuzzer/containersqueuegetsize_fuzzer.cpp index c7654cb67a734646bb29bbf05b5326b79005f247..4ae49e94ff03835f0f7afd30fd7444ecff9432b1 100644 --- a/test/fuzztest/containersqueuegetsize_fuzzer/containersqueuegetsize_fuzzer.cpp +++ b/test/fuzztest/containersqueuegetsize_fuzzer/containersqueuegetsize_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueueGetSizeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersqueuepop_fuzzer/containersqueuepop_fuzzer.cpp b/test/fuzztest/containersqueuepop_fuzzer/containersqueuepop_fuzzer.cpp index a977f7a16aa323e7f868835d82f33acd13921721..8eb1847530d99cfd810096574b4d52e0010975fc 100644 --- a/test/fuzztest/containersqueuepop_fuzzer/containersqueuepop_fuzzer.cpp +++ b/test/fuzztest/containersqueuepop_fuzzer/containersqueuepop_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersQueuePopFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstack_fuzzer/containersstack_fuzzer.cpp b/test/fuzztest/containersstack_fuzzer/containersstack_fuzzer.cpp index 1ddf1d58118914e23d79c2d573075d6d43285679..7c88333cb126096e7a9e8d9261c8a5785fcc1425 100644 --- a/test/fuzztest/containersstack_fuzzer/containersstack_fuzzer.cpp +++ b/test/fuzztest/containersstack_fuzzer/containersstack_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackforeach_fuzzer/containersstackforeach_fuzzer.cpp b/test/fuzztest/containersstackforeach_fuzzer/containersstackforeach_fuzzer.cpp index 473f04f8230a991d7df11706a6a11293466958ed..0bddd74f40e7574c3cfde726fdf6f6bc0521ca73 100644 --- a/test/fuzztest/containersstackforeach_fuzzer/containersstackforeach_fuzzer.cpp +++ b/test/fuzztest/containersstackforeach_fuzzer/containersstackforeach_fuzzer.cpp @@ -86,7 +86,7 @@ namespace OHOS { void ContainersStackForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackgetlength_fuzzer/containersstackgetlength_fuzzer.cpp b/test/fuzztest/containersstackgetlength_fuzzer/containersstackgetlength_fuzzer.cpp index 1ad00c42bfa095fa37a20d0bafda340bee0bd86c..4c057531e3b8b316efd637ce381a6721b7223d3a 100644 --- a/test/fuzztest/containersstackgetlength_fuzzer/containersstackgetlength_fuzzer.cpp +++ b/test/fuzztest/containersstackgetlength_fuzzer/containersstackgetlength_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackGetLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackisempty_fuzzer/containersstackisempty_fuzzer.cpp b/test/fuzztest/containersstackisempty_fuzzer/containersstackisempty_fuzzer.cpp index 586e5300091172944dba30c27f830f291955309b..24ecc5ccbf59eeb3d851f85864aa5defb0efd72e 100644 --- a/test/fuzztest/containersstackisempty_fuzzer/containersstackisempty_fuzzer.cpp +++ b/test/fuzztest/containersstackisempty_fuzzer/containersstackisempty_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackFuzzIsEmptyTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackiterator_fuzzer/containersstackiterator_fuzzer.cpp b/test/fuzztest/containersstackiterator_fuzzer/containersstackiterator_fuzzer.cpp index 16fa89a5c604b3d3ec4f6de10d139d7c6eff92c3..182855c41663e74ea2e3434fdfd3b0b0a2280053 100644 --- a/test/fuzztest/containersstackiterator_fuzzer/containersstackiterator_fuzzer.cpp +++ b/test/fuzztest/containersstackiterator_fuzzer/containersstackiterator_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackIteratorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstacklocate_fuzzer/containersstacklocate_fuzzer.cpp b/test/fuzztest/containersstacklocate_fuzzer/containersstacklocate_fuzzer.cpp index 4b70ff146a458403ab170671ae6d7fc90fcedf21..e7edfc675f63fcc9a95c9476e18e93fa8fb5ad18 100644 --- a/test/fuzztest/containersstacklocate_fuzzer/containersstacklocate_fuzzer.cpp +++ b/test/fuzztest/containersstacklocate_fuzzer/containersstacklocate_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackLocateFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackpeek_fuzzer/containersstackpeek_fuzzer.cpp b/test/fuzztest/containersstackpeek_fuzzer/containersstackpeek_fuzzer.cpp index ee4418eb163f0c5bc088c1153b326f7c1a36b4f1..2b9b3288f8769ea4fbf9d332ca05483af6dbad0f 100644 --- a/test/fuzztest/containersstackpeek_fuzzer/containersstackpeek_fuzzer.cpp +++ b/test/fuzztest/containersstackpeek_fuzzer/containersstackpeek_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackPeekFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackpop_fuzzer/containersstackpop_fuzzer.cpp b/test/fuzztest/containersstackpop_fuzzer/containersstackpop_fuzzer.cpp index 0449858382db599c1cfe791fe1e9852cc1d5c9a3..8a730cb402a79fd8dcf91275438a071b82729d83 100644 --- a/test/fuzztest/containersstackpop_fuzzer/containersstackpop_fuzzer.cpp +++ b/test/fuzztest/containersstackpop_fuzzer/containersstackpop_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackPopFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersstackpush_fuzzer/containersstackpush_fuzzer.cpp b/test/fuzztest/containersstackpush_fuzzer/containersstackpush_fuzzer.cpp index 2fb13d166cd72475df8202d9ada27d6d8044e0d2..c4d0481714f71517f8e0ec6f962c664ad7708e92 100644 --- a/test/fuzztest/containersstackpush_fuzzer/containersstackpush_fuzzer.cpp +++ b/test/fuzztest/containersstackpush_fuzzer/containersstackpush_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersStackPushFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreemapcommon_fuzzer/containerstreemapcommon_fuzzer.h b/test/fuzztest/containerstreemapcommon_fuzzer/containerstreemapcommon_fuzzer.h index 6bae959860f524cbd7a3f08b6f00e113a07c52c8..f9305199798b1785bcc604ddee2d07c8bc378683 100755 --- a/test/fuzztest/containerstreemapcommon_fuzzer/containerstreemapcommon_fuzzer.h +++ b/test/fuzztest/containerstreemapcommon_fuzzer/containerstreemapcommon_fuzzer.h @@ -81,7 +81,7 @@ public: static bool InitFuzzTest(const uint8_t *data, size_t &size, int32_t &key, EcmaVM *&vm, JSThread *&thread) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); vm = JSNApi::CreateJSVM(option); thread = vm->GetJSThread(); if (size <= 0) { diff --git a/test/fuzztest/containerstreesetadd_fuzzer/containerstreesetadd_fuzzer.cpp b/test/fuzztest/containerstreesetadd_fuzzer/containerstreesetadd_fuzzer.cpp index 856da957e3614587602cd1aa205fb70ec1b20b5b..5108e58d2e9e17f42c3d8fbad4cfb638dd0ededd 100644 --- a/test/fuzztest/containerstreesetadd_fuzzer/containerstreesetadd_fuzzer.cpp +++ b/test/fuzztest/containerstreesetadd_fuzzer/containerstreesetadd_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp b/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp index d2e2a4009b19e91419d04191d3b6cd6a2c568f1f..e6f6e6ea03bc218c2e545a3efa0fa708ba74edfb 100644 --- a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp +++ b/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetClearFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp b/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp index 17e01ee85a7514fb6a0adca6fdd539084589f235..81f2410276eb5f56c96d319eb0d6ce93c3c49eb7 100644 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp +++ b/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetConstructorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp b/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp index fc811f198a08e0612fd11fc8388e7be6774fd504..cefb8c5974e4a37f07b6214b250fa3d9f3e5c941 100644 --- a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp +++ b/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetEntriesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp b/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp index 87c6b4e2d47398bbacb89ddd2b6013cf83ec8bff..64aa3450303ed9a317538fb2d97d831394c367f9 100644 --- a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp +++ b/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp @@ -87,7 +87,7 @@ namespace OHOS { void ContainersTreeSetForEachFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp index b8443caad40431305dc7da14cafe295580393dac..8dd3a1b78fb35e1e896c84d9adfd578d922f84af 100644 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp +++ b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetGetFirstValueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetgethighervalue_fuzzer/containerstreesetgethighervalue_fuzzer.cpp b/test/fuzztest/containerstreesetgethighervalue_fuzzer/containerstreesetgethighervalue_fuzzer.cpp index c5ee474fd476dd9214ef305660f889e820ea2a64..5ae5a3bba61eb17f136e6f4b698161096e6e549f 100644 --- a/test/fuzztest/containerstreesetgethighervalue_fuzzer/containerstreesetgethighervalue_fuzzer.cpp +++ b/test/fuzztest/containerstreesetgethighervalue_fuzzer/containerstreesetgethighervalue_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetGetHigherValueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp index 6e8c80121f2d02c8295d62b7e79f90c348c42f1f..4db8284e6fbe831e3cba83fa9779e6c04b1ebe38 100644 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp +++ b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetGetLastValueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp b/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp index 9ae0261a039b9f104b6073588f7dc4a68036d782..f568b0418ccf49e07a97a01357c3a9c06201b84a 100644 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp +++ b/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetGetLengthFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetgetlowervalue_fuzzer/containerstreesetgetlowervalue_fuzzer.cpp b/test/fuzztest/containerstreesetgetlowervalue_fuzzer/containerstreesetgetlowervalue_fuzzer.cpp index dfe8c114a34e18f5b19a9ebb1e6758410c74a101..865a549c5807f2b4fa9a56848e4ffdd656521206 100644 --- a/test/fuzztest/containerstreesetgetlowervalue_fuzzer/containerstreesetgetlowervalue_fuzzer.cpp +++ b/test/fuzztest/containerstreesetgetlowervalue_fuzzer/containerstreesetgetlowervalue_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetGetLowerValueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesethas_fuzzer/containerstreesethas_fuzzer.cpp b/test/fuzztest/containerstreesethas_fuzzer/containerstreesethas_fuzzer.cpp index c93844f7e39d4cb08e2e750176a07188648767f6..e5fe30ae92ddc4fd239fefe46907587943cb7db5 100644 --- a/test/fuzztest/containerstreesethas_fuzzer/containerstreesethas_fuzzer.cpp +++ b/test/fuzztest/containerstreesethas_fuzzer/containerstreesethas_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp b/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp index 77f4cecc1da13df17729464d7818f1f3ca0a4efb..42f889b0b96e6b8a53dece2df4af93dcb24a599c 100644 --- a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp +++ b/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetIsEmptyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp b/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp index 864146a2cde6f7c3de7ab3dd6cee42414355fe48..3086badaaf85243d1f3607be70670b4ef9a75fd7 100644 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp +++ b/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetPopFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp b/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp index eaf5890166a88057763529e1b41f917df70a15e0..7a7179d1ac2b2f74e99b538c7fa117a0a30ce290 100644 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp +++ b/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetPopLastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetremove_fuzzer/containerstreesetremove_fuzzer.cpp b/test/fuzztest/containerstreesetremove_fuzzer/containerstreesetremove_fuzzer.cpp index 15ff964b14841b1ebd467d9aae2587989b69fce3..d3b133e6bd42d006c51f07cbbb9a876e584c5786 100644 --- a/test/fuzztest/containerstreesetremove_fuzzer/containerstreesetremove_fuzzer.cpp +++ b/test/fuzztest/containerstreesetremove_fuzzer/containerstreesetremove_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp b/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp index 150639a6500816f1f181b0af21ab449cd29249e6..f13e2d617dbe97a252fd6abc41dd353d3fd44eec 100644 --- a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp +++ b/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp @@ -81,7 +81,7 @@ namespace OHOS { void ContainersTreeSetValuesFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h b/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h index 2dff0406bd29a3c2cb3e41fe8aff7c471ef7b281..950224f156481626894412a7a9c14cec03645381 100644 --- a/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h +++ b/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h @@ -111,7 +111,7 @@ public: static void ContainersVectorAddFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -134,7 +134,7 @@ public: static void ContainersVectorGetFirstElementFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -163,7 +163,7 @@ public: static void ContainersVectorGetIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -193,7 +193,7 @@ public: static void ContainersVectorGetLastElementFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -222,7 +222,7 @@ public: static void ContainersVectorHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -252,7 +252,7 @@ public: static void ContainersVectorInsertFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -276,7 +276,7 @@ public: static void ContainersVectorRemoveFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -306,7 +306,7 @@ public: static void ContainersVectorSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -337,7 +337,7 @@ public: static void ContainersVectorGetLastIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -366,7 +366,7 @@ public: static void ContainersVectorGetLastIndexFromFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -396,7 +396,7 @@ public: static void ContainersVectorGetIndexFromFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -429,7 +429,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -507,7 +507,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -534,7 +534,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -563,7 +563,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -586,7 +586,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -610,7 +610,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -632,7 +632,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -654,7 +654,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -686,7 +686,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -708,7 +708,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -730,7 +730,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -752,7 +752,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -784,7 +784,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -806,7 +806,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -828,7 +828,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -857,7 +857,7 @@ public: return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/copyableglobalisempty_fuzzer/copyableglobalisempty_fuzzer.cpp b/test/fuzztest/copyableglobalisempty_fuzzer/copyableglobalisempty_fuzzer.cpp index d705eb9b6ed51e9b193644871f7c8680e53acf92..8f34ef6021e8c2d6ca1800defa4f71fa06a9766c 100644 --- a/test/fuzztest/copyableglobalisempty_fuzzer/copyableglobalisempty_fuzzer.cpp +++ b/test/fuzztest/copyableglobalisempty_fuzzer/copyableglobalisempty_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void CopyableGlobalIsEmptyFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/copyableglobalsetandclearweak_fuzzer/copyableglobalsetandclearweak_fuzzer.cpp b/test/fuzztest/copyableglobalsetandclearweak_fuzzer/copyableglobalsetandclearweak_fuzzer.cpp index 71ced3ca825d76df73006c60a72d87d770dd8045..1c348dc357d141f0f0e7298274ab213f2f8c5b33 100644 --- a/test/fuzztest/copyableglobalsetandclearweak_fuzzer/copyableglobalsetandclearweak_fuzzer.cpp +++ b/test/fuzztest/copyableglobalsetandclearweak_fuzzer/copyableglobalsetandclearweak_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void CopyableGlobalSetandClearWeakFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/createbigwords_fuzzer/createbigwords_fuzzer.cpp b/test/fuzztest/createbigwords_fuzzer/createbigwords_fuzzer.cpp index 02ad2d231aca4a2f9e3cdf187ec221877657b062..be14116b3027d986576957a36e7f9f1bc75108f8 100644 --- a/test/fuzztest/createbigwords_fuzzer/createbigwords_fuzzer.cpp +++ b/test/fuzztest/createbigwords_fuzzer/createbigwords_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void CreateBigWordsFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/dataviewrefnew_fuzzer/dataviewrefnew_fuzzer.cpp b/test/fuzztest/dataviewrefnew_fuzzer/dataviewrefnew_fuzzer.cpp index d6bf8412e8d50474047742d50f7b9a34a1cf8f21..7d83b0ff0fc156a26099d7bc13184be1920aaa23 100644 --- a/test/fuzztest/dataviewrefnew_fuzzer/dataviewrefnew_fuzzer.cpp +++ b/test/fuzztest/dataviewrefnew_fuzzer/dataviewrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void DataViewRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/daterefnew_fuzzer/daterefnew_fuzzer.cpp b/test/fuzztest/daterefnew_fuzzer/daterefnew_fuzzer.cpp index 76fbf0ac7234c5a39d00938d6b138711c7b4500b..28026a48fd24d5550252480aa2d28846cda6377d 100644 --- a/test/fuzztest/daterefnew_fuzzer/daterefnew_fuzzer.cpp +++ b/test/fuzztest/daterefnew_fuzzer/daterefnew_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void DateRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -50,7 +50,7 @@ namespace OHOS { void DateRefGetTimeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -75,7 +75,7 @@ namespace OHOS { void DateRefToStringFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/dumpheapsnapshot1_fuzzer/dumpheapsnapshot1_fuzzer.cpp b/test/fuzztest/dumpheapsnapshot1_fuzzer/dumpheapsnapshot1_fuzzer.cpp index 1411b2fa997728aeb0990ef303b4b5955829bfaf..ca3afac289ebaa515af3619c583ad8996527246e 100644 --- a/test/fuzztest/dumpheapsnapshot1_fuzzer/dumpheapsnapshot1_fuzzer.cpp +++ b/test/fuzztest/dumpheapsnapshot1_fuzzer/dumpheapsnapshot1_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void DumpHeapSnapshot1FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/dumpheapsnapshot2_fuzzer/dumpheapsnapshot2_fuzzer.cpp b/test/fuzztest/dumpheapsnapshot2_fuzzer/dumpheapsnapshot2_fuzzer.cpp index b8a87a323632563cc9b24e091f2473f76a1cba12..2870f02033ab4bdd32a020c29deac40fd4f67b06 100644 --- a/test/fuzztest/dumpheapsnapshot2_fuzzer/dumpheapsnapshot2_fuzzer.cpp +++ b/test/fuzztest/dumpheapsnapshot2_fuzzer/dumpheapsnapshot2_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void DumpHeapSnapshot2FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); DumpFormat dumpFormat = DumpFormat::JSON; if (size <= 0) { diff --git a/test/fuzztest/dumpheapsnapshot3_fuzzer/dumpheapsnapshot3_fuzzer.cpp b/test/fuzztest/dumpheapsnapshot3_fuzzer/dumpheapsnapshot3_fuzzer.cpp index 339fddba0e985c0ea6852d3c87c71a1c5ff3de8a..2726cac3c31cf4de9ddf7462fd7d94bc029c3f9f 100644 --- a/test/fuzztest/dumpheapsnapshot3_fuzzer/dumpheapsnapshot3_fuzzer.cpp +++ b/test/fuzztest/dumpheapsnapshot3_fuzzer/dumpheapsnapshot3_fuzzer.cpp @@ -33,7 +33,7 @@ namespace OHOS { return; } RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); size_t maxEnumNum = static_cast(DumpFormat::OTHER) + 1; DumpFormat dumpFormat = static_cast(size % maxEnumNum); diff --git a/test/fuzztest/escapelocalscope_fuzzer/escapelocalscope_fuzzer.cpp b/test/fuzztest/escapelocalscope_fuzzer/escapelocalscope_fuzzer.cpp index f8dd67b68e2ec93a4241469abdcfb98f0cf1125f..b5f327a79821808c23b669fa0338a63d9578254b 100644 --- a/test/fuzztest/escapelocalscope_fuzzer/escapelocalscope_fuzzer.cpp +++ b/test/fuzztest/escapelocalscope_fuzzer/escapelocalscope_fuzzer.cpp @@ -29,7 +29,7 @@ Local FuncRefNewCFCallbackForTest(JsiRuntimeCallInfo *info) void EscapeLocalScopeFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/exceptionaggregateerror_fuzzer/exceptionaggregateerror_fuzzer.cpp b/test/fuzztest/exceptionaggregateerror_fuzzer/exceptionaggregateerror_fuzzer.cpp index 50d71f409288d667b8e812b9d0428ea77a242cbe..01587e47a3f2e5e993a09a4b977c820d234fcf1c 100644 --- a/test/fuzztest/exceptionaggregateerror_fuzzer/exceptionaggregateerror_fuzzer.cpp +++ b/test/fuzztest/exceptionaggregateerror_fuzzer/exceptionaggregateerror_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ExceptionAggregateErrorFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/exceptionclass_fuzzer/exceptionclass_fuzzer.cpp b/test/fuzztest/exceptionclass_fuzzer/exceptionclass_fuzzer.cpp index 6886c67455402738f22a523145c9a340f35eb50d..3469043de4926f9eed314f590c1f50b5dcf5f39f 100644 --- a/test/fuzztest/exceptionclass_fuzzer/exceptionclass_fuzzer.cpp +++ b/test/fuzztest/exceptionclass_fuzzer/exceptionclass_fuzzer.cpp @@ -15,18 +15,18 @@ #include "exceptionclass_fuzzer.h" #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void ExpectionErrorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -40,7 +40,7 @@ namespace OHOS { void ExpectionRangeErrorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -54,7 +54,7 @@ namespace OHOS { void ReferenceErrorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -68,7 +68,7 @@ namespace OHOS { void SYNTexErrorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/exceptionevalerror_fuzzer/exceptionevalerror_fuzzer.cpp b/test/fuzztest/exceptionevalerror_fuzzer/exceptionevalerror_fuzzer.cpp index bb59a7ad900d947e96875948f552baacc4d62181..9282ee0a788b288753b40df152634fb89dd35462 100644 --- a/test/fuzztest/exceptionevalerror_fuzzer/exceptionevalerror_fuzzer.cpp +++ b/test/fuzztest/exceptionevalerror_fuzzer/exceptionevalerror_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ExceptionEvalErrorFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/exceptionoomerror_fuzzer/exceptionoomerror_fuzzer.cpp b/test/fuzztest/exceptionoomerror_fuzzer/exceptionoomerror_fuzzer.cpp index a5b4d7562504127764b0332d4400a711811fd664..e4d89630c497855980a016ea117943f7a16167fa 100644 --- a/test/fuzztest/exceptionoomerror_fuzzer/exceptionoomerror_fuzzer.cpp +++ b/test/fuzztest/exceptionoomerror_fuzzer/exceptionoomerror_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ExceptionOOMErrorFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/exceptiontypeerror_fuzzer/exceptiontypeerror_fuzzer.cpp b/test/fuzztest/exceptiontypeerror_fuzzer/exceptiontypeerror_fuzzer.cpp index 7dc8bb4d18e57b239de832b043f1bbc5c36e7e20..7b4cd9fb11e5f20b5a3b43d261fff401ccff3246 100644 --- a/test/fuzztest/exceptiontypeerror_fuzzer/exceptiontypeerror_fuzzer.cpp +++ b/test/fuzztest/exceptiontypeerror_fuzzer/exceptiontypeerror_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ExceptionTypeErrorFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); JSThread *thread_ = nullptr; thread_ = vm_->GetJSThread(); diff --git a/test/fuzztest/float32arrayrefnew_fuzzer/float32arrayrefnew_fuzzer.cpp b/test/fuzztest/float32arrayrefnew_fuzzer/float32arrayrefnew_fuzzer.cpp index e80ea16672d44a360cea3ec76e2c46730dccc111..5d365a7c2b92de3d6a4262664b42fb612234c654 100644 --- a/test/fuzztest/float32arrayrefnew_fuzzer/float32arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/float32arrayrefnew_fuzzer/float32arrayrefnew_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void Float32ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/float64arrayrefnew_fuzzer/float64arrayrefnew_fuzzer.cpp b/test/fuzztest/float64arrayrefnew_fuzzer/float64arrayrefnew_fuzzer.cpp index db8c613e0217e82611742b0c89ddd047e8586b12..d09ef1b2c172653a631aa1117eeb16d8f835011f 100644 --- a/test/fuzztest/float64arrayrefnew_fuzzer/float64arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/float64arrayrefnew_fuzzer/float64arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Float64ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/functionrefcall_fuzzer/functionrefcall_fuzzer.cpp b/test/fuzztest/functionrefcall_fuzzer/functionrefcall_fuzzer.cpp index 68f5efc572ce02d32222800c7a77a5faed637e78..79d7c91679d501da313cfdea51a1af9a78f1c97c 100644 --- a/test/fuzztest/functionrefcall_fuzzer/functionrefcall_fuzzer.cpp +++ b/test/fuzztest/functionrefcall_fuzzer/functionrefcall_fuzzer.cpp @@ -30,7 +30,7 @@ namespace OHOS { void FunctionRefCallFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/functionrefconstructor_fuzzer/functionrefconstructor_fuzzer.cpp b/test/fuzztest/functionrefconstructor_fuzzer/functionrefconstructor_fuzzer.cpp index 1830c86ca4c0fbe0d380c551dd2a26964e92c584..7cd1c6dde1f7efab1d962e62d84d1b1886c46e93 100644 --- a/test/fuzztest/functionrefconstructor_fuzzer/functionrefconstructor_fuzzer.cpp +++ b/test/fuzztest/functionrefconstructor_fuzzer/functionrefconstructor_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { void FunctionRefConstructorFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/functionrefgetfunctionprototype_fuzzer/functionrefgetfunctionprototype_fuzzer.cpp b/test/fuzztest/functionrefgetfunctionprototype_fuzzer/functionrefgetfunctionprototype_fuzzer.cpp index de96370ed1c11661829992f748c6a3519a9dc024..e93c6a41478bde5190f26f6bd15962adb5d07104 100644 --- a/test/fuzztest/functionrefgetfunctionprototype_fuzzer/functionrefgetfunctionprototype_fuzzer.cpp +++ b/test/fuzztest/functionrefgetfunctionprototype_fuzzer/functionrefgetfunctionprototype_fuzzer.cpp @@ -30,7 +30,7 @@ Local FuncRefConCallbackForTest(JsiRuntimeCallInfo *info) void FunctionRefGetFunctionPrototypeFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/functionrefinherit_fuzzer/functionrefinherit_fuzzer.cpp b/test/fuzztest/functionrefinherit_fuzzer/functionrefinherit_fuzzer.cpp index d2b584e4529cc8990b485cfb4e2adf716e76cd8d..7cebccf49f7f8a4d5260bdc5430ce7cbb3ceebd2 100644 --- a/test/fuzztest/functionrefinherit_fuzzer/functionrefinherit_fuzzer.cpp +++ b/test/fuzztest/functionrefinherit_fuzzer/functionrefinherit_fuzzer.cpp @@ -14,7 +14,7 @@ */ #include "functionrefinherit_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/global_env.h" #include "ecmascript/js_function.h" @@ -23,13 +23,13 @@ using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void FunctionRefInheritFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/functionrefisnative_fuzzer/functionrefisnative_fuzzer.cpp b/test/fuzztest/functionrefisnative_fuzzer/functionrefisnative_fuzzer.cpp index 8595259365c984d8c8ae303fa7d566dea3e655ea..47f12dbd5cfeac03f19e1124ea9f289a2f630061 100644 --- a/test/fuzztest/functionrefisnative_fuzzer/functionrefisnative_fuzzer.cpp +++ b/test/fuzztest/functionrefisnative_fuzzer/functionrefisnative_fuzzer.cpp @@ -30,7 +30,7 @@ Local FuncRefConCallbackForTest(JsiRuntimeCallInfo *info) void FunctionRefIsNativeFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/functionrefname_fuzzer/functionrefname_fuzzer.cpp b/test/fuzztest/functionrefname_fuzzer/functionrefname_fuzzer.cpp index 68e14279bdd1c4fb26b8ce1b8aad70f37ff000c2..4dfd5a76f266b67808b39faa47fafe7c7d7666cc 100644 --- a/test/fuzztest/functionrefname_fuzzer/functionrefname_fuzzer.cpp +++ b/test/fuzztest/functionrefname_fuzzer/functionrefname_fuzzer.cpp @@ -30,7 +30,7 @@ Local FuncRefConCallbackForTest(JsiRuntimeCallInfo *info) void FunctionRefSetNameFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -47,7 +47,7 @@ void FunctionRefSetNameFuzzTest(const uint8_t *data, size_t size) void FunctionRefGetNameFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/functionrefnew_fuzzer/functionrefnew_fuzzer.cpp b/test/fuzztest/functionrefnew_fuzzer/functionrefnew_fuzzer.cpp index 3e03362464d46d03953113dfbaaf1c8f08e519dc..6fd8883c10fb030188f887ee95989d3eb2d52e0a 100644 --- a/test/fuzztest/functionrefnew_fuzzer/functionrefnew_fuzzer.cpp +++ b/test/fuzztest/functionrefnew_fuzzer/functionrefnew_fuzzer.cpp @@ -30,7 +30,7 @@ namespace OHOS { void FunctionRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/functionrefnewclassfunction_fuzzer/functionrefnewclassfunction_fuzzer.cpp b/test/fuzztest/functionrefnewclassfunction_fuzzer/functionrefnewclassfunction_fuzzer.cpp index a4437fbea76910f838312fcba4a4d6447d1ec027..950f844ad39f3b14ac132715358f7f492901375c 100644 --- a/test/fuzztest/functionrefnewclassfunction_fuzzer/functionrefnewclassfunction_fuzzer.cpp +++ b/test/fuzztest/functionrefnewclassfunction_fuzzer/functionrefnewclassfunction_fuzzer.cpp @@ -30,7 +30,7 @@ namespace OHOS { void FunctionRefNewClassFunctionFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/generatorfunctionref_fuzzer/generatorfunctionref_fuzzer.cpp b/test/fuzztest/generatorfunctionref_fuzzer/generatorfunctionref_fuzzer.cpp index c8023b151c6dce7c03a567256e3c9c3f7054af92..3106f41948f445cba12b27398f975e33899fee30 100644 --- a/test/fuzztest/generatorfunctionref_fuzzer/generatorfunctionref_fuzzer.cpp +++ b/test/fuzztest/generatorfunctionref_fuzzer/generatorfunctionref_fuzzer.cpp @@ -52,7 +52,7 @@ Local CreateGeneratorObj(EcmaVM *vm) void IsGeneratorFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -67,7 +67,7 @@ void IsGeneratorFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void GetGeneratorStateFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -81,7 +81,7 @@ void GetGeneratorStateFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void GetGeneratorFunctionFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/getallocationprofile_fuzzer/getallocationprofile_fuzzer.cpp b/test/fuzztest/getallocationprofile_fuzzer/getallocationprofile_fuzzer.cpp index 9b91741e173d06522112e360b1660e17d8abf001..fb69c6e9c7e03a382c1ce246fd1553f45e8572c7 100644 --- a/test/fuzztest/getallocationprofile_fuzzer/getallocationprofile_fuzzer.cpp +++ b/test/fuzztest/getallocationprofile_fuzzer/getallocationprofile_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void GetAllocationProfileFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/getbundlename_fuzzer/getbundlename_fuzzer.cpp b/test/fuzztest/getbundlename_fuzzer/getbundlename_fuzzer.cpp index a6a7b4f11747f84c0ae7976a0238d0430d0638c2..567aa71716f8e8142a84f175a367b542524fa2a0 100644 --- a/test/fuzztest/getbundlename_fuzzer/getbundlename_fuzzer.cpp +++ b/test/fuzztest/getbundlename_fuzzer/getbundlename_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void GetBundleNameFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/getformatfunction_fuzzer/getformatfunction_fuzzer.cpp b/test/fuzztest/getformatfunction_fuzzer/getformatfunction_fuzzer.cpp index 2dbf942442ee8225af1b5ec7e75e4e1c3a8b6ad5..21f65fb9330e5ee8986abda64eb01650bc2f8957 100644 --- a/test/fuzztest/getformatfunction_fuzzer/getformatfunction_fuzzer.cpp +++ b/test/fuzztest/getformatfunction_fuzzer/getformatfunction_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { void NumberGetFormatFunctionFuzzerTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/getmodulename_fuzzer/getmodulename_fuzzer.cpp b/test/fuzztest/getmodulename_fuzzer/getmodulename_fuzzer.cpp index 10426b619d46a5493e8d5a72d0157945471f8f61..06d4b4d56e230b3aea5cf042aa15176cc9ed7aa5 100644 --- a/test/fuzztest/getmodulename_fuzzer/getmodulename_fuzzer.cpp +++ b/test/fuzztest/getmodulename_fuzzer/getmodulename_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void GetModuleNameFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/getnativepointerfield_fuzzer/getnativepointerfield_fuzzer.cpp b/test/fuzztest/getnativepointerfield_fuzzer/getnativepointerfield_fuzzer.cpp index 3834b90cbfcc774f7d1fe9a1c18a76d955aa2ab3..5453c73cb09ff68134c8bb858864a43f50d2f734 100644 --- a/test/fuzztest/getnativepointerfield_fuzzer/getnativepointerfield_fuzzer.cpp +++ b/test/fuzztest/getnativepointerfield_fuzzer/getnativepointerfield_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void GetNativePointerFieldFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/getwordsarray_fuzzer/getwordsarray_fuzzer.cpp b/test/fuzztest/getwordsarray_fuzzer/getwordsarray_fuzzer.cpp index 19bcbd44f543908b3024283a99cf9bff06aa162b..f909f8e31a8d3e31458f4e39fec0c101b7974121 100644 --- a/test/fuzztest/getwordsarray_fuzzer/getwordsarray_fuzzer.cpp +++ b/test/fuzztest/getwordsarray_fuzzer/getwordsarray_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void GetWordsArrayFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/int16arrayrefnew_fuzzer/int16arrayrefnew_fuzzer.cpp b/test/fuzztest/int16arrayrefnew_fuzzer/int16arrayrefnew_fuzzer.cpp index b2e07cc5be97bd0ae739a6391ed9bd7193f67c4f..cbf96474e2d457693397ace625b4b3d48dec0bd7 100644 --- a/test/fuzztest/int16arrayrefnew_fuzzer/int16arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/int16arrayrefnew_fuzzer/int16arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Int16ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/int32arrayrefnew_fuzzer/int32arrayrefnew_fuzzer.cpp b/test/fuzztest/int32arrayrefnew_fuzzer/int32arrayrefnew_fuzzer.cpp index fa1a36bd67f80c5c2d1cd34dbd4aef4a37da7abb..5bec8f35d0f84c51177e08d233ac2e71df3f9433 100644 --- a/test/fuzztest/int32arrayrefnew_fuzzer/int32arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/int32arrayrefnew_fuzzer/int32arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Int32ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/int8arrayrefnew_fuzzer/int8arrayrefnew_fuzzer.cpp b/test/fuzztest/int8arrayrefnew_fuzzer/int8arrayrefnew_fuzzer.cpp index 1cfe53efa8e9c17889ca38d4628bc98e9b953c1c..b188b7612c4ac6af013caf6d81cfb186bc019c8c 100644 --- a/test/fuzztest/int8arrayrefnew_fuzzer/int8arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/int8arrayrefnew_fuzzer/int8arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Int8ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/integerrefnewvalue_fuzzer/integerrefnewvalue_fuzzer.cpp b/test/fuzztest/integerrefnewvalue_fuzzer/integerrefnewvalue_fuzzer.cpp index 495ed68e53ce6d3cdda739798f7bf23fb2ffffb2..f3cdd3e5f861ba936851b4e5322cf89e50617a00 100644 --- a/test/fuzztest/integerrefnewvalue_fuzzer/integerrefnewvalue_fuzzer.cpp +++ b/test/fuzztest/integerrefnewvalue_fuzzer/integerrefnewvalue_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void IntegerRefNewValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); unsigned int number = 123; if (data == nullptr || size <= 0) { diff --git a/test/fuzztest/jsnapiaddworker_fuzzer/jsnapiaddworker_fuzzer.cpp b/test/fuzztest/jsnapiaddworker_fuzzer/jsnapiaddworker_fuzzer.cpp index 778c5a154b718f23fe03534c5abbc6b60aee87a2..e7eb0201a499742643836042f07783a01f84a16a 100644 --- a/test/fuzztest/jsnapiaddworker_fuzzer/jsnapiaddworker_fuzzer.cpp +++ b/test/fuzztest/jsnapiaddworker_fuzzer/jsnapiaddworker_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiAddWorkerFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapicontext_fuzzer/jsnapicontext_fuzzer.cpp b/test/fuzztest/jsnapicontext_fuzzer/jsnapicontext_fuzzer.cpp index 58735bd923c4adddf2a4bedf0ad26cb4f539ccd3..c9766d112cf60bf5ae228f609620f95117ca3f1e 100644 --- a/test/fuzztest/jsnapicontext_fuzzer/jsnapicontext_fuzzer.cpp +++ b/test/fuzztest/jsnapicontext_fuzzer/jsnapicontext_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiSwitchCurrentContextFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapideleteserializationdata_fuzzer/jsnapideleteserializationdata_fuzzer.cpp b/test/fuzztest/jsnapideleteserializationdata_fuzzer/jsnapideleteserializationdata_fuzzer.cpp index 4dce4052c9af1da7008e85de6ef1e269d93ec596..170a45aaebe4b8b092d65ab6d8353cf2e0d4baf2 100644 --- a/test/fuzztest/jsnapideleteserializationdata_fuzzer/jsnapideleteserializationdata_fuzzer.cpp +++ b/test/fuzztest/jsnapideleteserializationdata_fuzzer/jsnapideleteserializationdata_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiDeleteSerializationDataFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/jsnapideserializevalue_fuzzer/jsnapideserializevalue_fuzzer.cpp b/test/fuzztest/jsnapideserializevalue_fuzzer/jsnapideserializevalue_fuzzer.cpp index 4031ad137dcd5ed7bcf2dae6306629f6b3f88170..d684e69d8ac21775c4bc535f3df42e1c986f20d9 100644 --- a/test/fuzztest/jsnapideserializevalue_fuzzer/jsnapideserializevalue_fuzzer.cpp +++ b/test/fuzztest/jsnapideserializevalue_fuzzer/jsnapideserializevalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiDeserializeValueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/jsnapiexception_fuzzer/jsnapiexception_fuzzer.cpp b/test/fuzztest/jsnapiexception_fuzzer/jsnapiexception_fuzzer.cpp index 746bef58bb8f2be8e4d34564e2979666b216b0b1..10ca19635c2af5edf4200d17b2a58835e4cca84b 100644 --- a/test/fuzztest/jsnapiexception_fuzzer/jsnapiexception_fuzzer.cpp +++ b/test/fuzztest/jsnapiexception_fuzzer/jsnapiexception_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiThrowExceptionFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiexceptions_fuzzer/jsnapiexceptions_fuzzer.cpp b/test/fuzztest/jsnapiexceptions_fuzzer/jsnapiexceptions_fuzzer.cpp index 37e03facbc53ff8db25dc6e80389b98ae98f4bcd..db5aab3258c7e6747c220a6b77b93bd3cfc0d364 100644 --- a/test/fuzztest/jsnapiexceptions_fuzzer/jsnapiexceptions_fuzzer.cpp +++ b/test/fuzztest/jsnapiexceptions_fuzzer/jsnapiexceptions_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiGetAndClearUncaughtExceptionFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -42,7 +42,7 @@ void JSNApiGetAndClearUncaughtExceptionFuzzTest(const uint8_t *data, size_t size void JSNApiThrowExceptionFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapihaspendingexception_fuzzer/jsnapihaspendingexception_fuzzer.cpp b/test/fuzztest/jsnapihaspendingexception_fuzzer/jsnapihaspendingexception_fuzzer.cpp index c86b8f1904ad18a0c1b9f37028e0174ea86ad322..ba8aa25a0569117071efe4c05a7e94cf710692e9 100644 --- a/test/fuzztest/jsnapihaspendingexception_fuzzer/jsnapihaspendingexception_fuzzer.cpp +++ b/test/fuzztest/jsnapihaspendingexception_fuzzer/jsnapihaspendingexception_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiUncaughtClearExceptionFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); JSThread *thread_ = nullptr; thread_ = vm_->GetJSThread(); diff --git a/test/fuzztest/jsnapiinformation_fuzzer/jsnapiinformation_fuzzer.cpp b/test/fuzztest/jsnapiinformation_fuzzer/jsnapiinformation_fuzzer.cpp index 2e2428451896d5914624fa21b5035f574ee08cdb..31e2596997a139b34e0ae0b644aead3efae8d02f 100644 --- a/test/fuzztest/jsnapiinformation_fuzzer/jsnapiinformation_fuzzer.cpp +++ b/test/fuzztest/jsnapiinformation_fuzzer/jsnapiinformation_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void JSNApiCreateEcmaVMFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -40,7 +40,7 @@ void JSNApiCreateEcmaVMFuzzTest([[maybe_unused]]const uint8_t *data, size_t size void JSNApiEnableUserUncaughtErrorHandlerFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -52,7 +52,7 @@ void JSNApiEnableUserUncaughtErrorHandlerFuzzTest([[maybe_unused]]const uint8_t void JSNApiFunctionFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -70,7 +70,7 @@ void JSNApiFunctionFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) void JSNApiIsMixedDebugEnabledFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -82,7 +82,7 @@ void JSNApiIsMixedDebugEnabledFuzzTest([[maybe_unused]]const uint8_t *data, size void JSNApiNotifyNativeCallingFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisarrayiterator_fuzzer/jsnapiisarrayiterator_fuzzer.cpp b/test/fuzztest/jsnapiisarrayiterator_fuzzer/jsnapiisarrayiterator_fuzzer.cpp index 2ad6f01fc10a47a51b3396764863e884392dd5c9..e1d756ef030878c1ee0396c23f16fafe2a37adf6 100644 --- a/test/fuzztest/jsnapiisarrayiterator_fuzzer/jsnapiisarrayiterator_fuzzer.cpp +++ b/test/fuzztest/jsnapiisarrayiterator_fuzzer/jsnapiisarrayiterator_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiIsArrayIterator_FuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisbundle_fuzzer/jsnapiisbundle_fuzzer.cpp b/test/fuzztest/jsnapiisbundle_fuzzer/jsnapiisbundle_fuzzer.cpp index a346520a5007bd7a24296a3e7f764e6060f00cab..d2e431a462f264f62b3582b0482762b7260e8ab3 100644 --- a/test/fuzztest/jsnapiisbundle_fuzzer/jsnapiisbundle_fuzzer.cpp +++ b/test/fuzztest/jsnapiisbundle_fuzzer/jsnapiisbundle_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t DIVISOR = 2; void JSNApiIsBundleFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisconstructor_fuzzer/jsnapiisconstructor_fuzzer.cpp b/test/fuzztest/jsnapiisconstructor_fuzzer/jsnapiisconstructor_fuzzer.cpp index 6e2574f0c2c6d407079fae454cdb5b255bbb7709..606299a0e05080966ed116c4343e0d6604070e42 100644 --- a/test/fuzztest/jsnapiisconstructor_fuzzer/jsnapiisconstructor_fuzzer.cpp +++ b/test/fuzztest/jsnapiisconstructor_fuzzer/jsnapiisconstructor_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiIsConstructorFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisfalse_fuzzer/jsnapiisfalse_fuzzer.cpp b/test/fuzztest/jsnapiisfalse_fuzzer/jsnapiisfalse_fuzzer.cpp index a1a7ae9cecc5aa2f16a3c64dcac3aa5ef164ecee..6a13e47156072aa74a0b5c6ddbb55ec3a5b8656a 100644 --- a/test/fuzztest/jsnapiisfalse_fuzzer/jsnapiisfalse_fuzzer.cpp +++ b/test/fuzztest/jsnapiisfalse_fuzzer/jsnapiisfalse_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiIsFalseFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisprofiling_fuzzer/jsnapiisprofiling_fuzzer.cpp b/test/fuzztest/jsnapiisprofiling_fuzzer/jsnapiisprofiling_fuzzer.cpp index f651095d49d32c3c9efe4f6f988e4bff36d1a7d1..c775773e0234734ec48088ac791a6a82e3d79df0 100644 --- a/test/fuzztest/jsnapiisprofiling_fuzzer/jsnapiisprofiling_fuzzer.cpp +++ b/test/fuzztest/jsnapiisprofiling_fuzzer/jsnapiisprofiling_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t DIVISOR = 2; void JSNApiIsProfilingFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiisstringiterator_fuzzer/jsnapiisstringiterator_fuzzer.cpp b/test/fuzztest/jsnapiisstringiterator_fuzzer/jsnapiisstringiterator_fuzzer.cpp index 760693d4403c6da1bbca77ae617b181a4dfde703..211e9b3a5f3a5c5ec0424e4ed0da9f9c89217914 100644 --- a/test/fuzztest/jsnapiisstringiterator_fuzzer/jsnapiisstringiterator_fuzzer.cpp +++ b/test/fuzztest/jsnapiisstringiterator_fuzzer/jsnapiisstringiterator_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiIsStringIterator_FuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiistrue_fuzzer/jsnapiistrue_fuzzer.cpp b/test/fuzztest/jsnapiistrue_fuzzer/jsnapiistrue_fuzzer.cpp index 368c33eedf6f650e9550f9b19f8373f4a9b999b6..2c92b10ebb93c68a7e45094bd733d9d3d72b7407 100644 --- a/test/fuzztest/jsnapiistrue_fuzzer/jsnapiistrue_fuzzer.cpp +++ b/test/fuzztest/jsnapiistrue_fuzzer/jsnapiistrue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiIsTrueFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiloadaotfile_fuzzer/jsnapiloadaotfile_fuzzer.cpp b/test/fuzztest/jsnapiloadaotfile_fuzzer/jsnapiloadaotfile_fuzzer.cpp index 56ccb1f500333695960de7e39fdf9078f5c1eaf3..6a86e8c935d2a4f67e5179cab8f7304da9336200 100644 --- a/test/fuzztest/jsnapiloadaotfile_fuzzer/jsnapiloadaotfile_fuzzer.cpp +++ b/test/fuzztest/jsnapiloadaotfile_fuzzer/jsnapiloadaotfile_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiLoadAotFileFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapipendingjob_fuzzer/jsnapipendingjob_fuzzer.cpp b/test/fuzztest/jsnapipendingjob_fuzzer/jsnapipendingjob_fuzzer.cpp index a3dfac35b3ffb8fe1f70d0e53041977f57541d96..ff0acb35e707c1fd47a9654f9be5800d0dd76954 100644 --- a/test/fuzztest/jsnapipendingjob_fuzzer/jsnapipendingjob_fuzzer.cpp +++ b/test/fuzztest/jsnapipendingjob_fuzzer/jsnapipendingjob_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiExecutePendingJobFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -40,7 +40,7 @@ void JSNApiExecutePendingJobFuzzTest(const uint8_t *data, size_t size) void JSNApiHasPendingJobFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiset_fuzzer/jsnapiset_fuzzer.cpp b/test/fuzztest/jsnapiset_fuzzer/jsnapiset_fuzzer.cpp index 1a91f5ea7dbb737063ccf25134f28a70ce47e5a1..eb51c8491f3c674a4556888b487c2e893919ee1e 100644 --- a/test/fuzztest/jsnapiset_fuzzer/jsnapiset_fuzzer.cpp +++ b/test/fuzztest/jsnapiset_fuzzer/jsnapiset_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void JSNApiSetAssetPathFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -39,7 +39,7 @@ void JSNApiSetAssetPathFuzzTest([[maybe_unused]]const uint8_t *data, size_t size void JSNApiSetBundleFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -54,7 +54,7 @@ void JSNApiSetBundleFuzzTest(const uint8_t *data, size_t size) void JSNApiSetHostEnqueueJobFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -68,7 +68,7 @@ void JSNApiSetHostEnqueueJobFuzzTest(const uint8_t *data, size_t size) void JSNApiSetMockModuleListFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -81,7 +81,7 @@ void JSNApiSetMockModuleListFuzzTest([[maybe_unused]]const uint8_t *data, size_t void JSNApiSetSourceMapTranslateCallbackFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/jsnapisethostpromiserejectiontracker_fuzzer/jsnapisethostpromiserejectiontracker_fuzzer.cpp b/test/fuzztest/jsnapisethostpromiserejectiontracker_fuzzer/jsnapisethostpromiserejectiontracker_fuzzer.cpp index 0b7ceb4ca10f3c07ae6f42ef8c8201ed64e663b8..79f69541de0d03c28d5a6729c963746ae7ab4584 100644 --- a/test/fuzztest/jsnapisethostpromiserejectiontracker_fuzzer/jsnapisethostpromiserejectiontracker_fuzzer.cpp +++ b/test/fuzztest/jsnapisethostpromiserejectiontracker_fuzzer/jsnapisethostpromiserejectiontracker_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiSetHostPromiseRejectionTrackerFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -36,7 +36,7 @@ namespace OHOS { void JSNApiSetNativePtrGetterFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -48,7 +48,7 @@ namespace OHOS { void JSNApiSetHostResolveBufferTrackerFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -63,7 +63,7 @@ namespace OHOS { void JSNApiSetUnloalNativeModuleCallbackFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/jsnapisetloop_fuzzer/jsnapisetloop_fuzzer.cpp b/test/fuzztest/jsnapisetloop_fuzzer/jsnapisetloop_fuzzer.cpp index a2df6274521097a7ad1d0f1162f20ba9f8718a77..65de0445fb13126b8090ef6e89fa0ccdc0436945 100644 --- a/test/fuzztest/jsnapisetloop_fuzzer/jsnapisetloop_fuzzer.cpp +++ b/test/fuzztest/jsnapisetloop_fuzzer/jsnapisetloop_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiSetLoopFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -39,7 +39,7 @@ namespace OHOS { void JSNApiSynchronizVMInfoFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapisetprofilerstate_fuzzer/jsnapisetprofilerstate_fuzzer.cpp b/test/fuzztest/jsnapisetprofilerstate_fuzzer/jsnapisetprofilerstate_fuzzer.cpp index 026b1d1d196843c6b25ea0b7ff06284a6ff3ba23..e3b30ce2663e074ecf521ac83eb1f05dba49b717 100644 --- a/test/fuzztest/jsnapisetprofilerstate_fuzzer/jsnapisetprofilerstate_fuzzer.cpp +++ b/test/fuzztest/jsnapisetprofilerstate_fuzzer/jsnapisetprofilerstate_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiSetProfilerStateFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapistartdebugger_fuzzer/jsnapistartdebugger_fuzzer.cpp b/test/fuzztest/jsnapistartdebugger_fuzzer/jsnapistartdebugger_fuzzer.cpp index 51779b37b91d04afee663468d4c6feaa5c01cc8b..1cf4547b64bfb15afe1371265bed19f46833819a 100644 --- a/test/fuzztest/jsnapistartdebugger_fuzzer/jsnapistartdebugger_fuzzer.cpp +++ b/test/fuzztest/jsnapistartdebugger_fuzzer/jsnapistartdebugger_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiStartDebuggerFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/jsnapistopdebugger_fuzzer/jsnapistopdebugger_fuzzer.cpp b/test/fuzztest/jsnapistopdebugger_fuzzer/jsnapistopdebugger_fuzzer.cpp index c342b0c20bf6fddc6e3c475fdcaf017f8f16200c..029e19cccf9ff0128a4edbec0c6343ae39999cbd 100644 --- a/test/fuzztest/jsnapistopdebugger_fuzzer/jsnapistopdebugger_fuzzer.cpp +++ b/test/fuzztest/jsnapistopdebugger_fuzzer/jsnapistopdebugger_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiStopDebuggerFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapitriggergc_fuzzer/jsnapitriggergc_fuzzer.cpp b/test/fuzztest/jsnapitriggergc_fuzzer/jsnapitriggergc_fuzzer.cpp index 9c6eeddd40abc2c3c46981e781796f4293d8a5ea..805af1a0cd03431c45f89240318ac82c10de4fa8 100644 --- a/test/fuzztest/jsnapitriggergc_fuzzer/jsnapitriggergc_fuzzer.cpp +++ b/test/fuzztest/jsnapitriggergc_fuzzer/jsnapitriggergc_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t DEFAULT_THREAD_COUNT = 3; void JSNApiTriggerGCFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiuncaughtclearexception_fuzzer/jsnapiuncaughtclearexception_fuzzer.cpp b/test/fuzztest/jsnapiuncaughtclearexception_fuzzer/jsnapiuncaughtclearexception_fuzzer.cpp index edbebff9cf0a016942f995c8298da4401a1168ad..60d082d22a1d8f8dad4b4e4fe25fd07926dee4c0 100644 --- a/test/fuzztest/jsnapiuncaughtclearexception_fuzzer/jsnapiuncaughtclearexception_fuzzer.cpp +++ b/test/fuzztest/jsnapiuncaughtclearexception_fuzzer/jsnapiuncaughtclearexception_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiUncaughtClearExceptionFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapiuncaughtexception_fuzzer/jsnapiuncaughtexception_fuzzer.cpp b/test/fuzztest/jsnapiuncaughtexception_fuzzer/jsnapiuncaughtexception_fuzzer.cpp index 20360c6bce355dfb407d91991388a9c210d3305d..57eb93781b8ed361a984550933b7f6ffec2d11b5 100644 --- a/test/fuzztest/jsnapiuncaughtexception_fuzzer/jsnapiuncaughtexception_fuzzer.cpp +++ b/test/fuzztest/jsnapiuncaughtexception_fuzzer/jsnapiuncaughtexception_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiUncaughtExceptionFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsnapivalue_fuzzer/jsnapivalue_fuzzer.cpp b/test/fuzztest/jsnapivalue_fuzzer/jsnapivalue_fuzzer.cpp index b1c44191d1e29b64574dcccc1abd9cb7cf2db085..b0b53747ae1fcd21e7982d3ae3bd34af71b63bda 100644 --- a/test/fuzztest/jsnapivalue_fuzzer/jsnapivalue_fuzzer.cpp +++ b/test/fuzztest/jsnapivalue_fuzzer/jsnapivalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSNApiValueFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsonparse_fuzzer/jsonparse_fuzzer.cpp b/test/fuzztest/jsonparse_fuzzer/jsonparse_fuzzer.cpp index 55ddfa076cf01601b20e4c858d347a65fa515c8d..3d95efcdae1aec922a5bff1a3f4bd2ffab3531af 100644 --- a/test/fuzztest/jsonparse_fuzzer/jsonparse_fuzzer.cpp +++ b/test/fuzztest/jsonparse_fuzzer/jsonparse_fuzzer.cpp @@ -15,13 +15,13 @@ #include "jsonparse_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; #define MAXBYTELEN sizeof(uint32_t) @@ -29,7 +29,7 @@ namespace OHOS { void JSONParseFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); const char *const test{R"({"orientation": "portrait"})"}; int32_t input = 0; diff --git a/test/fuzztest/jsonstringify_fuzzer/jsonstringify_fuzzer.cpp b/test/fuzztest/jsonstringify_fuzzer/jsonstringify_fuzzer.cpp index e4d53205e425c36af910359762ff8f8adf7cd9d0..696c94945e367a5fe3adb1725f22a7bc97e7dc72 100644 --- a/test/fuzztest/jsonstringify_fuzzer/jsonstringify_fuzzer.cpp +++ b/test/fuzztest/jsonstringify_fuzzer/jsonstringify_fuzzer.cpp @@ -15,13 +15,13 @@ #include "jsonstringify_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; #define MAXBYTELEN sizeof(uint32_t) @@ -29,7 +29,7 @@ namespace OHOS { void JSONStringifyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); const char *const test{R"({"orientation": "portrait"})"}; int32_t input = 0; diff --git a/test/fuzztest/jsvalueref_fuzzer/jsvalueref_fuzzer.cpp b/test/fuzztest/jsvalueref_fuzzer/jsvalueref_fuzzer.cpp index f6422ed32019cd789245070c382441cedf4870e8..60475984ac0400de3ec27c66f205c823cc3d8258 100644 --- a/test/fuzztest/jsvalueref_fuzzer/jsvalueref_fuzzer.cpp +++ b/test/fuzztest/jsvalueref_fuzzer/jsvalueref_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSValueRefIsNullFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -38,7 +38,7 @@ namespace OHOS { void JSValueRefIsBooleanFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefbooleavalue_fuzzer/jsvaluerefbooleavalue_fuzzer.cpp b/test/fuzztest/jsvaluerefbooleavalue_fuzzer/jsvaluerefbooleavalue_fuzzer.cpp index fa99498e3df5d1a01c5740914e9ba5446f70b5d8..58426a67ecd95db73849b3ba5dbd8512137b8d8b 100644 --- a/test/fuzztest/jsvaluerefbooleavalue_fuzzer/jsvaluerefbooleavalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefbooleavalue_fuzzer/jsvaluerefbooleavalue_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t DIVIDEND = 2; void BooleaValueFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluereffoundationvalue_fuzzer/jsvaluereffoundationvalue_fuzzer.cpp b/test/fuzztest/jsvaluereffoundationvalue_fuzzer/jsvaluereffoundationvalue_fuzzer.cpp index 4b4b2bb542d17400e732a6dff61262de5413fe8f..99eac5a7c0ff2776b48c108ed11c466e198cc1c6 100644 --- a/test/fuzztest/jsvaluereffoundationvalue_fuzzer/jsvaluereffoundationvalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluereffoundationvalue_fuzzer/jsvaluereffoundationvalue_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void JSValueRefIsNumberValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int key = 0; uint32_t inputUnit32 = 32; @@ -64,7 +64,7 @@ void JSValueRefIsNumberValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsStringValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -78,7 +78,7 @@ void JSValueRefIsStringValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefWithinInt32ValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int number = 0; if (data == nullptr || size <= 0) { @@ -106,7 +106,7 @@ Local FunCallback(JsiRuntimeCallInfo *info) void JSValueRefIsFunctionValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -122,7 +122,7 @@ void JSValueRefIsFunctionValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsTypedArrayValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int number = 123; if (data == nullptr || size <= 0) { @@ -157,7 +157,7 @@ void JSValueRefIsTypedArrayValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsDateValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int key = 0; uint32_t inputUnit32 = 32; @@ -200,7 +200,7 @@ void JSValueRefIsDateValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsErrorValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int key = 0; uint32_t inputUnit32 = 32; @@ -233,7 +233,7 @@ void JSValueRefIsErrorValueFuzzTest(const uint8_t *data, size_t size) void JSValueRefToStringValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int key = 0; uint32_t inputUnit32 = 32; diff --git a/test/fuzztest/jsvaluerefint32value_fuzzer/jsvaluerefint32value_fuzzer.cpp b/test/fuzztest/jsvaluerefint32value_fuzzer/jsvaluerefint32value_fuzzer.cpp index ab89d09db35b94d3e4e47ec716c88f18dad57fa6..f58daab4ea094d01e764619be571094ef91bb1e2 100644 --- a/test/fuzztest/jsvaluerefint32value_fuzzer/jsvaluerefint32value_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefint32value_fuzzer/jsvaluerefint32value_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void JSValueRefInt32ValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int inputNum = 0; if (data == nullptr || size <= 0) { diff --git a/test/fuzztest/jsvaluerefintegervalue_fuzzer/jsvaluerefintegervalue_fuzzer.cpp b/test/fuzztest/jsvaluerefintegervalue_fuzzer/jsvaluerefintegervalue_fuzzer.cpp index 7617a2d5a3de5d5c7f7b06c5d5d031e746d99017..aac8b389997296d6b3053cc3d822297da122ecad 100644 --- a/test/fuzztest/jsvaluerefintegervalue_fuzzer/jsvaluerefintegervalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefintegervalue_fuzzer/jsvaluerefintegervalue_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { void JSValueRefIntegerValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisarray_fuzzer/jsvaluerefisarray_fuzzer.cpp b/test/fuzztest/jsvaluerefisarray_fuzzer/jsvaluerefisarray_fuzzer.cpp index da24e8e29afcd1d7c95e69c995c06a0ab4074fc2..747b6aebc05f934b3710c009ed3a399b24bc293b 100644 --- a/test/fuzztest/jsvaluerefisarray_fuzzer/jsvaluerefisarray_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisarray_fuzzer/jsvaluerefisarray_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void IsInt8ArrayFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -40,7 +40,7 @@ void IsInt8ArrayFuzztest(const uint8_t *data, size_t size) void IsUint8ArrayFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -56,7 +56,7 @@ void IsUint8ArrayFuzztest(const uint8_t *data, size_t size) void IsUint8ClampedArrayFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -72,7 +72,7 @@ void IsUint8ClampedArrayFuzztest(const uint8_t *data, size_t size) void IsInt16ArrayFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -89,7 +89,7 @@ void IsInt16ArrayFuzztest(const uint8_t *data, size_t size) void IsUint16ArrayFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisarraybuffer_fuzzer/jsvaluerefisarraybuffer_fuzzer.cpp b/test/fuzztest/jsvaluerefisarraybuffer_fuzzer/jsvaluerefisarraybuffer_fuzzer.cpp index dd40cbe4c37b43ff6cc42f9dcfcb735a87a6f5ff..fe420f703e7951e562fedbbf3e5e6b4d40ce730d 100644 --- a/test/fuzztest/jsvaluerefisarraybuffer_fuzzer/jsvaluerefisarraybuffer_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisarraybuffer_fuzzer/jsvaluerefisarraybuffer_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSValueRefIsArrayBufferFuzzerTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisarrayvalue_fuzzer/jsvaluerefisarrayvalue_fuzzer.cpp b/test/fuzztest/jsvaluerefisarrayvalue_fuzzer/jsvaluerefisarrayvalue_fuzzer.cpp index 10a9ac3cd1f0e69b5ee55fdcc86f643dc11a5310..5206643a00102e82b3b558e13966c4f6bf9b5521 100644 --- a/test/fuzztest/jsvaluerefisarrayvalue_fuzzer/jsvaluerefisarrayvalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisarrayvalue_fuzzer/jsvaluerefisarrayvalue_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void JSValueRefIsArrayValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); uint32_t length = 3; if (data == nullptr || size <= 0) { diff --git a/test/fuzztest/jsvaluerefisasync_fuzzer/jsvaluerefisasync_fuzzer.cpp b/test/fuzztest/jsvaluerefisasync_fuzzer/jsvaluerefisasync_fuzzer.cpp index 644da9e4eb708f2f5f4fb8920d03421d25be1466..a8c9bf9a739263a1e2687511b7106229ac3391b4 100644 --- a/test/fuzztest/jsvaluerefisasync_fuzzer/jsvaluerefisasync_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisasync_fuzzer/jsvaluerefisasync_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { void JSValueRefIsAsyncGeneratorFunctionTrueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -53,7 +53,7 @@ namespace OHOS { void JSValueRefIsAsyncGeneratorFunctionFalseFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -70,7 +70,7 @@ namespace OHOS { void JSValueRefIsAsyncGeneratorObjectTrueFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -94,7 +94,7 @@ namespace OHOS { void JSValueRefIsAsyncGeneratorObjectFalseFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisbig64array_fuzzer/jsvaluerefisbig64array_fuzzer.cpp b/test/fuzztest/jsvaluerefisbig64array_fuzzer/jsvaluerefisbig64array_fuzzer.cpp index 5bdfcdd8756c97c40c6e118874bf44f1f20d739e..fd9bb20d5d24c9d276c9c90f5b997e3576503f09 100644 --- a/test/fuzztest/jsvaluerefisbig64array_fuzzer/jsvaluerefisbig64array_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisbig64array_fuzzer/jsvaluerefisbig64array_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void JSValueRefIsBigInt64ArrayFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -53,7 +53,7 @@ void JSValueRefIsBigInt64ArrayFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsBigUint64ArrayRefNewFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisbuffer_fuzzer/jsvaluerefisbuffer_fuzzer.cpp b/test/fuzztest/jsvaluerefisbuffer_fuzzer/jsvaluerefisbuffer_fuzzer.cpp index 4b48d78690b0d6f3f64649edfc884de81e0984a4..bbd03fefc982858d72838d2e5a0aace627c342ed 100644 --- a/test/fuzztest/jsvaluerefisbuffer_fuzzer/jsvaluerefisbuffer_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisbuffer_fuzzer/jsvaluerefisbuffer_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSValueRefIsBufferFuzzerTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefiscontainer_fuzzer/jsvaluerefiscontainer_fuzzer.cpp b/test/fuzztest/jsvaluerefiscontainer_fuzzer/jsvaluerefiscontainer_fuzzer.cpp index c6639566443c4f2e9979578b264260f2ff10e8f7..daaca8acfd297bf4712c27df1c5051ab1ca964cc 100644 --- a/test/fuzztest/jsvaluerefiscontainer_fuzzer/jsvaluerefiscontainer_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefiscontainer_fuzzer/jsvaluerefiscontainer_fuzzer.cpp @@ -14,7 +14,7 @@ */ #include "jsvaluerefiscontainer_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/global_env.h" #include "ecmascript/js_api/js_api_tree_map.h" @@ -30,13 +30,13 @@ using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void JSValueRefIsVectorFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -61,7 +61,7 @@ void JSValueRefIsVectorFuzzTest([[maybe_unused]]const uint8_t *data, size_t size void JSValueRefIsMapFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -75,7 +75,7 @@ void JSValueRefIsMapFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) void JSValueRefIsRegExpFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -104,7 +104,7 @@ void JSValueRefIsRegExpFuzzTest([[maybe_unused]]const uint8_t *data, size_t size void JSValueRefIsSetFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -130,7 +130,7 @@ void JSValueRefIsSetFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) void JSValueRefIsTreeMapFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -155,7 +155,7 @@ void JSValueRefIsTreeMapFuzzTest([[maybe_unused]]const uint8_t *data, size_t siz void JSValueRefIsTreeSetFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefiscorrect_fuzzer/jsvaluerefiscorrect_fuzzer.cpp b/test/fuzztest/jsvaluerefiscorrect_fuzzer/jsvaluerefiscorrect_fuzzer.cpp index e8c80593d4d61e792e8bfafac882b1015ebbe4f8..163b06010c005d4046e34d8412f8381e657acf13 100644 --- a/test/fuzztest/jsvaluerefiscorrect_fuzzer/jsvaluerefiscorrect_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefiscorrect_fuzzer/jsvaluerefiscorrect_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "jsvaluerefiscorrect_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void JSValueRefIsFalseFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; @@ -40,7 +40,7 @@ void JSValueRefIsFalseFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) void JSValueRefIsTrueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -61,7 +61,7 @@ void JSValueRefIsTrueFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsHoleFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -82,7 +82,7 @@ void JSValueRefIsHoleFuzzTest(const uint8_t *data, size_t size) void JSValueRefIsUndefinedFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisdataview_fuzzer/jsvaluerefisdataview_fuzzer.cpp b/test/fuzztest/jsvaluerefisdataview_fuzzer/jsvaluerefisdataview_fuzzer.cpp index 1083332ba852ef05d95a8c945139d20cf6eba9af..46867563546b238306d70457dee2a0b92d3bc156 100644 --- a/test/fuzztest/jsvaluerefisdataview_fuzzer/jsvaluerefisdataview_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisdataview_fuzzer/jsvaluerefisdataview_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSValueRefIsDataViewFuzzerTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefisgenerator_fuzzer/jsvaluerefisgenerator_fuzzer.cpp b/test/fuzztest/jsvaluerefisgenerator_fuzzer/jsvaluerefisgenerator_fuzzer.cpp index 2f21fc5db41fc8890ba4185693f578d0a954905c..203c6c97c4b3a91bdb9e05856bdab13478debef0 100644 --- a/test/fuzztest/jsvaluerefisgenerator_fuzzer/jsvaluerefisgenerator_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisgenerator_fuzzer/jsvaluerefisgenerator_fuzzer.cpp @@ -33,7 +33,7 @@ namespace OHOS { void IsGeneratorObjectFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefishashmap_fuzzer/jsvaluerefishashmap_fuzzer.cpp b/test/fuzztest/jsvaluerefishashmap_fuzzer/jsvaluerefishashmap_fuzzer.cpp index ef9608aa2bc5519daa8d705d0b15eff12b4c120b..0414a8e4b0632dd04a38a01b5bda7e68b5fc983e 100644 --- a/test/fuzztest/jsvaluerefishashmap_fuzzer/jsvaluerefishashmap_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefishashmap_fuzzer/jsvaluerefishashmap_fuzzer.cpp @@ -62,7 +62,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -118,7 +118,7 @@ JSHandle ConstructobjectHashMap(JSThread *thread) void JSValueRefIsHashMapFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefishashset_fuzzer/jsvaluerefishashset_fuzzer.cpp b/test/fuzztest/jsvaluerefishashset_fuzzer/jsvaluerefishashset_fuzzer.cpp index d9d5464e1ee9c35c9210378eeb681e015c39fb30..ed42600409cecc1db3f1eb4ea3ba8cb5ea30990e 100644 --- a/test/fuzztest/jsvaluerefishashset_fuzzer/jsvaluerefishashset_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefishashset_fuzzer/jsvaluerefishashset_fuzzer.cpp @@ -80,7 +80,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -140,7 +140,7 @@ JSHandle ConstructobjectHashSet(JSThread *thread) void JSValueRefIsHashSetFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefisjs_fuzzer/jsvaluerefisjs_fuzzer.cpp b/test/fuzztest/jsvaluerefisjs_fuzzer/jsvaluerefisjs_fuzzer.cpp index b0d20be6549b636a401b7b32f0be60bb54afa3d6..5ca5ebf42e4cfe8d2216f739a552ce55b73292c3 100644 --- a/test/fuzztest/jsvaluerefisjs_fuzzer/jsvaluerefisjs_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisjs_fuzzer/jsvaluerefisjs_fuzzer.cpp @@ -14,7 +14,7 @@ */ #include "jsvaluerefisjs_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/js_array.h" #include "ecmascript/js_primitive_ref.h" @@ -24,13 +24,13 @@ using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void JSValueRefIsJSArrayFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -48,7 +48,7 @@ void JSValueRefIsJSArrayFuzzTest([[maybe_unused]]const uint8_t *data, size_t siz void JSValueRefIsJSPrimitiveNumberFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefisjsprimitive_fuzzer/jsvaluerefisjsprimitive_fuzzer.cpp b/test/fuzztest/jsvaluerefisjsprimitive_fuzzer/jsvaluerefisjsprimitive_fuzzer.cpp index 723bff6a6f020de0e736111029cb11b61e915b4b..ab8bd3fb843d33454c0839f6497c1fd0c2be2757 100644 --- a/test/fuzztest/jsvaluerefisjsprimitive_fuzzer/jsvaluerefisjsprimitive_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisjsprimitive_fuzzer/jsvaluerefisjsprimitive_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void IsJSPrimitiveSymbolFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -48,7 +48,7 @@ void IsJSPrimitiveSymbolFuzztest([[maybe_unused]]const uint8_t *data, size_t siz void IsJSPrimitiveStringFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -69,7 +69,7 @@ void IsJSPrimitiveStringFuzztest([[maybe_unused]]const uint8_t *data, size_t siz void IsJSPrimitiveIntFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefislightweightmapandset_fuzzer/jsvaluerefislightweightmapandset_fuzzer.cpp b/test/fuzztest/jsvaluerefislightweightmapandset_fuzzer/jsvaluerefislightweightmapandset_fuzzer.cpp index a6f27be16d65c4c170765b1660bd2251baada801..572c87ab121810aed0c25104a6dc0b15e01ed1c2 100644 --- a/test/fuzztest/jsvaluerefislightweightmapandset_fuzzer/jsvaluerefislightweightmapandset_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefislightweightmapandset_fuzzer/jsvaluerefislightweightmapandset_fuzzer.cpp @@ -80,7 +80,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -166,7 +166,7 @@ JSHandle ConstructobjectLightWeightSet(JSThread *thread) void JSValueRefIsLightWeightMapFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -186,7 +186,7 @@ void JSValueRefIsLightWeightMapFuzzTest([[maybe_unused]] const uint8_t *data, si void JSValueRefIsLightWeightSetFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefislinkedlist_fuzzer/jsvaluerefislinkedlist_fuzzer.cpp b/test/fuzztest/jsvaluerefislinkedlist_fuzzer/jsvaluerefislinkedlist_fuzzer.cpp index 598a43b97294f09bbf22bcd5a6fb92aa9d5e2ea1..5324f94bf8b25f161c4e8f12900aca6638436c98 100644 --- a/test/fuzztest/jsvaluerefislinkedlist_fuzzer/jsvaluerefislinkedlist_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefislinkedlist_fuzzer/jsvaluerefislinkedlist_fuzzer.cpp @@ -81,7 +81,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -115,7 +115,7 @@ void TearDownFrame(JSThread *thread, JSTaggedType *prev) void JSValueRefIsLinkedListFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefislinkedlistiterator_fuzzer/jsvaluerefislinkedlistiterator_fuzzer.cpp b/test/fuzztest/jsvaluerefislinkedlistiterator_fuzzer/jsvaluerefislinkedlistiterator_fuzzer.cpp index cab5fdda821132ccbe93f17f0c4ac2abf6615b50..e6c89e159583721ff2030d64ee0c279211867030 100644 --- a/test/fuzztest/jsvaluerefislinkedlistiterator_fuzzer/jsvaluerefislinkedlistiterator_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefislinkedlistiterator_fuzzer/jsvaluerefislinkedlistiterator_fuzzer.cpp @@ -86,7 +86,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -120,7 +120,7 @@ void TearDownFrame(JSThread *thread, JSTaggedType *prev) void JSValueRefIsLinkedListIteratorFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefislist_fuzzer/jsvaluerefislist_fuzzer.cpp b/test/fuzztest/jsvaluerefislist_fuzzer/jsvaluerefislist_fuzzer.cpp index 8a595fac4b358333df13950a570af54e31aa72a4..5b8b4e2d29acb68a2a57cb44d12ae957ab93aa4e 100644 --- a/test/fuzztest/jsvaluerefislist_fuzzer/jsvaluerefislist_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefislist_fuzzer/jsvaluerefislist_fuzzer.cpp @@ -81,7 +81,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -115,7 +115,7 @@ void TearDownFrame(JSThread *thread, JSTaggedType *prev) void JSValueRefIsListFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefismodulenamespace_fuzzer/jsvaluerefismodulenamespace_fuzzer.cpp b/test/fuzztest/jsvaluerefismodulenamespace_fuzzer/jsvaluerefismodulenamespace_fuzzer.cpp index 62f523dd3542aa4aa6bdcadff573d3c7cd961e90..22fc04c84b2284b9e8ed0bc2acd0ccd27752b344 100644 --- a/test/fuzztest/jsvaluerefismodulenamespace_fuzzer/jsvaluerefismodulenamespace_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefismodulenamespace_fuzzer/jsvaluerefismodulenamespace_fuzzer.cpp @@ -36,7 +36,7 @@ constexpr uint32_t ERROR_TYPE_LEN = 2; void IsModuleNamespaceObjectFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -68,7 +68,7 @@ void IsModuleNamespaceObjectFuzztest([[maybe_unused]]const uint8_t *data, size_t void IsProxyFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -93,7 +93,7 @@ void IsProxyFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSCollatorFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -120,7 +120,7 @@ void IsJSCollatorFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSPluralRulesFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -148,7 +148,7 @@ void IsJSPluralRulesFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsStrictEqualsFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -163,7 +163,7 @@ void IsStrictEqualsFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSListFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -177,7 +177,7 @@ void IsJSListFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSPrimitiveRefFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -200,7 +200,7 @@ void IsJSPrimitiveRefFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsDequeFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -239,7 +239,7 @@ Local CreateJSValueRef(EcmaVM *vm, panda::ecmascript::JSType type) void IsJSIntlFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -256,7 +256,7 @@ void IsJSIntlFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSDateTimeFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -273,7 +273,7 @@ void IsJSDateTimeFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size void IsJSNumberFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -290,7 +290,7 @@ void IsJSNumberFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) void IsJSRelativeTimeFormatFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefisnativepointervalue_fuzzer/jsvaluerefisnativepointervalue_fuzzer.cpp b/test/fuzztest/jsvaluerefisnativepointervalue_fuzzer/jsvaluerefisnativepointervalue_fuzzer.cpp index 9b10f3bbc47a30922b287ecd7123007178d8d423..edcd5e71f8fd2764a6c6d7706f0df6e0b536386a 100644 --- a/test/fuzztest/jsvaluerefisnativepointervalue_fuzzer/jsvaluerefisnativepointervalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisnativepointervalue_fuzzer/jsvaluerefisnativepointervalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSValueRefIsNativePointerValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefisplainarray_fuzzer/jsvaluerefisplainarray_fuzzer.cpp b/test/fuzztest/jsvaluerefisplainarray_fuzzer/jsvaluerefisplainarray_fuzzer.cpp index f14fa08132da92ef4f8e11b948b001ded0bff725..deecadd04c78b0051a159ba117efdbb4bcbd0a3a 100644 --- a/test/fuzztest/jsvaluerefisplainarray_fuzzer/jsvaluerefisplainarray_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefisplainarray_fuzzer/jsvaluerefisplainarray_fuzzer.cpp @@ -81,7 +81,7 @@ EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue n } EcmaRuntimeCallInfo *ecmaRuntimeCallInfo = reinterpret_cast(newSp - 2); *(--newSp) = numActualArgs; - *(--newSp) = ToUintPtr(thread); + *(--newSp) = common::ToUintPtr(thread); ecmaRuntimeCallInfo->SetNewTarget(newTgt); return ecmaRuntimeCallInfo; } @@ -115,7 +115,7 @@ void TearDownFrame(JSThread *thread, JSTaggedType *prev) void JSValueRefIsPlainArrayFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/jsvaluerefispromisevalue_fuzzer/jsvaluerefispromisevalue_fuzzer.cpp b/test/fuzztest/jsvaluerefispromisevalue_fuzzer/jsvaluerefispromisevalue_fuzzer.cpp index f6d7122c46f0e6d09408a5873c01d57b622c1aca..302a303e990daf64087184072c568aae6da3a08d 100644 --- a/test/fuzztest/jsvaluerefispromisevalue_fuzzer/jsvaluerefispromisevalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefispromisevalue_fuzzer/jsvaluerefispromisevalue_fuzzer.cpp @@ -31,7 +31,7 @@ Local RejectCallback(JsiRuntimeCallInfo *info) void JSValueRefIsPromiseValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefissharedarraybuffer_fuzzer/jsvaluerefissharedarraybuffer_fuzzer.cpp b/test/fuzztest/jsvaluerefissharedarraybuffer_fuzzer/jsvaluerefissharedarraybuffer_fuzzer.cpp index 86ebbef0c59d84e6fa0b287f85d0bc026f9f8c19..cf679881d565ae2c2706e1f561e9ee5e5e730d13 100644 --- a/test/fuzztest/jsvaluerefissharedarraybuffer_fuzzer/jsvaluerefissharedarraybuffer_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefissharedarraybuffer_fuzzer/jsvaluerefissharedarraybuffer_fuzzer.cpp @@ -35,7 +35,7 @@ namespace OHOS { void JSValueRefIsWeakMapFuzzerTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluerefnullvalue_fuzzer/jsvaluerefnullvalue_fuzzer.cpp b/test/fuzztest/jsvaluerefnullvalue_fuzzer/jsvaluerefnullvalue_fuzzer.cpp index f30966e43a543044df162a6d59963b55360cd793..8f1554b0b9e3c8cf6ef5dfc58fe0c7f1f5b289af 100644 --- a/test/fuzztest/jsvaluerefnullvalue_fuzzer/jsvaluerefnullvalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefnullvalue_fuzzer/jsvaluerefnullvalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSValueRefNullValueFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "Parameter out of range.."; diff --git a/test/fuzztest/jsvaluerefobject_fuzzer/jsvaluerefobject_fuzzer.cpp b/test/fuzztest/jsvaluerefobject_fuzzer/jsvaluerefobject_fuzzer.cpp index 3d76db44f420b1dadaea9ce4057ac54116fb85d4..16523df8120bb62124ec71ef428a205222e31b57 100644 --- a/test/fuzztest/jsvaluerefobject_fuzzer/jsvaluerefobject_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefobject_fuzzer/jsvaluerefobject_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void JSValueRefIsSymbolFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -43,7 +43,7 @@ namespace OHOS { void JSValueRefIsBigIntFuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -58,7 +58,7 @@ namespace OHOS { void JSValueRefIsObjectFuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -72,7 +72,7 @@ namespace OHOS { void IsArgumentsObjectFuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -91,7 +91,7 @@ namespace OHOS { void IsJSPrimitiveBooleanFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -106,7 +106,7 @@ namespace OHOS { void IsGeneratorFunctionFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluereftobigint_fuzzer/jsvaluereftobigint_fuzzer.cpp b/test/fuzztest/jsvaluereftobigint_fuzzer/jsvaluereftobigint_fuzzer.cpp index d2af29b8c81d51585cd2320f43113eb8861dd544..c3c4193ea921ef13ff81315f5c2483933005a0be 100644 --- a/test/fuzztest/jsvaluereftobigint_fuzzer/jsvaluereftobigint_fuzzer.cpp +++ b/test/fuzztest/jsvaluereftobigint_fuzzer/jsvaluereftobigint_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSValueRefToBigIntFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -45,7 +45,7 @@ void JSValueRefToBigIntFuzztest(const uint8_t *data, size_t size) void JSValueRefTypeofFuzztest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/jsvaluereftobooleanvalue_fuzzer/jsvaluereftobooleanvalue_fuzzer.cpp b/test/fuzztest/jsvaluereftobooleanvalue_fuzzer/jsvaluereftobooleanvalue_fuzzer.cpp index 59fa24409eb069be9ca7f184a83cce4e5b7c3f30..560f923da5274f37b20ad3accda97164fd170bf3 100644 --- a/test/fuzztest/jsvaluereftobooleanvalue_fuzzer/jsvaluereftobooleanvalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluereftobooleanvalue_fuzzer/jsvaluereftobooleanvalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSValueRefToBooleanValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; diff --git a/test/fuzztest/jsvaluereftonumbervalue_fuzzer/jsvaluereftonumbervalue_fuzzer.cpp b/test/fuzztest/jsvaluereftonumbervalue_fuzzer/jsvaluereftonumbervalue_fuzzer.cpp index 878f34373965ecd0868258c5da6e210df7ee3f7a..de3d53bb4d5331cd1635dee82adf9c047867a157 100644 --- a/test/fuzztest/jsvaluereftonumbervalue_fuzzer/jsvaluereftonumbervalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluereftonumbervalue_fuzzer/jsvaluereftonumbervalue_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void JSValueRefToNumberValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; diff --git a/test/fuzztest/jsvaluereftoobjectvalue_fuzzer/jsvaluereftoobjectvalue_fuzzer.cpp b/test/fuzztest/jsvaluereftoobjectvalue_fuzzer/jsvaluereftoobjectvalue_fuzzer.cpp index c7c57b609f7da50af90a7d15031b27414c09a0b3..e162b975cfff1b0222a8ff5e52f7b6a526e66b1a 100644 --- a/test/fuzztest/jsvaluereftoobjectvalue_fuzzer/jsvaluereftoobjectvalue_fuzzer.cpp +++ b/test/fuzztest/jsvaluereftoobjectvalue_fuzzer/jsvaluereftoobjectvalue_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void JSValueRefToObjectValueFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "Parameter out of range.."; diff --git a/test/fuzztest/jsvaluerefuint32value_fuzzer/jsvaluerefuint32value_fuzzer.cpp b/test/fuzztest/jsvaluerefuint32value_fuzzer/jsvaluerefuint32value_fuzzer.cpp index 6c56fe049b48095c49039c963d74559335fecf5e..b89912b3165fb460f7f9467785fd772bbc169111 100644 --- a/test/fuzztest/jsvaluerefuint32value_fuzzer/jsvaluerefuint32value_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefuint32value_fuzzer/jsvaluerefuint32value_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void JSValueRefUint32ValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); unsigned int number = 456; if (data == nullptr || size <= 0) { diff --git a/test/fuzztest/jsvaluerefwithinint32_fuzzer/jsvaluerefwithinint32_fuzzer.cpp b/test/fuzztest/jsvaluerefwithinint32_fuzzer/jsvaluerefwithinint32_fuzzer.cpp index 54d34946e2f32f4918cbcacec4ac2968ad715257..00360f99d89018312f53475f10f045ed4178a1e4 100644 --- a/test/fuzztest/jsvaluerefwithinint32_fuzzer/jsvaluerefwithinint32_fuzzer.cpp +++ b/test/fuzztest/jsvaluerefwithinint32_fuzzer/jsvaluerefwithinint32_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "jsvaluerefwithinint32_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void JSValueRefWithinInt32FuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/loadpatchlong_fuzzer/loadpatchlong_fuzzer.cpp b/test/fuzztest/loadpatchlong_fuzzer/loadpatchlong_fuzzer.cpp index f66e9f720f9d7111030e00e071809b5d63830cd8..f93539f6ce30f222d8d97a5ef5a7604275a9edde 100644 --- a/test/fuzztest/loadpatchlong_fuzzer/loadpatchlong_fuzzer.cpp +++ b/test/fuzztest/loadpatchlong_fuzzer/loadpatchlong_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void LoadPatchLongFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); std::string baseFileName = "index.abc"; std::string patchFileName = "index.abc"; diff --git a/test/fuzztest/mapiteratorefget_fuzzer/mapiteratorefget_fuzzer.cpp b/test/fuzztest/mapiteratorefget_fuzzer/mapiteratorefget_fuzzer.cpp index 91af5d17879d55c7d5bedaced4130c23f0921759..c2a4c350ddcfffae8a6cc5b775259b54757b3dce 100644 --- a/test/fuzztest/mapiteratorefget_fuzzer/mapiteratorefget_fuzzer.cpp +++ b/test/fuzztest/mapiteratorefget_fuzzer/mapiteratorefget_fuzzer.cpp @@ -65,7 +65,7 @@ namespace OHOS { void MapIteratorRefGetIndexFuzzTest([[maybe_unused]] const uint8_t *data, [[maybe_unused]] size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -90,7 +90,7 @@ void MapIteratorRefGetIndexFuzzTest([[maybe_unused]] const uint8_t *data, [[mayb void MapIteratorRefGetKindFuzzTest([[maybe_unused]] const uint8_t *data, [[maybe_unused]] size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/maprefgetsetkeyvaluesize_fuzzer/maprefgetsetkeyvaluesize_fuzzer.cpp b/test/fuzztest/maprefgetsetkeyvaluesize_fuzzer/maprefgetsetkeyvaluesize_fuzzer.cpp index 36529490acbbd759209b2927a3d13dc37d88df3f..23e905ca6ff059edb5d7a9eaf59f74cf68179170 100644 --- a/test/fuzztest/maprefgetsetkeyvaluesize_fuzzer/maprefgetsetkeyvaluesize_fuzzer.cpp +++ b/test/fuzztest/maprefgetsetkeyvaluesize_fuzzer/maprefgetsetkeyvaluesize_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void Int32GetSizeFuzzerTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/nativepointernew1_fuzzer/nativepointernew1_fuzzer.cpp b/test/fuzztest/nativepointernew1_fuzzer/nativepointernew1_fuzzer.cpp index bba4b24f44fd4e7e2708333a1de5eeab66b1c3d6..d69716f17e84d0d1aee03c7cd87187f95016bd79 100644 --- a/test/fuzztest/nativepointernew1_fuzzer/nativepointernew1_fuzzer.cpp +++ b/test/fuzztest/nativepointernew1_fuzzer/nativepointernew1_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void NativePointerNew1FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/nativepointernew2_fuzzer/nativepointernew2_fuzzer.cpp b/test/fuzztest/nativepointernew2_fuzzer/nativepointernew2_fuzzer.cpp index ede8b222f6df6a924b01848aa783966fccac703b..a84b182ba78960213c9daa8935bea2f0b0d6f0b7 100644 --- a/test/fuzztest/nativepointernew2_fuzzer/nativepointernew2_fuzzer.cpp +++ b/test/fuzztest/nativepointernew2_fuzzer/nativepointernew2_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void NativePointerNew2FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/newbigintbyint64_fuzzer/newbigintbyint64_fuzzer.cpp b/test/fuzztest/newbigintbyint64_fuzzer/newbigintbyint64_fuzzer.cpp index d41f9fde39fe1ddb3ea09f59db8ba9916b9e8e1b..dced8684bac9457d17d134a8f784ae40aae028ba 100644 --- a/test/fuzztest/newbigintbyint64_fuzzer/newbigintbyint64_fuzzer.cpp +++ b/test/fuzztest/newbigintbyint64_fuzzer/newbigintbyint64_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void NewBigIntByInt64FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/newbigintbyuint64_fuzzer/newbigintbyuint64_fuzzer.cpp b/test/fuzztest/newbigintbyuint64_fuzzer/newbigintbyuint64_fuzzer.cpp index c1a803945a4c7c167615f0ef792a44047877681e..3d536b24532584fc26c92f5e80e1309d2e795c71 100644 --- a/test/fuzztest/newbigintbyuint64_fuzzer/newbigintbyuint64_fuzzer.cpp +++ b/test/fuzztest/newbigintbyuint64_fuzzer/newbigintbyuint64_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void NewBigIntByUint64FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/notifyapplicationstate_fuzzer/notifyapplicationstate_fuzzer.cpp b/test/fuzztest/notifyapplicationstate_fuzzer/notifyapplicationstate_fuzzer.cpp index 76b32bf5b1800a28366e3a4fbc2b401b9236a68d..82a34eeb90607bf12997eb2845583b47e19827ab 100644 --- a/test/fuzztest/notifyapplicationstate_fuzzer/notifyapplicationstate_fuzzer.cpp +++ b/test/fuzztest/notifyapplicationstate_fuzzer/notifyapplicationstate_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void NotifyApplicationStateFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/notifyidletime_fuzzer/notifyidletime_fuzzer.cpp b/test/fuzztest/notifyidletime_fuzzer/notifyidletime_fuzzer.cpp index ba5d4506fec36cba450f3c93d1789bba3d63ea9b..768d3f8da3a6ca110acc39d2e80aaa81b5b0bbbb 100644 --- a/test/fuzztest/notifyidletime_fuzzer/notifyidletime_fuzzer.cpp +++ b/test/fuzztest/notifyidletime_fuzzer/notifyidletime_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void NotifyIdleTimeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/numberrefnewdouble_fuzzer/numberrefnewdouble_fuzzer.cpp b/test/fuzztest/numberrefnewdouble_fuzzer/numberrefnewdouble_fuzzer.cpp index 8f54ccfacfbdf33a687e5003b4a7746186a7e743..efc288de14a11957b06b5f1d36045041a72d92e5 100644 --- a/test/fuzztest/numberrefnewdouble_fuzzer/numberrefnewdouble_fuzzer.cpp +++ b/test/fuzztest/numberrefnewdouble_fuzzer/numberrefnewdouble_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void NumberRefNewDoubleFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/numberrefnewint32_fuzzer/numberrefnewint32_fuzzer.cpp b/test/fuzztest/numberrefnewint32_fuzzer/numberrefnewint32_fuzzer.cpp index 85b178ca97fe2f2440bca092f0f0db32825d0743..a03b476a02ebd11cbfd49ffe9cacf0f5d59bead9 100644 --- a/test/fuzztest/numberrefnewint32_fuzzer/numberrefnewint32_fuzzer.cpp +++ b/test/fuzztest/numberrefnewint32_fuzzer/numberrefnewint32_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void NumberRefNewInt32FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/numberrefnewint64_fuzzer/numberrefnewint64_fuzzer.cpp b/test/fuzztest/numberrefnewint64_fuzzer/numberrefnewint64_fuzzer.cpp index 96d8bfe1c18f9fb67c08eb803eff69dab3952335..f2ab66c9f5e40d8fcafa6c6c8ef23d667daf2e80 100644 --- a/test/fuzztest/numberrefnewint64_fuzzer/numberrefnewint64_fuzzer.cpp +++ b/test/fuzztest/numberrefnewint64_fuzzer/numberrefnewint64_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void NumberRefNewInt64FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/numberrefnewuint32_fuzzer/numberrefnewuint32_fuzzer.cpp b/test/fuzztest/numberrefnewuint32_fuzzer/numberrefnewuint32_fuzzer.cpp index e24a68756aa71247ad3e1ba4f0d6343caf296b86..25f792596b0de276203fc243ad5811c4587dffa6 100644 --- a/test/fuzztest/numberrefnewuint32_fuzzer/numberrefnewuint32_fuzzer.cpp +++ b/test/fuzztest/numberrefnewuint32_fuzzer/numberrefnewuint32_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void NumberRefNewUint32FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); uint32_t input = 0; if (size <= 0) { diff --git a/test/fuzztest/numberrefvalue_fuzzer/numberrefvalue_fuzzer.cpp b/test/fuzztest/numberrefvalue_fuzzer/numberrefvalue_fuzzer.cpp index 13c6e54aabec327929ff50d4a94672c522c5b10d..574b542352e50affcd379579dea45b936be769cf 100644 --- a/test/fuzztest/numberrefvalue_fuzzer/numberrefvalue_fuzzer.cpp +++ b/test/fuzztest/numberrefvalue_fuzzer/numberrefvalue_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void NumberRefValueFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); double input = 0; if (data == nullptr || size <= 0) { diff --git a/test/fuzztest/objectbool_fuzzer/objectbool_fuzzer.cpp b/test/fuzztest/objectbool_fuzzer/objectbool_fuzzer.cpp index b29f4dc1bebaed2121b285c59f5bfbf436301aba..539c6e730d8c55dab3ed802816582eb0157a2b9d 100644 --- a/test/fuzztest/objectbool_fuzzer/objectbool_fuzzer.cpp +++ b/test/fuzztest/objectbool_fuzzer/objectbool_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ObjectBoolGetFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -39,7 +39,7 @@ void ObjectBoolGetFuzzTest(const uint8_t *data, size_t size) void ObjectBoolHasFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -54,7 +54,7 @@ void ObjectBoolHasFuzzTest(const uint8_t *data, size_t size) void ObjectBoolSetFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/objectdelete_fuzzer/objectdelete_fuzzer.cpp b/test/fuzztest/objectdelete_fuzzer/objectdelete_fuzzer.cpp index 3e94146694b97776c1fc5f3f872bc13feaa27b34..275f8e57e14fa9163b80dc185cbe8c73efee1830 100644 --- a/test/fuzztest/objectdelete_fuzzer/objectdelete_fuzzer.cpp +++ b/test/fuzztest/objectdelete_fuzzer/objectdelete_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectDeleteFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/objectget_fuzzer/objectget_fuzzer.cpp b/test/fuzztest/objectget_fuzzer/objectget_fuzzer.cpp index 1d46a2efcffa6b5385d4704fd0f73cf6a18451f4..7b458833b16dff0c3a1117f061c777e881ce9544 100644 --- a/test/fuzztest/objectget_fuzzer/objectget_fuzzer.cpp +++ b/test/fuzztest/objectget_fuzzer/objectget_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectGetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/objectgetinformation_fuzzer/objectgetinformation_fuzzer.cpp b/test/fuzztest/objectgetinformation_fuzzer/objectgetinformation_fuzzer.cpp index f388d3e0a7905579f35ab35906ed4fa3ba1c0ab6..ac1b6828fba2d59e4762dc9fd2c0c8058971dde2 100644 --- a/test/fuzztest/objectgetinformation_fuzzer/objectgetinformation_fuzzer.cpp +++ b/test/fuzztest/objectgetinformation_fuzzer/objectgetinformation_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ObjectGetAllPropertyNamesFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -58,7 +58,7 @@ void ObjectGetAllPropertyNamesFuzzTest(const uint8_t *data, size_t size) void ObjectGetNativePointerFieldCountFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -85,7 +85,7 @@ void ObjectGetNativePointerFieldCountFuzzTest(const uint8_t *data, size_t size) void ObjectGetOwnEnumerablePropertyNamesFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -110,7 +110,7 @@ void ObjectGetOwnEnumerablePropertyNamesFuzzTest(const uint8_t *data, size_t siz void ObjectGetOwnPropertyNamesFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/objecthas_fuzzer/objecthas_fuzzer.cpp b/test/fuzztest/objecthas_fuzzer/objecthas_fuzzer.cpp index c48df933faeec3fc3e666db15c00d65c333c5922..dc4f1fc675aa6e81e9a480c055023a6a9847baa5 100644 --- a/test/fuzztest/objecthas_fuzzer/objecthas_fuzzer.cpp +++ b/test/fuzztest/objecthas_fuzzer/objecthas_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/objectref_fuzzer/objectref_fuzzer.cpp b/test/fuzztest/objectref_fuzzer/objectref_fuzzer.cpp index bdb40f716ff60dba5358e57e1d059bffbe1cb11b..2a6f8c136ec5ba5e2826f2a92c6fa6ab47bab0dc 100644 --- a/test/fuzztest/objectref_fuzzer/objectref_fuzzer.cpp +++ b/test/fuzztest/objectref_fuzzer/objectref_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { void SetAccessorPropertyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -49,7 +49,7 @@ namespace OHOS { void DefinePropertyFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/objectrefall_fuzzer/objectrefall_fuzzer.cpp b/test/fuzztest/objectrefall_fuzzer/objectrefall_fuzzer.cpp index f8db7be686666cc5aa0564102dac0bc49375195d..db737c84bce99370c1d8196b4cbf8a58dcda4412 100644 --- a/test/fuzztest/objectrefall_fuzzer/objectrefall_fuzzer.cpp +++ b/test/fuzztest/objectrefall_fuzzer/objectrefall_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void ObjectGetPrototypeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -42,7 +42,7 @@ namespace OHOS { void ObjectSealFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -60,7 +60,7 @@ namespace OHOS { void ObjectFreezeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/objectrefdelete_fuzzer/objectrefdelete_fuzzer.cpp b/test/fuzztest/objectrefdelete_fuzzer/objectrefdelete_fuzzer.cpp index f17d548e4117ce172aa6a858183ba95ad0a29bbe..5b0febfc28d9751dc7c3e4c607a04cc0fdaa499d 100644 --- a/test/fuzztest/objectrefdelete_fuzzer/objectrefdelete_fuzzer.cpp +++ b/test/fuzztest/objectrefdelete_fuzzer/objectrefdelete_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectRefDeleteFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { std::cout << "illegal input!"; diff --git a/test/fuzztest/objectrefgetglobalobject_fuzzer/objectrefgetglobalobject_fuzzer.cpp b/test/fuzztest/objectrefgetglobalobject_fuzzer/objectrefgetglobalobject_fuzzer.cpp index 9ff10fc85f9f057118e1c3621b93a444c46dee8c..97f80d1d2cef9615bb2de6d8bf0bcf72768214db 100644 --- a/test/fuzztest/objectrefgetglobalobject_fuzzer/objectrefgetglobalobject_fuzzer.cpp +++ b/test/fuzztest/objectrefgetglobalobject_fuzzer/objectrefgetglobalobject_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectRefGetGlobalObjectFuzzTest([[maybe_unused]] const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "Parameter out of range.."; diff --git a/test/fuzztest/objectrefgetownproperty_fuzzer/objectrefgetownproperty_fuzzer.cpp b/test/fuzztest/objectrefgetownproperty_fuzzer/objectrefgetownproperty_fuzzer.cpp index 04250bc462aa60cdf1dde3a4aa0b0d5f67cdae67..00cf160a302b54657094d14e3d182a37280a9e4f 100644 --- a/test/fuzztest/objectrefgetownproperty_fuzzer/objectrefgetownproperty_fuzzer.cpp +++ b/test/fuzztest/objectrefgetownproperty_fuzzer/objectrefgetownproperty_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void JSNApiGetOwnPropertyFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/objectrefsetprototype_fuzzer/objectrefsetprototype_fuzzer.cpp b/test/fuzztest/objectrefsetprototype_fuzzer/objectrefsetprototype_fuzzer.cpp index 9d94c2ff48813fe86060dc14eb86ded321fcc41a..c5caa13bf38ad2bf5a48f6892b05af91a7b808f7 100644 --- a/test/fuzztest/objectrefsetprototype_fuzzer/objectrefsetprototype_fuzzer.cpp +++ b/test/fuzztest/objectrefsetprototype_fuzzer/objectrefsetprototype_fuzzer.cpp @@ -23,7 +23,7 @@ namespace OHOS { void ObjectRefSetPrototypeFuzzTest([[maybe_unused]]const uint8_t *data, [[maybe_unused]]size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "Parameter out of range."; diff --git a/test/fuzztest/objectset_fuzzer/objectset_fuzzer.cpp b/test/fuzztest/objectset_fuzzer/objectset_fuzzer.cpp index 8ba3ec512ecfe9016d91ab6e1a7c4d9f79f80a51..73efa12f89dd96dec15dadfaa1c26ea7f01abd6c 100644 --- a/test/fuzztest/objectset_fuzzer/objectset_fuzzer.cpp +++ b/test/fuzztest/objectset_fuzzer/objectset_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ObjectSetFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/primitiverefgetvalue_fuzzer/primitiverefgetvalue_fuzzer.cpp b/test/fuzztest/primitiverefgetvalue_fuzzer/primitiverefgetvalue_fuzzer.cpp index 2fed6e56b775a2bc9edb378cf9f80febd25f023a..f94e3d5145fe4cf40d784f0e2010eb797140f45b 100644 --- a/test/fuzztest/primitiverefgetvalue_fuzzer/primitiverefgetvalue_fuzzer.cpp +++ b/test/fuzztest/primitiverefgetvalue_fuzzer/primitiverefgetvalue_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { void PrimitiveRefGetValueFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/promiseref_fuzzer/promiseref_fuzzer.cpp b/test/fuzztest/promiseref_fuzzer/promiseref_fuzzer.cpp index 58dcc6760fb7e95a34981799d31221e9323a2366..89195c1eeffa6491782edf5835eb1ce226133635 100644 --- a/test/fuzztest/promiseref_fuzzer/promiseref_fuzzer.cpp +++ b/test/fuzztest/promiseref_fuzzer/promiseref_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { using FunctionCallback = Local(*)(JsiRuntimeCallInfo*); RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -45,7 +45,7 @@ namespace OHOS { { using FunctionCallback = Local(*)(JsiRuntimeCallInfo*); RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -66,7 +66,7 @@ namespace OHOS { { using FunctionCallback = Local(*)(JsiRuntimeCallInfo*); RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/promiserejectinfo_fuzzer/promiserejectinfo_fuzzer.cpp b/test/fuzztest/promiserejectinfo_fuzzer/promiserejectinfo_fuzzer.cpp index b6b4873839cc8280ee81c5ff021fbf1bfb7c1926..a2f6ae7af01a083114463f1438dd33ddd4b530ca 100644 --- a/test/fuzztest/promiserejectinfo_fuzzer/promiserejectinfo_fuzzer.cpp +++ b/test/fuzztest/promiserejectinfo_fuzzer/promiserejectinfo_fuzzer.cpp @@ -15,18 +15,18 @@ #include "promiserejectinfo_fuzzer.h" #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void PromiseRejectInfoNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -45,7 +45,7 @@ namespace OHOS { void GetDataFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -64,7 +64,7 @@ namespace OHOS { void PromiseRejectInfoGetPromiseFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -83,7 +83,7 @@ namespace OHOS { void PromiseRejectInfoGetReasonFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -102,7 +102,7 @@ namespace OHOS { void PromiseRejectInfoGetOperationFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/propertyattribute_fuzzer/propertyattribute_fuzzer.cpp b/test/fuzztest/propertyattribute_fuzzer/propertyattribute_fuzzer.cpp index f58625d7f83fffa7e4f17752de7c53e713b3772a..9d45bed1cf9208ac161df74dfe01280f4f91cb79 100644 --- a/test/fuzztest/propertyattribute_fuzzer/propertyattribute_fuzzer.cpp +++ b/test/fuzztest/propertyattribute_fuzzer/propertyattribute_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void PropertyAttributeFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; @@ -39,7 +39,7 @@ void PropertyAttributeFuzzTest(const uint8_t *data, size_t size) void PropertyAttributeSetIsFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/proxyrefisrevoked_fuzzer/proxyrefisrevoked_fuzzer.cpp b/test/fuzztest/proxyrefisrevoked_fuzzer/proxyrefisrevoked_fuzzer.cpp index 27982da575d92552cdfbfcc43c89d5da57901cf9..d1d6c0ddbb5c8e1b3ad2e08e62785b167d786ec2 100644 --- a/test/fuzztest/proxyrefisrevoked_fuzzer/proxyrefisrevoked_fuzzer.cpp +++ b/test/fuzztest/proxyrefisrevoked_fuzzer/proxyrefisrevoked_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ProxyRefIsRevokedFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/publicapicollatorrefget_fuzzer/publicapicollatorrefget_fuzzer.cpp b/test/fuzztest/publicapicollatorrefget_fuzzer/publicapicollatorrefget_fuzzer.cpp index 60087700e6b0d0728118d92a759cea2fcecb6bdd..e962cd689f157a6c8269981db112180af2d0e73e 100644 --- a/test/fuzztest/publicapicollatorrefget_fuzzer/publicapicollatorrefget_fuzzer.cpp +++ b/test/fuzztest/publicapicollatorrefget_fuzzer/publicapicollatorrefget_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { void GetCompareFunctionFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/publicapigeneratorobjectref_fuzzer/publicapigeneratorobjectref_fuzzer.cpp b/test/fuzztest/publicapigeneratorobjectref_fuzzer/publicapigeneratorobjectref_fuzzer.cpp index d1fa617ec99345eb42c430472aa19dbd6d412352..3b795b4d1a07d59afc2ab6f8b6b8a3424427841a 100644 --- a/test/fuzztest/publicapigeneratorobjectref_fuzzer/publicapigeneratorobjectref_fuzzer.cpp +++ b/test/fuzztest/publicapigeneratorobjectref_fuzzer/publicapigeneratorobjectref_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { void GetGeneratorReceiverFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/publicapilocalregexpref_fuzzer/publicapilocalregexpref_fuzzer.cpp b/test/fuzztest/publicapilocalregexpref_fuzzer/publicapilocalregexpref_fuzzer.cpp index ba05d0f53b26379acbc705226de020954ba9493f..c0a3e8af622c34820f753a8557e5bca009ee2908 100644 --- a/test/fuzztest/publicapilocalregexpref_fuzzer/publicapilocalregexpref_fuzzer.cpp +++ b/test/fuzztest/publicapilocalregexpref_fuzzer/publicapilocalregexpref_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void LocalRegExpGetOriginalSourceFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -56,7 +56,7 @@ void LocalRegExpGetOriginalSourceFuzzTest([[maybe_unused]]const uint8_t *data, s void LocalRegExpRefGetOriginalFlagsFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -85,7 +85,7 @@ void LocalRegExpRefGetOriginalFlagsFuzzTest([[maybe_unused]]const uint8_t *data, void LocalRegExpIsGlobalRefFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -107,7 +107,7 @@ void LocalRegExpIsGlobalRefFuzzTest([[maybe_unused]]const uint8_t *data, size_t void LocalRegExpIsIgnoreCaseFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -131,7 +131,7 @@ void LocalRegExpIsIgnoreCaseFuzzTest([[maybe_unused]]const uint8_t *data, size_t void LocalRegExpIsMultilineFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -155,7 +155,7 @@ void LocalRegExpIsMultilineFuzzTest([[maybe_unused]]const uint8_t *data, size_t void LocalRegExpIsDotAllFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -179,7 +179,7 @@ void LocalRegExpIsDotAllFuzzTest([[maybe_unused]]const uint8_t *data, size_t siz void LocalRegExpIsUtf16FuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -203,7 +203,7 @@ void LocalRegExpIsUtf16FuzzTest([[maybe_unused]]const uint8_t *data, size_t size void LocalRegExpIsSticklFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/setbundlename_fuzzer/setbundlename_fuzzer.cpp b/test/fuzztest/setbundlename_fuzzer/setbundlename_fuzzer.cpp index 66dc0f9bd91e8be3953e0a84daaa0699fd3b910c..1248775f074210e146a3ecb88f1ed41341e165a7 100644 --- a/test/fuzztest/setbundlename_fuzzer/setbundlename_fuzzer.cpp +++ b/test/fuzztest/setbundlename_fuzzer/setbundlename_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void SetBundleNameFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/setcpusamplinginterval_fuzzer/setcpusamplinginterval_fuzzer.cpp b/test/fuzztest/setcpusamplinginterval_fuzzer/setcpusamplinginterval_fuzzer.cpp index e849e45245d9debe29e0fdc1e3b28f2a9ea49221..e95f03a19b7e5fe443f71a63b28d9b73e274ba72 100644 --- a/test/fuzztest/setcpusamplinginterval_fuzzer/setcpusamplinginterval_fuzzer.cpp +++ b/test/fuzztest/setcpusamplinginterval_fuzzer/setcpusamplinginterval_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void SetCpuSamplingIntervalFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/setiteratorrefget_fuzzer/setiteratorrefget_fuzzer.cpp b/test/fuzztest/setiteratorrefget_fuzzer/setiteratorrefget_fuzzer.cpp index 961d334b7be1b089d4a4cb345b2154526b29b1b9..0987028a7d610f7153621f65fb1f0a03e6d5b215 100644 --- a/test/fuzztest/setiteratorrefget_fuzzer/setiteratorrefget_fuzzer.cpp +++ b/test/fuzztest/setiteratorrefget_fuzzer/setiteratorrefget_fuzzer.cpp @@ -46,7 +46,7 @@ JSSet *CreateJSSet(JSThread *thread) void SetIteratorRefGetFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/setmodulename_fuzzer/setmodulename_fuzzer.cpp b/test/fuzztest/setmodulename_fuzzer/setmodulename_fuzzer.cpp index a879cad528c643deab80a5a9ddf4819be1e8cfaf..73412e956687c8420287c7d34a083a4dad585b9c 100644 --- a/test/fuzztest/setmodulename_fuzzer/setmodulename_fuzzer.cpp +++ b/test/fuzztest/setmodulename_fuzzer/setmodulename_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void SetModuleNameFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/setnativepointerfield_fuzzer/setnativepointerfield_fuzzer.cpp b/test/fuzztest/setnativepointerfield_fuzzer/setnativepointerfield_fuzzer.cpp index e6b50bf608568df97165e3af3fe0098041406e4e..9ff9d77fc44a1cb90a12701186e91efb341af502 100644 --- a/test/fuzztest/setnativepointerfield_fuzzer/setnativepointerfield_fuzzer.cpp +++ b/test/fuzztest/setnativepointerfield_fuzzer/setnativepointerfield_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void SetNativePointerFieldFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/setnativepointerfieldcount_fuzzer/setnativepointerfieldcount_fuzzer.cpp b/test/fuzztest/setnativepointerfieldcount_fuzzer/setnativepointerfieldcount_fuzzer.cpp index 691daefd9948feb6523409c6bb1808bc5a712985..cb0aafa9541575f2882a4a28c7f0ca23e70e7bdb 100644 --- a/test/fuzztest/setnativepointerfieldcount_fuzzer/setnativepointerfieldcount_fuzzer.cpp +++ b/test/fuzztest/setnativepointerfieldcount_fuzzer/setnativepointerfieldcount_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void SetNativePointerFieldCountFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/setrefgetsize_fuzzer/setrefgetsize_fuzzer.cpp b/test/fuzztest/setrefgetsize_fuzzer/setrefgetsize_fuzzer.cpp index 19f7336a0a187021ce13ebe1ba535b48b5e21b95..4c7b42bacb3545554cbda008418d7309bf89ac63 100644 --- a/test/fuzztest/setrefgetsize_fuzzer/setrefgetsize_fuzzer.cpp +++ b/test/fuzztest/setrefgetsize_fuzzer/setrefgetsize_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { void SetRefGetSizeFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/setrefgettotalelements_fuzzer/setrefgettotalelements_fuzzer.cpp b/test/fuzztest/setrefgettotalelements_fuzzer/setrefgettotalelements_fuzzer.cpp index bd0ceceb78618387f48729416e5bc8506884853d..e954db99123cbb790a30805e3c11f65df0f2f20f 100644 --- a/test/fuzztest/setrefgettotalelements_fuzzer/setrefgettotalelements_fuzzer.cpp +++ b/test/fuzztest/setrefgettotalelements_fuzzer/setrefgettotalelements_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { void SetRefGetTotalElementsFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/setrefgetvalue_fuzzer/setrefgetvalue_fuzzer.cpp b/test/fuzztest/setrefgetvalue_fuzzer/setrefgetvalue_fuzzer.cpp index 11bfa246637f6cadaacfe99efce349a5b8b6d43a..45340ffc4034daba5c7c45e6d8fe213bcfc6c41c 100644 --- a/test/fuzztest/setrefgetvalue_fuzzer/setrefgetvalue_fuzzer.cpp +++ b/test/fuzztest/setrefgetvalue_fuzzer/setrefgetvalue_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { void SetRefGetValueFuzztest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/snapshotserializebuiltins_fuzzer/snapshotserializebuiltins_fuzzer.cpp b/test/fuzztest/snapshotserializebuiltins_fuzzer/snapshotserializebuiltins_fuzzer.cpp index 4c9d8932beb0e289c2a64813cadcc7f21a260eb4..f8623404f788ba86fee8bbf900a6909534a7a07a 100644 --- a/test/fuzztest/snapshotserializebuiltins_fuzzer/snapshotserializebuiltins_fuzzer.cpp +++ b/test/fuzztest/snapshotserializebuiltins_fuzzer/snapshotserializebuiltins_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { std::remove(fileName.c_str()); // generate builtins.snapshot file RuntimeOption option1; - option1.SetLogLevel(LOG_LEVEL::ERROR); + option1.SetLogLevel(common::LOG_LEVEL::ERROR); option1.SetArkProperties(ArkProperties::ENABLE_SNAPSHOT_SERIALIZE); // create vm and generate builtins.snapshot file EcmaVM *vm1 = JSNApi::CreateJSVM(option1); @@ -39,7 +39,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm1); RuntimeOption option2; - option2.SetLogLevel(LOG_LEVEL::ERROR); + option2.SetLogLevel(common::LOG_LEVEL::ERROR); option2.SetArkProperties(ArkProperties::ENABLE_SNAPSHOT_DESERIALIZE); // create vm by deserialize builtins.snapshot file EcmaVM *vm2 = JSNApi::CreateJSVM(option2); diff --git a/test/fuzztest/snapshotserializedeserialize_fuzzer/snapshotserializedeserialize_fuzzer.cpp b/test/fuzztest/snapshotserializedeserialize_fuzzer/snapshotserializedeserialize_fuzzer.cpp index 3baa377408ddc95d0a64118875584bded4bab810..e18f02a1bf75827f6db3e1f87ef83d37503e42c9 100644 --- a/test/fuzztest/snapshotserializedeserialize_fuzzer/snapshotserializedeserialize_fuzzer.cpp +++ b/test/fuzztest/snapshotserializedeserialize_fuzzer/snapshotserializedeserialize_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void SnapshotSerializeDeserializeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/snapshotserializehugeobject_fuzzer/snapshotserializehugeobject_fuzzer.cpp b/test/fuzztest/snapshotserializehugeobject_fuzzer/snapshotserializehugeobject_fuzzer.cpp index 6be2db0f610175a69aa048454bb0224c091b49fa..7a561bc071ecf95b3f0f4ca9d37ce10cba316df9 100644 --- a/test/fuzztest/snapshotserializehugeobject_fuzzer/snapshotserializehugeobject_fuzzer.cpp +++ b/test/fuzztest/snapshotserializehugeobject_fuzzer/snapshotserializehugeobject_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void SnapshotSerializeHugeObjectFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/snapshotserializerange_fuzzer/snapshotserializerange_fuzzer.cpp b/test/fuzztest/snapshotserializerange_fuzzer/snapshotserializerange_fuzzer.cpp index 0d4414c6534604167871623a471860e67fb04aca..22de33c1014a3f3f8b850cb2548fea6f8f53d90c 100644 --- a/test/fuzztest/snapshotserializerange_fuzzer/snapshotserializerange_fuzzer.cpp +++ b/test/fuzztest/snapshotserializerange_fuzzer/snapshotserializerange_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void SnapshotSerializeRangeFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/startcpuprofilerforfile_fuzzer/startcpuprofilerforfile_fuzzer.cpp b/test/fuzztest/startcpuprofilerforfile_fuzzer/startcpuprofilerforfile_fuzzer.cpp index 7243a160894224419904cfcf8c10e828fc671828..404986c037f9feb097871e0c4e3e0e7608cd20e0 100644 --- a/test/fuzztest/startcpuprofilerforfile_fuzzer/startcpuprofilerforfile_fuzzer.cpp +++ b/test/fuzztest/startcpuprofilerforfile_fuzzer/startcpuprofilerforfile_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void StartCpuProfilerForFileFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/startsampling_fuzzer/startsampling_fuzzer.cpp b/test/fuzztest/startsampling_fuzzer/startsampling_fuzzer.cpp index 86b7f56161d8c18054178ff7cd9c73473a3011b0..47ec614747387c3eec40c4b7ef2e39fef31b5b86 100644 --- a/test/fuzztest/startsampling_fuzzer/startsampling_fuzzer.cpp +++ b/test/fuzztest/startsampling_fuzzer/startsampling_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void StartSamplingFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/stopsampling_fuzzer/stopsampling_fuzzer.cpp b/test/fuzztest/stopsampling_fuzzer/stopsampling_fuzzer.cpp index e5087d76ab1ca1f35c09b408458f52c6a6731186..76b33789342253e5c821a6fc370b746d96d47f2d 100644 --- a/test/fuzztest/stopsampling_fuzzer/stopsampling_fuzzer.cpp +++ b/test/fuzztest/stopsampling_fuzzer/stopsampling_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void StopSamplingFuzzerTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/stringrefcast_fuzzer/stringrefcast_fuzzer.cpp b/test/fuzztest/stringrefcast_fuzzer/stringrefcast_fuzzer.cpp index c6b949f4a288fea737f80a9dbaa11f3777ff2b39..f5bb4a1fd3c206d47a30bc7097e5200747064b0f 100644 --- a/test/fuzztest/stringrefcast_fuzzer/stringrefcast_fuzzer.cpp +++ b/test/fuzztest/stringrefcast_fuzzer/stringrefcast_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void StringRefCastFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefgetnapiwrapperstring_fuzzer/stringrefgetnapiwrapperstring_fuzzer.cpp b/test/fuzztest/stringrefgetnapiwrapperstring_fuzzer/stringrefgetnapiwrapperstring_fuzzer.cpp index 0cf406afd231eedb2a24537280409f8476db5833..8a89673a5fe02b287eec0ac2e5cf4ffc3565c1b7 100644 --- a/test/fuzztest/stringrefgetnapiwrapperstring_fuzzer/stringrefgetnapiwrapperstring_fuzzer.cpp +++ b/test/fuzztest/stringrefgetnapiwrapperstring_fuzzer/stringrefgetnapiwrapperstring_fuzzer.cpp @@ -13,20 +13,20 @@ * limitations under the License. */ -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" #include "stringrefgetnapiwrapperstring_fuzzer.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefGetNapiWrapperStringFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringreflength_fuzzer/stringreflength_fuzzer.cpp b/test/fuzztest/stringreflength_fuzzer/stringreflength_fuzzer.cpp index 5b3b71eda2ae9f30dcc5c531d3a08cdd8380117c..3ea7f339c005e8ffd34c549223297cc286f8f3a6 100644 --- a/test/fuzztest/stringreflength_fuzzer/stringreflength_fuzzer.cpp +++ b/test/fuzztest/stringreflength_fuzzer/stringreflength_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "stringreflength_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefLengthFuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefnewfromutf16_fuzzer/stringrefnewfromutf16_fuzzer.cpp b/test/fuzztest/stringrefnewfromutf16_fuzzer/stringrefnewfromutf16_fuzzer.cpp index b9d362796008b2f3495eef131816fefb6e9392e5..6f77f75ad54aba8ea7649cb87cc7808c85452e28 100644 --- a/test/fuzztest/stringrefnewfromutf16_fuzzer/stringrefnewfromutf16_fuzzer.cpp +++ b/test/fuzztest/stringrefnewfromutf16_fuzzer/stringrefnewfromutf16_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "stringrefnewfromutf16_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefNewFromUtf16FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefnewfromutf8_fuzzer/stringrefnewfromutf8_fuzzer.cpp b/test/fuzztest/stringrefnewfromutf8_fuzzer/stringrefnewfromutf8_fuzzer.cpp index ae649fe37343b96c552bb3c678d4d050fdf6c9e5..8782c8ca6ea6eee0221179ad6a0ab9374ca7e623 100644 --- a/test/fuzztest/stringrefnewfromutf8_fuzzer/stringrefnewfromutf8_fuzzer.cpp +++ b/test/fuzztest/stringrefnewfromutf8_fuzzer/stringrefnewfromutf8_fuzzer.cpp @@ -15,19 +15,19 @@ #include "stringrefnewfromutf8_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefNewFromUtf8FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/stringrefutf8length_fuzzer/stringrefutf8length_fuzzer.cpp b/test/fuzztest/stringrefutf8length_fuzzer/stringrefutf8length_fuzzer.cpp index 2ab8923679ac49130e75f4c74d25e206e64e8aa0..0e1f469d06d55be10e2380c45ab6a9584c990a7c 100644 --- a/test/fuzztest/stringrefutf8length_fuzzer/stringrefutf8length_fuzzer.cpp +++ b/test/fuzztest/stringrefutf8length_fuzzer/stringrefutf8length_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "stringrefutf8length_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefUtf8LengthFuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefwritelatin1_fuzzer/stringrefwritelatin1_fuzzer.cpp b/test/fuzztest/stringrefwritelatin1_fuzzer/stringrefwritelatin1_fuzzer.cpp index ab2326b13417b778de42dc3655fa54e36fcaf6fd..8b375212ed50485554e1789ee7273db6223834a4 100644 --- a/test/fuzztest/stringrefwritelatin1_fuzzer/stringrefwritelatin1_fuzzer.cpp +++ b/test/fuzztest/stringrefwritelatin1_fuzzer/stringrefwritelatin1_fuzzer.cpp @@ -14,19 +14,19 @@ */ #include "stringrefwritelatin1_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefWriteLatin1FuzzTest([[maybe_unused]]const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefwriteutf16_fuzzer/stringrefwriteutf16_fuzzer.cpp b/test/fuzztest/stringrefwriteutf16_fuzzer/stringrefwriteutf16_fuzzer.cpp index e9d74253d768ec9b8803bffa7c7cb5f329b2190a..48c7f6f951108503a8ac415132e2a597279b5097 100644 --- a/test/fuzztest/stringrefwriteutf16_fuzzer/stringrefwriteutf16_fuzzer.cpp +++ b/test/fuzztest/stringrefwriteutf16_fuzzer/stringrefwriteutf16_fuzzer.cpp @@ -15,18 +15,18 @@ #include "stringrefwriteutf16_fuzzer.h" #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void StringRefWriteUtf16FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/stringrefwriteutf8_fuzzer/stringrefwriteutf8_fuzzer.cpp b/test/fuzztest/stringrefwriteutf8_fuzzer/stringrefwriteutf8_fuzzer.cpp index 310668c170952b4d7205036c3e67e3dd36357a29..88ce7fd8467935db77e93ebfa500e96a5660d156 100644 --- a/test/fuzztest/stringrefwriteutf8_fuzzer/stringrefwriteutf8_fuzzer.cpp +++ b/test/fuzztest/stringrefwriteutf8_fuzzer/stringrefwriteutf8_fuzzer.cpp @@ -16,19 +16,19 @@ #include "stringrefwriteutf8_fuzzer.h" #include "ecmascript/base/string_helper.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/napi/include/jsnapi.h" using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; bool createstatus = true; namespace OHOS { void StringRefWriteUtf8FuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (size <= 0) { return; diff --git a/test/fuzztest/symbolnew_fuzzer/symbolnew_fuzzer.cpp b/test/fuzztest/symbolnew_fuzzer/symbolnew_fuzzer.cpp index ca1f4f58c4cd31c4dfffcb470f8368e942239fa7..1d66ae62eea74bb4809f61c4694acb1d207d987d 100644 --- a/test/fuzztest/symbolnew_fuzzer/symbolnew_fuzzer.cpp +++ b/test/fuzztest/symbolnew_fuzzer/symbolnew_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void SymbolNewFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm_ = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/symbolrefgetdescription_fuzzer/symbolrefgetdescription_fuzzer.cpp b/test/fuzztest/symbolrefgetdescription_fuzzer/symbolrefgetdescription_fuzzer.cpp index 466939c68a0f71802f2897cd2620c58988806335..4ac0aa04d92ffe09f9a515457831fd7ac8d0037e 100644 --- a/test/fuzztest/symbolrefgetdescription_fuzzer/symbolrefgetdescription_fuzzer.cpp +++ b/test/fuzztest/symbolrefgetdescription_fuzzer/symbolrefgetdescription_fuzzer.cpp @@ -24,7 +24,7 @@ namespace OHOS { void SymbolRefGetDescriptionFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/tonativepointer_fuzzer/tonativepointer_fuzzer.cpp b/test/fuzztest/tonativepointer_fuzzer/tonativepointer_fuzzer.cpp index 5da7df242decd80a76046dbd9ea09c48b3782d59..338f9edefbfa1062d58d48b90a3eb955f58daece 100644 --- a/test/fuzztest/tonativepointer_fuzzer/tonativepointer_fuzzer.cpp +++ b/test/fuzztest/tonativepointer_fuzzer/tonativepointer_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { void ToNativePointerFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/uint16arrayrefnew_fuzzer/uint16arrayrefnew_fuzzer.cpp b/test/fuzztest/uint16arrayrefnew_fuzzer/uint16arrayrefnew_fuzzer.cpp index 2b0306c25236bd5b9b90454f27196766d1bd8270..214784e7725cd8bed114fe709dffb36f400e6d44 100644 --- a/test/fuzztest/uint16arrayrefnew_fuzzer/uint16arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/uint16arrayrefnew_fuzzer/uint16arrayrefnew_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void Uint16ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/uint32arrayrefbytelength_fuzzer/uint32arrayrefbytelength_fuzzer.cpp b/test/fuzztest/uint32arrayrefbytelength_fuzzer/uint32arrayrefbytelength_fuzzer.cpp index 9dd8d36793cf2846d35706e068e192b578989a13..339f711481c8b93b24728705a0e579bcad389845 100644 --- a/test/fuzztest/uint32arrayrefbytelength_fuzzer/uint32arrayrefbytelength_fuzzer.cpp +++ b/test/fuzztest/uint32arrayrefbytelength_fuzzer/uint32arrayrefbytelength_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { void Uint32ArrayRefByteLengthFuzzTest(const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); if (data == nullptr || size <= 0) { LOG_ECMA(ERROR) << "illegal input!"; diff --git a/test/fuzztest/uint32arrayrefnew_fuzzer/uint32arrayrefnew_fuzzer.cpp b/test/fuzztest/uint32arrayrefnew_fuzzer/uint32arrayrefnew_fuzzer.cpp index 58b9d36c9ba3ec78ff8d50cca00f6ec0b20d7211..e09e0c8eeeec22c89f8f2f9d9138f418533a7e76 100644 --- a/test/fuzztest/uint32arrayrefnew_fuzzer/uint32arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/uint32arrayrefnew_fuzzer/uint32arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Uint32ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/uint8arrayrefnew_fuzzer/uint8arrayrefnew_fuzzer.cpp b/test/fuzztest/uint8arrayrefnew_fuzzer/uint8arrayrefnew_fuzzer.cpp index 8728ac113f22c27fb07eae2f38a7f3ec0af92aec..54ae09fe93c4fc7eda09aca67ee4ae9262c21ddf 100644 --- a/test/fuzztest/uint8arrayrefnew_fuzzer/uint8arrayrefnew_fuzzer.cpp +++ b/test/fuzztest/uint8arrayrefnew_fuzzer/uint8arrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Uint8ArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/uint8clampedarrayrefnew_fuzzer/uint8clampedarrayrefnew_fuzzer.cpp b/test/fuzztest/uint8clampedarrayrefnew_fuzzer/uint8clampedarrayrefnew_fuzzer.cpp index c77836eadea76956907746df62a7284a8684bc44..82fc6aeb30e92c74f6ed73dd5423738fa52098c0 100644 --- a/test/fuzztest/uint8clampedarrayrefnew_fuzzer/uint8clampedarrayrefnew_fuzzer.cpp +++ b/test/fuzztest/uint8clampedarrayrefnew_fuzzer/uint8clampedarrayrefnew_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { void Uint8ClampedArrayRefNewFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); int32_t input; if (size <= 0) { diff --git a/test/fuzztest/weakmapref_fuzzer/weakmapref_fuzzer.cpp b/test/fuzztest/weakmapref_fuzzer/weakmapref_fuzzer.cpp index 5db47e39d0ca7d2a47d6eb10199080d98420bc68..fe067d3a3aee6fb7626118f49f9695aab56b6261 100644 --- a/test/fuzztest/weakmapref_fuzzer/weakmapref_fuzzer.cpp +++ b/test/fuzztest/weakmapref_fuzzer/weakmapref_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { void WeakMapRefFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); diff --git a/test/fuzztest/weaksetref_fuzzer/weaksetref_fuzzer.cpp b/test/fuzztest/weaksetref_fuzzer/weaksetref_fuzzer.cpp index f5d12c0cdb4813ce6a19bddf3561768c1027a309..47dfc6622d3d81d05d04bb3faa50e92a1d50389f 100644 --- a/test/fuzztest/weaksetref_fuzzer/weaksetref_fuzzer.cpp +++ b/test/fuzztest/weaksetref_fuzzer/weaksetref_fuzzer.cpp @@ -14,7 +14,7 @@ */ #include "weaksetref_fuzzer.h" -#include "ecmascript/base/utf_helper.h" +#include "common_components/base/utf_helper.h" #include "ecmascript/ecma_string-inl.h" #include "ecmascript/global_env.h" #include "ecmascript/js_handle.h" @@ -25,13 +25,13 @@ using namespace panda; using namespace panda::ecmascript; -using namespace panda::ecmascript::base::utf_helper; +using namespace common::utf_helper; namespace OHOS { void WeakSetRefGetSizeFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -59,7 +59,7 @@ void WeakSetRefGetSizeFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) void WeakSetRefGetTotalElementsFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm); @@ -87,7 +87,7 @@ void WeakSetRefGetTotalElementsFuzzTest([[maybe_unused]]const uint8_t *data, siz void WeakSetRefGetValueFuzzTest([[maybe_unused]]const uint8_t *data, size_t size) { RuntimeOption option; - option.SetLogLevel(LOG_LEVEL::ERROR); + option.SetLogLevel(common::LOG_LEVEL::ERROR); EcmaVM *vm = JSNApi::CreateJSVM(option); { JsiFastNativeScope scope(vm);