Running LuaJIT「建议收藏」

Running LuaJIT「建议收藏」原文:http://luajit.org/running.htmlLuaJIThasonlyasinglestand-aloneexecutable,called luajit onPOSIXsystemsor luajit.exe onWindows.ItcanbeusedtorunsimpleLuastatementsorwholeLuaap…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

原文:http://luajit.org/running.html

LuaJIT has only a single stand-alone executable, called luajit on POSIX systems or luajit.exe on Windows. It can be used to run simple Lua statements or whole Lua applications from the command line. It has an interactive mode, too.

Command Line Options

The luajit stand-alone executable is just a slightly modified version of the regular luastand-alone executable. It supports the same basic options, too. luajit -h prints a short list of the available options. Please have a look at the Lua manual for details.

LuaJIT has some additional options:

-b[options] input output

This option saves or lists bytecode. The following additional options are accepted:

  • -l — Only list bytecode.
  • -s — Strip debug info (this is the default).
  • -g — Keep debug info.
  • -n name — Set module name (default: auto-detect from input name)
  • -t type — Set output file type (default: auto-detect from output name).
  • -a arch — Override architecture for object files (default: native).
  • -o os — Override OS for object files (default: native).
  • -e chunk — Use chunk string as input.
  • – (a single minus sign) — Use stdin as input and/or stdout as output.

The output file type is auto-detected from the extension of the output file name:

  • c — C source file, exported bytecode data.
  • h — C header file, static bytecode data.
  • obj or o — Object file, exported bytecode data (OS- and architecture-specific).
  • raw or any other extension — Raw bytecode file (portable).

Notes:

  • See also string.dump() for information on bytecode portability and compatibility.
  • A file in raw bytecode format is auto-detected and can be loaded like any Lua source file. E.g. directly from the command line or with loadfile(), dofile() etc.
  • To statically embed the bytecode of a module in your application, generate an object file and just link it with your application.
  • On most ELF-based systems (e.g. Linux) you need to explicitly export the global symbols when linking your application, e.g. with: -Wl,-E
  • require() tries to load embedded bytecode data from exported symbols (in *.exe or lua51.dll on Windows) and from shared libraries in package.cpath.

Typical usage examples:

luajit -b test.lua test.out                 # Save bytecode to test.out
luajit -bg test.lua test.out                # Keep debug info
luajit -be "print('hello world')" test.out  # Save cmdline script

luajit -bl test.lua                         # List to stdout
luajit -bl test.lua test.txt                # List to test.txt
luajit -ble "print('hello world')"          # List cmdline script

luajit -b test.lua test.obj                 # Generate object file
# Link test.obj with your application and load it with require("test")

-j cmd[=arg[,arg…]]

This option performs a LuaJIT control command or activates one of the loadable extension modules. The command is first looked up in the jit.* library. If no matching function is found, a module named jit.<cmd> is loaded and the start() function of the module is called with the specified arguments (if any). The space between -j and cmd is optional.

Here are the available LuaJIT control commands:

  • -jon — Turns the JIT compiler on (default).
  • -joff — Turns the JIT compiler off (only use the interpreter).
  • -jflush — Flushes the whole cache of compiled code.
  • -jv — Shows verbose information about the progress of the JIT compiler.
  • -jdump — Dumps the code and structures used in various compiler stages.

The -jv and -jdump commands are extension modules written in Lua. They are mainly used for debugging the JIT compiler itself. For a description of their options and output format, please read the comment block at the start of their source. They can be found in the lib directory of the source distribution or installed under the jit directory. By default this is /usr/local/share/luajit-2.0.5/jit on POSIX systems.

-O[level]
-O[+]flag   -O-flag
-Oparam=value

This options allows fine-tuned control of the optimizations used by the JIT compiler. This is mainly intended for debugging LuaJIT itself. Please note that the JIT compiler is extremely fast (we are talking about the microsecond to millisecond range). Disabling optimizations doesn’t have any visible impact on its overhead, but usually generates code that runs slower.

The first form sets an optimization level — this enables a specific mix of optimization flags. -O0 turns off all optimizations and higher numbers enable more optimizations. Omitting the level (i.e. just -O) sets the default optimization level, which is -O3 in the current version.

The second form adds or removes individual optimization flags. The third form sets a parameter for the VM or the JIT compiler to a specific value.

