Fix crash in generating cast function with a null NativeArray
Cherry-pick gencommon.ml fix for better anonymous function naming
Increased max stack size for macros