From: Jon Olson <olson@mmsi.com>
To: "Jochen Hoenicke" <Jochen.Hoenicke@Informatik.Uni-Oldenburg.DE>,
Per Bothner <per@bothner.com>
Cc: java-discuss@sourceware.cygnus.com, classpath@gnu.org
Subject: Re: Proposal for CNI/JNI problems
Date: Sat, 01 Apr 2000 00:00:00 -0000 [thread overview]
Message-ID: <00011208053500.10598@toontown.mmsi.com> (raw)
In-Reply-To: <14460.37463.273837.406646@celan.Informatik.Uni-Oldenburg.DE>
On Wed, 12 Jan 2000, Jochen Hoenicke wrote:
>Another point is how to put pointers to native structures into a
>classfile. Sun didn't solve it well. If I understand the code in
>japhar's java/util/zip correctly sun used an int field to store the
>pointer and later changed it to long to support 64bit architectures.
>libgcj declares natives fields as "gnu.gcj.RawData", but this is not
>portable to other jvms, where the garbage collector doesn't know that
>this class is special. My solution was to put the structure into a
>java byte array, which imposes a little overhead, but should be
>portable (and you get it freed automatically).
>
> Jochen
Interesting idea, putting the native peer class into a byte array.
Seems like kind of a hack, but I guess it solves the problem.
Sun's solution of using a long to store a pointer is a real kludge.
My solution was to store an `int' as the peer and to make any
Java class which require a native peer a subclass of this Peer
class:
public class Peer
{
protected int _peer;
public Peer(int peer) { _peer = peer; }
public native void destroy();
protected void finalize() {
destroy();
}
}
Native code stores peer objects in a C++ Vector and manages
recovering space when finalized in destroy().
--
Jon Olson, Modular Mining Systems
3289 E. Hemisphere Loop
Tucson, AZ 85706
INTERNET: olson@mmsi.com
PHONE: (520)746-9127
FAX: (520)889-5790
next prev parent reply other threads:[~2000-04-01 0:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-01 0:00 Paul Fisher
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Paul Fisher
2000-04-01 0:00 ` Aaron M. Renn
2000-04-01 0:00 ` Stuart Ballard
2000-04-01 0:00 ` Chris Blizzard
2000-04-01 0:00 ` Chris Blizzard
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Bernd Kreimeier
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Bernd Kreimeier
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Bernd Kreimeier
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Bernd Kreimeier
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Alexandre Oliva
2000-04-01 0:00 ` Bernd Kreimeier
2000-04-01 0:00 ` Jochen Hoenicke
2000-04-01 0:00 ` Stuart Ballard
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 ` Jon Olson [this message]
2000-04-01 0:00 David Pettersson
2000-04-01 0:00 ` Per Bothner
2000-04-01 0:00 Lam.Mark
2000-04-01 0:00 ` Aaron M. Renn
2000-04-01 0:00 ` Brian Jones
2000-04-01 0:00 Boehm, Hans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00011208053500.10598@toontown.mmsi.com \
--to=olson@mmsi.com \
--cc=Jochen.Hoenicke@Informatik.Uni-Oldenburg.DE \
--cc=classpath@gnu.org \
--cc=java-discuss@sourceware.cygnus.com \
--cc=per@bothner.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).