You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by 史成荣 <ic...@gmail.com> on 2007/08/06 09:22:33 UTC

[drlvm][jitrino]-about exception handling

The exception handling infrastructure in some JVM is designed to track
objects as they are locked and unlocked. It automatically unlock any locked
objects when the exception occurs before any exception handler is executed
or before the frame is deleted if there is no
handler for the exception in the frame's method. Does the Harmony DRLVM hava
this mechanism?

Re: [drlvm][jitrino]-about exception handling

Posted by Xiao-Feng Li <xi...@gmail.com>.
On 8/6/07, 史成荣 <ic...@gmail.com> wrote:
> But it is said in Mark Stoodley's paper: Automatically Reducing Repetitive
> Synchronization with a Just-in-Time Compiler for Java(cgo'05) that "The
> exception handling infrastructure in IBM's JVM is already designed to track
> objects as they are locked and unlocked. It automatically unlock any locked
> objects when the exception occurs before any exception handler is executed
> or before the frame is deleted if there is no handler for the exception in
> the frame's method. This mechanism is orthogonal to synchronization
> elimination.
> In a JVM without such a mechanism, new catch blocks must be created to
> explicitly unlock the object if an exception occurs."

Chengrong, no matter the releasing op is conducted by JVM
automatically or in an explicitly created catch block, the idea is the
same: to release the lock. It's only implementation difference.

> And I had a look at chaprer 8 and 7.12 of JVM spec, didn't find any
> description about the releasing of the lock(s) when  the exception is
> thrown.

I am sure there is some description on it. Please check exception chapter.

Thanks,
xiaofeng

> Thanks,
> Chengrong
>


-- 
http://xiao-feng.blogspot.com

Re: [drlvm][jitrino]-about exception handling

Posted by 史成荣 <ic...@gmail.com>.
Thanks for all your helps, I got it. Thanks!

Re: [drlvm][jitrino]-about exception handling

Posted by Nathan Beyer <nb...@gmail.com>.
Locks must be released if code exits a synchronized region and an
exception being thrown is just one means of exiting a synchronized
region. If locks weren't released when an exception is thrown, this
would introduce the possibility (inevitability) for dead-lock in
correctly written code.

-Nathan

On 8/6/07, 史成荣 <ic...@gmail.com> wrote:
> But it is said in Mark Stoodley's paper: Automatically Reducing Repetitive
> Synchronization with a Just-in-Time Compiler for Java(cgo'05) that "The
> exception handling infrastructure in IBM's JVM is already designed to track
> objects as they are locked and unlocked. It automatically unlock any locked
> objects when the exception occurs before any exception handler is executed
> or before the frame is deleted if there is no handler for the exception in
> the frame's method. This mechanism is orthogonal to synchronization
> elimination.
> In a JVM without such a mechanism, new catch blocks must be created to
> explicitly unlock the object if an exception occurs."
> And I had a look at chaprer 8 and 7.12 of JVM spec, didn't find any
> description about the releasing of the lock(s) when  the exception is
> thrown.
>
> Thanks,
> Chengrong
>

Re: [drlvm][jitrino]-about exception handling

Posted by 史成荣 <ic...@gmail.com>.
But it is said in Mark Stoodley's paper: Automatically Reducing Repetitive
Synchronization with a Just-in-Time Compiler for Java(cgo'05) that "The
exception handling infrastructure in IBM's JVM is already designed to track
objects as they are locked and unlocked. It automatically unlock any locked
objects when the exception occurs before any exception handler is executed
or before the frame is deleted if there is no handler for the exception in
the frame's method. This mechanism is orthogonal to synchronization
elimination.
In a JVM without such a mechanism, new catch blocks must be created to
explicitly unlock the object if an exception occurs."
And I had a look at chaprer 8 and 7.12 of JVM spec, didn't find any
description about the releasing of the lock(s) when  the exception is
thrown.

Thanks,
Chengrong

Re: [drlvm][jitrino]-about exception handling

Posted by Xiao-Feng Li <xi...@gmail.com>.
On 8/6/07, 史成荣 <ic...@gmail.com> wrote:
> The exception handling infrastructure in some JVM is designed to track
> objects as they are locked and unlocked. It automatically unlock any locked
> objects when the exception occurs before any exception handler is executed
> or before the frame is deleted if there is no
> handler for the exception in the frame's method. Does the Harmony DRLVM hava
> this mechanism?
>

Chengrong, I guess this is required by JVM spec to release the lock(s)
when the exception is thrown out of the (nested) locked region.
Otherwise, they will have unpaired monitorexits.

Thanks,
xiaofeng
-- 
http://xiao-feng.blogspot.com

Re: [drlvm][jitrino]-about exception handling

Posted by Pavel Afremov <pa...@gmail.com>.
Hello.

Yes, Evgueni is right.



DRLVM now hasn't mechanism to free any locks, but it has mechanism for
object unlocking for synchronized methods.

So DRLVM can safety exit from static and non static synchronized methods.



BR

Pavel Afremov


On 8/6/07, Evgueni Brevnov <ev...@gmail.com> wrote:
>
> On 8/6/07, 史成荣 <ic...@gmail.com> wrote:
> > The exception handling infrastructure in some JVM is designed to track
> > objects as they are locked and unlocked. It automatically unlock any
> locked
> > objects when the exception occurs before any exception handler is
> executed
> > or before the frame is deleted if there is no
> > handler for the exception in the frame's method. Does the Harmony DRLVM
> hava
> > this mechanism?
> >
>
> Hi,
>
> Straight answer is no, DRLVM doesn't have special mechanism for object
> unlocking and relies on compiler to produce appropriate finally block.
>
> Evgueni
>

Re: [drlvm][jitrino]-about exception handling

Posted by Evgueni Brevnov <ev...@gmail.com>.
On 8/6/07, 史成荣 <ic...@gmail.com> wrote:
> The exception handling infrastructure in some JVM is designed to track
> objects as they are locked and unlocked. It automatically unlock any locked
> objects when the exception occurs before any exception handler is executed
> or before the frame is deleted if there is no
> handler for the exception in the frame's method. Does the Harmony DRLVM hava
> this mechanism?
>

Hi,

Straight answer is no, DRLVM doesn't have special mechanism for object
unlocking and relies on compiler to produce appropriate finally block.

Evgueni