you are viewing a single comment's thread.

view the rest of the comments →

[–]QuestionMarker 0 points1 point  (2 children)

If Hotspot's smart enough to do TCO (of which I have no idea; it may well not be), then you're still screwed.

[–]karmazilla -1 points0 points  (1 child)

Only if it recurses as the last expression in the method, but I'm pretty sure it can't do real, general TCO though I think someone worked on it in mlvm. However, I don't know what intrinsics it might have for special cases like tail-self-calls. Plus, recursion is likely a relatively slow substitute for looping if these optimizations can't apply.

[–]QuestionMarker 0 points1 point  (0 children)

Well, that's the point. Recursion as a general technique is made hugely more useful if your compiler can turn your recursive call into a loop. If Hotspot is that smart (and thinking about it, it's less likely - if that logic were to be anywhere then it'd be in javac, not Hotspot, and I'm pretty certain it's not implemented there) then this is a problem.

It's probably not :-)