• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Runtime Core<a name="EN-US_TOPIC_0000001138850082"></a>
2
3- [Runtime Core<a name="EN-US_TOPIC_0000001138850082"></a>](#runtime-core)
4  - [Introduction<a name="section11660541593"></a>](#introduction)
5  - [Directory Structure<a name="section161941989596"></a>](#directory-structure)
6  - [Building](#building)
7  - [Guidelines](#guidelines)
8    - [Usage Guidelines<a name="section1312121216216"></a>](#usage-guidelines)
9      - [Assembler ark\_asm](#assembler-ark_asm)
10      - [Disassembler ark\_disasm](#disassembler-ark_disasm)
11  - [Repositories Involved<a name="section1371113476307"></a>](#repositories-involved)
12
13## Introduction<a name="section11660541593"></a>
14
15As a common module of language runtime in OpenHarmony, ArkCompiler Runtime Core consists of language-independent basic runtime libraries, including ArkCompiler File, Tooling, Base and ISA. ArkCompiler File provides bytecodes and information required for executing bytecodes. Tooling supports runtime debugger. Base is responsible for implementing platform related utilities. ISA provides common instruction set architecture that is language-independent.
16
17**Figure 1** ArkCompiler Runtime Core architecture diagram:
18
19![ArkCompiler Runtime Core Arch](docs/images/runtime_core_arch.png)
20
21For more information, see: [ARK Runtime Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/ARK-Runtime-Subsystem.md).
22
23## Directory Structure<a name="section161941989596"></a>
24
25```
26├── assembler               # Assembler that converts an ARK bytecode file in text format (*.pa) into a bytecode file in binary format (*.abc). For details about the format, see docs/assembly_format.md and docs/file_format.md.
27├── bytecode_optimizer      # Bytecode optimizer, further optimize the ARK bytecode to generate optimized bytecode file in binary format (*.abc).
28├── cmake                   # Cmake script that contains the toolchain files and common cmake functions used to define the build and test targets.
29├── compiler                # Compiler including IR(intermediate representation) and passes for bytecode optimization. See docs/ir_format.md.
30├── cross_values            # Cross values generator.
31├── disassembler            # Disassembler that converts an ARK bytecode file in binary format (*.abc) into an ARK bytecode file in text format (*.pa).
32├── docs                    # Language frontend, ARK file format, and runtime design documents.
33├── dprof                   # Data used to collect the profiling data for ARK runtime.
34├── gn                      # GN templates and configuration files.
35├── irtoc                   # IR to code tool, aims to compile a manually created IR to the target code.
36├── isa                     # Bytecode ISA description file YAML, Ruby scripts and templates.
37├── ldscripts               # Linker scripts used to place ELF sections larger than 4 GB in a non-PIE executable file.
38├── libark_defect_scan_aux  # Vulnerability defect scanning tool for ARK bytecode file in binary format (*.abc).
39├── libpandabase            # Basic ArkCompiler runtime library, including logs, synchronization primitives, and common data structure.
40├── libpandafile            # Source code repository of ARK bytecode files (*.abc) in binary format.
41├── libziparchive           # Provides APIs for reading and using zip files implemented by zlib.
42├── panda                   # CLI tool used to execute ARK bytecode files in binary format(*.abc).
43├── pandastdlib             # Standard libraries wrote by the ARK assembler.
44├── platforms               # Platform related utilities.
45├── plugins                 # Language-dependent plugins.
46├── quickener               # Quickener tool.
47├── runtime                 # ARK runtime command module.
48├── scripts                 # CI Scripts.
49├── templates               # Ruby templates and scripts used to process command line options, loggers, error messages, and events.
50├── tests                   # Test cases.
51└── verification            # Bytecode verifier. See docs/bc_verification.
52```
53
54## Building
55
56**Linux platform**
57```
58$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_linux_tools_packages
59```
60**Windows platform**
61```
62$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_windows_tools_packages
63```
64**Mac platform**
65```
66$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_mac_tools_packages
67```
68
69## Guidelines
70
71### Usage Guidelines<a name="section1312121216216"></a>
72
73#### Assembler ark\_asm
74
75The ark\_asm assembler converts the text ARK bytecode file into a bytecode file in binary format.
76
77Command:
78
79```
80ark_asm [Options] Input file Output file
81```
82
83Supported options:
84
85| Option        | Description                                                                                  |
86|---------------|----------------------------------------------------------------------------------------------|
87| --dump-scopes | Save the result to a JSON file to support the debug mode in Visual Studio Code.              |
88| --help        | Display help information.                                                                    |
89| --log-file    | Specify the log file output path after log printing is enabled.                              |
90| --optimize    | Enable compilation optimization.                                                             |
91| --size-stat   | Collect statistics and print ARK bytecode information after conversion.                      |
92| --verbose     | Enable log printing.                                                                         |
93| --version     | Print version info, including file format version and minimum supported file format version. |
94
95Input file: ARK bytecodes in text format
96
97Output file: ARK bytecodes in binary format
98
99#### Disassembler ark\_disasm
100
101The ark\_disasm disassembler converts binary ARK bytecodes into readable text ARK bytecodes.
102
103Command:
104
105```
106ark_disasm [Options] Input file Output file
107```
108
109Supported options:
110
111| Option                 | Description                                                                                  |
112|------------------------|----------------------------------------------------------------------------------------------|
113| --debug                | Enable the function for printing debug information.                                          |
114| --debug-file           | Specify the path of the debug information output file. The default is `std::cout`.           |
115| --help                 | Display help information.                                                                    |
116| --quiet                | Enable all of the "--skip-\*" flags.                                                         |
117| --skip-string-literals | Replace string literals with their respective id's, thus shortening emitted code size.       |
118| --verbose              | Enable log printing.                                                                         |
119| --version              | Print version info, including file format version and minimum supported file format version. |
120
121Input file: ARK bytecodes in binary format
122
123Output file: ARK bytecodes in text format
124
125
126For more information, please see: [ARK Runtime Usage Guide](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/ARK-Runtime-Usage-Guide.md).
127
128## Repositories Involved<a name="section1371113476307"></a>
129
130**[arkcompiler\_runtime\_core](https://gitee.com/openharmony/ark_runtime_core)**
131
132[arkcompiler\_ets\_runtime](https://gitee.com/openharmony/arkcompiler_ets_runtime)
133
134[arkcompiler\_ets\_frontend](https://gitee.com/openharmony/arkcompiler_ets_frontend)
135