diff options
author | fesily <fesil@foxmail.com> | 2023-05-22 15:47:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-22 15:47:09 +0800 |
commit | 717d143f6bd6cea14f4cd2e4d244432115563d09 (patch) | |
tree | 47e3fc0096054cbff2d0f4501f1a555cff2c5bda /meta | |
parent | 3d837666e6a0e01a5c1f207d56ba81fd99bdcd52 (diff) | |
parent | 86916250304abc76b4b54486851f33ac12e64caf (diff) | |
download | lua-language-server-717d143f6bd6cea14f4cd2e4d244432115563d09.zip |
Merge branch 'master' into meta-support-metable
Diffstat (limited to 'meta')
-rw-r--r-- | meta/template/jit.lua | 22 | ||||
-rw-r--r-- | meta/template/jit.profile.lua | 20 | ||||
-rw-r--r-- | meta/template/jit.util.lua | 120 |
3 files changed, 156 insertions, 6 deletions
diff --git a/meta/template/jit.lua b/meta/template/jit.lua index dae996b5..b047ba4e 100644 --- a/meta/template/jit.lua +++ b/meta/template/jit.lua @@ -5,29 +5,39 @@ ---@class jitlib ---@field version string ---@field version_num number ----@field os string ----@field arch string +---@field os 'Windows'|'Linux'|'OSX'|'BSD'|'POSIX'|'Other' +---@field arch 'x86'|'x64'|'arm'|'arm64'|'arm64be'|'ppc'|'ppc64'|'ppc64le'|'mips'|'mipsel'|'mips64'|'mips64el'|string jit = {} ---@overload fun(...):... ---@param func function|boolean ---@param recursive? boolean -function jit.on(func, recursive) end +function jit.on(func, recursive) +end ---@overload fun(...):... ---@param func function|boolean ---@param recursive? boolean -function jit.off(func, recursive) end +function jit.off(func, recursive) +end ---@overload fun(...):... ---@overload fun(tr: number) ---@param func function|boolean ---@param recursive? boolean -function jit.flush(func, recursive) end +function jit.flush(func, recursive) +end ---@return boolean status ---@return string ... ---@nodiscard -function jit.status() end +function jit.status() +end + +jit.opt = {} + +---@param ... any flags +function jit.opt.start(...) +end return jit diff --git a/meta/template/jit.profile.lua b/meta/template/jit.profile.lua new file mode 100644 index 00000000..d0e788ce --- /dev/null +++ b/meta/template/jit.profile.lua @@ -0,0 +1,20 @@ +---#if not JIT then DISABLE() end +---@meta jit.profile + +local profile = {} + +---@param mode string +---@param func fun(L:thread,samples:integer,vmst:string) +function profile.start(mode, func) +end + +function profile.stop() +end + +---@overload fun(th:thread,fmt:string,depth:integer) +---@param fmt string +---@param depth integer +function profile.dumpstack(fmt, depth) +end + +return profile
\ No newline at end of file diff --git a/meta/template/jit.util.lua b/meta/template/jit.util.lua new file mode 100644 index 00000000..08694286 --- /dev/null +++ b/meta/template/jit.util.lua @@ -0,0 +1,120 @@ +---#if not JIT then DISABLE() end +---@meta jit.util + +---@class Trace +---@class Proto + +local util = {} + +---@class jit.funcinfo.lua +local funcinfo = { + linedefined = 0, + lastlinedefined = 0, + stackslots = 0, + params = 0, + bytecodes = 0, + gcconsts = 0, + nconsts = 0, + upvalues = 0, + currentline = 0, + isvararg = false, + children = false, + source = "", + loc = "", + ---@type Proto[] + proto = {} +} + +---@class jit.funcinfo.c +---@field ffid integer|nil +local funcinfo2 = { + addr = 0, + upvalues = 0, +} + + +---@param func function +---@param pc? integer +---@return jit.funcinfo.c|jit.funcinfo.lua info +function util.funcinfo(func, pc) +end + +---@param func function +---@param pc integer +---@return integer? ins +---@return integer? m +function util.funcbc(func, pc) +end + +---@param func function +---@param idx integer +---@return any? k +function util.funck(func, idx) +end + +---@param func function +---@param idx integer +---@return string? name +function util.funcuvname(func, idx) +end + +---@class jit.traceinfo +local traceinfo = { + nins = 0, + nk = 0, + link = 0, + nexit = 0, + linktype = "" +} + +---@param tr Trace +---@return jit.traceinfo? info +function util.traceinfo(tr) +end + +---@param tr Trace +---@param ref integer +---@return integer? m +---@return integer? ot +---@return integer? op1 +---@return integer? op2 +---@return integer? prev +function util.traceir(tr, ref) +end + +---@param tr Trace +---@param idx integer +---@return any? k +---@return integer? t +---@return integer? slot +function util.tracek(tr, idx) +end + +---@class jit.snap : integer[] + +---@param tr Trace +---@param sn integer +---@return jit.snap? snap +function util.tracesnap(tr, sn) +end + +---@param tr Trace +---@return string? mcode +---@return integer? addr +---@return integer? loop +function util.tracemc(tr) +end + +---@overload fun(exitno:integer):integer +---@param tr Trace +---@param exitno integer +---@return integer? addr +function util.traceexitstub(tr, exitno) +end + +---@param idx integer +---@return integer? addr +function util.ircalladdr(idx) +end + +return util |