This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta, trunk] stabilize java type's uids
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 01 Mar 2009 02:47:33 -0300
- Subject: [vta, trunk] stabilize java type's uids
Using types that are not canonicalized for Java builtin types makes them
eligible for garbage collection. If the unsigned variant of a signed
type is requested multiple times, their UIDs may vary depending on
whether an intervening garbage collection drops. When UIDs vary,
various passes that walk hash tables whose hash values depend on such
UIDs, may cause compilation differences.
This patch stabilizes such hashes, registering canonical signed types
and unsigned variants, and keeping the latter from being collected.
I'm installing this in the VTA branch. Ok 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-13 15:04:54.000000000 -0200
@@ -3163,10 +3163,18 @@ 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);
+ {
+ tree stype;
+ /* "__java_char" or ""__java_boolean". */
+ type = build_nonstandard_integer_type (-size, 1);
+ /* Get the signed type cached and attached to the unsigned type,
+ so it doesn't get garbage-collected at "random" times,
+ causing potential codegen differences out of different UIDs
+ and different alias set numbers. */
+ stype = build_nonstandard_integer_type (-size, 0);
+ TREE_CHAIN (type) = stype;
/*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