Here is a patch that will enable a module to change the stack_base_ptr temporarilly during a call. A background discussion can be found here:
http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg64586.html
Regards,Thomas Hallgren