You can either use this option multiple times (like -Ocse -O-dce -Ohotloop=10) or separate several settings with a comma (like -O+cse,-dce,hotloop=10). The settings are applied from left to right and later settings override earlier ones. You can freely mix the three forms, but note that setting an optimization level overrides all earlier flags.

Here are the available flags and at what optimization levels they are enabled:

Flag -O1 -O2 -O3  
fold Constant Folding, Simplifications and Reassociation
cse Common-Subexpression Elimination
dce Dead-Code Elimination
narrow   Narrowing of numbers to integers
loop   Loop Optimizations (code hoisting)
fwd     Load Forwarding (L2L) and Store Forwarding (S2L)
dse     Dead-Store Elimination
abc     Array Bounds Check Elimination
sink     Allocation/Store Sinking
fuse     Fusion of operands into instructions

Here are the parameters and their default settings:

Parameter Default  
maxtrace 1000 Max. number of traces in the cache
maxrecord 4000 Max. number of recorded IR instructions
maxirconst 500 Max. number of IR constants of a trace
maxside 100 Max. number of side traces of a root trace
maxsnap 500 Max. number of snapshots for a trace
hotloop 56 Number of iterations to detect a hot loop or hot call
hotexit 10 Number of taken exits to start a side trace
tryside 4 Number of attempts to compile a side trace
instunroll 4 Max. unroll factor for instable loops
loopunroll 15 Max. unroll factor for loop ops in side traces
callunroll 3 Max. unroll factor for pseudo-recursive calls
recunroll 2 Min. unroll factor for true recursion
sizemcode 32 Size of each machine code area in KBytes (Windows: 64K)
maxmcode 512 Max. total size of all machine code areas in KBytes
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/185188.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 开发者一定要了解的六款大数据采集平台

    开发者一定要了解的六款大数据采集平台    随着大数据越来越被重视,数据采集的挑战变的尤为突出。今天为大家介绍几款数据采集平台:  ApacheFlume  Fluentd  Logstash  Chukwa  Scribe  SplunkForwarder  大数据平台与数据采集  任何完整的大数据平台,一般包括以下的几个过程:  数据采集  数据存储  数据处理  数据展现…

    2022年5月1日
    101
  • struts2使用AbstractInterceptor实现拦截器[通俗易懂]

    struts2使用AbstractInterceptor实现拦截器[通俗易懂]2.使用abstractinterceptor抽象类来实现自定义拦截器完成用户是否登陆判断1.写个类继承AbstractInterceptorpublicclassMyintercetorextendsAbstractInterceptor{}2.重写interceptor方法//下列事例是做用户名是否登陆的验证publicStringinterce

    2022年5月14日
    172
  • J2ME开发初探

    J2ME开发初探摘要:本文是J2ME开发的入门性文章,从零开始介绍了进行J2ME开发首先需要了解的一些东西。阅读本文几乎不需要相关的基础知识。1.1.       J2ME简介J2ME是Java2Platform,MicroEdition的简称。它是SunMicrosystems公司在Java的品脾之下的四种平台之一,其他三种分别是J2SE,J2EE和JavaCard。J2ME的目标是消费

    2022年7月11日
    19
  • 好友朋友圈动态仅三天可见?点击这个按钮,不管多久都能看

    好友朋友圈动态仅三天可见?点击这个按钮,不管多久都能看微信朋友圈可以说是了解好友的最好地方,但是现在大部分人都会设置朋友圈动态仅三天可见的权限。这样就只能看到好友三天内的朋友圈内容,其实只要点击这个按钮,多久都能看!先给大家介绍一点朋友圈小技巧吧!快速设置朋友圈权限朋友圈最烦人的就是广告了,本来想看看好友们有趣的动态,但翻了好几页都是广告。其实只需长按对方头像,就能设置不看对方的权限啦!发表纯文字朋友圈家里…

    2022年6月11日
    99
  • 新鲜出炉: IE8 beta1 的下载地址以及官方论坛

    新鲜出炉: IE8 beta1 的下载地址以及官方论坛

    2021年7月26日
    94
  • springboot详细讲解_Springboot项目

    springboot详细讲解_Springboot项目系列文章目录一、Spring和Springboot的区别及其注意事项什么?二、忽略文件技巧,这样就可以减少很多不必要的文件生成三、SpringBootParent讲解四、stater的介绍五、引导类的介绍六、Springboot内置tomcat(辅助功能必看)可以更改服务提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录系列文章目录 前言 一、pandas是什么? 二、使用步骤 1.引入库 2.读入数据 总结前..

    2022年9月22日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号