[Java Spec Report] Re: Infinite loop created by javac

"danhicksbyron" <[email protected]> Fri, 30 Jul 2004 15:18:11 -0000
Newsgroups gmane.comp.java.spec-report
Message-ID <[email protected]>
--- In [email protected], "Neal Gafter"
<Neal.Gafter@g...> wrote:
> --- In [email protected], "danhicksbyron" <danhicks@m...>
> > The above bit of code is a disassembly 
> > of the "finally" clause of a 
> > synchronized block, as compiled by javac 1.4.1.  If any 
> > exception 
> > occurs out of the monitorexit, control will be returned to 
> > 221 and the 
> > exception condition will loop infinitely.
> > 
> > What is the logic(?) behind this scheme?
> 
> This is the only correct way to generate code for the synchronized
> statement.  The generated code must preserve the invariant that
> control does not leave the synchronized block until the monitor has
> been released.  If this looping is happening to you then your VM is
> probably broken.

But the JVM spec requires that the monitorexit throw exceptions in two
cases where nothing can ever be unlocked -- null pointer and no lock
held on the object.  Never mind how the situation got broken (possibly
by a JNI routine or non-javac code), this construct is essentially
guaranteeing an infinite loop.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this mailing list, send an email to:
[email protected]
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/java-spec-report/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/