arkcompiler_runtime_core/static_core
Torok Gergo 69348c7745
[ETS] Fixing type alias CTS test
Issue:
https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I9U38V

Reason:
It should allowed to be declared in function scopes and with the same name as variable that is not an other type alias.

Description:
Moved a CTS test to ignore list

Signed-off-by: Gergo Torok <gergo.torok@huawei.com>
2024-07-19 12:19:50 +03:00
..
assembler [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
bytecode_optimizer Fix python codecheck 2024-07-11 16:29:55 +03:00
cmake !1404 Add host ohos toolchain 2024-04-11 20:03:33 +00:00
compiler !2115 Fix Blue codecheck 2024-07-19 08:19:33 +00:00
cross_values Enable check for using double quotes in shell scripts and fix detected issues 2024-03-11 16:42:31 +03:00
disassembler [LLVM AOT] Bring-up GN build for AOT and LLVMAOT 2024-07-02 14:52:06 +03:00
docs Implement string constant pool in interop 2024-02-28 17:28:27 +03:00
dprof [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
extras Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
gn Add fastverify mode 2024-07-11 12:51:18 +03:00
irtoc [LLVM AOT] Bring-up GN build for AOT and LLVMAOT 2024-07-02 14:52:06 +03:00
isa Enable check for using double quotes in shell scripts and fix detected issues 2024-03-11 16:42:31 +03:00
ldscripts Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
libllvmbackend Optimize cache for number-to-string conversions 2024-07-15 10:27:05 +03:00
libpandabase [MM] stdlib process interface 2024-07-16 00:58:41 +08:00
libpandafile [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
libziparchive [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
models Add license in arkcompiler 2023-10-06 18:54:08 +03:00
panda Follow-up for fixing component check 2024-05-27 14:15:41 +03:00
pandastdlib Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
patches [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
platforms [MM] stdlib process interface 2024-07-16 00:58:41 +08:00
plugins [ETS] Fixing type alias CTS test 2024-07-19 12:19:50 +03:00
quickener [ArkTS] Fix local variables types in debug info 2024-07-01 10:11:45 +03:00
runtime !1726 Implement cache for number-to-string conversions V2 2024-07-17 05:26:37 +00:00
scripts !1968 Panda SDK misses libes2panda-public.so 2024-07-19 00:42:24 +00:00
static_linker [ArkTS] Fix local variables types in debug info 2024-07-01 10:11:45 +03:00
templates !1019 Fix shell scripts style inside static_core folder 2024-02-11 15:35:48 +00:00
tests !2086 [ArkTS CTS] Sync test locations with the ArkTS Specification version 2024.07.16 2024-07-19 00:38:27 +00:00
tools [ETS] Throwing errors on redeclarations 2024-06-19 09:07:57 +02:00
verification Implement 'launch' expression support in verifier 2024-06-21 12:38:47 +03:00
.clang-format Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
.clang-tidy [Codestyle] Change static VM codestyle 2024-01-10 16:09:23 +03:00
.gn Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
ark_config.gni [GN] Support gn standalone build 2024-07-08 21:43:39 +03:00
ark_root.gni Add fastverify mode 2024-07-11 12:51:18 +03:00
AUTHORS Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
BUILD.gn Add fastverify mode 2024-07-11 12:51:18 +03:00
CMakeLists.txt !971 [ArkTS] [PT] Refactor Inspector websocket server 2024-03-22 16:12:53 +00:00
LICENSE Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
OAT.xml Add arkplatform and static_core 2023-09-29 17:50:24 +03:00
README.md !1916 Support gn standalone build 2024-07-10 18:28:02 +00:00
REVIEWERS Update REVIEWERS for interop tests 2024-07-17 15:18:39 +03:00

Bootstrapping

Currently an officially supported host OS for development, building and testing is Ubuntu 18.04 and Ubuntu 20.04. The full list of packages required for building and testing the project is specified in scripts/deps-lists files. These packages can be installed either manually or by running a bootstrap script:

$ sudo ./scripts/install-deps-ubuntu

For more bootstrapping options, run:

$ sudo ./scripts/install-deps-ubuntu --help

E.g. for development purposes you should run:

$ sudo ./scripts/install-deps-ubuntu -i=dev

If you want additionally to install Python dependencies for running tests add a parameter -i=test:

$ sudo ./scripts/install-deps-ubuntu -i=dev -i=test

It creates a virtual environment .venv-panda in your home directory with all required dependencies. Later, tests Python scripts can activate this environment. If you already have run with the parameter -i=test the second time it might be skipped.

Third party

Panda uses third party libraries. To install the libraries and apply patches, run:

$ ./scripts/install-third-party --force-clone

Building

Assuming your system is bootstrapped, please run the following commands in the root of the project:

$ mkdir panda-build
$ cd panda-build
$ cmake /path/to/panda/repository -GNinja
$ ninja

This will build Panda in debug mode with your default C++ compiler. All supported compilers can be found in cmake/toolchain. E.g., to build with Clang 14, pass a path to the corresponding toolchain file during configuration:

$ cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/panda/repository/cmake/toolchain/host_clang_14.cmake /path/to/panda/repository

Explicitly setting build types

Recommended way to build Panda is to set CMAKE_BUILD_TYPE variable explicitly during configurations. Supported values are:

Mode Assertions Optimizations Debug info
Debug Yes None (CMake default) -g (CMake default)
Release No -O3 (CMake default) None (CMake default)
FastVerify Yes -O2 -ggdb3

Notes:

  • Other common modes (RelWithDebInfo, MinSizeRel, DebugDetailed) should work but they are not tested in CI.
  • Unlike RelWithDebInfo, FastVerify preserves assertions (and provides more verbose debug information). Use this build type for running heavy test suites when you want both fast-running code and debuggability.
  • DebugDetailed gives more debug information than Debug, it can be usefull for debugging unit tests for example.

Example:

$ cmake -DCMAKE_BUILD_TYPE=Release ...

Building with LLVM Backend

If you want to build Ark with LLVM Backend you need to build first special modified LLVM 15 binaries.

If modified LLVM available in /opt, the following two options are necessary to build Ark with LLVM Backend functions.

cmake -DPANDA_LLVM_BACKEND=true -DLLVM_TARGET_PATH=/opt/llvm-15-{type}-{arch} ...

The PANDA_LLVM_BACKEND enables:

  1. LLVM Irtoc Interpreter. Use -DPANDA_LLVM_INTERPRETER=OFF to disable.
  2. LLVM Fastpaths compilation. Use -DPANDA_LLVM_FASTPATH=OFF to disable.
  3. LLVM Interpreter inlining. Use -DPANDA_LLVM_INTERPRETER_INLINING=OFF to disable.
  4. LLVM AOT compiler. Use -DPANDA_LLVM_AOT=OFF to disable.

PANDA_LLVM_INTERPRETER, PANDA_LLVM_FASTPATH, and PANDA_LLVM_AOT are ON if PANDA_LLVM_BACKEND is turned on.

It is recommended to choose clang compiler using toolchain files: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/host_clang_14.cmake. By default GNU compiler c++ is used, but some features are not available in such gcc builds.

Cross ARM64 build with LLVM Backend

For cross-build, when e.g. -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/cross-clang-14-qemu-aarch64.cmake is used, two LLVM-paths options are required when all LLVM Backend functions are enabled.

  • First one is target LLVM, like -DLLVM_TARGET_PATH=/opt/llvm-15-debug-aarch64
    • It is required for AOT, so, alternatively, you can use -DPANDA_LLVM_AOT=OFF.
  • Second one is host LLVM, like -DLLVM_HOST_PATH=/opt/llvm-15-debug-x86_64
    • It is required for Irtoc compilation, so, alternatively, you can disable appropriate Interpreter and FastPath options (see above).

Running tests with QEMU for cross-compiled aarch64/arm builds

Recommended QEMU version for running tests is 6.2.0 (but 5.1+ should be ok, too). By default, it is downloaded and installed during environment bootstrap. Any system-installed package is left intact. If recommended QEMU version is not accessible via $PATH it can be specified during configuration time:

# If QEMU is available as /opt/qemu-6.2.0/bin/qemu-aarch64
$ cmake -DQEMU_PREFIX=/opt/qemu-6.2.0 ...

Building with GN

  1. Getting GN binary
$ git clone https://gn.googlesource.com/gn
$ cd gn
$ python build/gen.py
$ ninja -C out
  1. Build panda using gn (arkts_asm, arkts_disasm, ark_aot, ark_aotdump, arkts_bin, es2panda, and verifier_bin targets are supported)
$ cd /path/to/panda/repository
$ /path/to/gn/repository/out/gn gen out
$ ninja -C out arkts_bin

When standard system, use

$ cd /path/to/panda/repository
$ /path/to/gn/repository/out/gn --args=-is_standard_system=true gen out
$ ninja -C out <target name>

To use LLVM Backend add the following arguments:

$ /path/to/gn/repository/out/gn out is_llvmbackend=true llvm_dir="/opt/llvm-15-{type}-{arch}" ...

Setting is_llvmbackend=true option enables the same scenarios as -DPANDA_LLVM_BACKEND=true option in cmake builds

Further reading

Testing

For testing, the following umbrella targets that guarantee building prior to running may be used:

  • tests, for running all testing suites.
  • tests_full, for running all testing suites and various code linters.

Clang tools

clang-format and clang-tidy checks are integrated into build system and can be called by target of build system:

$ ninja code-style-check # clang-format
$ ninja clang-tidy-check # clang-tidy

Test coverage

In order to measure bytecode optimizer coverage, configure your build with -DENABLE_BYTECODE_OPTIMIZER_COVERAGE=true. Then run:

$ ninja bytecode_optimizer_coverage

Benchmarking

To build and run benchmarks, please use the umbrella target benchmarks or any of its dependencies. Please see the root CMakeLists.txt for more details.

NB! Make sure that you configure your build with -DCMAKE_BUILD_TYPE=Release, otherwise your run will most likely be dead slow.

Running

Running assembler

Assuming that you are in panda-build directory, please run:

$ ./bin/ark_asm /path/to/panda-assembly.pa /path/to/binary/output.abc

Running interpreter

Assuming that your main function is defined as .function main(...) in the assembly listing, and /path/to/binary/output.abc is the result of the assembler, please run:

$ ./bin/ark /path/to/binary/output.abc _GLOBAL::main