Login
User name:
Password:
Remember me 
Powered by BlogHarbor
Powered by BlogHarbor
Re: Re: Tail recursive functions
by Michael Kay
Further thoughts on tail calls to a different function. It's easy enough to reuse the XPathContext object and the stackframe that it contains when calling a different function. But these objects are on the Java heap, which is rarely a cause of problems. It's not so easy to do a tail call to a different function without consuming Java stack space. Saxon was doing this by returning to the original caller of the first function with a request to call the second one, and this is where the design became fragile. However, I think I can reduce the amount of Java stack space used by such calls (as well as reducing heap space) by returning all the way down to the outermost level of the function before doing the tail call. This is probably still worthwhile.
Post comment:
  Receive comment notifications for this article
Subject: 
Comment: 
Comment verification:

Please enter the text you see inside the graphic to post your comment:
This blog does not allow anonymous comments. Please provide your username and password along with your comment.
Login information:
Username: 
Password: 
If you would like to post contact information on your comment, please enter your information into the optional fields below:
Contact information:
URL:  example: http://yourdomain.com