From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18184 invoked by alias); 18 Jul 2011 16:18:09 -0000 Received: (qmail 18167 invoked by uid 22791); 18 Jul 2011 16:18:08 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Jul 2011 16:17:53 +0000 Received: by qyk30 with SMTP id 30so1615477qyk.20 for ; Mon, 18 Jul 2011 09:17:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.78.135 with SMTP id l7mr5023666qck.90.1311005871893; Mon, 18 Jul 2011 09:17:51 -0700 (PDT) Received: by 10.229.10.170 with HTTP; Mon, 18 Jul 2011 09:17:51 -0700 (PDT) In-Reply-To: References: Date: Mon, 18 Jul 2011 16:18:00 -0000 Message-ID: Subject: Re: gnu.gcj.RawData vs. long From: Bryce McKinlay To: Craig Vanderborgh Cc: java@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-07/txt/msg00007.txt.bz2 On Mon, Jul 18, 2011 at 5:08 PM, Craig Vanderborgh wrote: > The problem is that gnu.gcj.RawData * is not portable. =A0The question > is: can I use "long" for the type instead without garbage collection > problems? =A0Can my native code store the pointer value in a Java "long" > in the CNI with impunity, or will Boehm GC think these pointers needs > to be considered for collection? Hi Craig. You must use gnu.gcj.RawData* if the reference being stored points to something allocated by the GC. The GC will not mark references held in non-pointer types. If it's something that was allocated outside the GC (ie, with malloc), it should be fine to use a long. Bryce