public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* stabilize java assertion tables
@ 2007-11-08  3:49 Alexandre Oliva
  2007-11-08  5:22 ` Alexandre Oliva
  2007-11-08 10:45 ` Andrew Haley
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandre Oliva @ 2007-11-08  3:49 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

Using TYPE_UID rather than pointers to hash type_assertions shaved off
another 70 -fvar-tracking-assignments (and, probably -g vs -g0)
codegen differences.  Now I'm down to four differences on
x86_64-linux-gnu libs, yay.

Ok for trunk, after retesting in it (rather than in the vta branch)
completes?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-stabilize-java-assertion-tables.patch --]
[-- Type: text/x-patch, Size: 1216 bytes --]

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

	* java/expr.c (type_assertion_hash): Hash type uids rather
	than tree pointers.

Index: gcc/java/expr.c
===================================================================
--- gcc/java/expr.c.orig	2007-09-08 20:11:06.000000000 -0300
+++ gcc/java/expr.c	2007-11-08 00:40:04.000000000 -0200
@@ -433,8 +433,26 @@ type_assertion_hash (const void *p)
   const type_assertion *k_p = p;
   hashval_t hash = iterative_hash (&k_p->assertion_code, sizeof
 				   k_p->assertion_code, 0);
-  hash = iterative_hash (&k_p->op1, sizeof k_p->op1, hash);
-  return iterative_hash (&k_p->op2, sizeof k_p->op2, hash);
+
+  switch (k_p->assertion_code) {
+  case JV_ASSERT_TYPES_COMPATIBLE:
+    hash = iterative_hash (&TYPE_UID (k_p->op2), sizeof TYPE_UID (k_p->op2),
+			   hash);
+    /* Fall through.  */
+
+  case JV_ASSERT_IS_INSTANTIABLE:
+    hash = iterative_hash (&TYPE_UID (k_p->op1), sizeof TYPE_UID (k_p->op1),
+			   hash);
+    /* Fall through.  */
+
+  case JV_ASSERT_END_OF_TABLE:
+    break;
+
+  default:
+    gcc_unreachable ();
+  }
+
+  return hash;
 }
 
 /* Add an entry to the type assertion table for the given class.  

[-- Attachment #3: Type: text/plain, Size: 249 bytes --]


-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stabilize java assertion tables
  2007-11-08  3:49 stabilize java assertion tables Alexandre Oliva
@ 2007-11-08  5:22 ` Alexandre Oliva
  2007-11-08 18:13   ` Alexandre Oliva
  2007-11-08 10:45 ` Andrew Haley
  1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Oliva @ 2007-11-08  5:22 UTC (permalink / raw)
  To: gcc-patches

On Nov  8, 2007, Alexandre Oliva <aoliva@redhat.com> wrote:

> Ok for trunk, after retesting in it (rather than in the vta branch)
> completes?

... and after fixing the placement of { in a separate line and the
indentantion?  *blush*

> +  switch (k_p->assertion_code) {

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stabilize java assertion tables
  2007-11-08  3:49 stabilize java assertion tables Alexandre Oliva
  2007-11-08  5:22 ` Alexandre Oliva
@ 2007-11-08 10:45 ` Andrew Haley
  2007-11-08 11:00   ` Andrew Haley
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Haley @ 2007-11-08 10:45 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches

Alexandre Oliva writes:
 > Using TYPE_UID rather than pointers to hash type_assertions shaved off
 > another 70 -fvar-tracking-assignments (and, probably -g vs -g0)
 > codegen differences.  Now I'm down to four differences on
 > x86_64-linux-gnu libs, yay.
 > 
 > Ok for trunk, after retesting in it (rather than in the vta branch)
 > completes?
 > 
 > for  gcc/ChangeLog.vta => gcc/java/ChangeLog
 > from  Alexandre Oliva  <aoliva@redhat.com>
 > 
 > 	* java/expr.c (type_assertion_hash): Hash type uids rather
 > 	than tree pointers.
 > 

I guess so.  I don't understand that fragment of code at all, but I'll
trust you.

Andrew.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stabilize java assertion tables
  2007-11-08 10:45 ` Andrew Haley
@ 2007-11-08 11:00   ` Andrew Haley
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2007-11-08 11:00 UTC (permalink / raw)
  To: Alexandre Oliva, gcc-patches

Andrew Haley writes:
 > Alexandre Oliva writes:
 >  > Using TYPE_UID rather than pointers to hash type_assertions shaved off
 >  > another 70 -fvar-tracking-assignments (and, probably -g vs -g0)
 >  > codegen differences.  Now I'm down to four differences on
 >  > x86_64-linux-gnu libs, yay.
 >  > 
 >  > Ok for trunk, after retesting in it (rather than in the vta branch)
 >  > completes?
 >  > 
 >  > for  gcc/ChangeLog.vta => gcc/java/ChangeLog
 >  > from  Alexandre Oliva  <aoliva@redhat.com>
 >  > 
 >  > 	* java/expr.c (type_assertion_hash): Hash type uids rather
 >  > 	than tree pointers.
 >  > 
 > 
 > I guess so.  I don't understand that fragment of code at all, but I'll
 > trust you.

Actually, that's a terrible thing for a maintainer to say.  Blame a
lack of coffee.

If the assertion code is JV_ASSERT_TYPES_COMPATIBLE, we hash both op1
and op2; if it's JV_ASSERT_IS_INSTANTIABLE we only hash op1.  And the
switch statement with multiple fall-throughs is the best way to do
this.  OK.

Andrew.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stabilize java assertion tables
  2007-11-08  5:22 ` Alexandre Oliva
@ 2007-11-08 18:13   ` Alexandre Oliva
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2007-11-08 18:13 UTC (permalink / raw)
  To: gcc-patches

On Nov  8, 2007, Alexandre Oliva <aoliva@redhat.com> wrote:

> Ok for trunk, after retesting in it (rather than in the vta branch)
> completes?

... and after fixing the placement of { in a separate line and the
indentantion?  *blush*

> +  switch (k_p->assertion_code) {

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-08 17:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08  3:49 stabilize java assertion tables Alexandre Oliva
2007-11-08  5:22 ` Alexandre Oliva
2007-11-08 18:13   ` Alexandre Oliva
2007-11-08 10:45 ` Andrew Haley
2007-11-08 11:00   ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).