How to convert javascript to LLVM IR?

拟墨画扇 提交于 2019-12-12 12:08:19

问题


Is there any LLVM backend for javascript? If not, other tools that convert dynamic language(similar to javascript) to LLVM IR will also be okay. Because I am writing a dynamic language compiler and such tools can help me find out how some features are implemented.


回答1:


FTL JIT (JavaScriptCore) uses LLVM as a backend.

Other VMs for dynamic languages using LLVM MCJIT:

  • Pyston
  • HHVM
  • LLILC
  • Julia
  • The list goes on



回答2:


I think you can have a look at Emscripten. It's a llvm-backend for asm.js.
But convert js to llvm IR is not easy, because the llvm IR is static typed, you need to use C-like language simulate a dynamic language. TypeScript maybe is a similar language you can have a look.



来源:https://stackoverflow.com/questions/34313561/how-to-convert-javascript-to-llvm-ir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!