LuaSTG-x Core API
jit Class Reference

Classes

class  opt
 
class  util
 

Public Member Functions

static function flush ()
 
static function off ()
 
static function on ()
 
static function status ()
 jit.off disables JIT compilation for a Lua function and flushes any already compiled code from the code cache. More...
 

Public Attributes

string arch
 Contains the target architecture name: "x86", "x64", "arm", "ppc", "ppcspe", or "mips". More...
 
string os
 Contains the target OS name: "Windows", "Linux", "OSX", "BSD", "POSIX" or "Other". More...
 
string version
 Contains the LuaJIT version string. More...
 
number version_num
 Contains the version number of the LuaJIT core. Version xx.yy.zz is represented by the decimal number xxyyzz. More...
 

Detailed Description

The functions in this built-in module control the behavior of the JIT compiler engine. Note that JIT-compilation is fully automatic — you probably won't need to use any of the following functions unless you have special needs.

Member Function Documentation

◆ flush()

static function flush ( )

Flushes the whole cache of compiled code.

◆ off()

static function off ( )

Turns the whole JIT compiler off.

◆ on()

static function on ( )

Turns the whole JIT compiler on (default).

◆ status()

static function status ( )

jit.off disables JIT compilation for a Lua function and flushes any already compiled code from the code cache.

jit.on(func|true [,true|false])

jit.off(func|true [,true|false])

jit.flush(func|true [,true|false])

jit.on enables JIT compilation for a Lua function (this is the default). jit.flush flushes the code, but doesn't affect the enable/disable status. The current function, i.e. the Lua function calling this library function, can also be specified by passing true as the first argument. If the second argument is true, JIT compilation is also enabled, disabled or flushed recursively for all sub-functions of a function. With false only the sub-functions are affected. The jit.on and jit.off functions only set a flag which is checked when the function is about to be compiled. They do not trigger immediate compilation. Typical usage is jit.off(true, true) in the main chunk of a module to turn off JIT compilation for the whole module for debugging purposes. jit.flush(tr)

Flushes the root trace, specified by its number, and all of its side traces from the cache. The code for the trace will be retained as long as there are any other traces which link to it. status, ... = jit.status()

Returns the current status of the JIT compiler. The first result is either true or false if the JIT compiler is turned on or off. The remaining results are strings for CPU-specific features and enabled optimizations.

Member Data Documentation

◆ arch

string arch

Contains the target architecture name: "x86", "x64", "arm", "ppc", "ppcspe", or "mips".

◆ os

Contains the target OS name: "Windows", "Linux", "OSX", "BSD", "POSIX" or "Other".

◆ version

string version

Contains the LuaJIT version string.

◆ version_num

number version_num

Contains the version number of the LuaJIT core. Version xx.yy.zz is represented by the decimal number xxyyzz.


The documentation for this class was generated from the following file: