Patch: FYI: small test suite change

Tom Tromey tromey@redhat.com
Wed Jul 9 21:06:00 GMT 2003


I'm checking this in.

I think Jeff Sturm wrote this, so I put his name on it.  Maybe I'm
wrong.

Anyway, this makes one of the tests a little more efficient, so we
don't time out when running it in the interpreter.

Tom


Index: ChangeLog
from  Jeff Sturm  <jsturm@one-point.com>

	* libjava.lang/SyncTest.java (run): Cache .class value.

Index: libjava.lang/SyncTest.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.lang/SyncTest.java,v
retrieving revision 1.1
diff -u -r1.1 SyncTest.java
--- libjava.lang/SyncTest.java 31 Jul 2001 02:13:46 -0000 1.1
+++ libjava.lang/SyncTest.java 9 Jul 2003 21:05:23 -0000
@@ -3,8 +3,11 @@
   static int counter;
 
   public void run() {
+    // We cache the .class value; otherwise this code is
+    // slow enough that it will time out in some situations.
+    Object lock = SyncTest.class;
     for (int n = 0; n < 1000000; n++)
-      synchronized (SyncTest.class) {
+      synchronized (lock) {
         counter++;
       }
   }



More information about the Java-patches mailing list