1 Star 0 Fork 632

yuqing_han / ark_js_runtime_wiki

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.79 KB
一键复制 编辑 原始数据 按行查看 历史
xliu 提交于 2022-01-24 15:25 . add container in readme

ARK JS Runtime Module

Introduction

ARK JS Runtime is the runtime used by JavaScript (JS) applications on OpenHarmony. It consists of the JS object allocator, garbage collector (GC), a standard library compliant with ECMAScript specifications, ARK bytecode interpreter, inline caches that store hidden classes, and the ARK Foreign Function Interface (AFFI).

For more infomation, see: ARK Runtime Subsystem.

ARK JS runtime architecture

Directory Structure

/ark/js_runtime
├─ ecmascript             # JS object definition
│   ├─ base               # Base helper class
│   ├─ builtins           # ECMAScript library
│   ├─ class_linker       # Bytecode pre-processing module
│   ├─ compiler           # JS compiler
│   ├─ containers         # Non-ECMAScript container library
│   ├─ cpu_profiler       # CPU Performance Analyzer
│   ├─ hprof              # Memory analysis utility class
│   ├─ ic                 # Inline cache module
│   ├─ interpreter        # JS interpreter
│   ├─ jobs               # Queue of jobs
│   ├─ js_vm              # ARK command line tool
│   ├─ mem                # Memory management module
│   ├─ napi               # External native interface
│   ├─ regexp             # Regular expression engine module
│   ├─ snapshot/mem       # Snapshot module
│   ├─ tests              # Unit test cases
│   ├─ thread             # Thread pool
│   ├─ tooling            # JS debugger
│   └─ vmstat             # Runtime status utility classes
└─ test                   # Module test cases

Constraints

  • Only the bytecode file generated by the ARK JS frontend can be run.
  • Only support ES2015 standard and strict mode ("use strict").
  • Don't support dynamically create functions via string (e.g., new Function("console.log(1))).

Build

./build.sh --product-name Hi3516DV300 --build-target ark_js_runtime

Available APIs

For details, see NAPI.

Usage Guidelines

For details about how to generate JS bytecodes, see Using the Toolchain.

To run bytecodes:

$ cd out/release
$ export LD_LIBRARY_PATH=clang_x64/ark/ark_js_runtime:clang_x64/ark/ark:clang_x64/global/i18n:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/
$ ./clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc

For more infomation, please see: ARK-Runtime-Usage-Guide.

Repositories Involved

ark_runtime_core

ark_js_runtime

ark_ts2abc

1
https://gitee.com/hyq5234/ark_js_runtime_wiki.git
git@gitee.com:hyq5234/ark_js_runtime_wiki.git
hyq5234
ark_js_runtime_wiki
ark_js_runtime_wiki
master

搜索帮助