• Home
Name Date Size #Lines LOC

..--

assembler/12-May-2024-22,48217,193

bytecode_optimizer/12-May-2024-7,8415,993

cmake/12-May-2024-3,9013,440

compiler/12-May-2024-72,12655,879

disassembler/12-May-2024-4,3463,529

docs/12-May-2024-8,5736,650

gn/12-May-2024-1,6701,469

isa/12-May-2024-2,9522,550

ldscripts/12-May-2024-457418

libark_defect_scan_aux/12-May-2024-3,8582,987

libpandabase/12-May-2024-29,34120,894

libpandafile/12-May-2024-20,27615,380

libziparchive/12-May-2024-1,294960

panda/12-May-2024-348271

pandastdlib/12-May-2024-707548

platforms/12-May-2024-4,0232,629

plugins/ecmascript/tests/12-May-2024-11781

scripts/12-May-2024-2,0571,473

templates/12-May-2024-959738

tests/12-May-2024-251,784231,089

.clang-formatD12-May-20243.7 KiB127125

.clang-tidyD12-May-20243.4 KiB7674

.gitattributesD12-May-2024127 76

.gitignoreD12-May-2024176 1716

.standalone_gnD12-May-2024877 2318

AUTHORSD12-May-20241.8 KiB137136

BUILD.gnD12-May-20248.4 KiB318281

CMakeLists.txtD12-May-202413.3 KiB367290

LICENSED12-May-202410.5 KiB192160

OAT.xmlD12-May-20244.2 KiB6820

README.mdD12-May-20247.6 KiB135100

README_zh.mdD12-May-20246.5 KiB13099

ark_config.gniD12-May-20248.2 KiB272230

ark_root.gniD12-May-20241,015 2925

bundle.jsonD12-May-20243.9 KiB108107

