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]

[gcjx] Patch: FYI: fix class registration


I'm checking this in on the gcjx branch.

This fixes runtime class registration.  This code is just lifted from
the current gcj.

Tom

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

	* glue.hh: Include rtl.h.
	* classobj.cc (create_class_instance): Call make_decl_rtl.  Don't
	take address of result.
	* driver.cc (register_classes): Taken from gcj.

Index: classobj.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/classobj.cc,v
retrieving revision 1.1.2.23
diff -u -r1.1.2.23 classobj.cc
--- classobj.cc 27 Apr 2005 17:40:36 -0000 1.1.2.23
+++ classobj.cc 29 Apr 2005 02:57:54 -0000
@@ -616,6 +616,5 @@
   result = builtins->map_class_object (klass->get ());
   DECL_INITIAL (result) = init;
   rest_of_decl_compilation (result, 1, 0);
-
-  result = build1 (ADDR_EXPR, type_class_ptr, result);
+  make_decl_rtl (result);
 }
Index: driver.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/driver.cc,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 driver.cc
--- driver.cc 8 Mar 2005 00:45:41 -0000 1.1.2.4
+++ driver.cc 29 Apr 2005 02:57:54 -0000
@@ -452,34 +452,14 @@
   if (TARGET_USE_JCR_SECTION)
     {
 #ifdef JCR_SECTION_NAME
-      int len = list_length (classes) + 1;
-      tree type = build_array_type (type_class_ptr,
-				    build_index_type (build_int_cst (type_jint,
-								     len)));
-      tree result = build_decl (VAR_DECL, get_identifier ("_jcr_list"), type);
-      DECL_SECTION_NAME (result) = build_string (strlen (JCR_SECTION_NAME),
-						 JCR_SECTION_NAME);
-
-      tree cons = NULL_TREE;
-      int i = 0;
+      named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
+      assemble_align (POINTER_SIZE);
       for (tree iter = classes; iter != NULL_TREE; iter = TREE_CHAIN (iter))
 	{
-	  // Destructively modify the purpose field.
-	  TREE_PURPOSE (iter) = build_int_cst (type_jint, i);
-	  ++i;
+	  mark_decl_referenced (TREE_VALUE (iter));
+	  assemble_integer (XEXP (DECL_RTL (TREE_VALUE (iter)), 0),
+			    POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 	}
-
-      classes = chainon (classes,
-			 tree_cons (build_int_cst (type_jint, i),
-				    null_pointer_node,
-				    NULL_TREE));
-
-      DECL_INITIAL (result) = build_constructor (type, classes);
-      TREE_STATIC (result) = 1;
-      DECL_ARTIFICIAL (result) = 1;
-      DECL_IGNORED_P (result) = 1;
-
-      rest_of_decl_compilation (result, 1, 0);
 #else
       // A target has defined TARGET_USE_JCR_SECTION, but doesn't have
       // a JCR_SECTION_NAME.
Index: glue.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/glue.hh,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 glue.hh
--- glue.hh 20 Apr 2005 16:05:07 -0000 1.1.2.12
+++ glue.hh 29 Apr 2005 02:57:54 -0000
@@ -71,6 +71,7 @@
 #include "debug.h"
 #include "version.h"
 #include "target.h"
+#include "rtl.h"
 
 // This gets us alloc_stmt_list().  Shouldn't that be in
 // tree-iterator.h?


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