From eade5b2eb06e1e068f15a25b5dc51f3fa96beb74 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 15 Apr 2008 00:15:15 +0000 Subject: [PATCH] hack to work around analysis bug --- .../Analysis/Locality/LocalityAnalysis.java | 19 +++++++++++++++---- .../Benchmarks/Prefetch/Em3d/dsm/BiGraph.java | 12 ++++++++---- .../src/Benchmarks/Prefetch/Em3d/dsm/makefile | 2 +- Robust/src/ClassLibrary/Integer.java | 4 +++- Robust/src/IR/Flat/BuildCode.java | 4 +++- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Robust/src/Analysis/Locality/LocalityAnalysis.java b/Robust/src/Analysis/Locality/LocalityAnalysis.java index f4187fe1..3e061bdd 100644 --- a/Robust/src/Analysis/Locality/LocalityAnalysis.java +++ b/Robust/src/Analysis/Locality/LocalityAnalysis.java @@ -196,7 +196,13 @@ public class LocalityAnalysis { MethodDescriptor md=lb.getMethod(); Hashtable> temptable=new Hashtable>(); Hashtable atomictable=new Hashtable(); - computeCallsFlags(md, lb, temptable, atomictable); + try { + computeCallsFlags(md, lb, temptable, atomictable); + } catch (Error e) { + System.out.println("Error in "+md+" context "+lb); + e.printStackTrace(); + System.exit(-1); + } atomictab.put(lb, atomictable); temptab.put(lb, temptable); @@ -363,12 +369,13 @@ public class LocalityAnalysis { Integer currreturnval=EITHER; //Start off with the either value for(Iterator methodit=methodset.iterator();methodit.hasNext();) { MethodDescriptor md=(MethodDescriptor) methodit.next(); + boolean isnative=md.getModifiers().isNative(); boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join"); LocalityBinding lb=new LocalityBinding(md, isatomic); if (isnative&&isatomic) { - System.out.println("Don't call native methods in atomic blocks!"); + System.out.println("Don't call native methods in atomic blocks!"+currlb.getMethod()); } if (runmethodset==null||!runmethodset.contains(md)) { //Skip this part if it is a run method @@ -495,10 +502,14 @@ public class LocalityAnalysis { void processOpNode(FlatOpNode fon, Hashtable currtable) { /* Just propagate value */ Integer srcvalue=currtable.get(fon.getLeft()); + if (srcvalue==null) { - throw new Error(fon.getLeft()+" is undefined!"); + if (!fon.getLeft().getType().isPtr()) { + srcvalue=LOCAL; + } else + throw new Error(fon.getLeft()+" is undefined!"); } - currtable.put(fon.getDest(), currtable.get(fon.getLeft())); + currtable.put(fon.getDest(), srcvalue); } void processCastNode(FlatCastNode fcn, Hashtable currtable) { diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java index 80099b92..b92fe89f 100644 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java @@ -41,10 +41,14 @@ public class BiGraph // making nodes (we create a table) //if (verbose) System.printString("making nodes (tables in orig. version)"); - Node[] hTable = global new Node[numNodes]; - Node[] eTable = global new Node[numNodes]; - hTable = Node.fillTable(numNodes, numDegree, r); - eTable = Node.fillTable(numNodes, numDegree, r); + Node[] hTable = global new Node[1]; + + Node[] eTable = global new Node[1]; + + if (true) { + eTable=Node.fillTable(numNodes, numDegree, r); + hTable=Node.fillTable(numNodes, numDegree, r); + } // making neighbors //if (verbose) System.printString("updating from and coeffs"); diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile index 014098e1..387658c1 100644 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile @@ -4,7 +4,7 @@ SRC=${MAINCLASS}.java \ Node.java \ Barrier.java FLAGS=-dsm -prefetch -optimize -profile -debug -mainclass ${MAINCLASS} -o ${MAINCLASS} -FLAGS2=-dsm -optimize -printflat -profile -debug -mainclass ${MAINCLASS} -o ${MAINCLASS}NP +FLAGS2=-dsm -optimize -profile -debug -mainclass ${MAINCLASS} -o ${MAINCLASS}NP default: ../../../../buildscript ${FLAGS2} ${SRC} diff --git a/Robust/src/ClassLibrary/Integer.java b/Robust/src/ClassLibrary/Integer.java index 06c621e1..2358adb7 100644 --- a/Robust/src/ClassLibrary/Integer.java +++ b/Robust/src/ClassLibrary/Integer.java @@ -40,7 +40,9 @@ public class Integer { val=10+b-'a'; else if (b>='A'&&b<='Z') val=10+b-'A'; - else cont=false; + else { + cont=false; + } if (cont) { if (val>=radix) System.error(); diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 3749ee24..84565ce1 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2016,7 +2016,9 @@ public class BuildCode { output.println(dst+"->"+nextobjstr+"="+revertptr+";"); output.println("trans->revertlist=(struct ___Object___ *)"+dst+";"); output.println("}"); - } else throw new Error("Unknown array type"); + } else { + throw new Error("Unknown array type in"+fsen+" in " + fm+"\n"+(lb!=null?(lb+" "+lb.getExplanation()):"")); + } if (srcglobal) { output.println("{"); String src=generateTemp(fm, fsen.getSrc(), lb); -- 2.34.1