diff --git a/BUILD.gn b/BUILD.gn index 40bf3889657e643b4712b015fcf4cad1148e3d17..999796cf5a3443ad4d69c1a2c93f0399b62614b8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -189,11 +189,35 @@ config("ark_toolchain_common_config") { } else { defines += [ "NDEBUG" ] } + + if (toolchain_enable_cmc_gc) { + print("########## toolchain enable cmc-gc ##############") + defines += [ "USE_CMC_GC" ] + defines += [ "USE_READ_BARRIER" ] + } else { + print("########## toolchain disable cmc-gc ##############") + } } config("ark_toolchain_public_config") { defines = [] + cflags_cc = [ + "-Wno-unused-command-line-argument", + "-Wno-variadic-macros", + "-Wno-gnu-anonymous-struct", + "-Wno-zero-length-array", + "-Wno-nested-anon-types", + "-Wno-c99-extensions", + "-Wno-unused-parameter", + "-Wno-shadow", + "-Wno-pedantic", + "-Wno-gnu-zero-variadic-macro-arguments", + "-Wno-unused-lambda-capture", + "-Wno-unused-function", + "-Wno-unused-variable", + ] + # debug is not compatible with ios for now if (!is_mingw && !is_mac && target_os != "ios") { defines += [ diff --git a/build/compile_script/ark.py b/build/compile_script/ark.py index 60035a4c0b7971228062f8891c2edc076541443d..9c3600920699a9ff5d14e402683b0ba43330d776 100755 --- a/build/compile_script/ark.py +++ b/build/compile_script/ark.py @@ -279,6 +279,10 @@ class ArkPy: "description": "Keep running unittest etc. until errors occured less than N times" " (use 0 to ignore all errors).", }, + "fast-rebuild": { + "flags": ["--fast-rebuild", "-fast-rebuild"], + "description": "Skip gn gen when not modify gn file", + }, }, "help": { "flags": ["help", "--help", "--h", "-help", "-h"], @@ -295,6 +299,7 @@ class ArkPy: enable_verbose = False enable_keepdepfile = False ignore_errors = 1 + fast_rebuild = False def __main__(self, arg_list: list): enable_ccache() @@ -828,15 +833,18 @@ class ArkPy: _write(build_log_path, str_to_build_log, "a") # gn command print("=== gn gen start ===") - code = call_with_output( - "{0} gen {1} --args=\"{2}\" --export-compile-commands".format( - self.gn_binary_path, out_path, " ".join(gn_args).replace("\"", "\\\"")), - build_log_path) - if code != 0: - print("=== gn gen failed! ===\n") - sys.exit(code) + if self.fast_rebuild: + print("=== skip gn gen ===") else: - print("=== gn gen success! ===\n") + code = call_with_output( + "{0} gen {1} --args=\"{2}\" --export-compile-commands".format( + self.gn_binary_path, out_path, " ".join(gn_args).replace("\"", "\\\"")), + build_log_path) + if code != 0: + print("=== gn gen failed! ===\n") + sys.exit(code) + else: + print("=== gn gen success! ===\n") # ninja command # Always add " -d keeprsp" to ninja command to keep response file("*.rsp"), thus we could get shared libraries # of an excutable from its response file. @@ -1015,9 +1023,6 @@ class ArkPy: elif self.is_dict_flags_match_arg(self.ARG_DICT.get("target").get("test262"), arg_list[0]): self.build_for_test262(out_path, gn_args, arg_list) elif self.is_dict_flags_match_arg(self.ARG_DICT.get("target").get("unittest"), arg_list[0]): - if len(arg_list) > 1: - print("\033[92m\"unittest\" not support additional arguments.\033[0m\n".format()) - sys.exit(0) self.build_for_unittest(out_path, gn_args, self.UNITTEST_LOG_FILE_NAME) elif self.is_dict_flags_match_arg(self.ARG_DICT.get("target").get("runtime_core_unittest"), arg_list[0]): if len(arg_list) > 1: @@ -1074,6 +1079,9 @@ class ArkPy: input_value )) sys.exit(0) + # match [option][fast-rebuild] flag + elif self.is_dict_flags_match_arg(self.ARG_DICT.get("option").get("fast-rebuild"), arg): + self.fast_rebuild = True # make a new list with flag that do not match any flag in [option] else: arg_list_ret.append(arg) diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 6f9d1fbf83b1b05c217d61cb5bc14e7254e82976..1b0b1cdb17d21377204d1e3cec751c928d970dcf 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -12,6 +12,7 @@ # limitations under the License. declare_args() { ark_standalone_build = true + ark_hybrid = false use_musl = true build_root = "//arkcompiler/toolchain/build" run_with_qemu = false @@ -19,6 +20,7 @@ declare_args() { enable_lto_O0 = false disable_force_gc = false timeout = 1200 + enable_cmc_gc = false } check_mac_system_and_cpu_script = diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn index d91c7f3cdee4957a32c0612b777c747e9187f381..927d507c8f930f7a031c9d366a79c9944293b4ff 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -101,7 +101,11 @@ group("static_core") { deps += [ "$ark_root/static_core/static_linker:static_linker" ] } if (target_os != "mingw" && target_os != "mac") { - deps += [ "$ark_root/static_core/runtime:libarkruntime" ] + if (ark_hybrid) { + deps += [ "$js_root:libark_jsruntime" ] + } else { + deps += [ "$ark_root/static_core/runtime:libarkruntime" ] + } } } @@ -109,15 +113,19 @@ group("hybrid") { deps = [ ":ets_frontend", ":ets_runtime", - ":static_core", "$ark_root/static_core/plugins/ets:etsstdlib(${host_toolchain})", ] if (target_os != "mingw" && target_os != "mac") { deps += [ "$ark_root/static_core/plugins/ets/runtime/interop_js:ets_interop_js_napi", + "$ark_root/static_core/plugins/ets/tests/interop_js/test_helper:interop_test_helper", "$ark_root/static_core/tools/ark_js_napi_cli:ark_js_napi_cli", ] } + + if (!ark_hybrid) { + deps += [ ":static_core" ] + } } group("toolchain") { diff --git a/build/scripts/generate_js_bytecode.py b/build/scripts/generate_js_bytecode.py index ea7ae832e2b999ca3405d5c2cd0c3611b7b1c381..1b721f63c4b16dceee5d5d5f1e27e2b768504229 100755 --- a/build/scripts/generate_js_bytecode.py +++ b/build/scripts/generate_js_bytecode.py @@ -58,6 +58,8 @@ def parse_args(): 'its value will be the path of input file if not specified') parser.add_argument("--enable-annotations", action='store_true', help='whether annotations are enabled or not') + parser.add_argument("--enable-ets-implements", action='store_true', + help='whether ets implements are enabled or not') arguments = parser.parse_args() return arguments @@ -107,6 +109,9 @@ def gen_abc_info(input_arguments): if input_arguments.enable_annotations: src_index = cmd.index(input_arguments.src_js) cmd.insert(src_index, '--enable-annotations') + if input_arguments.enable_ets_implements: + src_index = cmd.index(input_arguments.src_js) + cmd.insert(src_index, '--enable-ets-implements') # insert d.ts option to cmd later cmd.append("--target-api-sub-version=beta3") diff --git a/test/ut/ignore-ut-debug-x64-toolchain-cmc-gc.txt b/test/ut/ignore-ut-debug-x64-toolchain-cmc-gc.txt new file mode 100644 index 0000000000000000000000000000000000000000..fddaabc946178f1310e88965a84d83c9cb631df5 --- /dev/null +++ b/test/ut/ignore-ut-debug-x64-toolchain-cmc-gc.txt @@ -0,0 +1 @@ +# Known failure list for ut - debug - x64 - toolchain -cmc -gc diff --git a/test/ut/ignore-ut-release-qemu-toolchain-cmc-gc.txt b/test/ut/ignore-ut-release-qemu-toolchain-cmc-gc.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2be333fa0642f3c560df9dfb674b3316ba5ca18 --- /dev/null +++ b/test/ut/ignore-ut-release-qemu-toolchain-cmc-gc.txt @@ -0,0 +1,14 @@ +# Known failure list for ut - release - qemu - toolchain -cmc -gc + +#24285 +test/test/libjsdebugtest.so + +#25856 +obj/arkcompiler/ets_runtime/ecmascript/mem/cmc_gc/libcommon_components_set/gc_hooks.o + +#26061 +obj/arkcompiler/toolchain/inspector/test/InspectorConnectTestWithQemu +obj/arkcompiler/toolchain/tooling/test/DebuggerClientTestWithQemu +obj/arkcompiler/toolchain/tooling/test/DebuggerEntryTestWithQemu +obj/arkcompiler/toolchain/tooling/test/DebuggerTestWithQemu +obj/arkcompiler/toolchain/tooling/test/DebuggerCIntClientTestWithQemu diff --git a/test/ut/ignore-ut-release-x64-toolchain-cmc-gc.txt b/test/ut/ignore-ut-release-x64-toolchain-cmc-gc.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac7b2b12e0e12abf0c7fb1c319756b5d1fb40df7 --- /dev/null +++ b/test/ut/ignore-ut-release-x64-toolchain-cmc-gc.txt @@ -0,0 +1 @@ +# Known failure list for ut - release - x64 - toolchain -cmc -gc diff --git a/toolchain_config.gni b/toolchain_config.gni index 9442eb52fa7f025498fb55465140ef9ac36141e6..70978b797bedc6908f826aa7646c19820ad89ce3 100644 --- a/toolchain_config.gni +++ b/toolchain_config.gni @@ -19,6 +19,15 @@ if (target_cpu == "arm64") { TARGET = "aarch64" } +declare_args() { + toolchain_enable_cmc_gc = false + enable_base_string = false +} + +if (defined(enable_cmc_gc) && !toolchain_enable_cmc_gc) { + toolchain_enable_cmc_gc = enable_cmc_gc +} + if (!ark_standalone_build) { build_root = "//build" ark_third_party_root = "//third_party" diff --git a/tooling/agent/tracing_impl.cpp b/tooling/agent/tracing_impl.cpp index b45405721bb3f6e1ecaee5b123c3d21d749e3a89..49054bcc04844b0e9182fa42a81a365c48f21743 100644 --- a/tooling/agent/tracing_impl.cpp +++ b/tooling/agent/tracing_impl.cpp @@ -93,6 +93,10 @@ void TracingImpl::DispatcherImpl::RequestMemoryDump(const DispatchRequest &reque { std::unique_ptr params = RequestMemoryDumpParams::Create(request.GetParams()); + if (params == nullptr) { + SendResponse(request, DispatchResponse::Fail("wrong params")); + return; + } std::string dumpGuid; bool success = false; DispatchResponse response = tracing_->RequestMemoryDump(std::move(params), dumpGuid, success); @@ -103,6 +107,10 @@ void TracingImpl::DispatcherImpl::Start(const DispatchRequest &request) { std::unique_ptr params = StartParams::Create(request.GetParams()); + if (params == nullptr) { + SendResponse(request, DispatchResponse::Fail("wrong params")); + return; + } DispatchResponse response = tracing_->Start(std::move(params)); SendResponse(request, response); } diff --git a/tooling/client/ark_multi/main.cpp b/tooling/client/ark_multi/main.cpp index 0cf44374c2af9c57353d3fd5f072f52c15ca1d13..20dab54c32fb2363e4fea1bf97f5f427f46839dd 100644 --- a/tooling/client/ark_multi/main.cpp +++ b/tooling/client/ark_multi/main.cpp @@ -16,6 +16,7 @@ #include #include "ecmascript/js_runtime_options.h" +#include "ecmascript/napi/include/jsnapi_expo.h" #include "ecmascript/platform/file.h" #include "tooling/utils/utils.h" #ifdef PANDA_TARGET_MACOS diff --git a/tooling/client/domain/debugger_client.cpp b/tooling/client/domain/debugger_client.cpp index 0cf24c78c8247980d9dc294f9c78c14e12ccbd66..821fd33041e362df68873dbf84531eeb3d732f22 100644 --- a/tooling/client/domain/debugger_client.cpp +++ b/tooling/client/domain/debugger_client.cpp @@ -381,6 +381,10 @@ void DebuggerClient::PausedReply(const std::unique_ptr json) std::map> data; for (int32_t i = 0; i < callFrames->GetSize(); i++) { std::unique_ptr callFrameInfo = CallFrame::Create(*(callFrames->Get(i))); + if (callFrameInfo == nullptr) { + LOGE("arkdb: get call frame info error"); + return; + } data.emplace(i + 1, std::move(callFrameInfo)); } diff --git a/tooling/client/domain/runtime_client.cpp b/tooling/client/domain/runtime_client.cpp index a46c1bc663a7f6ebb82dcad85cef3c0c560dec93..0293330c22fe264b0b1b0ff4c5203929df60c229 100644 --- a/tooling/client/domain/runtime_client.cpp +++ b/tooling/client/domain/runtime_client.cpp @@ -297,6 +297,10 @@ void RuntimeClient::HandleHeapUsage(std::unique_ptr json) Session *session = SessionManager::getInstance().GetSessionById(sessionId_); VariableManager &variableManager = session->GetVariableManager(); std::unique_ptr heapUsageReturns = GetHeapUsageReturns::Create(*result); + if (heapUsageReturns == nullptr) { + LOGE("arkdb: get heap usage returns error"); + return; + } variableManager.SetHeapUsageInfo(std::move(heapUsageReturns)); variableManager.ShowHeapUsageInfo(); } diff --git a/tooling/test/BUILD.gn b/tooling/test/BUILD.gn index 46dd78d9180eadbab370d45b51034e28155a897e..1cfca62b8dd14600c46818fb0948a7f9fe5f556c 100644 --- a/tooling/test/BUILD.gn +++ b/tooling/test/BUILD.gn @@ -132,6 +132,7 @@ ohos_shared_library("jsdebugtest") { deps = [ "..:libark_ecma_debugger_test" ] external_deps = [ + "bounds_checking_function:libsec_shared", "ets_runtime:libark_jsruntime", "icu:shared_icuuc", "libuv:uv", @@ -223,13 +224,17 @@ host_unittest_action("DebuggerTest") { # hiviewdfx libraries external_deps = hiviewdfx_ext_deps + + # libuv should be before libark_jsruntime + # because there are libuv weak symbols in libark_jsruntime + # and libuv should be loaded before their resolution + external_deps += [ "libuv:uv" ] external_deps += [ "bounds_checking_function:libsec_shared", "cJSON:cjson", "ets_runtime:libark_jsruntime", "icu:shared_icui18n", "icu:shared_icuuc", - "libuv:uv", "runtime_core:libarkbase_static", ] deps += hiviewdfx_deps diff --git a/tooling/test/client_utils/test_list.cpp b/tooling/test/client_utils/test_list.cpp index 24e7883dcfb09b50f91f014953cd4a3e3eaa12eb..91d58bd974c045841143cfd8daab0a7ac978792a 100644 --- a/tooling/test/client_utils/test_list.cpp +++ b/tooling/test/client_utils/test_list.cpp @@ -90,8 +90,11 @@ static void RegisterTests() TestUtil::RegisterTest("JsSourceTest", GetJsSourceTest()); TestUtil::RegisterTest("JsTracingTest", GetJsTracingTest()); TestUtil::RegisterTest("JsWatchTest", GetJsWatchTest()); +#ifndef USE_CMC_GC + // Need support heapdump TestUtil::RegisterTest("JsHeapdumpTest", GetJsHeapdumpTest()); - TestUtil::RegisterTest("JsAllocationtrackTest", GetJsAllocationtrackTest()); + TestUtil::RegisterTest("JsHeapdumpLoopTest", GetJsHeapdumpLoopTest()); +#endif TestUtil::RegisterTest("JsStepintoTest", GetJsStepintoTest()); TestUtil::RegisterTest("JsStepoutTest", GetJsStepoutTest()); TestUtil::RegisterTest("JsStepoverTest", GetJsStepoverTest()); @@ -110,9 +113,12 @@ static void RegisterTests() TestUtil::RegisterTest("JsHeapusageTest", GetJsHeapusageTest()); TestUtil::RegisterTest("JsHeapusageAsyncTest", GetJsHeapusageAsyncTest()); TestUtil::RegisterTest("JsHeapusageStepTest", GetJsHeapusageStepTest()); - TestUtil::RegisterTest("JsHeapdumpLoopTest", GetJsHeapdumpLoopTest()); +#ifndef USE_CMC_GC + // Need support allocation tracker + TestUtil::RegisterTest("JsAllocationtrackTest", GetJsAllocationtrackTest()); TestUtil::RegisterTest("JsAllocationTrackLoopTest", GetJsAllocationTrackLoopTest()); TestUtil::RegisterTest("JsAllocationTrackRecursionTest", GetJsAllocationTrackRecursionTest()); +#endif TestUtil::RegisterTest("JsJsWatchBasicTypeTest", GetJsWatchBasicTypeTest()); TestUtil::RegisterTest("JsJsWatchSetTypeTest", GetJsWatchSetTypeTest()); TestUtil::RegisterTest("JsJsWatchOtherTypeTest", GetJsWatchOtherTypeTest());