optimized __lwt_dispatch function.