From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12969 invoked by alias); 24 Feb 2011 02:34:27 -0000 Received: (qmail 12780 invoked by uid 22791); 24 Feb 2011 02:34:26 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_GC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail3.caviumnetworks.com (HELO mail3.caviumnetworks.com) (12.108.191.235) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Feb 2011 02:34:21 +0000 Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,7,2,8378) id ; Wed, 23 Feb 2011 18:35:12 -0800 Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 23 Feb 2011 18:34:19 -0800 Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 23 Feb 2011 18:34:19 -0800 Message-ID: <4D65C3AB.4090005@caviumnetworks.com> Date: Thu, 24 Feb 2011 02:34:00 -0000 From: David Daney User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 MIME-Version: 1.0 To: majia gm CC: Java List , gcc-help@gcc.gnu.org Subject: Re: Must unwind in gcc be ported for gcj? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00005.txt.bz2 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