From gmmajia at gmail.com Fri Feb 25 00:47:04 2011 From: gmmajia at gmail.com (majia gm) Date: Fri, 25 Feb 2011 16:47:04 +0800 Subject: Dose zero need gcc unwind support? Message-ID: 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. From gbenson at redhat.com Fri Feb 25 02:05:04 2011 From: gbenson at redhat.com (Gary Benson) Date: Fri, 25 Feb 2011 10:05:04 +0000 Subject: Dose zero need gcc unwind support? In-Reply-To: References: Message-ID: <20110225100503.GA3392@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/ From gmmajia at gmail.com Fri Feb 25 19:10:05 2011 From: gmmajia at gmail.com (majia gm) Date: Sat, 26 Feb 2011 11:10:05 +0800 Subject: Dose zero need gcc unwind support? In-Reply-To: <20110225100503.GA3392@redhat.com> References: <20110225100503.GA3392@redhat.com> Message-ID: 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 : > 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/ > From gbenson at redhat.com Mon Feb 28 01:51:50 2011 From: gbenson at redhat.com (Gary Benson) Date: Mon, 28 Feb 2011 09:51:50 +0000 Subject: Dose zero need gcc unwind support? In-Reply-To: References: <20110225100503.GA3392@redhat.com> Message-ID: <20110228095150.GB3356@redhat.com> 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 : > > 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/