summaryrefslogtreecommitdiff
path: root/src/lib_jit.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-01-26 21:49:04 +0100
committerMike Pall <mike>2010-01-26 21:49:04 +0100
commit67ca399a30cec05acacd7ea33d5cb0e361f92755 (patch)
tree335806ea53e2f98a71eb2395baa1d3d7bea352ae /src/lib_jit.c
parente058714a2e3745a819b77e6b50551e423897026a (diff)
downloadluajit-67ca399a30cec05acacd7ea33d5cb0e361f92755.tar.gz
luajit-67ca399a30cec05acacd7ea33d5cb0e361f92755.tar.bz2
luajit-67ca399a30cec05acacd7ea33d5cb0e361f92755.zip
Compress snapshots using a simple, extensible 1D-compression.
Typically reduces storage overhead for snapshot maps by 60%. The extensible format is a prerequisite for the next redesign steps: Eliminate IR_FRAME and implement return-to-lower-frame.
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r--src/lib_jit.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index aa421613..f3425d98 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -332,18 +332,25 @@ LJLIB_CF(jit_util_tracesnap)
332 if (T && sn < T->nsnap) { 332 if (T && sn < T->nsnap) {
333 SnapShot *snap = &T->snap[sn]; 333 SnapShot *snap = &T->snap[sn];
334 SnapEntry *map = &T->snapmap[snap->mapofs]; 334 SnapEntry *map = &T->snapmap[snap->mapofs];
335 BCReg s, nslots = snap->nslots; 335 MSize n, nent = snap->nent;
336 BCReg nslots = snap->nslots;
336 GCtab *t; 337 GCtab *t;
337 lua_createtable(L, nslots ? (int)nslots : 1, 0); 338 lua_createtable(L, nslots ? (int)nslots : 1, 0);
338 t = tabV(L->top-1); 339 t = tabV(L->top-1);
339 setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS); 340 setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS);
340 for (s = 0; s < nslots; s++) { 341 /* NYI: get rid of this and expose the compressed slot map. */
341 TValue *o = lj_tab_setint(L, t, (int32_t)(s+1)); 342 {
342 IRRef ref = snap_ref(map[s]); 343 BCReg s;
343 if (ref) 344 for (s = 0; s < nslots; s++) {
344 setintV(o, (int32_t)ref - REF_BIAS); 345 TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
345 else
346 setboolV(o, 0); 346 setboolV(o, 0);
347 }
348 }
349 for (n = 0; n < nent; n++) {
350 BCReg s = snap_slot(map[n]);
351 IRRef ref = snap_ref(map[n]);
352 TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
353 setintV(o, (int32_t)ref - REF_BIAS);
347 } 354 }
348 return 1; 355 return 1;
349 } 356 }