Re: Java Compilers and Tail Recursion

"Shri Borde" <>
3 Jan 1998 16:30:36 -0500

          From comp.compilers

Related articles
Java Compilers and Tail Recursion (Jason Karney) (1997-12-23)
Re: Java Compilers and Tail Recursion (Mark Tillotson) (1997-12-29)
Re: Java Compilers and Tail Recursion (Shri Borde) (1998-01-03)
Re: Java Compilers and Tail Recursion (David Chase) (1998-01-03)
| List of all articles for this month |

From: "Shri Borde" <>
Date: 3 Jan 1998 16:30:36 -0500
Organization: Microsoft Corp.
References: 97-12-163 97-12-168
Keywords: Java, optimize

If a tail-recursive method does not violate the security policy, there
is no reason why the optimized version will. So the compiler can
surely optimize it.

As to whether compilers actually do, I dont know. But I do know that
the Microsoft JIT compiler optimizes tail recursion.

Many of the Java compilers do not perform good optimizations. Its
mostly lazy programming. But also note that many optimizations are
best not done as it impedes the JIT compiler in generation of good
native code. But tail- recursion is not such a case, and should surely
be optimized.
Shri <>

Jason Karney <> asked:
>| Is the current crop of Java compilers smart enough to optimize tail
>| recursion? I am specifically wondering about Symantec and Sun's JDK
>| compilers.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.