1# ARK Runtime Subsystem<a name="EN-US_TOPIC_0000001138852894"></a> 2 3## Introduction<a name="section11660541593"></a> 4 5ARK is a unified programming platform developed. 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. 6 7The 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. 8 9The following figure shows the architecture of the JS compiler toolchain. 10 11 12 13The 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\). 14 15The following figure shows the JS runtime architecture. 16 17 18 19ARK-JS Runtime runs ARK bytecode files to implement JS semantic logic. 20 21ARK-JS Runtime consists of the following: 22 23- Core Runtime 24 25 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. 26 27- Execution Engine 28 29 The Execution Engine consists of an interpreter that executes bytecodes, Inline Caches that store hidden classes, and Profiler that analyzes and records runtime types. 30 31- ECMAScript Runtime 32 33 ECMAScript Runtime consists of the JS object allocator, garbage collector \(GC\), and an internal library that supports ECMAScript specifications. 34 35- ARK Foreign Function Interface \(AFFI\) 36 37 The AFFI provides a C++ function interface for ARK-JS runtime. 38 39 40## Directory Structure<a name="section161941989596"></a> 41 42``` 43/ark 44├── js_runtime # JS runtime module 45├── runtime_core # Runtime common module 46└── ts2abc # JS front-end tool 47``` 48 49## Usage Guide<a name="section18393638195820"></a> 50 51[ARK-Runtime-Usage-Guide](https://gitee.com/openharmony/ark_js_runtime/blob/master/docs/ARK-Runtime-Usage-Guide.md) 52 53## Repositories Involved<a name="section1371113476307"></a> 54 55[ark\_runtime\_core](https://gitee.com/openharmony/ark_runtime_core) 56 57[ark\_js\_runtime](https://gitee.com/openharmony/ark_js_runtime) 58 59[ark\_ts2abc](https://gitee.com/openharmony/ark_ts2abc) 60