This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[BC] Patch: FYI: FIXME consolidation
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 12 Aug 2004 13:09:00 -0600
- Subject: [BC] Patch: FYI: FIXME consolidation
- Reply-to: tromey at redhat dot com
While I'm still digging through the new code, I decided to consolidate
most of the "is this class BC compiled?" FIXME comments into one
place. There's still one in Class.h (which btw is a big mess, yuck).
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/lang/Class.h (Class::_Jv_isBinaryCompatible): Declare as
friend.
* java/lang/natClassLoader.cc (_Jv_WaitForState): Use
_Jv_isBinaryCompatible.
* java/lang/natClass.cc (initializeClass): Use
_Jv_isBinaryCompatible.
(_Jv_LinkSymbolTable): Likewise.
* include/jvm.h (_Jv_isBinaryCompatible): New function.
Index: include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.63.6.1
diff -u -r1.63.6.1 jvm.h
--- include/jvm.h 16 Apr 2004 12:49:56 -0000 1.63.6.1
+++ include/jvm.h 12 Aug 2004 19:23:41 -0000
@@ -1,6 +1,6 @@
// jvm.h - Header file for private implementation information. -*- c++ -*-
-/* 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.
@@ -511,4 +511,14 @@
extern void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event);
#endif
+
+// This returns true if and only if the class in question was compiled
+// using the binary compatibility flag.
+inline bool
+_Jv_isBinaryCompatible (jclass k)
+{
+ // FIXME: ugly implementation.
+ return k->size_in_bytes == -1;
+}
+
#endif /* __JAVA_JVM_H__ */
Index: java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.63.12.4
diff -u -r1.63.12.4 Class.h
--- java/lang/Class.h 20 May 2004 23:34:03 -0000 1.63.12.4
+++ java/lang/Class.h 12 Aug 2004 19:23:41 -0000
@@ -1,6 +1,6 @@
// Class.h - Header file for java.lang.Class. -*- c++ -*-
-/* 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.
@@ -254,8 +254,9 @@
// FIXME: this probably shouldn't be public.
jint size (void)
{
- // FIXME size_in_bytes == -1 is an evil way to test for BC compiled programs
- if (size_in_bytes == (jint)-1)
+ // FIXME: ugly implementation.
+ // FIXME: can't use _Jv_isBinaryCompatible here.
+ if (size_in_bytes == -1)
{
int static_size;
_Jv_LayoutClass(this, &static_size);
@@ -377,6 +378,8 @@
friend jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass,
jint flags);
+ friend bool _Jv_isBinaryCompatible (jclass);
+
// Return array class corresponding to element type KLASS, creating it if
// necessary.
inline friend jclass
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.75.2.6
diff -u -r1.75.2.6 natClass.cc
--- java/lang/natClass.cc 5 Aug 2004 17:39:06 -0000 1.75.2.6
+++ java/lang/natClass.cc 12 Aug 2004 19:23:42 -0000
@@ -868,8 +868,7 @@
_Jv_PrepareConstantTimeTables (this);
// Assign storage to fields
- // FIXME size_in_bytes == -1 is an evil way to test for BC compiled programs
- if (size_in_bytes == (jint)-1)
+ if (_Jv_isBinaryCompatible (this))
{
int static_size;
_Jv_LayoutClass(this, &static_size);
@@ -1735,9 +1734,7 @@
// if (_Jv_CheckAccess (klass, cls, field->flags))
// {
- // FIXME size_in_bytes == -1 is an evil way to test
- // for BC compiled programs
- if (cls->size_in_bytes == (jint)-1)
+ if (_Jv_isBinaryCompatible (cls))
{
int static_size;
_Jv_LayoutClass(cls, &static_size);
@@ -2131,8 +2128,7 @@
jclass super = klass->getSuperclass();
while (super != NULL)
{
- // FIXME size_in_bytes == -1 is an evil way to test for BC compiled programs
- if (super->size_in_bytes == (jint)-1)
+ if (_Jv_isBinaryCompatible (super))
_Jv_LayoutClass(super, static_size);
int num = JvNumInstanceFields (super);
_Jv_Field *field = JvGetFirstInstanceField (super);
Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.64.8.4
diff -u -r1.64.8.4 natClassLoader.cc
--- java/lang/natClassLoader.cc 12 Aug 2004 17:58:15 -0000 1.64.8.4
+++ java/lang/natClassLoader.cc 12 Aug 2004 19:23:42 -0000
@@ -59,8 +59,7 @@
else
#endif
// Assign storage to fields
- // FIXME size_in_bytes == -1 is an evil way to test for BC compiled programs
- if (klass->size_in_bytes == (jint)-1)
+ if (_Jv_isBinaryCompatible (klass))
{
int static_size;
_Jv_LayoutClass(klass, &static_size);