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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • jetbrains系列软件汉化图文教程

    idea 激活码,jetbrains系列软件汉化图文教程

    2022年3月13日
    61
  • js面试题及答案2020_JS面试题大全

    js面试题及答案2020_JS面试题大全关于javascript的面试题面试必备

    2022年8月28日
    6
  • 【NOIP2011提高组】选择客栈

    【NOIP2011提高组】选择客栈题目背景NOIP2011提高组 DAY1 试题。题目描述丽江河边有 n 家很有特色的客栈,客栈按照其位置顺序从 1 到 n 编号。每家客栈都按照某一种色调进行装饰(总共 k 种,用整数 0 ~ k-1 表示),且每家客栈都设有一家咖啡店,每家咖啡店均有各自的最低消费。两位游客一起去丽江旅游,他们喜欢相同的色调,又想尝试两个不同的客栈,因此决定分别住在色调相同的两家客栈中。晚上,他们…

    2022年9月2日
    2
  • 单模光纤的传输距离比多模光纤的传输距离_单模多模单模光纤传感器

    单模光纤的传输距离比多模光纤的传输距离_单模多模单模光纤传感器1.1000Base-SX及1000Base-LX是什么意思?短波长光传输1000Base-SX、长波长光传输1000Base-LX多模光纤可以分为长波激光(称为1000BaseLX)和短波激光(称为1000BaseSX)。2.千兆位以太网标准问题:请问多模和单模光纤的极限传输距离是多少?标准光纤类型光纤直径(μm)最大传输距离1000base-sx多模62.5260m1000base-sx…

    2022年8月30日
    0
  • APP测试基本流程以及APP测试要点梳理,保证您看了不后悔!

    APP测试基本流程以及APP测试要点梳理,保证您看了不后悔!前言:相信很多刚刚步入测试行业的小伙伴对于APP测试不是很熟悉,这次我为大家提供一篇宝藏文章,希望大家喜欢,谢谢!一、APP测试基本流程1、流程图2、测试周期测试周期可按项目的开发周期来确定测试时间,一般测试时间为两三周(即15个工作日),根据项目情况以及版本质量可适当缩短或延长测试时间。3、测试资源测试任务开始前,检查各项测试资源。–产品功能需求文档;–产品原型图;–产品效果图;–测试设备;–其他。4、日报及产品上线报告(内部报告机制)–测试人员每天需对所测项目发送测试日报。(

    2022年5月5日
    109
  • java8 HashMap数据结构实现源码解析

    目录一、基础元素Node二、红黑树元素TreeNode1、类定义和类属性2、基础方法:3、红黑树插入元素实现4、红黑树的查找实现5、红黑树的形态转换实现6、红黑树的扩容切分实现一、基础元素NodestaticclassNode<K,V>implementsMap.Entry<K,V>{//key的ha…

    2022年4月8日
    41

发表回复

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

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