From 30f6e17002019124c3eb495ea9db451b49961db1 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sun, 3 Apr 2011 21:41:10 +0000 Subject: [PATCH] bugs in buildflat...break optimization phase --- Robust/src/IR/Flat/BuildFlat.java | 65 ++++++++++++++++--------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index 6645b01e..ffc9e382 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -209,22 +209,22 @@ public class BuildFlat { FlatNode fn=np.getBegin(); if ((state.THREAD||state.MGC)&&currmd.getModifiers().isSynchronized()) { MethodDescriptor memd=(MethodDescriptor)typeutil.getClass("Object").getMethodTable().get("MonitorEnter"); - FlatNode first = null; - FlatNode end = null; - for(int j = 0; j < this.lockStack.size(); j++) { - TempDescriptor thistd = this.lockStack.elementAt(j); - FlatCall fc = new FlatCall(memd, null, thistd, new TempDescriptor[0]); - fc.setNumLine(bn.getNumLine()); - if(first == null) { - first = end = fc; - } else { - end.addNext(fc); - end = fc; - } - } + FlatNode first = null; + FlatNode end = null; + + { + if (lockStack.size()!=1) { + throw new Error("TOO MANY THINGS ON LOCKSTACK"); + } + TempDescriptor thistd = this.lockStack.elementAt(0); + FlatCall fc = new FlatCall(memd, null, thistd, new TempDescriptor[0]); + fc.setNumLine(bn.getNumLine()); + first = end = fc; + } + end.addNext(fn); fn=first; - end = np.getEnd(); + end = np.getEnd(); if (np.getEnd()!=null&&np.getEnd().kind()!=FKind.FlatReturnNode) { MethodDescriptor memdex=(MethodDescriptor)typeutil.getClass("Object").getMethodTable().get("MonitorExit"); while(!this.lockStack.isEmpty()) { @@ -237,8 +237,8 @@ public class BuildFlat { FlatNode rnflat=spliceReturn(end); rnflat.addNext(fe); } else { - this.lockStack.clear(); - } + this.lockStack.clear(); + } } else if (state.DSM&&currmd.getModifiers().isAtomic()) { curran.addNext(fn); fn=curran; @@ -279,7 +279,7 @@ public class BuildFlat { for(int i=0; i