From fe5beaeac54457a1fc0be4a6b1857111ee6fb5e9 Mon Sep 17 00:00:00 2001 From: Rokashevich Svetlana Date: Wed, 21 May 2025 00:46:51 +0800 Subject: [PATCH] Create hybrid VM Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IC7W1T Signed-off-by: Rokashevich Svetlana Change-Id: Iff71aefbf7f43e7e5560b090f514727ae3e5a5a3 --- BUILD.gn | 70 ++++++++++++++++++++++++++++++++++++++++++ build/core/gn/BUILD.gn | 14 ++++++--- 2 files changed, 79 insertions(+), 5 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 999796cf..bcb78ebf 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -298,3 +298,73 @@ group("runtime_core_host_ut") { deps = [ "$ark_root:runtime_core_host_unittest" ] } } + +config("ark_hybrid_config") { + ldflags = [ "-Wl,--unresolved-symbols=ignore-all" ] +} + +ohos_shared_library("libarkhybridruntime") { + stack_protector_ret = false + + external_deps = [ + "ets_runtime:libark_jsruntime_static_lib", + "runtime_core:libarkruntime_static", + ] + + if (current_cpu == "amd64" || current_cpu == "x64" || + current_cpu == "x86_64") { + ldflags = [ "-latomic" ] + } + + if (ark_hybrid) { + include_dirs = [ "$ark_root/common_interfaces" ] + defines = [ "ARK_HYBRID" ] + } + + deps = [] + if (is_arkui_x && target_os == "ios") { + deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ] + } else { + external_deps += [ "bounds_checking_function:libsec_shared" ] + } + + if (!is_arkui_x) { + external_deps += [ "runtime_core:libarkfile_runtime_static" ] + } else { + deps += [ "$ark_root/libpandafile:libarkfile_runtime_static" ] + } + + if (is_ohos && is_standard_system && !is_debug) { + version_script = "libarkhybridruntime.map" + } + + # hiviewdfx libraries + external_deps += hiviewdfx_ext_deps + deps += hiviewdfx_deps + + install_enable = true + + if (!is_mingw && !is_mac) { + output_extension = "so" + } + if (!is_standard_system) { + relative_install_dir = "ark" + } + + if (ark_standalone_build || (defined(is_arkui_x) && is_arkui_x)) { + deps += [ + "$ark_third_party_root/icu/icu4c:static_icui18n", + "$ark_third_party_root/icu/icu4c:static_icuuc", + ] + } else { + public_external_deps = [ + "icu:shared_icui18n", + "icu:shared_icuuc", + ] + } + + subsystem_name = "arkcompiler" + part_name = "toolchain" + + configs = [ ":ark_hybrid_config" ] +} diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn index 927d507c..5c14eb91 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -57,6 +57,13 @@ group("ets_runtime") { "$js_root/ecmascript/js_vm:ark_js_vm", "$js_root/ecmascript/quick_fix:quick_fix", ] + + if (ark_hybrid) { + deps += [ "$toolchain_root:libarkhybridruntime" ] + } else { + deps += [ "$js_root:libark_jsruntime" ] + } + if ((target_os == "linux" && target_cpu == "x64") || (target_cpu == "arm64" && target_os == "ohos") || (target_cpu == "arm64" && target_os == "mac")) { @@ -102,7 +109,7 @@ group("static_core") { } if (target_os != "mingw" && target_os != "mac") { if (ark_hybrid) { - deps += [ "$js_root:libark_jsruntime" ] + deps += [ "$toolchain_root:libarkhybridruntime" ] } else { deps += [ "$ark_root/static_core/runtime:libarkruntime" ] } @@ -113,6 +120,7 @@ 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") { @@ -122,10 +130,6 @@ group("hybrid") { "$ark_root/static_core/tools/ark_js_napi_cli:ark_js_napi_cli", ] } - - if (!ark_hybrid) { - deps += [ ":static_core" ] - } } group("toolchain") { -- Gitee