summaryrefslogtreecommitdiff
path: root/meta/template/jit.util.lua
blob: cf525527a9223279f7ccc2437034dd94ded6622c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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