bug fixes for LookUpServerThread.java
[IRC.git] / Robust / src / Benchmarks / Prefetch / Chase / Chase.java
1 public class Foo {
2     Foo next;
3     public Foo() {
4       next=null;
5     }
6 }
7
8 public class Chase extends Thread {
9     Foo base;
10     public Chase(Foo b) {
11         base=b;
12     }
13     
14     public static void main(String [] argv) {
15         Chase c;
16         atomic {
17             Foo fold=global new Foo();
18             
19             for(int i=0;i<10000;i++) {
20                 Foo f=global new Foo();
21                 f.next=fold;
22                 fold=f;
23             }
24             
25             c=global new Chase(fold);
26         }
27         c.start((128<<24)|(195<<16)|(136<<8)|162);
28         c.join();
29     }
30     
31     public void run() {
32         atomic {
33             Foo b=base;
34         /*
35         //Running small test for manual prefetch
36         //TODO Remove later 
37         Object o = b;
38         short noffsets = (short) 2;
39         short[] offsets = new short[2];
40         offsets[0] = getoffset{Foo, next};
41         offsets[1] = (short)5;
42         System.rangePrefetch(o, offsets);
43         */
44             while(b!=null)
45           b=b.next;
46         }
47     }
48 }