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]

[vta, trunk?] stabilize __java_boolean garbage collection/aliasing


Many new -fcompare-debug failures appeared in libjava C++ sources.  At
least one of them had to do with CV-qualified variants of
__java_boolean referenced in pointer types getting alias set numbers,
then being garbage collected and removed from the canonical type hash
table at "random" (depending on the amount of memory available, used,
allocated since the last collection, etc).

Then, when we looked up the alias set of another such pointer,
c_common_get_alias_set would call c_common_signed_type, which would in
turn create yet another 1-bit integral type, and create a new alias
set for it.

I haven't seen any actual codegen differences caused by this (I can't
even imagine how it might arise, given that the types end up garbage
collected across function compilations), but the different alias set
numbers are detected as a difference by the RTL dump compares used by
-fcompare-debug, and I remember having debugged codegen differences
caused by alias set variations caused by garbage collection before.

I'm going to install this in the branch once my testing is done.
Does it look good for the trunk?

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* cp/decl.c (record_builtin_java_type): Use canonicalized integer
	types. 

Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c.orig	2008-12-10 03:12:03.000000000 -0200
+++ gcc/cp/decl.c	2008-12-11 06:56:11.000000000 -0200
@@ -3163,10 +3163,10 @@ record_builtin_java_type (const char* na
 {
   tree type, decl;
   if (size > 0)
-    type = make_signed_type (size);
+    type = build_nonstandard_integer_type (size, 0);
   else if (size > -32)
     { /* "__java_char" or ""__java_boolean".  */
-      type = make_unsigned_type (-size);
+      type = build_nonstandard_integer_type (-size, 0);
       /*if (size == -1)	TREE_SET_CODE (type, BOOLEAN_TYPE);*/
     }
   else
-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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