From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8364 invoked by alias); 8 Jun 2011 18:31:28 -0000 Received: (qmail 8355 invoked by uid 22791); 8 Jun 2011 18:31:28 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Jun 2011 18:31:08 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p58IV8m0005425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 8 Jun 2011 14:31:08 -0400 Received: from zebedee.pink (ovpn-113-116.phx2.redhat.com [10.3.113.116]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p58IV68i013680; Wed, 8 Jun 2011 14:31:07 -0400 Message-ID: <4DEFBFEA.7090706@redhat.com> Date: Wed, 08 Jun 2011 18:31:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: java@gcc.gnu.org Subject: Re: Add a Field to java.lang.Object References: <4DEFAF45.8080709@student.ethz.ch> In-Reply-To: <4DEFAF45.8080709@student.ethz.ch> Content-Type: text/plain; charset=ISO-8859-1 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-06/txt/msg00013.txt.bz2 On 06/08/2011 06:20 PM, Noah Heusser wrote: > I'm trying to add an new extra field into java.lang.Object. I need that > to do some memory synchronization via Network. > > If I just insert the new Field in libjava/java/lang/Object.h (access > form the Java World is not needed) I get a segmentation fault whenever I > try to run a Java Software using that Object.h. (It does no matter > whether I add it to _JvObjectPrefix or java::lang::Object) > > If the JV_HASH_SYNCHRONIZATION Preprocessor Variable is not defined an > extra Filed sync_info gets inserted in Object.h. > But everywhere where extra Code is inserted depending on > JV_HASH_SYNCHRONIZATION it seems to deal with whether or not the Garbage > Collector needs to scan the Object. > > If I add the Field in libjava/java/lang/Object.java I get a compile > Error when I compile gcj: > ../../../../gcc-src/libjava/java/lang/Object.java:517:0: internal > compiler error: Segmentation fault > > What extra change is needed after adding a Filed to Object? Add it to libjava/java/langObject.h and gcc/java/class.c in make_class_data() after sync_info. It must be after the GC bitmap marking descriptor. Be aware that the offset from the start of the object is used in the marking descriptor. You're going to have to get used to the way that works. I think that's it, but you'll have to try it. Andrew.