This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BC] Patch: FYI: Remove StringClass


I'm checking this in on the BC branch.

The old StringClass define now dies.  I think this is the last remnant
of the old days when you couldn't refer to the `class$' field from
C++.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* include/jvm.h (StringClass): Removed.
	* jni.cc (_Jv_JNI_ThrowNew): Don't use StringClass.
	* interpret.cc (_Jv_InitField): Don't use StringClass.
	* java/lang/natString.cc (_Jv_StringFindSlot): Don't use
	StringClass.
	(rehash): Likewise
	(intern): Likewise.
	(_Jv_FinalizeString): Likewise.
	(_Jv_NewStringUtf8Const): Likewise.
	(equals): Likewise.
	* prims.cc (JvConvertArgv): Don't use StringClass.

Index: interpret.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/interpret.cc,v
retrieving revision 1.40.18.2
diff -u -r1.40.18.2 interpret.cc
--- interpret.cc 14 Sep 2004 21:12:51 -0000 1.40.18.2
+++ interpret.cc 14 Sep 2004 23:15:26 -0000
@@ -3307,7 +3307,7 @@
       /* fall through */
 
     case JV_CONSTANT_ResolvedString:
-      if (! (field->type == &StringClass
+      if (! (field->type == &java::lang::String::class$
  	     || field->type == &java::lang::Class::class$))
 	throw_class_format_error ("string initialiser to non-string field");
 
Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.81.6.2
diff -u -r1.81.6.2 jni.cc
--- jni.cc 14 Sep 2004 21:12:51 -0000 1.81.6.2
+++ jni.cc 14 Sep 2004 23:15:27 -0000
@@ -560,11 +560,12 @@
 					       NULL);
 
       jclass *elts = elements (argtypes);
-      elts[0] = &StringClass;
+      elts[0] = &java::lang::String::class$;
 
       Constructor *cons = clazz->getConstructor (argtypes);
 
-      jobjectArray values = JvNewObjectArray (1, &StringClass, NULL);
+      jobjectArray values = JvNewObjectArray (1, &java::lang::String::class$,
+					      NULL);
       jobject *velts = elements (values);
       velts[0] = JvNewStringUTF (message);
 
Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.87.10.5
diff -u -r1.87.10.5 prims.cc
--- prims.cc 14 Sep 2004 21:12:52 -0000 1.87.10.5
+++ prims.cc 14 Sep 2004 23:15:28 -0000
@@ -759,7 +759,7 @@
 {
   if (argc < 0)
     argc = 0;
-  jobjectArray ar = JvNewObjectArray(argc, &StringClass, NULL);
+  jobjectArray ar = JvNewObjectArray(argc, &java::lang::String::class$, NULL);
   jobject *ptr = elements(ar);
   jbyteArray bytes = NULL;
   for (int i = 0;  i < argc;  i++)
Index: include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.63.6.5
diff -u -r1.63.6.5 jvm.h
--- include/jvm.h 14 Sep 2004 21:12:53 -0000 1.63.6.5
+++ include/jvm.h 14 Sep 2004 23:15:29 -0000
@@ -225,9 +225,6 @@
   char utfstr##_buf[utfstr##_len <= 256 ? utfstr##_len : 0]; \
   _Jv_TempUTFString utfstr(utfstr##thejstr, sizeof(utfstr##_buf)==0 ? 0 : utfstr##_buf)
 
-// FIXME: remove this define.
-#define StringClass java::lang::String::class$
-
 namespace gcj
 {
   /* Some constants used during lookup of special class methods.  */
Index: java/lang/natString.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natString.cc,v
retrieving revision 1.33.18.1
diff -u -r1.33.18.1 natString.cc
--- java/lang/natString.cc 20 Apr 2004 21:59:40 -0000 1.33.18.1
+++ java/lang/natString.cc 14 Sep 2004 23:15:29 -0000
@@ -1,6 +1,6 @@
 // natString.cc - Implementation of java.lang.String native methods.
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -56,7 +56,7 @@
 jstring*
 _Jv_StringFindSlot (jchar* data, jint len, jint hash)
 {
-  JvSynchronize sync (&StringClass);
+  JvSynchronize sync (&java::lang::String::class$);
 
   int start_index = hash & (strhash_size - 1);
   int deleted_index = -1;
@@ -119,7 +119,7 @@
 void
 java::lang::String::rehash()
 {
-  JvSynchronize sync (&StringClass);
+  JvSynchronize sync (&java::lang::String::class$);
 
   if (strhash == NULL)
     {
@@ -166,7 +166,7 @@
 jstring
 java::lang::String::intern()
 {
-  JvSynchronize sync (&StringClass);
+  JvSynchronize sync (&java::lang::String::class$);
   if (3 * strhash_count >= 2 * strhash_size)
     rehash();
   jstring* ptr = _Jv_StringGetSlot(this);
@@ -193,7 +193,7 @@
 void
 _Jv_FinalizeString (jobject obj)
 {
-  JvSynchronize sync (&StringClass);
+  JvSynchronize sync (&java::lang::String::class$);
 
   // We might not actually have intern()d any strings at all, if
   // we're being called from Reference.
@@ -285,7 +285,7 @@
     }
   chrs -= length;
 
-  JvSynchronize sync (&StringClass);
+  JvSynchronize sync (&java::lang::String::class$);
   if (3 * strhash_count >= 2 * strhash_size)
     java::lang::String::rehash();
   jstring* ptr = _Jv_StringFindSlot (chrs, length, hash);
@@ -526,7 +526,7 @@
     return false;
   if (anObject == this)
     return true;
-  if (anObject->getClass() != &StringClass)
+  if (anObject->getClass() != &java::lang::String::class$)
     return false;
   jstring other = (jstring) anObject;
   if (count != other->count)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]