summaryrefslogtreecommitdiff
path: root/libjava/java/lang/ref/Reference.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-02 14:31:47 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-02 14:31:47 +0000
commitb1a749bacce901a0cad8abbbfc0addb482a8adfa (patch)
tree64d840b2a9f59c9bf181680bd6e70172a0dc5e86 /libjava/java/lang/ref/Reference.java
parentc32d045231e086867f117700fbe01dbbbce3ea14 (diff)
downloadgcc-b1a749bacce901a0cad8abbbfc0addb482a8adfa.tar.gz
* gcj/javaprims.h: Rebuilt class list.
* boehm.cc (_Jv_GCRegisterDisappearingLink): New function. (_Jv_GCCanReclaimSoftReference): New function. * include/jvm.h (_Jv_GCRegisterDisappearingLink): Declare. (_Jv_GCCanReclaimSoftReference): Declare. * java/lang/ref/Reference.java (referent): Now a RawData. (create): Renamed from `created'. Added object argument. (Reference): Don't initialize `referent' here. * Makefile.in: Rebuilt. * Makefile.am (nat_source_files): Added new file. * java/lang/ref/natReference.cc: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45958 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/ref/Reference.java')
-rw-r--r--libjava/java/lang/ref/Reference.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/libjava/java/lang/ref/Reference.java b/libjava/java/lang/ref/Reference.java
index 23490333b0d..5a6c66324b2 100644
--- a/libjava/java/lang/ref/Reference.java
+++ b/libjava/java/lang/ref/Reference.java
@@ -64,8 +64,21 @@ public abstract class Reference
/**
* The underlying object. This field is handled in a special way by
* the garbage collection.
+ * GCJ LOCAL:
+ * This is a RawData because it must be disguised from the GC.
+ * END GCJ LOCAL
*/
- Object referent;
+ gnu.gcj.RawData referent;
+
+ /**
+ * This is like REFERENT but is not scanned by the GC. We keep a
+ * copy around so that we can see when clear() has been called.
+ * GCJ LOCAL:
+ * This field doesn't exist in Classpath; we use it to detect
+ * clearing.
+ * END GCJ LOCAL
+ */
+ gnu.gcj.RawData copy;
/**
* The queue this reference is registered on. This is null, if this
@@ -97,7 +110,7 @@ public abstract class Reference
*/
Reference(Object ref)
{
- referent = ref;
+ create (ref);
}
/**
@@ -112,11 +125,16 @@ public abstract class Reference
{
if (q == null)
throw new NullPointerException();
- referent = ref;
queue = q;
+ create (ref);
}
/**
+ * Notifies the VM that a new Reference has been created.
+ */
+ private native void create (Object o);
+
+ /**
* Returns the object, this reference refers to.
* @return the object, this reference refers to, or null if the
* reference was cleared.
@@ -138,6 +156,7 @@ public abstract class Reference
public void clear()
{
referent = null;
+ copy = null;
}
/**