[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-zero-dev
Subject:    Dose zero need gcc unwind support?
From:       gbenson () redhat ! com (Gary Benson)
Date:       2011-02-28 9:51:50
Message-ID: 20110228095150.GB3356 () redhat ! com
[Download RAW message or body]

Hi,

OpenJDK handles Java exceptions itself.  Each thread in the VM has
a Thread object associated with it, which contains a field in which
thrown exceptions are stored.  Things that care about whether an
exception is in force simply check this slot and act accordingly.
There are macros to help with this.  You'll often see this in Zero:

  if (HAS_PENDING_EXCEPTION)
    return;

There are also two macros called CHECK and TRAPS to help with this.
Methods from which exceptions can be thrown are defined with TRAPS
as their last "argument":

  void CppInterpreter::main_loop(int recurse, TRAPS) {
    ...
  }

When you call these methods you supply CHECK as their last "argument":

  if (recurse) {
    main_loop(recurse - 1, CHECK);
  }

Cheers,
Gary

majia gm wrote:
> Hi, Gary.
> 
> Thank you for your reply. But what about the exception? Dose OpenJDK
> use C++ exception to implement Java exception? Or the Java exception
> is purely soft?
> 
> 2011/2/25 Gary Benson <gbenson at redhat.com>:
> > Hi,
> >
> > Zero doesn't use the operating system's stack at all. ?OpenJDK
> > creates a stack for each thread, but after that it's treated as
> > an opaque block of memory.
> >
> > Cheers,
> > Gary
> >
> > majia gm wrote:
> > > Hi, everyone.
> > >
> > > I'd like to use zero. The current gcc in our platform use
> > > setjmp/longjmp to implement c++ exception and has no support for
> > > one-by-one frame unwinding. And I want to know, whether zero need
> > > gcc unwind support or not?
> > >
> > > I know gcj need this to implement classloader inheritance. For
> > > example, Loader A load Class A, and Class A calls method in Class
> > > B. Then Class B need to be loaded by using the same class loader,
> > > Loader A.
> > >
> > > In order to know which class call the method in Class B, JVM in gcj
> > > need to unwind the stack to find out in which class the calling
> > > method is.
> > >
> > > Dose OpenJDK has the similar implementation on abi stack unwind?
> > >
> > > Thank you.
> >
> > --
> > http://gbenson.net/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic