Skip to content

haohao022/qjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An Object Lifetime Tool On QuickJS

编译项目

`make`

运行脚本

通过qjs允许一个js脚本: ./qjs xlz.js

Debug

输出bytecode: 代码中修改此处的宏定义,可以输出想看的bytecode,如:

/* dump the bytecode of the compiled functions: combination of bits
   1: dump pass 3 final byte code
   2: dump pass 2 code
   4: dump pass 1 code
   8: dump stdlib functions
  16: dump bytecode in hex
  32: dump line number table
 */
#define DUMP_BYTECODE  (3)
//输出最终解释执行的bytecode,此外还有很多debug的define可以利用帮助后续开发。

输出该项目增加的检测行为(暂时不全?后续完善): #define DEV

输出配置检测的heap大小:

假设检测10000000字节:./qjs xlz.js mmap_size 10000000

如何适当修改gc的间隔阈值帮助实验:

部署到Android

Step1. 下载交叉编译工具

Android NDK下载地址:https://developer.android.google.cn/ndk/downloads?hl=zh-cn

下载对应平台的工具,之后解压到 ${android_ndk_dir} ,无需编译。

Step2. 修改QuickJS中的Makefile文件

附件修改的是原版QuickJS的Makefile文件,修改的地方已经使用 #haohao 标注供参考。具体修改方案 如下:

  • CROSS_PREFIX CROSS_PREFIX=${android_ndk_dir}/toolchains/llvm/prebuilt/linux-x86_64/bin/
  • CC
    CC=$(CROSS_PREFIX)aarch64-linux-android29-clang
  • AR
    AR=$(CROSS_PREFIX)llvm-ar
  • LIBS
    LIBS+=-ldl -lc
    Android NDK中不提供 libpthread 库,相关功能使用 libc 库代替。

Step3. 编译

make

Licensing

QuickJS is released under the MIT license.

Unless otherwise specified, the QuickJS sources are copyright Fabrice Bellard and Charlie Gordon.


Fabrice Bellard - https://bellard.org/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 79.4%
  • JavaScript 19.6%
  • Other 1.0%