summaryrefslogtreecommitdiff
path: root/src/lj_func.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_func.c')
-rw-r--r--src/lj_func.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/lj_func.c b/src/lj_func.c
index 74aba745..adc8c039 100644
--- a/src/lj_func.c
+++ b/src/lj_func.c
@@ -17,46 +17,10 @@
17 17
18/* -- Prototypes ---------------------------------------------------------- */ 18/* -- Prototypes ---------------------------------------------------------- */
19 19
20GCproto *lj_func_newproto(lua_State *L)
21{
22 GCproto *pt = lj_mem_newobj(L, GCproto);
23 pt->gct = ~LJ_TPROTO;
24 pt->numparams = 0;
25 pt->framesize = 0;
26 pt->sizeuv = 0;
27 pt->flags = 0;
28 pt->trace = 0;
29 setmref(pt->k, NULL);
30 setmref(pt->bc, NULL);
31 setmref(pt->uv, NULL);
32 pt->sizebc = 0;
33 pt->sizekgc = 0;
34 pt->sizekn = 0;
35 pt->sizelineinfo = 0;
36 pt->sizevarinfo = 0;
37 pt->sizeuvname = 0;
38 pt->linedefined = 0;
39 pt->lastlinedefined = 0;
40 setmref(pt->lineinfo, NULL);
41 setmref(pt->varinfo, NULL);
42 setmref(pt->uvname, NULL);
43 setgcrefnull(pt->chunkname);
44 return pt;
45}
46
47void LJ_FASTCALL lj_func_freeproto(global_State *g, GCproto *pt) 20void LJ_FASTCALL lj_func_freeproto(global_State *g, GCproto *pt)
48{ 21{
49 MSize nkgc = round_nkgc(pt->sizekgc);
50 MSize sizek = nkgc*(MSize)sizeof(GCRef) +
51 pt->sizekn*(MSize)sizeof(lua_Number);
52 lj_mem_free(g, mref(pt->k, GCRef) - nkgc, sizek);
53 lj_mem_freevec(g, proto_bc(pt), pt->sizebc, BCIns);
54 lj_mem_freevec(g, proto_uv(pt), pt->sizeuv, uint16_t);
55 lj_mem_freevec(g, proto_lineinfo(pt), pt->sizelineinfo, BCLine);
56 lj_mem_freevec(g, proto_varinfo(pt), pt->sizevarinfo, VarInfo);
57 lj_mem_freevec(g, mref(pt->uvname, GCRef), pt->sizeuvname, GCRef);
58 lj_trace_freeproto(g, pt); 22 lj_trace_freeproto(g, pt);
59 lj_mem_freet(g, pt); 23 lj_mem_free(g, pt, pt->sizept);
60} 24}
61 25
62/* -- Upvalues ------------------------------------------------------------ */ 26/* -- Upvalues ------------------------------------------------------------ */