diff --git a/BUILD.gn b/BUILD.gn index f30ca7fdd9670d89445ed7ff4d29800084bc8fce..99eb906472feb4c0e43e0dbdff5ed6c124738b0f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,46 +11,53 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (defined(ark_flag)) { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} -group("ark_packages") { - if (host_os != "mac") { - deps = [ - "$ark_root/libpandabase:libarkbase", - "$ark_root/libpandafile:libarkfile", - "$ark_root/libziparchive:libarkziparchive", - ] +if (!defined(ark_flag)) { + group("ark_packages") { + if (host_os != "mac") { + deps = [ + "$ark_root/libpandabase:libarkbase", + "$ark_root/libpandafile:libarkfile", + "$ark_root/libziparchive:libarkziparchive", + ] + } } -} -group("ark_host_linux_tools_packages") { - if (host_os != "mac") { - deps = [ - "$ark_root/assembler:ark_asm(${host_toolchain})", - "$ark_root/disassembler:ark_disasm(${host_toolchain})", - "$ark_root/libpandabase:libarkbase(${host_toolchain})", - "$ark_root/libpandafile:libarkfile(${host_toolchain})", - "$ark_root/libziparchive:libarkziparchive(${host_toolchain})", - ] + group("ark_host_linux_tools_packages") { + if (host_os != "mac") { + deps = [ + "$ark_root/assembler:ark_asm(${host_toolchain})", + "$ark_root/disassembler:ark_disasm(${host_toolchain})", + "$ark_root/libpandabase:libarkbase(${host_toolchain})", + "$ark_root/libpandafile:libarkfile(${host_toolchain})", + "$ark_root/libziparchive:libarkziparchive(${host_toolchain})", + ] + } } -} -group("ark_host_windows_tools_packages") { - if (host_os != "mac" && !ark_standalone_build) { - deps = [ - "$ark_root/assembler:ark_asm(//build/toolchain/mingw:mingw_x86_64)", - "$ark_root/disassembler:ark_disasm(//build/toolchain/mingw:mingw_x86_64)", - ] + group("ark_host_windows_tools_packages") { + if (host_os != "mac" && !ark_standalone_build) { + deps = [ + "$ark_root/assembler:ark_asm(//build/toolchain/mingw:mingw_x86_64)", + "$ark_root/disassembler:ark_disasm(//build/toolchain/mingw:mingw_x86_64)", + ] + } } -} -group("ark_host_mac_tools_packages") { - if (host_os == "mac") { - deps = [ - "$ark_root/assembler:ark_asm(//build/toolchain/mac:clang_x64)", - "$ark_root/disassembler:ark_disasm(//build/toolchain/mac:clang_x64)", - ] + group("ark_host_mac_tools_packages") { + if (host_os == "mac") { + deps = [ + "$ark_root/assembler:ark_asm(//build/toolchain/mac:clang_x64)", + "$ark_root/disassembler:ark_disasm(//build/toolchain/mac:clang_x64)", + ] + } } } diff --git a/ark_config.gni b/ark_config.gni index 057ccd80585292b97a5b1ac484d4e2d878dd9d41..9f60a6db30ba22aaee7755e2acc5307b1d0cf80d 100644 --- a/ark_config.gni +++ b/ark_config.gni @@ -21,8 +21,13 @@ if (ark_standalone_build) { with_ecmascript = true use_pbqp = true } else { - ark_root = "//ark/runtime_core" - ark_third_party_root = "//third_party" + if (!defined(ark_flag)) { + ark_root = "//ark/runtime_core" + ark_third_party_root = "//third_party" + } else { + ark_root = "//runtime_core" + ark_third_party_root = "//build/core/third_party" + } with_ecmascript = false use_pbqp = false } @@ -30,13 +35,13 @@ if (ark_standalone_build) { ark_enable_global_register_variables = true enable_bytecode_optimizer = false -if (ark_standalone_build) { +if (ark_standalone_build || defined(ark_flag)) { sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secshared" sdk_libc_secshared_config = "$ark_third_party_root/securec:libsec_public_config" if (is_mingw || is_mac || is_linux) { - sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secstatic" + sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secshared" } } else { sdk_libc_secshared_dep = "//utils/native/base:utilsecurec_shared" diff --git a/assembler/BUILD.gn b/assembler/BUILD.gn index ecf04b5de7c7e241fcce94cab6f041a2863b6470..306b5825d327350722e35aa641809f0432d1c6a4 100644 --- a/assembler/BUILD.gn +++ b/assembler/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkassembler_public_config") { include_dirs = [ @@ -47,10 +52,10 @@ libarkassembler_configs = [ "$ark_root/libpandafile:arkfile_public_config", ] -ohos_shared_library("libarkassembler") { +source_set("libarkassembler_static") { sources = libarkassembler_sources - configs = libarkassembler_configs + public_configs = libarkassembler_configs deps = [ ":ark_asm_ecmascript_meta_gen_h", @@ -65,17 +70,12 @@ ohos_shared_library("libarkassembler") { "$ark_root/libpandafile:libarkfile", sdk_libc_secshared_dep, ] - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkassembler_frontend_static") { +source_set("libarkassembler_frontend_set") { sources = libarkassembler_sources - configs = libarkassembler_configs + public_configs = libarkassembler_configs deps = [ ":ark_asm_ecmascript_meta_gen_h", @@ -92,12 +92,12 @@ ohos_static_library("libarkassembler_frontend_static") { ] } -ohos_executable("ark_asm") { +source_set("ark_asm_static") { sources = [ "pandasm.cpp" ] include_dirs = [ "$target_gen_dir" ] - configs = [ + public_configs = [ sdk_libc_secshared_config, ":arkassembler_public_config", "$ark_root:ark_config", @@ -111,13 +111,54 @@ ohos_executable("ark_asm") { "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", ] +} + +if (!defined(ark_flag)) { + ohos_executable("ark_asm") { + deps = [ ":ark_asm_static" ] + + if (!is_mac && !is_mingw && !ark_standalone_build) { + ldflags = [ "-static-libstdc++" ] + } + + install_enable = true + subsystem_name = "ark" + } - if (!is_mac && !is_mingw && !ark_standalone_build) { - ldflags = [ "-static-libstdc++" ] + ohos_shared_library("libarkassembler") { + deps = [ ":libarkassembler_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + + ohos_static_library("libarkassembler_frontend_static") { + deps = [ ":libarkassembler_frontend_set" ] + } +} else { + ark_executable("ark_asm") { + deps = [ ":ark_asm_static" ] + ldflags = [ + "-shared", + "-ldl", + "-lm", + ] + if (!is_mac && !is_mingw && !ark_standalone_build) { + ldflags += [ "-static-libstdc++" ] + } } - install_enable = true - subsystem_name = "ark" + ark_shared_library("libarkassembler") { + deps = [ ":libarkassembler_static" ] + output_extension = "so" + } + + ark_static_library("libarkassembler_frontend_static") { + deps = [ ":libarkassembler_frontend_set" ] + } } ark_isa_gen("isa_gen_libarkassembler") { diff --git a/dprof/BUILD.gn b/dprof/BUILD.gn index 6496e70f843bcf3e663edf42b5220e3287e8c206..a277c1232ccd9fbfd04548c0fa9de9c547134e49 100644 --- a/dprof/BUILD.gn +++ b/dprof/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("libdprof_config") { include_dirs = [ @@ -22,14 +27,14 @@ config("libdprof_config") { ] } -ohos_static_library("libdprof") { +source_set("libdprof_static") { sources = [ "libdprof/dprof/ipc/ipc_message.cpp", "libdprof/dprof/ipc/ipc_unix_socket.cpp", "libdprof/dprof/profiling_data.cpp", ] - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", sdk_libc_secshared_config, @@ -38,3 +43,13 @@ ohos_static_library("libdprof") { deps = [ "$ark_root/libpandabase:libarkbase" ] } + +if (!defined(ark_flag)) { + ohos_static_library("libdprof") { + deps = [ ":libdprof_static" ] + } +} else { + ark_static_library("libdprof") { + deps = [ ":libdprof_static" ] + } +} diff --git a/isa/BUILD.gn b/isa/BUILD.gn index 62aa71f00184787ea32ad344d9e9fea9d789471b..2d5972301549d098d495679a180b88c965a448ab 100644 --- a/isa/BUILD.gn +++ b/isa/BUILD.gn @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") +if (defined(ark_flag)) { + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") +} action("isa_combine") { script = "$ark_root/isa/combine.rb" diff --git a/libpandabase/BUILD.gn b/libpandabase/BUILD.gn index d5404d9b59b82d80b7f4497b478a1c7dba25f1e0..cbfbe8ebe403e976400dd591c449d85724106f36 100644 --- a/libpandabase/BUILD.gn +++ b/libpandabase/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkbase_public_config") { include_dirs = [ @@ -122,24 +127,43 @@ libarkbase_deps = [ sdk_libc_secshared_dep, ] -ohos_shared_library("libarkbase") { +source_set("libarkbase_static") { sources = libarkbase_sources - configs = libarkbase_configs + public_configs = libarkbase_configs deps = libarkbase_deps - - output_extension = "so" - if (!is_standard_system) { - relative_install_dir = "ark" - } - subsystem_name = "ark" } -ohos_static_library("libarkbase_frontend_static") { +source_set("libarkbase_frontend_set") { sources = libarkbase_sources - configs = libarkbase_configs + public_configs = libarkbase_configs deps = libarkbase_deps } + +if (!defined(ark_flag)) { + ohos_shared_library("libarkbase") { + deps = [ ":libarkbase_static" ] + + output_extension = "so" + if (!is_standard_system) { + relative_install_dir = "ark" + } + subsystem_name = "ark" + } + + ohos_static_library("libarkbase_frontend_static") { + deps = [ ":libarkbase_frontend_set" ] + } +} else { + ark_shared_library("libarkbase") { + deps = [ ":libarkbase_static" ] + output_extension = "so" + } + + ark_static_library("libarkbase_frontend_static") { + deps = [ ":libarkbase_frontend_set" ] + } +} diff --git a/libpandafile/BUILD.gn b/libpandafile/BUILD.gn index 6d9b5e656ff6f32dff21761fc56375ed431150c6..d7668c6afc04ec5455e19731ecf123423e8a486e 100644 --- a/libpandafile/BUILD.gn +++ b/libpandafile/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkfile_public_config") { include_dirs = [ @@ -24,8 +29,8 @@ config("arkfile_public_config") { if (!ark_standalone_build) { include_dirs += [ - "//third_party/zlib", - "//third_party/zlib/contrib/minizip", + "$ark_third_party_root/zlib", + "$ark_third_party_root/zlib/contrib/minizip", ] } else { include_dirs += [ "$ark_third_party_root/miniz" ] @@ -57,10 +62,10 @@ libarkfile_configs = [ ":arkfile_public_config", ] -ohos_shared_library("libarkfile") { +source_set("libarkfile_static") { sources = libarkfile_sources - configs = libarkfile_configs + public_configs = libarkfile_configs deps = [ ":isa_gen_libarkfile_bytecode_emitter_def_gen_h", @@ -74,18 +79,12 @@ ohos_shared_library("libarkfile") { "$ark_root/libziparchive:libarkziparchive", sdk_libc_secshared_dep, ] - - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkfile_frontend_static") { +source_set("libarkfile_frontend_set") { sources = libarkfile_sources - configs = libarkfile_configs + public_configs = libarkfile_configs deps = [ ":isa_gen_libarkfile_bytecode_emitter_def_gen_h", @@ -101,6 +100,29 @@ ohos_static_library("libarkfile_frontend_static") { ] } +if (!defined(ark_flag)) { + ohos_shared_library("libarkfile") { + deps = [ ":libarkfile_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + ohos_static_library("libarkfile_frontend_static") { + deps = [ ":libarkfile_frontend_set" ] + } +} else { + ark_shared_library("libarkfile") { + deps = [ ":libarkfile_static" ] + output_extension = "so" + } + ark_static_library("libarkfile_frontend_static") { + deps = [ ":libarkfile_frontend_set" ] + } +} + ark_gen_file("libarkfile_type_gen_h") { template_file = "templates/type.h.erb" data_file = "types.yaml" diff --git a/libziparchive/BUILD.gn b/libziparchive/BUILD.gn index 7b050e19ef62ae3ebdc3029c5957f2b6dd73ed8a..a8894d3cca39dd35b4472f235d70f59914cf3e82 100644 --- a/libziparchive/BUILD.gn +++ b/libziparchive/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkziparchive_config") { include_dirs = [ @@ -22,18 +27,18 @@ config("arkziparchive_config") { if (!ark_standalone_build) { include_dirs += [ - "//third_party/zlib", - "//third_party/zlib/contrib/minizip", + "$ark_third_party_root/zlib", + "$ark_third_party_root/zlib/contrib/minizip", ] } else { include_dirs += [ "$ark_third_party_root/miniz" ] } } -ohos_shared_library("libarkziparchive") { +source_set("libarkziparchive_static") { sources = [ "zip_archive.cpp" ] - configs = [ + public_configs = [ ":arkziparchive_config", "$ark_root:ark_config", sdk_libc_secshared_config, @@ -43,23 +48,17 @@ ohos_shared_library("libarkziparchive") { "$ark_root/libpandabase:libarkbase", sdk_libc_secshared_dep, ] - if (!ark_standalone_build) { - deps += [ "//third_party/zlib:libz" ] + deps += [ "$ark_third_party_root/zlib:libz" ] } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkziparchive_frontend_static") { +source_set("libarkziparchive_frontend_set") { sources = [ "zip_archive.cpp" ] - configs = [ + public_configs = [ ":arkziparchive_config", "$ark_root:ark_config", sdk_libc_secshared_config, @@ -69,10 +68,32 @@ ohos_static_library("libarkziparchive_frontend_static") { "$ark_root/libpandabase:libarkbase_frontend_static", sdk_libc_secshared_dep, ] - if (!ark_standalone_build) { - deps += [ "//third_party/zlib:libz" ] + deps += [ "$ark_third_party_root/zlib:libz" ] } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } } + +if (!defined(ark_flag)) { + ohos_shared_library("libarkziparchive") { + deps = [ ":libarkziparchive_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + ohos_static_library("libarkziparchive_frontend_static") { + deps = [ ":libarkziparchive_frontend_set" ] + } +} else { + ark_shared_library("libarkziparchive") { + deps = [ ":libarkziparchive_static" ] + output_extension = "so" + } + ark_static_library("libarkziparchive_frontend_static") { + deps = [ ":libarkziparchive_frontend_set" ] + } +} diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index eef472101927ba6bfe6dcaad262d677f542829c5..4b234359b20f98dbd8d08828318459b53858fb37 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -11,9 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") -import("$ark_root/verification/verification.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") + import("$ark_root/verification/verification.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") + import("$ark_root/verification/verification.gni") +} config("arkruntime_public_config") { include_dirs = [ @@ -21,9 +27,9 @@ config("arkruntime_public_config") { "$target_gen_dir", "$target_gen_dir/generated", "$target_gen_dir/include", - "//third_party/icu/icu4c/source/common", - "//third_party/icu/icu4c/source/i18n", - "//third_party/icu/icu4c/source/", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/i18n", + "$ark_third_party_root/icu/icu4c/source/", ] configs = [ "$ark_root/verification/gen:verification_public_config" ] } @@ -62,7 +68,7 @@ group("arkruntime_header_deps") { ] } -ohos_static_library("libarkruntime_static") { +source_set("libarkruntime_set") { sources = [ "arch/asm_support.cpp", "assert_gc_scope.cpp", @@ -200,7 +206,7 @@ ohos_static_library("libarkruntime_static") { sources += core_vm_sources sources += verifier_sources - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", @@ -244,24 +250,6 @@ ohos_static_library("libarkruntime_static") { ":bridge_dispatch_dyn_amd64", ] } - - if (current_cpu == "amd64" || current_cpu == "x64" || - current_cpu == "x86_64") { - ldflags = [ "-latomic" ] - } - - output_extension = "a" - subsystem_name = "ark" -} - -ohos_shared_library("libarkruntime") { - deps = [ ":libarkruntime_static" ] - - output_extension = "so" - if (!is_standard_system) { - relative_install_dir = "ark" - } - subsystem_name = "ark" } config("arkruntime_interpreter_impl_config") { @@ -274,9 +262,9 @@ config("arkruntime_interpreter_impl_config") { "$target_gen_dir", "$target_gen_dir/generated", "$target_gen_dir/include", - "//third_party/icu/icu4c/source/common", - "//third_party/icu/icu4c/source/i18n", - "//third_party/icu/icu4c/source/", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/i18n", + "$ark_third_party_root/icu/icu4c/source/", ] cflags_cc = [ @@ -300,10 +288,10 @@ config("arkruntime_interpreter_impl_config") { } } -ohos_static_library("arkruntime_interpreter_impl") { +source_set("arkruntime_interpreter_impl_static") { sources = [ "interpreter/interpreter_impl.cpp" ] - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", @@ -319,6 +307,55 @@ ohos_static_library("arkruntime_interpreter_impl") { ] } +if (!defined(ark_flag)) { + ohos_static_library("libarkruntime_static") { + deps = [ ":libarkruntime_set" ] + + if (current_cpu == "amd64" || current_cpu == "x64" || + current_cpu == "x86_64") { + ldflags = [ "-latomic" ] + } + + output_extension = "a" + subsystem_name = "ark" + } + + ohos_shared_library("libarkruntime") { + deps = [ ":libarkruntime_static" ] + + output_extension = "so" + if (!is_standard_system) { + relative_install_dir = "ark" + } + subsystem_name = "ark" + } + + ohos_static_library("arkruntime_interpreter_impl") { + deps = [ ":arkruntime_interpreter_impl_static" ] + } +} else { + ark_static_library("libarkruntime_static") { + deps = [ ":libarkruntime_set" ] + + if (current_cpu == "amd64" || current_cpu == "x64" || + current_cpu == "x86_64") { + ldflags = [ "-latomic" ] + } + + output_extension = "a" + } + + ark_shared_library("libarkruntime") { + deps = [ ":libarkruntime_static" ] + + output_extension = "so" + } + + ark_static_library("arkruntime_interpreter_impl") { + deps = [ ":arkruntime_interpreter_impl_static" ] + } +} + template("gen_intrinsics_yaml") { assert(defined(invoker.data_files), "data_files required!") assert(defined(invoker.output_file), "output_file required!") @@ -368,15 +405,29 @@ ark_isa_gen("isa_gen_libarkruntime") { isa = "$root_gen_dir/isa/isa.yaml" isa_api = "$ark_root/isa/isapi.rb" bridge_dispatch_template = "templates/bridge_dispatch.S.erb" -bridge_archs = [ - "aarch64", - "arm", - "armhf", - "amd64", - "x86", - "x86_64", - "x64", -] +if (!defined(ark_flag)) { + bridge_archs = [ + "aarch64", + "arm", + "armhf", + "amd64", + "x86", + "x86_64", + "x64", + ] +} else { + bridge_archs = [ + "aarch64", + "arm", + "armhf", + "amd64", + + #"x86", + "x86_64", + "x64", + ] +} + foreach(arch, bridge_archs) { ark_gen_file("bridge_dispatch_${arch}") { data_file = isa diff --git a/runtime/asm_defines/BUILD.gn b/runtime/asm_defines/BUILD.gn index be455aaeaf8fdebafb028138c6d3e9fe0a5fd5b2..f23534ca9a6175cbc63034a9cadbb2f53343a5d3 100644 --- a/runtime/asm_defines/BUILD.gn +++ b/runtime/asm_defines/BUILD.gn @@ -11,36 +11,68 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("asmdefines_public_config") { include_dirs = [ "$target_gen_dir/generated/" ] } -ohos_static_library("asm_defines") { - sources = [ "defines.cpp" ] - configs = [ - "$ark_root:ark_config", - "$ark_root/runtime:arkruntime_public_config", - "$ark_root/libpandabase:arkbase_public_config", - sdk_libc_secshared_config, - "$ark_root/libpandafile:arkfile_public_config", - ] - cflags_cc = [ - "-Wno-invalid-offsetof", - "-S", - ] - output_dir = "$target_gen_dir/generated" - output_extension = "S" - output_name = "libasm_defines" - deps = [ - "$ark_root/libpandafile:libarkfile", - "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", - "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", - "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", - sdk_libc_secshared_dep, - ] +if (!defined(ark_flag)) { + ohos_static_library("asm_defines") { + sources = [ "defines.cpp" ] + configs = [ + "$ark_root:ark_config", + "$ark_root/runtime:arkruntime_public_config", + "$ark_root/libpandabase:arkbase_public_config", + sdk_libc_secshared_config, + "$ark_root/libpandafile:arkfile_public_config", + ] + cflags_cc = [ + "-Wno-invalid-offsetof", + "-S", + ] + output_dir = "$target_gen_dir/generated" + output_extension = "S" + output_name = "libasm_defines" + deps = [ + "$ark_root/libpandafile:libarkfile", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", + sdk_libc_secshared_dep, + ] + } +} else { + ark_static_library("asm_defines") { + sources = [ "defines.cpp" ] + configs = [ + "$ark_root:ark_config", + "$ark_root/runtime:arkruntime_public_config", + "$ark_root/libpandabase:arkbase_public_config", + sdk_libc_secshared_config, + "$ark_root/libpandafile:arkfile_public_config", + ] + cflags_cc = [ + "-Wno-invalid-offsetof", + "-S", + ] + output_dir = "$target_gen_dir/generated" + output_extension = "S" + output_name = "libasm_defines" + deps = [ + "$ark_root/libpandafile:libarkfile", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", + sdk_libc_secshared_dep, + ] + } } action("asm_defines_generator") { diff --git a/runtime/templates/bridge_helpers_x64.rb b/runtime/templates/bridge_helpers_x64.rb new file mode 100755 index 0000000000000000000000000000000000000000..166d414de56ab269aeb4cabb4be6bd8581b540c3 --- /dev/null +++ b/runtime/templates/bridge_helpers_x64.rb @@ -0,0 +1,25 @@ +# Copyright (c) 2021 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. + +def cmp_opcode(imm) + return "cmpl $#{imm}, %ecx" +end + +def jump_eq(target) + return "je #{target}" +end + +def handler_path(name) + return "bridge/arch/amd64/handle_#{name}_amd64.S" +end + diff --git a/runtime/templates/bridge_helpers_x86_64.rb b/runtime/templates/bridge_helpers_x86_64.rb new file mode 100755 index 0000000000000000000000000000000000000000..166d414de56ab269aeb4cabb4be6bd8581b540c3 --- /dev/null +++ b/runtime/templates/bridge_helpers_x86_64.rb @@ -0,0 +1,25 @@ +# Copyright (c) 2021 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. + +def cmp_opcode(imm) + return "cmpl $#{imm}, %ecx" +end + +def jump_eq(target) + return "je #{target}" +end + +def handler_path(name) + return "bridge/arch/amd64/handle_#{name}_amd64.S" +end + diff --git a/verification/gen/BUILD.gn b/verification/gen/BUILD.gn index 440644e9a4b9e7574285f629780657b2c6c64599..fafc4cb5dd7a681b6c4a5d2a1b379e37d658fab3 100644 --- a/verification/gen/BUILD.gn +++ b/verification/gen/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (defined(ark_flag)) { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} config("verification_public_config") { include_dirs = [ @@ -37,9 +42,7 @@ ark_isa_gen("isa_gen_verification_gen") { ] sources = "templates" ## ark_root/templates destination = "$target_gen_dir/include" ## target_gen_dir/include - extra_dependencies = [ - ":verification_abs_int_inl_compat_checks_h", - ] + extra_dependencies = [ ":verification_abs_int_inl_compat_checks_h" ] } ark_gen_file("verification_verifier_messages_h") { diff --git a/verification/verification.gni b/verification/verification.gni index 1af659e307437e96d21205e83beb55cfcda73d3b..0e7025fffe26889e3c9c409ab451991d68966950 100644 --- a/verification/verification.gni +++ b/verification/verification.gni @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") +if (defined(ark_flag)) { + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") +} type_sources = [ "$ark_root/verification/type/type_param.cpp",