Remove dynamic allocations from filter loop

 Restructure the main filter loop so that ffi pointer values are not live at
 control flow boundaries - that is, so they are confined to one trace.  This
 allows luajit to sink (optimize out) the dynamic allocations.