From 5ee377f4bb758cd66ecb244b396e35d7002c949b Mon Sep 17 00:00:00 2001 From: Artem Udovichenko Date: Wed, 27 Sep 2023 20:00:43 +0300 Subject: [PATCH 1/2] Fix GN files according to OHOS directory structure Change-Id: Ic6cccfadbb6a7b61deadeeaa0364f932286eb2c1 Signed-off-by: Artem Udovichenko --- BUILD.gn | 2 +- plugin.gn | 2 +- subproject_sources.gn | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 028602e91..76daa1d0e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") +import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("//build/ohos.gni") group("ark_packages") { diff --git a/plugin.gn b/plugin.gn index b9b78d907..38f8a3e3c 100644 --- a/plugin.gn +++ b/plugin.gn @@ -1,2 +1,2 @@ -import("//ark/runtime_core/ark_root.gni") +import("//arkcompiler/runtime_core/static_core/ark_root.gni") import("$ark_root/plugins/ecmascript/subproject_sources.gn") diff --git a/subproject_sources.gn b/subproject_sources.gn index c2424dd46..fefaafa89 100644 --- a/subproject_sources.gn +++ b/subproject_sources.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_root.gni") +import("//arkcompiler/runtime_core/static_core/ark_root.gni") _plugin_dir = get_path_info(".", "abspath") assert(string_replace(_plugin_dir, "//", "") != _plugin_dir) @@ -60,8 +60,8 @@ arkbytecodeopt_deps = [ "$_plugin_dir:isa_gen_ecma_bytecodeopt_ecmascript_codegen_intrinsics_gen_inc", ] arkruntime_deps = [ - "$ark_root/assembler:libarkassembler_frontend_static", - "$ark_root/libpandafile:libarkfile_frontend_static", + "$ark_root/assembler:libarktsassembler_frontend_static", + "$ark_root/libpandafile:libarktsfile_frontend_static", "$_plugin_dir/es2panda:libes2panda_frontend_static", ] @@ -219,10 +219,10 @@ srcs_runtime = [ # Should be files deleted??? #srcs_arm = [ "bridge/arch/arm/builtin_bridge_arm.S" ] -if (current_cpu == "arm64") { +if (current_cpu == "arm") { + srcs_runtime += [ "runtime/bridge/arch/arm/builtin_bridge_arm.S" ] +} else if (current_cpu == "arm64") { srcs_runtime += [ "runtime/bridge/arch/aarch64/builtin_bridge_aarch64.S" ] -} - -if (current_cpu == "amd64" || current_cpu == "x64" || current_cpu == "x86_64") { +} else if (current_cpu == "amd64" || current_cpu == "x64" || current_cpu == "x86_64") { srcs_runtime += [ "runtime/bridge/arch/amd64/builtin_bridge_amd64.S" ] } -- Gitee From 9f442ac6536267b066f9d12322026cb358d9aded Mon Sep 17 00:00:00 2001 From: Vsevolod Pukhov Date: Fri, 29 Sep 2023 17:53:15 +0300 Subject: [PATCH 2/2] Allow es2panda build with disabled ecmascript Change-Id: I3fe9d67c705d91da43d065661e8de74007ce502d Signed-off-by: Vsevolod Pukhov --- BUILD.gn | 4 ++-- CMakeLists.txt | 6 ++++-- HostTools.cmake | 1 - runtime/CMakeLists.txt | 1 + runtime/base/json_parser.h | 3 +-- runtime/js_eval.cpp | 2 +- subproject_sources.gn | 2 +- tests/CMakeLists.txt | 3 ++- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 76daa1d0e..7dca88e02 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -15,7 +15,7 @@ import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("//build/ohos.gni") group("ark_packages") { - deps = ["$ark_root/plugins/ecmascript/es2panda/aot:es2panda"] + deps = ["$ark_es2panda_root/aot:es2panda"] } group("ark_host_linux_tools_packages") { @@ -63,7 +63,7 @@ config("runtime") { "$ark_root_gen_dir", ] configs = [ - "es2panda:libes2panda_public_config", + "$ark_es2panda_root:libes2panda_public_config", "$ark_root/assembler:arkassembler_public_config", "$ark_root/libpandafile:arkfile_public_config", ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 7154af07a..95d78f49b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,10 @@ panda_target_compile_definitions(arkbytecodeopt PUBLIC -DENABLE_BYTECODE_OPT -DA add_custom_target(ecmascript_tests COMMENT "Running ecmascript test suites") +if(TARGET es2panda_tests) + add_dependencies(ecmascript_tests es2panda_tests) +endif() + # NB! ADDING THIS PROPERTY IS ALLOWED ONLY IN SPECIAL CASES. DO NOT COPY-PASTE IT. set_target_properties(ecmascript_tests PROPERTIES first-level-tests-dependency TRUE) add_dependencies(tests ecmascript_tests) @@ -36,8 +40,6 @@ if(PANDA_WITH_TOOLCHAIN) add_subdirectory(assembler) add_subdirectory(isa) add_subdirectory(irtoc_scripts) - add_subdirectory(es2panda) - add_dependencies(panda_bins es2panda) endif() add_subdirectory(bytecode_optimizer) diff --git a/HostTools.cmake b/HostTools.cmake index c775085f0..e03d65577 100644 --- a/HostTools.cmake +++ b/HostTools.cmake @@ -1,4 +1,3 @@ -list(APPEND HOST_TOOLS_TARGETS es2panda) list(APPEND HOST_TOOLS_TARGETS irtoc_ecmascript_fastpath) list(APPEND HOST_TOOLS_BYPRODUCTS "${host_tools_build_dir}/irtoc/irtoc_ecmascript/irtoc_ecmascript_fastpath/irtoc_ecmascript_fastpath.o" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 44e62a1c9..e3f0a6ab3 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -224,6 +224,7 @@ panda_target_include_directories(arkruntime_obj PUBLIC ${PANDA_ECMASCRIPT_PLUGIN_SOURCE}/runtime ${PANDA_BINARY_ROOT}/compiler/generated ${PANDA_BINARY_ROOT}/plugins/ecmascript/ecmastdlib + ${ES2PANDA_PATH} ${ECMA_GEN_DIR} ) diff --git a/runtime/base/json_parser.h b/runtime/base/json_parser.h index 5d35d4df7..713da40f7 100644 --- a/runtime/base/json_parser.h +++ b/runtime/base/json_parser.h @@ -29,7 +29,6 @@ #include "plugins/ecmascript/runtime/js_handle.h" #include "plugins/ecmascript/runtime/js_tagged_value.h" #include "plugins/ecmascript/runtime/object_factory.h" -#include "plugins/ecmascript/es2panda/util/helpers.h" #include "libpandabase/utils/utf.h" namespace panda::ecmascript::base { @@ -135,7 +134,7 @@ private: std::string str_num(current_, end_ + 1); current_ = end_; auto d = std::stod(str_num); - if (es2panda::util::Helpers::IsInteger(d)) { + if (static_cast(d) == d) { return JSTaggedValue(static_cast(d)); } return JSTaggedValue(d); diff --git a/runtime/js_eval.cpp b/runtime/js_eval.cpp index ebbee0d5d..9519011e3 100644 --- a/runtime/js_eval.cpp +++ b/runtime/js_eval.cpp @@ -19,7 +19,7 @@ #include "plugins/ecmascript/runtime/base/builtins_base.h" #include "plugins/ecmascript/runtime/internal_call_params.h" #include "plugins/ecmascript/runtime/interpreter/interpreter-inl.h" -#include "plugins/ecmascript/es2panda/es2panda.h" +#include "plugins/ecmascript/es2panda/es2panda.h" // TODO(vpukhov): adjust es2panda path #include "assembler/assembly-emitter.h" namespace panda::ecmascript { diff --git a/subproject_sources.gn b/subproject_sources.gn index fefaafa89..4e4bcaf2a 100644 --- a/subproject_sources.gn +++ b/subproject_sources.gn @@ -62,7 +62,7 @@ arkbytecodeopt_deps = [ arkruntime_deps = [ "$ark_root/assembler:libarktsassembler_frontend_static", "$ark_root/libpandafile:libarktsfile_frontend_static", - "$_plugin_dir/es2panda:libes2panda_frontend_static", + "$ark_es2panda_root:libes2panda_frontend_static", ] runtime_yamls = [ "runtime/ecma_runtime.yaml" ] diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e63dc22b7..3238f0455 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -250,7 +250,8 @@ endfunction() if(CMAKE_CROSSCOMPILING) ExternalProject_Get_Property(panda_host_tools binary_dir) set(es2panda_target panda_host_tools-build) - set(es2panda_bin "${binary_dir}/plugins/ecmascript/es2panda/aot/es2panda") + # TODO(vpukhov): adjust es2panda path + set(es2panda_bin "${binary_dir}/plugins/ets/es2panda/aot/es2panda") else() set(es2panda_target es2panda) set(es2panda_bin $) -- Gitee