--- /dev/null
+public class Array extends Thread {
+ int [][] array;
+
+ public Array() {
+ int xmax=10000;
+ int ymax=10;
+ array=global new int[xmax][ymax];
+ for(int i=0;i<xmax;i++) {
+ for(int j=0;j<ymax;j++) {
+ array[i][j]=i*j;
+ }
+ }
+ }
+
+ public static void main(String [] argv) {
+ Array a;
+ atomic {
+ a=global new Array();
+ }
+ a.start((128<<24)|(195<<16)|(136<<8)|162);
+ a.join();
+ }
+
+ public void run() {
+ short[] offsets = new short[4];
+ offsets[0] = getoffset{Array, array};
+ offsets[1] = (short) 0;
+ offsets[2] = (short) 0;
+ offsets[3] = (short) 100;
+ System.rangePrefetch(this, offsets);
+ atomic {
+ int xlength=array.length;
+ int ylength=array[0].length;
+ long sum;
+ for(int i=0;i<xlength;i++) {
+ int a[]=array[i];
+ for(int j=0;j<ylength;j++) {
+ sum+=a[j];
+ }
+ }
+ }
+ }
+}
--- /dev/null
+MAINCLASS=Array
+SRC1=${MAINCLASS}.java
+FLAGS=-dsm -rangeprefetch -dsmcaching -optimize -excprefetch Array.Array -mainclass ${MAINCLASS} -trueprob 0.98
+default:
+ ../../../../buildscript ${FLAGS} -o ${MAINCLASS}RangeN ${SRC1}
+
+clean:
+ rm -rf tmpbuilddirectory
+ rm *.bin
--- /dev/null
+public class Foo {
+ Foo next;
+ public Foo() {
+ next=null;
+ }
+}
+
+public class Chase extends Thread {
+ Foo base;
+ public Chase(Foo b) {
+ base=b;
+ }
+
+ public static void main(String [] argv) {
+ Chase c;
+ atomic {
+ Foo fold=global new Foo();
+
+ for(int i=0;i<10000;i++) {
+ Foo f=global new Foo();
+ f.next=fold;
+ fold=f;
+ }
+
+ c=global new Chase(fold);
+ }
+ c.start((128<<24)|(195<<16)|(136<<8)|162);
+ c.join();
+ }
+
+ public void run() {
+ short[] offsets = new short[4];
+ offsets[0] = getoffset{Chase, base};
+ offsets[1] = (short) 0;
+ offsets[2] = getoffset{Foo, next};
+ offsets[3] = (short) 32;
+ System.rangePrefetch(this, offsets);
+ atomic {
+ Foo b=base;
+ int i = 0;
+ while(b!=null) {
+ b=b.next;
+ i++;
+ }
+ }
+ }
+}
--- /dev/null
+MAINCLASS=Chase
+SRC1=${MAINCLASS}.java
+FLAGS1=-dsm -rangeprefetch -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.99
+#for testing no java option
+#FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.99 -nojava
+default:
+ ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangeN ${SRC1}
+
+clean:
+ rm -rf tmpbuilddirectory
+ rm *.bin