From c73545661f1049d2f5e9339b6dc0291fa10b033c Mon Sep 17 00:00:00 2001 From: weng-changcheng Date: Sat, 7 Jun 2025 00:34:19 +0800 Subject: [PATCH] fix namespace and path Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICD9Y9 Signed-off-by: weng-changcheng Change-Id: I331f9dd37bb4ac69647eda2592be03ba0ef817ec --- BUILD.gn | 4 +- .../{common_runtime/src => }/BUILD.gn | 30 +- .../base/asan_interface.h | 8 +- .../src => }/base/atomic_spin_lock.h | 10 +- .../src => }/base/c_string.cpp | 6 +- .../{common_runtime/src => }/base/c_string.h | 10 +- .../src/log_manager.cpp => base/config.h} | 26 +- .../{common_runtime/src => }/base/globals.h | 14 +- .../src => }/base/hash_utils.h | 13 +- .../src => }/base/immortal_wrapper.h | 11 +- .../src => }/base/mem_utils.cpp | 4 +- .../{common_runtime/src => }/base/mem_utils.h | 12 +- .../{common_runtime/src => }/base/rw_lock.h | 10 +- .../{common_runtime/src => }/base/spin_lock.h | 12 +- .../src => }/base/sys_call.cpp | 6 +- .../{common_runtime/src => }/base/sys_call.h | 14 +- .../src => }/base/time_utils.cpp | 6 +- .../src => }/base/time_utils.h | 14 +- .../base/utf_helper.cpp | 89 ++-- .../base/utf_helper.h | 36 +- .../base_runtime/base_runtime.cpp | 23 +- .../base_runtime/base_runtime_param.cpp | 6 +- .../base_runtime/base_runtime_param.h | 4 +- common_components/base_runtime/hooks.h | 4 +- .../src => }/common/base_object.h | 14 +- .../src => }/common/mark_work_stack.h | 11 +- .../src => }/common/mem_common.h | 13 +- .../src => }/common/page_allocator.h | 29 +- .../src => }/common/page_cache.cpp | 6 +- .../src => }/common/page_cache.h | 11 +- .../src => }/common/page_pool.h | 46 +- .../src => }/common/run_type.cpp | 6 +- .../src => }/common/run_type.h | 11 +- .../src => }/common/scoped_object_access.h | 13 +- .../src => }/common/scoped_object_lock.h | 26 +- .../src => }/common/type_def.h | 15 +- .../common_runtime/src/base/log_file.cpp | 13 +- .../common_runtime/src/base/log_file.h | 7 +- .../src/inspector/heap_data.cpp | 2 +- .../common_runtime/src/log_manager.h | 31 -- .../src => }/heap/allocator/alloc_buffer.h | 15 +- .../heap/allocator/alloc_buffer_manager.h | 20 +- .../src => }/heap/allocator/alloc_util.h | 11 +- .../src => }/heap/allocator/allocator.cpp | 14 +- .../src => }/heap/allocator/allocator.h | 13 +- .../heap/allocator/free_region_manager.h | 17 +- .../src => }/heap/allocator/local_deque.h | 13 +- .../src => }/heap/allocator/memory_map.cpp | 15 +- .../src => }/heap/allocator/memory_map.h | 16 +- .../src => }/heap/allocator/region_desc.h | 59 +-- .../src => }/heap/allocator/region_list.h | 15 +- .../heap/allocator/region_manager.cpp | 50 +-- .../src => }/heap/allocator/region_manager.h | 26 +- .../src => }/heap/allocator/region_space.cpp | 29 +- .../src => }/heap/allocator/region_space.h | 34 +- .../src => }/heap/allocator/slot_list.h | 14 +- .../src => }/heap/allocator/treap.cpp | 8 +- .../src => }/heap/allocator/treap.h | 15 +- .../src => }/heap/barrier/barrier.cpp | 22 +- .../src => }/heap/barrier/barrier.h | 16 +- .../src => }/heap/collector/collector.cpp | 10 +- .../src => }/heap/collector/collector.h | 17 +- .../heap/collector/collector_proxy.cpp | 6 +- .../src => }/heap/collector/collector_proxy.h | 17 +- .../heap/collector/collector_resources.cpp | 22 +- .../heap/collector/collector_resources.h | 16 +- .../heap/collector/copy_data_manager.cpp | 16 +- .../heap/collector/copy_data_manager.h | 35 +- .../heap/collector/finalizer_processor.cpp | 18 +- .../heap/collector/finalizer_processor.h | 20 +- .../src => }/heap/collector/gc_infos.h | 18 +- .../src => }/heap/collector/gc_request.cpp | 10 +- .../src => }/heap/collector/gc_request.h | 17 +- .../src => }/heap/collector/gc_stats.cpp | 28 +- .../src => }/heap/collector/gc_stats.h | 15 +- .../src => }/heap/collector/region_bitmap.h | 20 +- .../src => }/heap/collector/task_queue.cpp | 8 +- .../src => }/heap/collector/task_queue.h | 19 +- .../heap/collector/trace_collector.cpp | 51 +-- .../src => }/heap/collector/trace_collector.h | 40 +- .../{common_runtime/src => }/heap/heap.cpp | 28 +- .../{common_runtime/src => }/heap/heap.h | 21 +- common_components/heap/heap_allocator.cpp | 12 +- .../src => heap}/heap_manager.cpp | 18 +- .../src => heap}/heap_manager.h | 15 +- common_components/heap/heap_visitor.cpp | 4 +- .../{common_runtime/src => }/heap/heap_work.h | 11 +- .../src => }/heap/verification.cpp | 6 +- .../src => }/heap/verification.h | 4 +- .../heap/w_collector/copy_barrier.cpp | 16 +- .../src => }/heap/w_collector/copy_barrier.h | 14 +- .../heap/w_collector/enum_barrier.cpp | 14 +- .../src => }/heap/w_collector/enum_barrier.h | 14 +- .../heap/w_collector/idle_barrier.cpp | 16 +- .../src => }/heap/w_collector/idle_barrier.h | 14 +- .../heap/w_collector/post_trace_barrier.cpp | 16 +- .../heap/w_collector/post_trace_barrier.h | 14 +- .../heap/w_collector/preforward_barrier.cpp | 16 +- .../heap/w_collector/preforward_barrier.h | 16 +- .../heap/w_collector/trace_barrier.cpp | 14 +- .../src => }/heap/w_collector/trace_barrier.h | 14 +- .../src => }/heap/w_collector/w_collector.cpp | 48 ++- .../src => }/heap/w_collector/w_collector.h | 19 +- common_components/log/log.cpp | 396 ++++++++++-------- common_components/log/log.h | 28 +- common_components/log/log_base.h | 4 +- .../src => }/mutator/mutator.cpp | 14 +- .../src => }/mutator/mutator.h | 25 +- .../src => }/mutator/mutator.inline.h | 12 +- .../src => }/mutator/mutator_manager.cpp | 18 +- .../src => }/mutator/mutator_manager.h | 26 +- .../src => }/mutator/safepoint_page_manager.h | 28 +- .../src => }/mutator/satb_buffer.cpp | 10 +- .../src => }/mutator/satb_buffer.h | 21 +- .../src => }/mutator/thread_local.cpp | 10 +- .../src => }/mutator/thread_local.h | 12 +- common_components/objects/base_object.cpp | 4 +- common_components/objects/base_string.cpp | 70 ++-- .../objects/string_table/hashtriemap-inl.h | 6 +- .../objects/string_table/hashtriemap.h | 6 +- .../platform/arm64/string_hash_internal.h | 45 +- .../platform/common/string_hash_internal.h | 39 +- common_components/platform/cpu.h | 4 +- common_components/platform/os.h | 4 +- .../platform/string_hash.h | 13 +- .../platform/string_hash_helper.h | 21 +- common_components/platform/unix/linux/cpu.cpp | 4 +- common_components/platform/unix/linux/os.cpp | 4 +- common_components/platform/unix/mac/cpu.cpp | 4 +- common_components/platform/unix/mac/os.cpp | 4 +- common_components/platform/windows/cpu.cpp | 4 +- common_components/platform/windows/os.cpp | 4 +- .../serialize/serialize_utils.cpp | 6 +- common_components/serialize/serialize_utils.h | 4 +- common_components/taskpool/runner.cpp | 15 +- common_components/taskpool/runner.h | 23 +- common_components/taskpool/task.h | 20 +- common_components/taskpool/task_queue.cpp | 12 +- common_components/taskpool/task_queue.h | 10 +- common_components/taskpool/taskpool.cpp | 8 +- common_components/taskpool/taskpool.h | 17 +- common_components/thread/thread_holder.cpp | 10 +- .../thread/thread_holder_manager.cpp | 16 +- ecmascript/base/config.h | 14 +- ecmascript/base/json_helper.cpp | 12 +- ecmascript/base/json_parser.h | 1 - ecmascript/base/json_stringifier.cpp | 2 +- ecmascript/base/number_helper.cpp | 2 +- ecmascript/base/string_helper.h | 7 +- ecmascript/base/tests/number_helper_test.cpp | 2 +- ecmascript/base/tests/string_helper_test.cpp | 4 +- ecmascript/base/tests/utf_helper_test.cpp | 94 ++--- ecmascript/builtins/builtins_ark_tools.cpp | 2 +- ecmascript/builtins/builtins_global.cpp | 36 +- ecmascript/builtins/builtins_global.h | 4 +- ecmascript/builtins/builtins_global_uri.cpp | 34 +- ecmascript/builtins/builtins_string.cpp | 7 +- ecmascript/builtins/builtins_string.h | 4 +- .../builtins/builtins_string_iterator.cpp | 6 +- ecmascript/compiler/BUILD.gn | 14 + .../builtins/builtins_string_stub_builder.cpp | 10 +- ecmascript/compiler/mcr_circuit_builder.cpp | 2 +- ecmascript/compiler/stub_compiler.cpp | 2 +- ecmascript/daemon/daemon_thread.cpp | 4 +- ecmascript/dfx/hprof/heap_profiler.cpp | 8 +- .../hprof/heap_snapshot_json_serializer.cpp | 4 +- ecmascript/dynamic_object_accessor.cpp | 2 +- ecmascript/dynamic_object_accessor.h | 5 +- ecmascript/dynamic_object_descriptor.cpp | 2 +- ecmascript/dynamic_object_descriptor.h | 2 +- ecmascript/dynamic_type_converter.cpp | 18 +- ecmascript/dynamic_type_converter.h | 9 +- ecmascript/ecma_string-inl.h | 32 +- ecmascript/ecma_string.cpp | 16 +- ecmascript/ecma_string.h | 21 +- ecmascript/ecma_string_table.cpp | 4 +- ecmascript/ecma_string_table.h | 14 +- ecmascript/ecma_string_table_optimization.cpp | 35 +- ecmascript/ecma_vm.cpp | 16 +- ecmascript/jit/jit.cpp | 10 +- ecmascript/jit/jit.h | 2 +- ecmascript/jit/jit_task.cpp | 2 +- ecmascript/jit/jit_task.h | 12 +- ecmascript/js_handle.h | 8 +- ecmascript/js_hclass.h | 6 +- ecmascript/js_runtime_options.cpp | 4 +- ecmascript/js_runtime_options.h | 8 +- ecmascript/js_tagged_value.h | 1 - ecmascript/js_thread.cpp | 2 +- ecmascript/js_thread.h | 25 +- ecmascript/jspandafile/js_pandafile.cpp | 6 +- ecmascript/jspandafile/js_pandafile.h | 4 +- ecmascript/mem/barriers-inl.h | 2 +- ecmascript/mem/barriers.cpp | 4 +- ecmascript/mem/barriers.h | 15 +- ecmascript/mem/cmc_gc/hooks.cpp | 67 +-- ecmascript/mem/concurrent_marker.cpp | 2 +- ecmascript/mem/concurrent_sweeper.cpp | 6 +- ecmascript/mem/concurrent_sweeper.h | 4 +- ecmascript/mem/dynamic_object_operator.cpp | 4 +- ecmascript/mem/dynamic_object_operator.h | 8 +- ecmascript/mem/full_gc.cpp | 2 +- ecmascript/mem/heap-inl.h | 71 ++-- ecmascript/mem/heap.cpp | 40 +- ecmascript/mem/heap.h | 28 +- ecmascript/mem/jit_fort_memdesc.h | 3 +- ecmascript/mem/mem_map_allocator.cpp | 3 +- ecmascript/mem/parallel_evacuator-inl.h | 4 +- ecmascript/mem/parallel_evacuator.cpp | 10 +- ecmascript/mem/parallel_evacuator.h | 8 +- ecmascript/mem/partial_gc.cpp | 4 +- ecmascript/mem/region.h | 2 +- .../shared_heap/shared_concurrent_sweeper.cpp | 4 +- .../shared_heap/shared_concurrent_sweeper.h | 4 +- ecmascript/mem/shared_heap/shared_full_gc.cpp | 2 +- ecmascript/mem/shared_heap/shared_gc.cpp | 2 +- .../mem/shared_heap/shared_gc_evacuator.cpp | 4 +- .../mem/shared_heap/shared_gc_evacuator.h | 4 +- ecmascript/mem/slots.h | 1 - ecmascript/mem/space.cpp | 4 +- ecmascript/mem/tagged_object-inl.h | 4 +- ecmascript/mem/tagged_object.h | 7 +- ecmascript/mem/tagged_state_word.h | 16 +- ecmascript/mem/visitor.h | 1 - ecmascript/mem/work_manager.h | 10 +- ecmascript/napi/include/jsnapi.h | 2 +- ecmascript/napi/jsnapi_expo.cpp | 12 +- ecmascript/napi/test/ffi_workload.cpp | 2 +- ecmascript/napi/test/jsnapi_first_tests.cpp | 4 +- ecmascript/napi/test/jsnapi_sample.cpp | 2 +- ecmascript/napi/test/jsnapi_second_tests.cpp | 4 +- .../napi/test/jsnapi_sendable_tests.cpp | 2 +- ecmascript/napi/test/jsnapi_third_tests.cpp | 4 +- ecmascript/object_factory-inl.h | 14 +- ecmascript/object_factory.cpp | 2 +- ecmascript/patch/patch_loader.cpp | 4 +- .../pgo_profiler/pgo_profiler_encoder.cpp | 5 +- .../pgo_profiler/pgo_profiler_encoder.h | 8 +- .../pgo_profiler/pgo_profiler_manager.cpp | 5 +- .../pgo_profiler/pgo_profiler_manager.h | 16 +- ecmascript/pgo_profiler/pgo_utils.h | 1 - .../pgo_profiler/tests/pgo_profiler_test.cpp | 2 +- .../tests/pgo_profiler_test_one.cpp | 10 +- ecmascript/platform/unix/linux/os.cpp | 2 +- ecmascript/platform/unix/ohos/backtrace.cpp | 1 - ecmascript/regexp/regexp_parser.cpp | 4 +- ecmascript/runtime.cpp | 22 +- ecmascript/runtime.h | 2 +- ecmascript/runtime_lock.h | 2 +- ecmascript/serializer/base_deserializer.cpp | 21 +- ecmascript/serializer/base_serializer.cpp | 2 +- ecmascript/serializer/serialize_data.h | 4 +- ecmascript/shared_mm/shared_mm.cpp | 1 - ecmascript/shared_object_factory.cpp | 2 +- .../stubs/runtime_optimized_stubs-inl.h | 38 +- ecmascript/stubs/runtime_stubs.cpp | 2 +- .../tests/dynamic_type_converter_test.cpp | 56 +-- ecmascript/tests/ecma_string_hash_test.cpp | 5 +- ecmascript/tests/ecma_string_table_test.cpp | 14 +- ecmascript/tests/ecma_vm_test.cpp | 5 +- ecmascript/tests/gc_taskpool_test.cpp | 24 +- ecmascript/tests/js_thread_state_test.cpp | 2 +- ecmascript/tests/read_only_space_test.cpp | 16 +- ecmascript/tests/test_helper.h | 2 +- libark_jsruntime.map | 30 +- script/run_ark_executable.py | 35 +- .../arraybufferrefnew_fuzzer.cpp | 4 +- ...aybufferrefnewwithtwoparameters_fuzzer.cpp | 4 +- .../arraylist_fuzzer/arraylist_fuzzer.cpp | 46 +- .../bigint64arrayrefnew_fuzzer.cpp | 2 +- .../bigintrefgetwordsarraysize_fuzzer.cpp | 2 +- .../bigintrefnew_fuzzer.cpp | 2 +- .../biginttoint64_fuzzer.cpp | 2 +- .../biginttouint64_fuzzer.cpp | 2 +- .../biguint64arrayrefnew_fuzzer.cpp | 2 +- .../booleanrefnewbool_fuzzer.cpp | 2 +- .../booleanrefvalue_fuzzer.cpp | 2 +- .../bufferrefnew_fuzzer.cpp | 10 +- .../buildjsstacktrace_fuzzer.cpp | 2 +- .../buildnativeandJsstacktrace_fuzzer.cpp | 2 +- ...sarraybufferallocatearraybuffer_fuzzer.cpp | 2 +- ...raybufferarraybufferconstructor_fuzzer.cpp | 2 +- ...tinsarraybufferclonearraybuffer_fuzzer.cpp | 2 +- ...arraybufferfastsetvalueinbuffer_fuzzer.cpp | 2 +- ...ffergetvaluefrombufferforbigint_fuzzer.cpp | 2 +- ...uffergetvaluefrombufferforfloat_fuzzer.cpp | 2 +- ...fergetvaluefrombufferforinteger_fuzzer.cpp | 2 +- .../builtinsarraybufferisview_fuzzer.cpp | 2 +- ...aybuffersetvalueinbufferforbyte_fuzzer.cpp | 2 +- ...setvalueinbufferforuint8clamped_fuzzer.cpp | 2 +- .../containersdequecommon_fuzzer.h | 18 +- .../containershashmapcommon_fuzzer.h | 2 +- .../containershashsetadd_fuzzer.cpp | 2 +- .../containershashsetclear_fuzzer.cpp | 2 +- .../containershashsetconstructor_fuzzer.cpp | 2 +- .../containershashsetentries_fuzzer.cpp | 2 +- .../containershashsetforeach_fuzzer.cpp | 2 +- .../containershashsetgetlength_fuzzer.cpp | 2 +- .../containershashsethas_fuzzer.cpp | 2 +- .../containershashsetisempty_fuzzer.cpp | 2 +- .../containershashsetremove_fuzzer.cpp | 2 +- .../containershashsetvalues_fuzzer.cpp | 2 +- .../containerslightweightmap_fuzzer.cpp | 2 +- .../containerslightweightmapat_fuzzer.cpp | 2 +- .../containerslightweightmapclear_fuzzer.cpp | 2 +- ...containerslightweightmapentries_fuzzer.cpp | 2 +- ...containerslightweightmapforeach_fuzzer.cpp | 2 +- .../containerslightweightmaphasall_fuzzer.cpp | 2 +- ...containerslightweightmapisempty_fuzzer.cpp | 2 +- .../containerslightweightmapkeys_fuzzer.cpp | 2 +- .../containerslightweightmaplength_fuzzer.cpp | 2 +- .../containerslightweightmapremove_fuzzer.cpp | 2 +- .../containerslightweightmapsetall_fuzzer.cpp | 2 +- ...ntainerslightweightmapsetandget_fuzzer.cpp | 2 +- ...ontainerslightweightmaptostring_fuzzer.cpp | 2 +- .../containerslightweightmapvalues_fuzzer.cpp | 2 +- .../containerslightweightset_fuzzer.cpp | 2 +- .../containerslightweightsetadd_fuzzer.cpp | 2 +- .../containerslightweightsetaddall_fuzzer.cpp | 2 +- .../containerslightweightsetclear_fuzzer.cpp | 2 +- ...containerslightweightsetentries_fuzzer.cpp | 2 +- .../containerslightweightsetequal_fuzzer.cpp | 2 +- ...containerslightweightsetforeach_fuzzer.cpp | 2 +- ...tainerslightweightsetgetindexof_fuzzer.cpp | 2 +- ...erslightweightsetgetiteratorobj_fuzzer.cpp | 2 +- ...containerslightweightsetgetsize_fuzzer.cpp | 2 +- ...tainerslightweightsetgetvalueat_fuzzer.cpp | 2 +- .../containerslightweightsethas_fuzzer.cpp | 2 +- .../containerslightweightsethasall_fuzzer.cpp | 2 +- ...containerslightweightsethashash_fuzzer.cpp | 2 +- ...containerslightweightsetisempty_fuzzer.cpp | 2 +- .../containerslightweightsetremove_fuzzer.cpp | 2 +- ...containerslightweightsettoarray_fuzzer.cpp | 2 +- ...ontainerslightweightsettostring_fuzzer.cpp | 2 +- .../containerslightweightsetvalues_fuzzer.cpp | 2 +- .../containerslinkedlistcommon_fuzzer.h | 44 +- .../containerslistadd_fuzzer.cpp | 2 +- .../containerslistclear_fuzzer.cpp | 2 +- .../containerslistconstructor_fuzzer.cpp | 2 +- .../containerslistconverttoarray_fuzzer.cpp | 4 +- .../containerslistequal_fuzzer.cpp | 4 +- .../containerslistforeach_fuzzer.cpp | 2 +- .../containerslistget_fuzzer.cpp | 4 +- .../containerslistgetindexof_fuzzer.cpp | 2 +- .../containerslistgetiteratorobj_fuzzer.cpp | 4 +- .../containerslistgetlastindexof_fuzzer.cpp | 2 +- .../containerslistgetsublist_fuzzer.cpp | 4 +- .../containerslisthas_fuzzer.cpp | 2 +- .../containerslistinsert_fuzzer.cpp | 2 +- .../containerslistisempty_fuzzer.cpp | 2 +- .../containerslistlength_fuzzer.cpp | 4 +- .../containerslistremove_fuzzer.cpp | 2 +- .../containerslistremovebyindex_fuzzer.cpp | 2 +- .../containerslistset_fuzzer.cpp | 2 +- .../containerslistsort_fuzzer.cpp | 2 +- .../containersplainarray_fuzzer.cpp | 36 +- .../containersprivatecommon_fuzzer.h | 2 +- .../containersqueue_fuzzer.cpp | 2 +- .../containersqueueadd_fuzzer.cpp | 2 +- .../containersqueueforeach_fuzzer.cpp | 2 +- .../containersqueuegetfirst_fuzzer.cpp | 2 +- .../containersqueuegetiteratorobj_fuzzer.cpp | 2 +- .../containersqueuegetsize_fuzzer.cpp | 2 +- .../containersqueuepop_fuzzer.cpp | 2 +- .../containersstack_fuzzer.cpp | 2 +- .../containersstackforeach_fuzzer.cpp | 2 +- .../containersstackgetlength_fuzzer.cpp | 2 +- .../containersstackisempty_fuzzer.cpp | 2 +- .../containersstackiterator_fuzzer.cpp | 2 +- .../containersstacklocate_fuzzer.cpp | 2 +- .../containersstackpeek_fuzzer.cpp | 2 +- .../containersstackpop_fuzzer.cpp | 2 +- .../containersstackpush_fuzzer.cpp | 2 +- .../containerstreemapcommon_fuzzer.h | 2 +- .../containerstreesetadd_fuzzer.cpp | 2 +- .../containerstreesetclear_fuzzer.cpp | 2 +- .../containerstreesetconstructor_fuzzer.cpp | 2 +- .../containerstreesetentries_fuzzer.cpp | 2 +- .../containerstreesetforeach_fuzzer.cpp | 2 +- .../containerstreesetgetfirstvalue_fuzzer.cpp | 2 +- ...containerstreesetgethighervalue_fuzzer.cpp | 2 +- .../containerstreesetgetlastvalue_fuzzer.cpp | 2 +- .../containerstreesetgetlength_fuzzer.cpp | 2 +- .../containerstreesetgetlowervalue_fuzzer.cpp | 2 +- .../containerstreesethas_fuzzer.cpp | 2 +- .../containerstreesetisempty_fuzzer.cpp | 2 +- .../containerstreesetpopfirst_fuzzer.cpp | 2 +- .../containerstreesetpoplast_fuzzer.cpp | 2 +- .../containerstreesetremove_fuzzer.cpp | 2 +- .../containerstreesetvalues_fuzzer.cpp | 2 +- .../containersvectorcommon_fuzzer.h | 54 +-- .../copyableglobalisempty_fuzzer.cpp | 2 +- .../copyableglobalsetandclearweak_fuzzer.cpp | 2 +- .../createbigwords_fuzzer.cpp | 2 +- .../dataviewrefnew_fuzzer.cpp | 2 +- .../daterefnew_fuzzer/daterefnew_fuzzer.cpp | 6 +- .../dumpheapsnapshot1_fuzzer.cpp | 2 +- .../dumpheapsnapshot2_fuzzer.cpp | 2 +- .../dumpheapsnapshot3_fuzzer.cpp | 2 +- .../escapelocalscope_fuzzer.cpp | 2 +- .../exceptionaggregateerror_fuzzer.cpp | 2 +- .../exceptionclass_fuzzer.cpp | 12 +- .../exceptionevalerror_fuzzer.cpp | 2 +- .../exceptionoomerror_fuzzer.cpp | 2 +- .../exceptiontypeerror_fuzzer.cpp | 2 +- .../float32arrayrefnew_fuzzer.cpp | 2 +- .../float64arrayrefnew_fuzzer.cpp | 2 +- .../functionrefcall_fuzzer.cpp | 2 +- .../functionrefconstructor_fuzzer.cpp | 2 +- ...functionrefgetfunctionprototype_fuzzer.cpp | 2 +- .../functionrefinherit_fuzzer.cpp | 6 +- .../functionrefisnative_fuzzer.cpp | 2 +- .../functionrefname_fuzzer.cpp | 4 +- .../functionrefnew_fuzzer.cpp | 2 +- .../functionrefnewclassfunction_fuzzer.cpp | 2 +- .../generatorfunctionref_fuzzer.cpp | 6 +- .../getallocationprofile_fuzzer.cpp | 2 +- .../getbundlename_fuzzer.cpp | 2 +- .../getformatfunction_fuzzer.cpp | 2 +- .../getmodulename_fuzzer.cpp | 2 +- .../getnativepointerfield_fuzzer.cpp | 2 +- .../getwordsarray_fuzzer.cpp | 2 +- .../int16arrayrefnew_fuzzer.cpp | 2 +- .../int32arrayrefnew_fuzzer.cpp | 2 +- .../int8arrayrefnew_fuzzer.cpp | 2 +- .../integerrefnewvalue_fuzzer.cpp | 2 +- .../jsnapiaddworker_fuzzer.cpp | 2 +- .../jsnapicontext_fuzzer.cpp | 2 +- .../jsnapideleteserializationdata_fuzzer.cpp | 2 +- .../jsnapideserializevalue_fuzzer.cpp | 2 +- .../jsnapiexception_fuzzer.cpp | 2 +- .../jsnapiexceptions_fuzzer.cpp | 4 +- .../jsnapihaspendingexception_fuzzer.cpp | 2 +- .../jsnapiinformation_fuzzer.cpp | 10 +- .../jsnapiisarrayiterator_fuzzer.cpp | 2 +- .../jsnapiisbundle_fuzzer.cpp | 2 +- .../jsnapiisconstructor_fuzzer.cpp | 2 +- .../jsnapiisfalse_fuzzer.cpp | 2 +- .../jsnapiisprofiling_fuzzer.cpp | 2 +- .../jsnapiisstringiterator_fuzzer.cpp | 2 +- .../jsnapiistrue_fuzzer.cpp | 2 +- .../jsnapiloadaotfile_fuzzer.cpp | 2 +- .../jsnapipendingjob_fuzzer.cpp | 4 +- .../jsnapiset_fuzzer/jsnapiset_fuzzer.cpp | 10 +- ...isethostpromiserejectiontracker_fuzzer.cpp | 8 +- .../jsnapisetloop_fuzzer.cpp | 4 +- .../jsnapisetprofilerstate_fuzzer.cpp | 2 +- .../jsnapistartdebugger_fuzzer.cpp | 2 +- .../jsnapistopdebugger_fuzzer.cpp | 2 +- .../jsnapitriggergc_fuzzer.cpp | 2 +- .../jsnapiuncaughtclearexception_fuzzer.cpp | 2 +- .../jsnapiuncaughtexception_fuzzer.cpp | 2 +- .../jsnapivalue_fuzzer/jsnapivalue_fuzzer.cpp | 2 +- .../jsonparse_fuzzer/jsonparse_fuzzer.cpp | 6 +- .../jsonstringify_fuzzer.cpp | 6 +- .../jsvalueref_fuzzer/jsvalueref_fuzzer.cpp | 4 +- .../jsvaluerefbooleavalue_fuzzer.cpp | 2 +- .../jsvaluereffoundationvalue_fuzzer.cpp | 16 +- .../jsvaluerefint32value_fuzzer.cpp | 2 +- .../jsvaluerefintegervalue_fuzzer.cpp | 2 +- .../jsvaluerefisarray_fuzzer.cpp | 10 +- .../jsvaluerefisarraybuffer_fuzzer.cpp | 2 +- .../jsvaluerefisarrayvalue_fuzzer.cpp | 2 +- .../jsvaluerefisasync_fuzzer.cpp | 8 +- .../jsvaluerefisbig64array_fuzzer.cpp | 4 +- .../jsvaluerefisbuffer_fuzzer.cpp | 2 +- .../jsvaluerefiscontainer_fuzzer.cpp | 16 +- .../jsvaluerefiscorrect_fuzzer.cpp | 12 +- .../jsvaluerefisdataview_fuzzer.cpp | 2 +- .../jsvaluerefisgenerator_fuzzer.cpp | 2 +- .../jsvaluerefishashmap_fuzzer.cpp | 4 +- .../jsvaluerefishashset_fuzzer.cpp | 4 +- .../jsvaluerefisjs_fuzzer.cpp | 8 +- .../jsvaluerefisjsprimitive_fuzzer.cpp | 6 +- ...svaluerefislightweightmapandset_fuzzer.cpp | 6 +- .../jsvaluerefislinkedlist_fuzzer.cpp | 4 +- .../jsvaluerefislinkedlistiterator_fuzzer.cpp | 4 +- .../jsvaluerefislist_fuzzer.cpp | 4 +- .../jsvaluerefismodulenamespace_fuzzer.cpp | 24 +- .../jsvaluerefisnativepointervalue_fuzzer.cpp | 2 +- .../jsvaluerefisplainarray_fuzzer.cpp | 4 +- .../jsvaluerefispromisevalue_fuzzer.cpp | 2 +- .../jsvaluerefissharedarraybuffer_fuzzer.cpp | 2 +- .../jsvaluerefnullvalue_fuzzer.cpp | 2 +- .../jsvaluerefobject_fuzzer.cpp | 12 +- .../jsvaluereftobigint_fuzzer.cpp | 4 +- .../jsvaluereftobooleanvalue_fuzzer.cpp | 2 +- .../jsvaluereftonumbervalue_fuzzer.cpp | 2 +- .../jsvaluereftoobjectvalue_fuzzer.cpp | 2 +- .../jsvaluerefuint32value_fuzzer.cpp | 2 +- .../jsvaluerefwithinint32_fuzzer.cpp | 6 +- .../loadpatchlong_fuzzer.cpp | 2 +- .../mapiteratorefget_fuzzer.cpp | 4 +- .../maprefgetsetkeyvaluesize_fuzzer.cpp | 2 +- .../nativepointernew1_fuzzer.cpp | 2 +- .../nativepointernew2_fuzzer.cpp | 2 +- .../newbigintbyint64_fuzzer.cpp | 2 +- .../newbigintbyuint64_fuzzer.cpp | 2 +- .../notifyapplicationstate_fuzzer.cpp | 2 +- .../notifyidletime_fuzzer.cpp | 2 +- .../numberrefnewdouble_fuzzer.cpp | 2 +- .../numberrefnewint32_fuzzer.cpp | 2 +- .../numberrefnewint64_fuzzer.cpp | 2 +- .../numberrefnewuint32_fuzzer.cpp | 2 +- .../numberrefvalue_fuzzer.cpp | 2 +- .../objectbool_fuzzer/objectbool_fuzzer.cpp | 6 +- .../objectdelete_fuzzer.cpp | 2 +- .../objectget_fuzzer/objectget_fuzzer.cpp | 2 +- .../objectgetinformation_fuzzer.cpp | 8 +- .../objecthas_fuzzer/objecthas_fuzzer.cpp | 2 +- .../objectref_fuzzer/objectref_fuzzer.cpp | 4 +- .../objectrefall_fuzzer.cpp | 6 +- .../objectrefdelete_fuzzer.cpp | 2 +- .../objectrefgetglobalobject_fuzzer.cpp | 2 +- .../objectrefgetownproperty_fuzzer.cpp | 2 +- .../objectrefsetprototype_fuzzer.cpp | 2 +- .../objectset_fuzzer/objectset_fuzzer.cpp | 2 +- .../primitiverefgetvalue_fuzzer.cpp | 2 +- .../promiseref_fuzzer/promiseref_fuzzer.cpp | 6 +- .../promiserejectinfo_fuzzer.cpp | 14 +- .../propertyattribute_fuzzer.cpp | 4 +- .../proxyrefisrevoked_fuzzer.cpp | 2 +- .../publicapicollatorrefget_fuzzer.cpp | 2 +- .../publicapigeneratorobjectref_fuzzer.cpp | 2 +- .../publicapilocalregexpref_fuzzer.cpp | 16 +- .../setbundlename_fuzzer.cpp | 2 +- .../setcpusamplinginterval_fuzzer.cpp | 2 +- .../setiteratorrefget_fuzzer.cpp | 2 +- .../setmodulename_fuzzer.cpp | 2 +- .../setnativepointerfield_fuzzer.cpp | 2 +- .../setnativepointerfieldcount_fuzzer.cpp | 2 +- .../setrefgetsize_fuzzer.cpp | 2 +- .../setrefgettotalelements_fuzzer.cpp | 2 +- .../setrefgetvalue_fuzzer.cpp | 2 +- .../snapshotserializebuiltins_fuzzer.cpp | 4 +- .../snapshotserializedeserialize_fuzzer.cpp | 2 +- .../snapshotserializehugeobject_fuzzer.cpp | 2 +- .../snapshotserializerange_fuzzer.cpp | 2 +- .../startcpuprofilerforfile_fuzzer.cpp | 2 +- .../startsampling_fuzzer.cpp | 2 +- .../stopsampling_fuzzer.cpp | 2 +- .../stringrefcast_fuzzer.cpp | 2 +- .../stringrefgetnapiwrapperstring_fuzzer.cpp | 6 +- .../stringreflength_fuzzer.cpp | 6 +- .../stringrefnewfromutf16_fuzzer.cpp | 6 +- .../stringrefnewfromutf8_fuzzer.cpp | 6 +- .../stringrefutf8length_fuzzer.cpp | 6 +- .../stringrefwritelatin1_fuzzer.cpp | 6 +- .../stringrefwriteutf16_fuzzer.cpp | 6 +- .../stringrefwriteutf8_fuzzer.cpp | 6 +- .../symbolnew_fuzzer/symbolnew_fuzzer.cpp | 2 +- .../symbolrefgetdescription_fuzzer.cpp | 2 +- .../tonativepointer_fuzzer.cpp | 2 +- .../uint16arrayrefnew_fuzzer.cpp | 2 +- .../uint32arrayrefbytelength_fuzzer.cpp | 2 +- .../uint32arrayrefnew_fuzzer.cpp | 2 +- .../uint8arrayrefnew_fuzzer.cpp | 2 +- .../uint8clampedarrayrefnew_fuzzer.cpp | 2 +- .../weakmapref_fuzzer/weakmapref_fuzzer.cpp | 2 +- .../weaksetref_fuzzer/weaksetref_fuzzer.cpp | 10 +- 560 files changed, 2666 insertions(+), 2484 deletions(-) rename common_components/{common_runtime/src => }/BUILD.gn (86%) rename {ecmascript => common_components}/base/asan_interface.h (90%) rename common_components/{common_runtime/src => }/base/atomic_spin_lock.h (85%) rename common_components/{common_runtime/src => }/base/c_string.cpp (99%) rename common_components/{common_runtime/src => }/base/c_string.h (96%) rename common_components/{common_runtime/src/log_manager.cpp => base/config.h} (55%) mode change 100755 => 100644 rename common_components/{common_runtime/src => }/base/globals.h (88%) rename common_components/{common_runtime/src => }/base/hash_utils.h (83%) rename common_components/{common_runtime/src => }/base/immortal_wrapper.h (88%) rename common_components/{common_runtime/src => }/base/mem_utils.cpp (97%) rename common_components/{common_runtime/src => }/base/mem_utils.h (84%) rename common_components/{common_runtime/src => }/base/rw_lock.h (93%) rename common_components/{common_runtime/src => }/base/spin_lock.h (86%) rename common_components/{common_runtime/src => }/base/sys_call.cpp (93%) rename common_components/{common_runtime/src => }/base/sys_call.h (85%) rename common_components/{common_runtime/src => }/base/time_utils.cpp (96%) rename common_components/{common_runtime/src => }/base/time_utils.h (85%) rename {ecmascript => common_components}/base/utf_helper.cpp (84%) rename {ecmascript => common_components}/base/utf_helper.h (89%) rename common_components/{common_runtime/src => }/common/base_object.h (81%) rename common_components/{common_runtime/src => }/common/mark_work_stack.h (96%) rename common_components/{common_runtime/src => }/common/mem_common.h (95%) rename common_components/{common_runtime/src => }/common/page_allocator.h (92%) rename common_components/{common_runtime/src => }/common/page_cache.cpp (97%) rename common_components/{common_runtime/src => }/common/page_cache.h (90%) rename common_components/{common_runtime/src => }/common/page_pool.h (75%) rename common_components/{common_runtime/src => }/common/run_type.cpp (98%) rename common_components/{common_runtime/src => }/common/run_type.h (93%) rename common_components/{common_runtime/src => }/common/scoped_object_access.h (88%) rename common_components/{common_runtime/src => }/common/scoped_object_lock.h (65%) rename common_components/{common_runtime/src => }/common/type_def.h (87%) mode change 100755 => 100644 common_components/common_runtime/src/base/log_file.cpp delete mode 100755 common_components/common_runtime/src/log_manager.h rename common_components/{common_runtime/src => }/heap/allocator/alloc_buffer.h (92%) rename common_components/{common_runtime/src => }/heap/allocator/alloc_buffer_manager.h (82%) rename common_components/{common_runtime/src => }/heap/allocator/alloc_util.h (88%) rename common_components/{common_runtime/src => }/heap/allocator/allocator.cpp (85%) rename common_components/{common_runtime/src => }/heap/allocator/allocator.h (92%) rename common_components/{common_runtime/src => }/heap/allocator/free_region_manager.h (93%) rename common_components/{common_runtime/src => }/heap/allocator/local_deque.h (96%) rename common_components/{common_runtime/src => }/heap/allocator/memory_map.cpp (95%) rename common_components/{common_runtime/src => }/heap/allocator/memory_map.h (91%) rename common_components/{common_runtime/src => }/heap/allocator/region_desc.h (96%) rename common_components/{common_runtime/src => }/heap/allocator/region_list.h (95%) rename common_components/{common_runtime/src => }/heap/allocator/region_manager.cpp (97%) rename common_components/{common_runtime/src => }/heap/allocator/region_manager.h (97%) rename common_components/{common_runtime/src => }/heap/allocator/region_space.cpp (94%) rename common_components/{common_runtime/src => }/heap/allocator/region_space.h (91%) rename common_components/{common_runtime/src => }/heap/allocator/slot_list.h (82%) rename common_components/{common_runtime/src => }/heap/allocator/treap.cpp (96%) rename common_components/{common_runtime/src => }/heap/allocator/treap.h (98%) rename common_components/{common_runtime/src => }/heap/barrier/barrier.cpp (92%) rename common_components/{common_runtime/src => }/heap/barrier/barrier.h (91%) rename common_components/{common_runtime/src => }/heap/collector/collector.cpp (89%) rename common_components/{common_runtime/src => }/heap/collector/collector.h (91%) rename common_components/{common_runtime/src => }/heap/collector/collector_proxy.cpp (92%) rename common_components/{common_runtime/src => }/heap/collector/collector_proxy.h (90%) rename common_components/{common_runtime/src => }/heap/collector/collector_resources.cpp (93%) rename common_components/{common_runtime/src => }/heap/collector/collector_resources.h (92%) rename common_components/{common_runtime/src => }/heap/collector/copy_data_manager.cpp (81%) rename common_components/{common_runtime/src => }/heap/collector/copy_data_manager.h (86%) rename common_components/{common_runtime/src => }/heap/collector/finalizer_processor.cpp (95%) rename common_components/{common_runtime/src => }/heap/collector/finalizer_processor.h (91%) rename common_components/{common_runtime/src => }/heap/collector/gc_infos.h (95%) rename common_components/{common_runtime/src => }/heap/collector/gc_request.cpp (91%) rename common_components/{common_runtime/src => }/heap/collector/gc_request.h (86%) rename common_components/{common_runtime/src => }/heap/collector/gc_stats.cpp (76%) rename common_components/{common_runtime/src => }/heap/collector/gc_stats.h (89%) rename common_components/{common_runtime/src => }/heap/collector/region_bitmap.h (87%) rename common_components/{common_runtime/src => }/heap/collector/task_queue.cpp (92%) rename common_components/{common_runtime/src => }/heap/collector/task_queue.h (96%) rename common_components/{common_runtime/src => }/heap/collector/trace_collector.cpp (96%) rename common_components/{common_runtime/src => }/heap/collector/trace_collector.h (90%) rename common_components/{common_runtime/src => }/heap/heap.cpp (92%) rename common_components/{common_runtime/src => }/heap/heap.h (91%) rename common_components/{common_runtime/src => heap}/heap_manager.cpp (71%) rename common_components/{common_runtime/src => heap}/heap_manager.h (83%) rename common_components/{common_runtime/src => }/heap/heap_work.h (87%) rename common_components/{common_runtime/src => }/heap/verification.cpp (99%) rename common_components/{common_runtime/src => }/heap/verification.h (97%) rename common_components/{common_runtime/src => }/heap/w_collector/copy_barrier.cpp (91%) rename common_components/{common_runtime/src => }/heap/w_collector/copy_barrier.h (86%) rename common_components/{common_runtime/src => }/heap/w_collector/enum_barrier.cpp (95%) rename common_components/{common_runtime/src => }/heap/w_collector/enum_barrier.h (88%) rename common_components/{common_runtime/src => }/heap/w_collector/idle_barrier.cpp (93%) rename common_components/{common_runtime/src => }/heap/w_collector/idle_barrier.h (89%) rename common_components/{common_runtime/src => }/heap/w_collector/post_trace_barrier.cpp (93%) rename common_components/{common_runtime/src => }/heap/w_collector/post_trace_barrier.h (88%) rename common_components/{common_runtime/src => }/heap/w_collector/preforward_barrier.cpp (91%) rename common_components/{common_runtime/src => }/heap/w_collector/preforward_barrier.h (84%) rename common_components/{common_runtime/src => }/heap/w_collector/trace_barrier.cpp (95%) rename common_components/{common_runtime/src => }/heap/w_collector/trace_barrier.h (89%) rename common_components/{common_runtime/src => }/heap/w_collector/w_collector.cpp (95%) rename common_components/{common_runtime/src => }/heap/w_collector/w_collector.h (94%) rename common_components/{common_runtime/src => }/mutator/mutator.cpp (95%) rename common_components/{common_runtime/src => }/mutator/mutator.h (94%) rename common_components/{common_runtime/src => }/mutator/mutator.inline.h (84%) rename common_components/{common_runtime/src => }/mutator/mutator_manager.cpp (96%) rename common_components/{common_runtime/src => }/mutator/mutator_manager.h (93%) rename common_components/{common_runtime/src => }/mutator/safepoint_page_manager.h (67%) rename common_components/{common_runtime/src => }/mutator/satb_buffer.cpp (80%) rename common_components/{common_runtime/src => }/mutator/satb_buffer.h (94%) rename common_components/{common_runtime/src => }/mutator/thread_local.cpp (75%) rename common_components/{common_runtime/src => }/mutator/thread_local.h (93%) rename ecmascript/platform/arm64/ecma_string_hash_internal.h => common_components/platform/arm64/string_hash_internal.h (76%) rename ecmascript/platform/common/ecma_string_hash_internal.h => common_components/platform/common/string_hash_internal.h (70%) rename ecmascript/platform/ecma_string_hash.h => common_components/platform/string_hash.h (83%) rename ecmascript/platform/ecma_string_hash_helper.h => common_components/platform/string_hash_helper.h (62%) diff --git a/BUILD.gn b/BUILD.gn index 4ac71bf365..f392bab9d5 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 523f811867..9748cdf6b3 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 fabb81e353..21ec669ce7 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 93335ec02c..f267cd4465 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 4e7d9fe07b..b8dc233cd4 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 2c00a2e454..80268ca40c 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 3a729ad5fd..79d9df0d6c --- 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 4793fe9efb..02b99f15a8 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 5d6f9be092..41ed0f6ea4 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 01615a71a5..6c4393dbbd 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 0d05cbff65..ae72054f41 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 12e2eedd9a..5a1b63e42e 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 6be6b4a5d6..27398fdfc2 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 1a68556385..bfe8b71578 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 631f2c1de8..7f36f48cdf 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 313d021413..09cbc6064e 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 8c78d8cc37..be31beeedd 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 ad180609dd..fbbe72f1e3 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 7a800a9ace..ef8f496c16 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 cba0962ff8..c3a198a252 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 a692674b8b..9984adc71b 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 2a819f3734..7fd8335781 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 1bfa8e3b0f..89b36fb586 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 ce0e97a26d..b76029fbad 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 7849636d07..51b818cd58 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 2f08f22b35..37ee3cce84 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 e275aaf384..0c73d0a224 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 a150e234c8..33d6a84bf1 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 4cbd8d5370..b9b22a25b3 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 2fbaa6eedb..a52061d3b9 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 baf602a9d0..a48b7e1e34 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 2da219c7bf..a1153ccdc1 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 970f3f7a7f..3f4fa0b4cd 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 833daa9e50..677fa42e6a 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 08992ee4e2..53f024ceef 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 767debd5cf..a64eca4355 --- 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 3bfaacc18b..f396c5e108 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 ff4c4e839b..b156abf39a 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 4fbe99c033..0000000000 --- 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 3c51cfdccf..aa442ec51a 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 ce4613f0e3..129ba158d8 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 687ce97014..291e13b9c8 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 9a99c64fc0..2b57eaf6ea 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 9c905beb20..330c7b0365 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 29a2559795..3225176cea 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 373a3bfdf1..afe07d276e 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 feb7c46188..e8bec46cbe 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 ad039cb648..40500d4c67 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 da00f39f10..7537f0a33e 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 e9bcb31f82..ad4e7c609a 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 b244447405..ada697c470 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 026d623dcf..4417943f98 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 1b77acac44..a4a07687ea 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 ac64a5b9c7..8c96b407e2 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 63852effba..a41aa68113 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 51faa15ca1..bcde1c4936 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 8ebdff7ad4..3cc48bff5d 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 02a14d7aac..3483d8af15 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 4cce6e7669..9043959de9 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 45adf65bb7..bc0652ebd2 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 94d6c710c4..cd520f4484 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 044e8eeb9f..27476aab7c 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 d8fd5d7a37..317bca8bd9 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 7b4587b8a0..7b31fbb689 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 438d1f6a78..559b1eeb5b 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 4c93e60b6a..386992c518 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 2e96f9548c..b39f042351 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 a65934f1f4..bd3c1af91c 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 6ff8d98ef2..44b6ed84c4 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 080047ad7f..a3ef4cddc7 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 0294a1c4ac..1ac9be0a47 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 9cb2aa3c72..a4657f46ed 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 05c5d331d8..e3619e78f4 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 bdf18cdd10..aecee8bfbe 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 c0009e3a51..4099cf06b6 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 8fa4f36a0f..bcd5ee8c90 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 72a763ef60..998edcd31b 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 593a8b67d4..f24bd7555e 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 425146e126..ad55f81367 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 87e9ab4d7e..2bb733ce44 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 72f0ad33b0..dfedc9ae67 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 f4ca627d82..d93cd4dca4 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 1ba58b1c1a..7300bf391e 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 8942f4ad59..6cf3a55e83 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 938268c93b..f08d132dc2 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 28ce0fea09..46144220de 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 56fa2ae5a1..be4a3b552c 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 3bede7a004..45cd617721 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 a95d1096cf..7084fd0007 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 5dc4f51789..36e9310851 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 ca25b946a0..0a3fe6babf 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 ae8650cf25..245dcdfbd6 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 708551b146..87955c8911 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 c3afc90006..6a8db3566c 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 5f60b9ddba..1a2d876d90 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 b2038c7910..987a98e5c5 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 d0f8296806..ca6f25b5a0 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 855c1f3f2a..82fc86f039 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 63ea1eb94c..2b5d3e1fde 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 0d38172957..9397728a97 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 0b28f2ed18..548776f4e4 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 e10e1861ae..5c050e59a5 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 9f08190f7c..d43f3fec04 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 5bdb12e592..a48cac107e 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 5375a86ada..00806123cc 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 e6f42b6ed7..4aa1150847 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 e0ba245535..6d455b9b38 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 4f11267891..f84e79c417 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 32eacc23be..e4a1961a0b 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 9da53b8d45..58e29eb3e8 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 1d3ff0560d..88423ba3ee 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 9ccf7347c7..db033cc73b 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 f099ef51c0..040a7d3aee 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 824e12f6ba..bb892c22db 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 d5173a93ec..a7c3df2f58 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 c83ed071c6..e73ca3dd4c 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 fffa9d9c58..3979df3612 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 ef67d93279..51d706a9cd 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 b399059854..4a55af6cae 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 f2625e8dd9..699fdec49d 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 44902dbb75..c1456274ba 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 ad15fa734d..e5b9afc315 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 c288272a8f..e0633448ee 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 eab65f9c77..81c5bc104d 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 d2d86d3af1..a285766abb 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 0233cac609..4fd4e404d7 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 9fd84c8af8..8a2dd8fcf4 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 1ef2137eb8..19ff061045 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 14f2b203b8..77260dc555 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 10f91c7c0a..ab0aae0f2a 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 14f2b203b8..77260dc555 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 cb180ec948..d0df7df7f8 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 c991c93ee6..8e51c85ae3 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 c030ca62e9..42ee009a6f 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 474e3f1cd8..a9c1ad4e96 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 1fe5d26e4e..507dd823a5 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 d9ada02d4e..0f542db942 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 dcd26e9d15..bfdbe51096 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 60dd259de5..99e16eba9e 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 d7f24d66db..95b1f0420a 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 fa35b296a4..ed4c80f5ed 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 f2c6fa98d9..0f52af45a7 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 7c8e540ef4..abc95dd014 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 6c8258b6f4..42e809eda3 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 a6bcd75dea..ca59df253e 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 4ee0aa3be8..5f096b88b9 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 0714b02629..269702f291 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 7f26fc97eb..e029fe18b1 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 64efcfc57c..ddc0b7796f 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 4aa109d555..a5573d2393 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 8f885c25b6..6db10c9a6f 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 8328ebfe7d..83fe369812 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 6eebf8bc9f..b7ddbce6bd 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 2c153733b4..bf831924a3 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 b0e495d045..55c47cf989 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 d163b527f6..5fd2e22466 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 79c5e60ab4..e4f82556d6 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 ab1eee5676..50a70afb57 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 385eaddb8e..f7b6ada090 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 097c22a0e6..7808c6798c 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 d493d3ac7b..8744f63d40 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 5ccf5b1a9c..e9ca9be864 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 33b0b42db6..1f6bb35089 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 130a2fa2f2..e71665036f 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 331d1194ea..9c754c4ef5 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 565c982d07..d851084886 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 57093e548f..5bf4d0f70b 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 938ef9910c..0e870e7fad 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 a179667932..3e4391e7d8 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 d8fd7d9d91..e78bd6185f 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 e6ccb8ec05..a2af4148d7 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 52074da6d2..e14b3a198e 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 03d1296117..4dc434b27c 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 326fdbf7c0..0a5313d8c0 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 c23e46fd34..647fe2a03e 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 eead712bda..7e170e93f2 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 de6632662f..a8bd9ef8cf 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 ed6a4242b6..9b21525cc9 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 e993937dae..d6a1cc8337 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 edcad51a8f..b86f2a9ceb 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 4cf62ad6b3..7f36687895 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 f6695cba6d..642438cfcb 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 0d9b6a5819..cdf5d17c6b 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 e73ea0ff48..14bf5fc711 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 053661ec7a..87866ac905 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 6e234bb2dc..bda4eea431 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 f0120ce2af..f1dd3992ac 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 9048f435e4..b2152b58c3 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 673d320ab2..ace958e3d7 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 7243a19dc7..5f6ff39ba0 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 0e40ee82f3..17fd966bd5 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 44267cd151..1b3ceebdb4 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 834b51136e..20ba1efc60 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 150c658716..f7df9d8067 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 7283898db8..675d8872ef 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 e7e8304e31..d2c11e5923 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 ef3a83ef8d..0cb69cc8c9 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 1dc483032e..be85f3b1f4 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 677ac483eb..784cc1f7d0 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 d53df08a33..cd6864d0d5 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 3849b6f093..87c73a6a0e 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 2eb02fea6c..1520d12863 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 f0c51d91b2..e44d6dfb07 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 833493f505..4f9628ae5f 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 a9bc42c04a..5422823b6c 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 46ea2c9d9d..a2e6aa0f70 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 5ca803cf81..834872cd89 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 bdeb548c3d..81ba6b9a2e 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 3c9a2f7e1b..4147ba38b3 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 14bc33019a..c0a1a025b8 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 4643cba9dd..d45f310203 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 11986966fe..d9cae60c87 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 106a240a1f..fbde801f10 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 1f241fb27e..41d91ef035 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 3e74f1039f..ecc5005c61 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 d58c09d8ca..6f85638981 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 137582ae92..5374f83fa8 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 73b7af1ca6..32fb387e06 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 290e88a6c5..8aa6a000d9 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 2455936f30..c3435f362e 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 f12f78b61b..fe8eb14330 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 0b35b29d90..d02c2fe9a7 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 4fe7aa9d49..5fa64b8efd 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 2ea8732eb0..19374daefd 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 dcb41fc7e1..fba47cd3da 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 a5c950193f..eaa519f410 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 1a5980ceea..cb40ea24c2 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 1b1fb02687..11785c9121 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 533ad3b501..e173266df6 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 2ab70fde7d..0817635f91 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 33e16f8ab4..e55594d863 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 0fb3dd6f68..5aaf8c633f 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 48f4151785..343091a60c 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 85229f3060..66432f71ea 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 1b4c20c181..1110dd453f 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 35826394df..bfff28b86e 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 d24499f83c..3b3e735104 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 aa1d514cea..2d49e27bdf 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 311c674797..d3fb6a92ec 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 3897f31358..cf709d8373 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 79bd16d111..783435c65d 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 cbfbce19f1..1160fd38c0 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 5c0e384377..7fac013554 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 061f3c98c7..e730e1cf12 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 2c2d42f857..ab2d916d09 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 551618a07f..e1c7053a63 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 c675d00392..34c809f27f 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 48a4a3ea7b..4d1e7d925d 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 22697b698b..11252b7ed9 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 8e421914be..99740d4a9b 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 3907da716a..a1e971ef21 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 b409f0e74c..199ef2df07 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 04544c8621..24408782b8 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 9c2ce3cf59..1fcfd6c835 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 99b9d9569f..a9fa33ebbe 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 25e7902b10..42f0bc44ed 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 4159406fef..7d863af6e1 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 636f10b0ef..6801fe006d 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 c50a86ec00..c493c3be51 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 fe7f805421..5dd6316def 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 a8be8146e2..99706631f8 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 38ba7be023..5e30d624a9 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 3755df0ca4..410d4de6ef 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 d8d08f9842..b378680d20 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 c4cc5bdd9b..aeb90e1848 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 6ca0c83236..155ae4fda0 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 0211bcca19..29d7648311 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 7052f172e0..6f394dbddb 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 13bdcbfcce..f146bbf1cc 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 4c08758705..77e132e149 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 de38e1119a..d3ff487259 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 2265e08a27..3b5067dd7b 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 eee10c7121..7317ac4fcb 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 380d1fe672..b8c319301e 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 c3daad3d0a..d9d99d6db9 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 95316f4c3c..560807ab82 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 f47de807ae..353b01be7e 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 f56a7cbec1..6e6c2b5434 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 a6d52f93eb..357663e45e 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 697168c20b..9c52f8ec82 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 7314983f8e..36793e911b 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 1e659155ba..1ede3e6095 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 61feecab30..a73a17c82a 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 0b15931a50..0cedd7f6ea 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 34f55023ad..ec82661b40 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 3b4a179da5..db113ac3a5 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 b4f1e7eb0f..4dd27be686 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 1803e6def7..0812f935f0 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 3e5ebc7ab0..6a8d2a16d9 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 e723c663a4..f6d175ae22 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 76c970d54e..807737bc98 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 723e391cd2..b8cb95498d 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 da734ab2b0..387588a615 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 fe4dd139f5..ea3ada69f7 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 732fe77cf1..ee2d368088 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 4af60e53ce..4ad1dbb23f 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 c126e0a204..4dd19abb9b 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 87363808d5..31ddb22640 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 24f09fd7c4..8a47fd334c 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 0d6b77e426..9dca032c77 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 195ea72a3e..090c5f6e63 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 8418a54580..b5210d0437 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 71e2d38d09..425a4d2104 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 2319051cf9..d693074883 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 187e329e46..61b2e53c0a 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 27d4819d37..c97f19d934 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 c80d5682a1..b39b984696 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 23d6b8fffc..bbe1151fee 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 0c131d286a..87f6394207 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 55b382002a..8913dbfedc 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 9a971907bd..74aacfdb6b 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 2dd52e9dee..1deb7d0519 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 e876db85e4..b76f68ad21 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 39293b97de..2f7fd61293 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 ebcf3cb9f1..d31ae5cf30 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 8c01ed219f..4812023a9f 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 a9d6e384c3..c908bf9f8f 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 a36850a787..9e7ef221b4 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 e57e0fc580..0244e9353b 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 a710186fa4..b9c105f4a1 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 2f36bd3a34..933471ebb8 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 8ae52ed3af..0c2cff1b7f 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 c3494d2f21..53610f0387 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 410833ba96..383b902978 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 a6107eaa84..b389113aa7 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 b2101ff69f..bdf593b7b0 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 4602f5f528..3950e8ee4e 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 38da43b17c..ebab96cd4b 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 8df8b28971..a2e714c6ef 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 e0f48d0563..2bf15c6501 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 70d54e5798..54e70e86b6 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 b05cdc1453..a01854c486 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 3fb8095d07..ed5bb45fd4 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 8772c281ec..b061c7a379 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 8ad99b8816..c1d41fba1d 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 723184044c..cb2d30b0ac 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 0abde171e5..5d53294c0d 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 62d2c2b9d1..890f5cee69 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 62ae9a889a..2877888d07 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 43d43e06f1..1f0101072e 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 5d0b391ae8..29d08fe3aa 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 eef9facce7..9a00dddbab 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 fa820189ed..d236a24a50 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 23aefaa08f..b4df06c827 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 8c3afef6cd..71ae2395b5 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 6ba16d3c7a..0cdba9e14f 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 c087604d9a..ff80fa5aa6 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 29404f941e..dd82716dc8 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 2309f970a3..b4f701986d 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 077c2b01a6..eaa20f4863 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 a4744bd7c4..17c1c37b04 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 56be0a57cd..432d1b97e8 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 f8efe59ad6..9e1936b101 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 949474bb8b..a1010535e4 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 00ab6ebcac..14763537ac 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 10bbf5f651..d4b8dc7ab3 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 bd1c8e1c3e..680e260478 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 2a6df5c154..30910d648a 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 2be3013fda..864730a813 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 cd14087525..c7ba4b3cbf 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 00d03c57de..ae062752b0 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 c7654cb67a..4ae49e94ff 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 a977f7a16a..8eb1847530 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 1ddf1d5811..7c88333cb1 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 473f04f823..0bddd74f40 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 1ad00c42bf..4c057531e3 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 586e530009..24ecc5ccbf 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 16fa89a5c6..182855c416 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 4b70ff146a..e7edfc675f 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 ee4418eb16..2b9b3288f8 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 0449858382..8a730cb402 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 2fb13d166c..c4d0481714 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 6bae959860..f930519979 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 856da957e3..5108e58d2e 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 d2e2a4009b..e6f6e6ea03 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 17e01ee85a..81f2410276 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 fc811f198a..cefb8c5974 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 87c6b4e2d4..64aa345030 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 b8443caad4..8dd3a1b78f 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 c5ee474fd4..5ae5a3bba6 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 6e8c80121f..4db8284e6f 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 9ae0261a03..f568b0418c 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 dfe8c114a3..865a549c58 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 c93844f7e3..e5fe30ae92 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 77f4cecc1d..42f889b0b9 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 864146a2cd..3086badaaf 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 eaf5890166..7a7179d1ac 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 15ff964b14..d3b133e6bd 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 150639a650..f13e2d617d 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 2dff0406bd..950224f156 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 d705eb9b6e..8f34ef6021 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 71ced3ca82..1c348dc357 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 02ad2d231a..be14116b30 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 d6bf8412e8..7d83b0ff0f 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 76fbf0ac72..28026a48fd 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 1411b2fa99..ca3afac289 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 b8a87a3236..2870f02033 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 339fddba0e..2726cac3c3 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 f8dd67b68e..b5f327a798 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 50d71f4092..01587e47a3 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 6886c67455..3469043de4 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 bb59a7ad90..9282ee0a78 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 a5b4d75625..e4d89630c4 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 7dc8bb4d18..7b4cd9fb11 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 e80ea16672..5d365a7c2b 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 db8c613e02..d09ef1b2c1 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 68f5efc572..79d7c91679 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 1830c86ca4..7cd1c6dde1 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 de96370ed1..e93c6a4147 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 d2b584e452..7cebccf49f 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 8595259365..47f12dbd5c 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 68e14279bd..4dfd5a76f2 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 3e03362464..6fd8883c10 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 a4437fbea7..950f844ad3 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 c8023b151c..3106f41948 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 9b91741e17..fb69c6e9c7 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 a6a7b4f117..567aa71716 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 2dbf942442..21f65fb933 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 10426b619d..06d4b4d56e 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 3834b90cbf..5453c73cb0 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 19bcbd44f5..f909f8e31a 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 b2e07cc5be..cbf96474e2 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 fa1a36bd67..5bec8f35d0 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 1cfe53efa8..b188b7612c 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 495ed68e53..f3cdd3e5f8 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 778c5a154b..e7eb0201a4 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 58735bd923..c9766d112c 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 4dce4052c9..170a45aaeb 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 4031ad137d..d684e69d8a 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 746bef58bb..10ca19635c 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 37e03facbc..db5aab3258 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 c86b8f1904..ba8aa25a05 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 2e24284518..31e2596997 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 2ad6f01fc1..e1d756ef03 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 a346520a50..d2e431a462 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 6e2574f0c2..606299a0e0 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 a1a7ae9cec..6a13e47156 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 f651095d49..c775773e02 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 760693d440..211e9b3a5f 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 368c33eedf..2c92b10ebb 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 56ccb1f500..6a86e8c935 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 a3dfac35b3..ff0acb35e7 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 1a91f5ea7d..eb51c8491f 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 0b7ceb4ca1..79f69541de 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 a2df627452..65de0445fb 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 026b1d1d19..e3b30ce266 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 51779b37b9..1cf4547b64 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 c342b0c20b..029e19cccf 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 9c6eeddd40..805af1a0cd 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 edbebff9cf..60d082d22a 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 20360c6bce..57eb93781b 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 b1c44191d1..b0b53747ae 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 55ddfa076c..3d95efcdae 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 e4d53205e4..696c94945e 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 f6422ed320..60475984ac 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 fa99498e3d..58426a67ec 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 4b4b2bb542..99eac5a7c0 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 ab89d09db3..f58daab4ea 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 7617a2d5a3..aac8b38999 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 da24e8e29a..747b6aebc0 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 dd40cbe4c3..fe420f703e 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 10a9ac3cd1..5206643a00 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 644da9e4eb..a8c9bf9a73 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 5bdfcdd875..fd9bb20d5d 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 4b48d78690..bbd03fefc9 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 c663956644..daaca8acfd 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 e8c80593d4..163b06010c 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 1083332ba8..4686756354 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 2f21fc5db4..203c6c97c4 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 ef9608aa2b..0414a8e4b0 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 d9d5464e1e..ed42600409 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 b0d20be654..5ca5ebf42e 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 723bff6a6f..ab8bd3fb84 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 a6f27be16d..572c87ab12 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 598a43b972..5324f94bf8 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 cab5fdda82..e6c89e1595 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 8a595fac4b..5b8b4e2d29 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 62f523dd35..22fc04c84b 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 9b10f3bbc4..edcd5e71f8 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 f14fa08132..deecadd04c 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 f6d7122c46..302a303e99 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 86ebbef0c5..cf679881d5 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 f30966e43a..8f1554b0b9 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 3d76db44f4..16523df812 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 d2af29b8c8..c3c4193ea9 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 59fa24409e..560f923da5 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 878f343739..de3d53bb4d 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 c7c57b609f..e162b975cf 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 6c56fe049b..b89912b316 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 54d34946e2..00360f99d8 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 f66e9f720f..f93539f6ce 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 91af5d1787..c2a4c350dd 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 36529490ac..23e905ca6f 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 bba4b24f44..d69716f17e 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 ede8b222f6..a84b182ba7 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 d41f9fde39..dced8684ba 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 c1a803945a..3d536b2453 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 76b32bf5b1..82a34eeb90 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 ba5d4506fe..768d3f8da3 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 8f54ccfacf..efc288de14 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 85b178ca97..a03b476a02 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 96d8bfe1c1..f2ab66c9f5 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 e24a68756a..25f792596b 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 13c6e54aab..574b542352 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 b29f4dc1be..539c6e730d 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 3e94146694..275f8e57e1 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 1d46a2efcf..7b458833b1 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 f388d3e0a7..ac1b6828fb 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 c48df933fa..dc4f1fc675 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 bdb40f716f..2a6f8c136e 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 f8db7be686..db737c84bc 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 f17d548e41..5b0febfc28 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 9ff10fc85f..97f80d1d2c 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 04250bc462..00cf160a30 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 9d94c2ff48..c5caa13bf3 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 8ba3ec512e..73efa12f89 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 2fed6e56b7..f94e3d5145 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 58dcc6760f..89195c1eef 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 b6b4873839..a2f6ae7af0 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 f58625d7f8..9d45bed1cf 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 27982da575..d1d6c0ddbb 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 60087700e6..e962cd689f 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 d1fa617ec9..3b795b4d1a 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 ba05d0f53b..c0a3e8af62 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 66dc0f9bd9..1248775f07 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 e849e45245..e95f03a19b 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 961d334b7b..0987028a7d 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 a879cad528..73412e9566 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 e6b50bf608..9ff9d77fc4 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 691daefd99..cb0aafa954 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 19f7336a0a..4c7b42bacb 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 bd0ceceb78..e954db9912 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 11bfa24663..45340ffc40 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 4c9d8932be..f8623404f7 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 3baa377408..e18f02a1bf 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 6be2db0f61..7a561bc071 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 0d4414c653..22de33c101 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 7243a16089..404986c037 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 86b7f56161..47ec614747 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 e5087d76ab..76b3378934 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 c6b949f4a2..f5bb4a1fd3 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 0cf406afd2..8a89673a5f 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 5b3b71eda2..3ea7f339c0 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 b9d3627960..6f77f75ad5 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 ae649fe373..8782c8ca6e 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 2ab8923679..0e1f469d06 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 ab2326b134..8b375212ed 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 e9d74253d7..48c7f6f951 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 310668c170..88ce7fd846 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 ca1f4f58c4..1d66ae62ee 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 466939c68a..4ac0aa04d9 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 5da7df242d..338f9edefb 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 2b0306c252..214784e772 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 9dd8d36793..339f711481 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 58b9d36c9b..e09e0c8eee 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 8728ac113f..54ae09fe93 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 c77836eade..82fc6aeb30 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 5db47e39d0..fe067d3a3a 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 f5d12c0cdb..47dfc6622d 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); -- Gitee