README.md

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/README.md).
127
128## Repositories Involved<a name="section1371113476307"></a>
129
130**[arkcompiler\_runtime\_core](https://gitee.com/openharmony/arkcompiler_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

README_zh.md

1# 方舟运行时公共组件<a name="ZH-CN_TOPIC_0000001138850082"></a>
2
3- [方舟运行时公共组件<a name="ZH-CN_TOPIC_0000001138850082"></a>](#方舟运行时公共组件)
4  - [简介<a name="section11660541593"></a>](#简介)
5  - [目录<a name="section161941989596"></a>](#目录)
6  - [编译构建](#编译构建)
7  - [说明](#说明)
8    - [使用说明<a name="section1312121216216"></a>](#使用说明)
9      - [汇编器工具概述](#汇编器工具概述)
10      - [反汇编器工具概述](#反汇编器工具概述)
11  - [相关仓<a name="section1371113476307"></a>](#相关仓)
12
13## 简介<a name="section11660541593"></a>
14
15方舟编译器运行时公共组件(ArkCompiler Runtime Core)是OpenHarmony中语言运行时的公共组件。主要由与语言无关的基础运行库组成,包含承载字节码以及执行字节码所需要相关信息的ArkCompiler File文件组件、支持运行时调试的Debugger Tooling工具组件、提供不同系统平台公共接口的ArkCompiler Base基础库组件、以及与语言无关的公共指令集体系结构ISA等。
16
17**图1** 方舟编译器运行时公共组件架构图:
18
19![方舟编译器运行时公共组件架构图](docs/images/runtime_core_arch.png)
20
21更多信息请参考:[方舟运行时子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/ARK-Runtime-Subsystem-zh.md)
22
23## 目录<a name="section161941989596"></a>
24
25```
26/arkcompiler/runtime_core
27├── assembler               # 汇编器,将文本格式的方舟字节码文件(*.pa)转换为二进制格式的字节码文件(*.abc),具体格式见:docs/assembly_format.mddocs/file_format.md
28├── bytecode_optimizer      # 字节码优化器,对方舟字节码进行进一步优化生成带优化的字节码文件(*.abc)
29├── cmake                   # Cmake脚本,包含工具链文件和用于定义构建和测试目标的常用cmake函数
30├── compiler                # 编译器,主要包含用于字节码优化的IR和passes等,更多信息可参:docs/ir_format.md
31├── cross_values            # 交叉值生成器
32├── disassembler            # 反汇编器,将二进制格式的方舟字节码文件(*.abc)转换为文本格式的方舟字节码文件(*.pa)
33├── docs                    # 包含语言前端、方舟文件格式和运行时的设计文档
34├── dprof                   # 用于ArkCompiler运行时收集profile数据
35├── gn                      # GN模板和配置文件
36├── irtoc                   # IR to code工具,将手工创建的IR编译为目标代码,具体可以参考:docs/irtoc.md
37├── isa                     # 字节码ISA描述文件YAML,ruby脚本和模板
38├── ldscripts               # 包含链接器脚本,用于在非PIE可执行文件中放置4GB以上的ELF section
39├── libark_defect_scan_aux  # 提供二进制格式方舟字节码文件(*.abc)的漏洞扫描接口
40├── libpandabase            # ArkCompiler运行时基本库,包含:日志、同步原语、公共数据结构等
41├── libpandafile            # 二进制格式的方舟字节码文件(*.abc)源码仓
42├── libziparchive           # 提供基于zlib库实现的读写压缩文件接口
43├── panda                   # CLI工具,用于执行方舟字节码文件(*.abc)
44├── pandastdlib             # 通过方舟汇编语言编写的标准库
45├── platforms               # 与系统平台相关的基础接口实现
46├── plugins                 # 部分与语言相关的插件
47├── quickener               # 加速器
48├── runtime                 # ArkCompiler运行时公共组件
49├── scripts                 # CI脚本
50├── templates               # ruby模板和脚本,处理包括:命令行选项、日志组件、错误消息、事件等
51├── tests                   # 测试用例
52└── verification            # 字节码验证器,具体可以参考:docs/bc_verification
53```
54
55## 编译构建
56**Linux平台**
57```
58$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_linux_tools_packages
59```
60**Windows平台**
61```
62$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_windows_tools_packages
63```
64**Mac平台**
65```
66$ ./build.sh --product-name hispark_taurus_standard --build-target ark_host_mac_tools_packages
67```
68
69## 说明
70### 使用说明<a name="section1312121216216"></a>
71
72#### 汇编器工具概述
73
74工具名称为ark\_asm,用于将文本格式的方舟字节码文件转换为二进制格式的方舟字节码文件。
75
76命令行格式:
77
78```
79ark_asm [选项] 输入文件 输出文件
80```
81
82| 选项 | 描述 |
83|---------------|------------------------------------------------|
84| --dump-scopes | 将结果保存到json文件中,以支持在VS Code中的debug模式 |
85| --help        | 帮助提示 |
86| --log-file    | 使能log打印后,指定log文件输出路径 |
87| --optimize    | 使能编译优化 |
88| --size-stat   | 统计并打印出转换后方舟字节码信息 |
89| --verbose     | 使能log打印 |
90| --version     | 打印版本信息,包括当前和所支持的最低的文件格式版本 |
91
92输入文件:文本格式的方舟字节码
93
94输出文件:二进制格式的方舟字节码
95
96#### 反汇编器工具概述
97
98工具名称为ark\_disasm,用于将二进制格式的方舟字节码文件转换为文本格式的方舟字节码文件。
99
100命令行格式:
101
102```
103ark_disasm [选项] 输入文件 输出文件
104```
105
106| 选项 | 描述 |
107|------------------------|----------------------------------|
108| --debug                | 使能调试信息 |
109| --debug-file           | 调试信息输出文件路径,默认为std::cout |
110| --help                 | 帮助提示 |
111| --quiet                | 使能所有"--skip-\*"选项 |
112| --skip-string-literals | 跳过对字符串字面量的反汇编 |
113| --verbose              | 增加输出文件的注释信息 |
114| --version              | 打印版本信息,包括当前和所支持的最低的文件格式版本 |
115
116输入文件:二进制格式的方舟字节码
117
118输出文件:文本格式的方舟字节码
119
120
121更多使用说明请参考:[方舟运行时使用指南](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/README_zh.md)
122
123## 相关仓<a name="section1371113476307"></a>
124
125**[arkcompiler\_runtime\_core](https://gitee.com/openharmony/arkcompiler_runtime_core)**
126
127[arkcompiler\_ets\_runtime](https://gitee.com/openharmony/arkcompiler_ets_runtime)
128
129[arkcompiler\_ets\_frontend](https://gitee.com/openharmony/arkcompiler_ets_frontend)
130