From 67ca399a30cec05acacd7ea33d5cb0e361f92755 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 26 Jan 2010 21:49:04 +0100 Subject: 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. --- src/lib_jit.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/lib_jit.c') 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) if (T && sn < T->nsnap) { SnapShot *snap = &T->snap[sn]; SnapEntry *map = &T->snapmap[snap->mapofs]; - BCReg s, nslots = snap->nslots; + MSize n, nent = snap->nent; + BCReg nslots = snap->nslots; GCtab *t; lua_createtable(L, nslots ? (int)nslots : 1, 0); t = tabV(L->top-1); setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS); - for (s = 0; s < nslots; s++) { - TValue *o = lj_tab_setint(L, t, (int32_t)(s+1)); - IRRef ref = snap_ref(map[s]); - if (ref) - setintV(o, (int32_t)ref - REF_BIAS); - else + /* NYI: get rid of this and expose the compressed slot map. */ + { + BCReg s; + for (s = 0; s < nslots; s++) { + TValue *o = lj_tab_setint(L, t, (int32_t)(s+1)); setboolV(o, 0); + } + } + for (n = 0; n < nent; n++) { + BCReg s = snap_slot(map[n]); + IRRef ref = snap_ref(map[n]); + TValue *o = lj_tab_setint(L, t, (int32_t)(s+1)); + setintV(o, (int32_t)ref - REF_BIAS); } return 1; } -- cgit v1.2.3-55-g6feb