This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Patch: Implement Class.getSigners


This patch adds a new `signers' field to Class and implements
Class.getSigners().

This required a couple changes to the front end, to add the new field.

Tested on x86 Red Hat Linux 9.  No regressions.

Ok?

Tom

Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* decl.c (java_init_decl_processing): Declare signers field.
	* class.c (make_class_data): Set signers field.

Index: gcc/java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.170
diff -u -r1.170 class.c
--- gcc/java/class.c 1 Oct 2003 16:22:11 -0000 1.170
+++ gcc/java/class.c 8 Oct 2003 20:42:10 -0000
@@ -1552,6 +1552,7 @@
   PUSH_FIELD_VALUE (cons, "idt", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "arrayclass", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "protectionDomain", null_pointer_node);
+  PUSH_FIELD_VALUE (cons, "signers", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "chain", null_pointer_node);
 
   FINISH_RECORD_CONSTRUCTOR (cons);
Index: gcc/java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.167
diff -u -r1.167 decl.c
--- gcc/java/decl.c 1 Oct 2003 16:22:11 -0000 1.167
+++ gcc/java/decl.c 8 Oct 2003 20:42:11 -0000
@@ -713,6 +713,7 @@
   PUSH_FIELD (class_type_node, field, "idt", ptr_type_node);  
   PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node);  
   PUSH_FIELD (class_type_node, field, "protectionDomain", ptr_type_node);
+  PUSH_FIELD (class_type_node, field, "signers", ptr_type_node);
   PUSH_FIELD (class_type_node, field, "chain", ptr_type_node);
   for (t = TYPE_FIELDS (class_type_node);  t != NULL_TREE;  t = TREE_CHAIN (t))
     FIELD_PRIVATE (t) = 1;
Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/ClassLoader.java (setSigners): Implemented.
	* boehm.cc (_Jv_MarkObj): Mark `signers' field.
	* java/lang/natClassLoader.cc (_Jv_InitNewClassFields):
	Initialize new fields.
	* java/lang/Class.java (getSigners): Now native.
	(setSigners): Declare.
	* java/lang/natClass.cc (getSigners): New method.
	(getSigners): Likewise.
	* java/lang/Class.h (Class::signers): New field.
	(Class::setSigners): New method.
Index: libjava/boehm.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v
retrieving revision 1.40
diff -u -r1.40 boehm.cc
--- libjava/boehm.cc 29 Sep 2003 07:13:40 -0000 1.40
+++ libjava/boehm.cc 8 Oct 2003 20:42:15 -0000
@@ -206,6 +206,8 @@
       MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cDlabel);
       p = (ptr_t) c->protectionDomain;
       MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cPlabel);
+      p = (ptr_t) c->signers;
+      MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cSlabel);
 
 #ifdef INTERPRETER
       if (_Jv_IsInterpretedClass (c))
Index: libjava/java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.59
diff -u -r1.59 Class.h
--- libjava/java/lang/Class.h 1 Oct 2003 16:22:12 -0000 1.59
+++ libjava/java/lang/Class.h 8 Oct 2003 20:42:20 -0000
@@ -197,6 +197,7 @@
   java::net::URL        *getResource (jstring resourceName);
   java::io::InputStream *getResourceAsStream (jstring resourceName);
   JArray<jobject> *getSigners (void);
+  void setSigners(JArray<jobject> *);
 
   inline jclass getSuperclass (void)
     {
@@ -433,6 +434,8 @@
   jclass arrayclass;
   // Security Domain to which this class belongs (or null).
   java::security::ProtectionDomain *protectionDomain;
+  // Signers of this class (or null).
+  JArray<jobject> *signers;
   // Used by Jv_PopClass and _Jv_PushClass to communicate with StackTrace.
   jclass chain;
 };
Index: libjava/java/lang/Class.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.java,v
retrieving revision 1.17
diff -u -r1.17 Class.java
--- libjava/java/lang/Class.java 25 Sep 2003 07:46:19 -0000 1.17
+++ libjava/java/lang/Class.java 8 Oct 2003 20:42:20 -0000
@@ -193,11 +193,8 @@
       return packageName.substring (0, end+1) + resourceName;
   }
 
-  // FIXME: implement.  Requires java.security.
-  public Object[] getSigners ()
-  {
-    return null;
-  }
+  public native Object[] getSigners ();
+  native void setSigners(Object[] signers);
 
   public native Class getSuperclass ();
   public native boolean isArray ();
Index: libjava/java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.30
diff -u -r1.30 ClassLoader.java
--- libjava/java/lang/ClassLoader.java 25 Sep 2003 07:46:19 -0000 1.30
+++ libjava/java/lang/ClassLoader.java 8 Oct 2003 20:42:20 -0000
@@ -502,7 +502,7 @@
    */
   protected final void setSigners(Class c, Object[] signers)
   {
-    //    c.setSigners(signers);
+    c.setSigners(signers);
   }
 
   /**
Index: libjava/java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.65
diff -u -r1.65 natClass.cc
--- libjava/java/lang/natClass.cc 1 Oct 2003 16:22:12 -0000 1.65
+++ libjava/java/lang/natClass.cc 8 Oct 2003 20:42:21 -0000
@@ -1534,6 +1534,18 @@
   return protectionDomain;
 }
 
+JArray<jobject> *
+java::lang::Class::getSigners()
+{
+  return signers;
+}
+
+void
+java::lang::Class::setSigners(JArray<jobject> *s)
+{
+  signers = s;
+}
+
 // Functions for indirect dispatch (symbolic virtual binding) support.
 
 // There are two tables, atable and otable.  atable is an array of
Index: libjava/java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.60
diff -u -r1.60 natClassLoader.cc
--- libjava/java/lang/natClassLoader.cc 2 Oct 2003 15:34:28 -0000 1.60
+++ libjava/java/lang/natClassLoader.cc 8 Oct 2003 20:42:21 -0000
@@ -539,6 +539,9 @@
   ret->field_count = 0;
   ret->static_field_count = 0;
   ret->vtable = NULL;
+  ret->otable_syms = NULL;
+  ret->atable = NULL;
+  ret->atable_syms = NULL;
   ret->interfaces = NULL;
   ret->loader = NULL;
   ret->interface_count = 0;
@@ -549,6 +552,7 @@
   ret->idt = NULL;
   ret->arrayclass = NULL;
   ret->protectionDomain = NULL;
+  ret->signers = NULL;
   ret->chain = NULL;
 }
 


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