Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Avoid creating a stacktrace prior to JDK 1.7 Date: Sun, 02 Oct 2011 02:04:42 +0200 Organization: albasani.net Lines: 37 Message-ID: References: <4424828.699.1317485416810.JavaMail.geo-discussion-forums@prng5> <1058576.2212.1317496868028.JavaMail.geo-discussion-forums@prfh23> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net 2q7vOZS947wVLyTTfPyUSJuFbtx1RTLFRqfT91KjvnbrmiBbw7ukOau/ZUbspfyyuV5AvGTR1qcA2h7ZG+94dA== NNTP-Posting-Date: Sun, 2 Oct 2011 00:04:43 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="d5etEVJHKvamnFpPgqclPoLeyuLyF7MG2jUYI5GbOwgnlqmaoWGJ7T7aubE8Yz5mJzcwhfCpTp1N1Yl8/Gwirhm2QxirbDKkwg6HIXdxjeFtVMT82KpEmGlcp/7x6/vL"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1 In-Reply-To: Cancel-Lock: sha1:LeOdEvKC1s4VjuhdJd5l9tkQMxI= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8470 Stanimir Stamenkov schrieb: > quite wrong!). Virtual machines are allowed to do extensive > | optimizations when JITing and may entirely remove stack frames, > | making it impossible to reliably locate the calling class and > | method. > > So it seems stack trace information is not guaranteed to be available to > user code. This detail may be given somewhere in the language or VM > specifications. Yes, you usually don't get a stack overflow when you do tail recursion for example. So a method: void p(int a) { ... p(b); } Is the same as a loop: void p(int a) { for (;;) { ... a = b; } } The simplest obtimisation a JIT can do is replace the last call p(b) by a jump, so not pushing a new return address on the stack and reusing the already pushed return address. Etc... Etc... Bye