This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Must unwind in gcc be ported for gcj?


On 02/23/2011 05:19 PM, majia gm wrote:
Hi, everyone.

I'm porting gcj (gcc-4.4.2) to another platform. Right now the gij
fails when interpreting the following program.

File A.java:

import B;
public class A{

	public static void main(String args[])
	{
		try{
			B b=(B)Class.forName("B").newInstance();
		catch(Exception e)
		{
			System.out.println("Cannot find Class B");
		}
	}
}

File B.java:

public class B
{}

I use gdb to track gij, and I found GetCallingClass() in forName()
returns NULL, then the bootstrap loader is used to search the Class B
but with no result. Should the Class B has the same class loader, the
system class loader as the Class A dose?

Then I track the GetCallingClass(), and I found it needs the unwind
function provided by gcc.  Must I port the unwind function?


Short answer: Yes.


libgcj relies internally on exception handling.

You might be able to construct simple programs that don't throw exceptions, but they are kind of a core language feature.

As you saw, the runtime startup code does throw and catch exceptions.

David Daney


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]