Commit 50b99cc8 by Tom Tromey Committed by Tom Tromey

natString.cc (unintern): Added `obj' argument.

	* java/lang/natString.cc (unintern): Added `obj' argument.
	(intern): Register finalizer for string.
	* java/lang/String.java (unintern): Now static; added obj
	argument.

From-SVN: r33124
parent 07385c49
2000-04-12 Tom Tromey <tromey@cygnus.com>
* java/lang/natString.cc (unintern): Added `obj' argument.
(intern): Register finalizer for string.
* java/lang/String.java (unintern): Now static; added obj
argument.
2000-04-11 Tom Tromey <tromey@cygnus.com>
* java/util/Vector.java (VectorEnumeration): Now `final'.
......
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
......@@ -302,6 +302,6 @@ public final class String
private native void init (byte[] chars, int hibyte, int offset, int count);
private native void init (byte[] chars, int offset, int count, String enc)
throws UnsupportedEncodingException;
private native void unintern ();
private static native void unintern (Object obj);
private static native void rehash ();
}
// natString.cc - Implementation of java.lang.String native methods.
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
......@@ -153,15 +153,18 @@ java::lang::String::intern()
SET_STRING_IS_INTERNED(this);
strhash_count++;
*ptr = this;
// When string is GC'd, clear the slot in the hash table.
_Jv_RegisterFinalizer ((void *) this, unintern);
return this;
}
/* Called by String fake finalizer. */
void
java::lang::String::unintern()
java::lang::String::unintern (jobject obj)
{
JvSynchronize sync (&StringClass);
jstring* ptr = _Jv_StringGetSlot(this);
jstring str = reinterpret_cast<jstring> (obj);
jstring* ptr = _Jv_StringGetSlot(str);
if (*ptr == NULL || *ptr == DELETED_STRING)
return;
*ptr = DELETED_STRING;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment