This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PATCH: hash-synchronization for alpha
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: PATCH: hash-synchronization for alpha
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Mon, 23 Jul 2001 00:05:34 -0400 (EDT)
- cc: java-patches at gcc dot gnu dot org
On 22 Jul 2001, Tom Tromey wrote:
> I can't comment on the correctness of this patch. I don't know
> anything about the alpha.
How about style, esp. the multi-line asm bits?
> How well does it fare against the test suite?
No change. (I'm seeing 8 failures, which may be due to local changes in
my tree.)
Note that we don't really have much to properly test synchronization. I
appended a simple test that demonstrates atomic increments. Should this
be part of the libgcj test suite?
> If it causes no regressions, please check it in.
Done; thanks.
// Test synchronization by performing concurrent atomic increments.
public class SyncTest implements Runnable {
static int counter;
public void run() {
for (int n = 0; n < 1000000; n++)
synchronized (SyncTest.class) {
counter++;
}
}
public static void main(String[] args) {
SyncTest test = new SyncTest();
Thread[] thr = new Thread[4];
for (int n = 0; n < thr.length; n++) {
thr[n] = new Thread(test);
thr[n].start();
}
for (int n = 0; n < thr.length; n++) {
try {
thr[n].join();
} catch (InterruptedException ex) {
}
}
System.out.println(counter == 1000000 * thr.length ?
"ok" : "fail: " + counter);
}
}