This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Java: add Class protection domain field
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Subject: Java: add Class protection domain field
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Wed, 21 Mar 2001 17:48:25 +1200
In order to fully implement the Java 2 ClassLoader security semantics
and API, we need a new field in java.lang.Class in which to track the
security environment (ProtectionDomain) that an individual class is
assigned to (arguably, any attempt to enforce security for a native
class is a waste of time, but libjava can, of course, load bytecode
from arbritrary sources, so we do want a security framework
implementation).
As the layout of java.lang.Class is dictated by the compiler, a
compiler patch is required to add this new field.
I'll post the runtime part of this patch soon, but wanted to get this
rubber-stamped first. OK?
regards
[ bryce ]
2001-03-21 Bryce McKinlay <bryce@albatross.co.nz>
* decl.c (init_decl_processing): Add new class field
"protectionDomain".
* class.c (make_class_data): Push initial value for "protectionDomain".
Index: gcc/java/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/decl.c,v
retrieving revision 1.87.2.2
diff -u -r1.87.2.2 decl.c
--- decl.c 2001/02/23 20:45:12 1.87.2.2
+++ decl.c 2001/03/11 11:39:13
@@ -674,6 +674,7 @@
PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node);
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);
for (t = TYPE_FIELDS (class_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
FIELD_PRIVATE (t) = 1;
push_super_field (class_type_node, object_type_node);
Index: gcc/java/class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.88
diff -u -r1.88 class.c
--- class.c 2001/02/04 22:44:02 1.88
+++ class.c 2001/03/11 11:39:13
@@ -1439,6 +1439,7 @@
PUSH_FIELD_VALUE (cons, "ancestors", null_pointer_node);
PUSH_FIELD_VALUE (cons, "idt", null_pointer_node);
PUSH_FIELD_VALUE (cons, "arrayclass", null_pointer_node);
+ PUSH_FIELD_VALUE (cons, "protectionDomain", null_pointer_node);
FINISH_RECORD_CONSTRUCTOR (cons);