Change out_of_memory test to use custom allocation handler instead of
rlimit as RLIMIT_AS doesn't seem to work on Mac OS X (Darwin) and
hence the test goes into an infinite loop. (Seems unlikely to work on
Windows either.)
Move save_stack/restore_stack up from CodeGen_Posix to CodeGen.
Add save_stack/restore_stack bracket aroudn closure allocation in
do_par_for call code generation to prevent overrunning stack space
with parallel loops with large counts.