MCPcopy Create free account
hub / github.com/Tencent/xLua / mark_function

Function mark_function

WebGLPlugins/perflib.c:159–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159static void mark_function(lua_State *L, lua_State *dL) {
160 const void *p = lua_topointer(L, -1);
161 int i;
162 lua_Debug ar;
163 char used_in[128];
164 const char *name;
165
166
167 if (!is_marked(dL, p)) {
168 marked(dL, p, 0); //已经在table里头算了
169
170 lua_pushvalue(L, -1);
171 lua_getinfo(L, ">S", &ar);
172 snprintf(used_in, sizeof(used_in) - 1, "%s:%d~%d", ar.short_src, ar.linedefined, ar.lastlinedefined);
173 used_in[sizeof(used_in) - 1] = 0;
174
175 for (i=1;;i++) {
176 name = lua_getupvalue(L,-1,i);
177 if (name == NULL)
178 break;
179 p = lua_topointer(L, -1);
180
181 if (*name != '\0' && LUA_TTABLE == lua_type(L, -1)) {
182 make_root(dL, p, name, RT_UPVALUE, used_in, 1);
183 lua_insert(dL, MARKED_TABLE);
184 mark_object(L, dL);
185 lua_remove(dL, MARKED_TABLE);
186 } else if (LUA_TFUNCTION == lua_type(L, -1)) {
187 mark_function(L, dL);
188 }
189 lua_pop(L, 1);
190 }
191 }
192}
193
194static void mark_object(lua_State *L, lua_State *dL) {
195 switch (lua_type(L, -1)) {

Callers 1

mark_objectFunction · 0.85

Calls 11

lua_topointerFunction · 0.85
is_markedFunction · 0.85
markedFunction · 0.85
lua_pushvalueFunction · 0.85
lua_getinfoFunction · 0.85
lua_getupvalueFunction · 0.85
lua_typeFunction · 0.85
make_rootFunction · 0.85
lua_insertFunction · 0.85
mark_objectFunction · 0.85
lua_removeFunction · 0.85

Tested by

no test coverage detected