1# ARK Runtime Subsystem<a name="EN-US_TOPIC_0000001138852894"></a> 2 3- [ARK Runtime Subsystem<a name="EN-US_TOPIC_0000001138852894"></a>](#ark-runtime-subsystem) 4 - [Introduction<a name="section11660541593"></a>](#introduction) 5 - [Directory Structure<a name="section161941989596"></a>](#directory-structure) 6 - [Usage Guide<a name="section18393638195820"></a>](#usage-guide) 7 - [Repositories Involved<a name="section1371113476307"></a>](#repositories-involved) 8 9## Introduction<a name="section11660541593"></a> 10 11ARK is a unified programming platform developed by Huawei. Its key components include a compiler, toolchain, and runtime. ARK supports compilation and execution of high-level programming languages on the multiple hardware platform and accelerates the execution of the OpenHarmony operating system and its applications and services on mobile phones, PCs, tablets, TVs, automobiles, and smart wearables. The ARK-JS open sourced this time provides the capability of compiling and running the JavaScript \(JS\) language on the standard system of OpenHarmony. 12 13The ARK-JS consists of two parts: JS compiler toolchain and JS runtime. The JS compiler toolchain compiles JS source code into ARK bytecodes. The JS runtime executes the generated ARK bytecodes. Unless otherwise specified, bytecodes refer to ARK bytecodes in this document. 14 15The following figure shows the architecture of the JS compiler toolchain. 16 17 18 19The JS front-end compiler parses the JS source code into an abstract syntax tree \(AST\), which is processed by the AST transformer, bytecode generator, and register allocator. The native emiter generates the ARK bytecode file \(.abc\). 20 21The following figure shows the JS runtime architecture. 22 23 24 25ARK-JS Runtime runs ARK bytecode files to implement JS semantic logic. 26 27ARK-JS Runtime consists of the following: 28 29- Core Runtime 30 31 Core Runtime consists of basic language-irrelevant runtime libraries, including ARK File, Tooling, and ARK Base. ARK File provides bytecodes. Tooling supports Debugger. ARK Base is responsible for implementing system calls. 32 33- Execution Engine 34 35 The Execution Engine consists of an interpreter that executes bytecodes, Inline Caches that store hidden classes, and Profiler that analyzes and records runtime types. 36 37- ECMAScript Runtime 38 39 ECMAScript Runtime consists of the JS object allocator, garbage collector \(GC\), and an internal library that supports ECMAScript specifications. 40 41- ARK Foreign Function Interface \(AFFI\) 42 43 The AFFI provides a C++ function interface for ARK-JS runtime. 44 45 46## Directory Structure<a name="section161941989596"></a> 47 48``` 49/ark 50├── js_runtime # JS runtime module 51├── runtime_core # Runtime common module 52└── ts2abc # JS front-end tool 53``` 54 55## Usage Guide<a name="section18393638195820"></a> 56 57[ARK-Runtime-Usage-Guide](https://gitee.com/openharmony/ark_js_runtime/blob/master/docs/ARK-Runtime-Usage-Guide.md) 58 59## Repositories Involved<a name="section1371113476307"></a> 60 61[ark\_runtime\_core](https://gitee.com/openharmony/ark_runtime_core) 62 63[ark\_js\_runtime](https://gitee.com/openharmony/ark_js_runtime) 64 65[ark\_ts2abc](https://gitee.com/openharmony/ark_ts2abc) 66