From: jzhou Date: Thu, 21 Oct 2010 18:27:54 +0000 (+0000) Subject: Small bug fix for multicore gc w/o tasks X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=08ac94bd17082ba8f04d3e23fb58d9b88b6e7c5a;p=IRC.git Small bug fix for multicore gc w/o tasks --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index c69398c3..595fffe5 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -636,8 +636,13 @@ public class BuildCode { outmethod.println("#include \"multicoreruntime.h\""); outmethod.println("#include \"runtime_arch.h\""); } - if (state.THREAD||state.DSM||state.SINGLETM) - outmethod.println("#include "); + if (state.THREAD||state.DSM||state.SINGLETM) { + if(state.MGC) { + outmethod.println("#include \"thread.h\""); + } else { + outmethod.println("#include "); + } + } if (state.main!=null) { outmethod.println("#include "); } diff --git a/Robust/src/IR/Flat/BuildCodeMGC.java b/Robust/src/IR/Flat/BuildCodeMGC.java index b21d78d2..d3762478 100644 --- a/Robust/src/IR/Flat/BuildCodeMGC.java +++ b/Robust/src/IR/Flat/BuildCodeMGC.java @@ -183,6 +183,9 @@ public class BuildCodeMGC extends BuildCode { Iterator it_sclasses = sctbl.getDescriptorsIterator(); while(it_sclasses.hasNext()) { ClassDescriptor t_cd = (ClassDescriptor)it_sclasses.next(); + if(t_cd.getNumStaticFields() != 0) { + // TODO may need to invoke static field initialization here + } MethodDescriptor t_md = (MethodDescriptor)t_cd.getMethodTable().get("staticblocks"); outmethod.println(" {"); if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) { diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 0874728e..9c7b393c 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -148,9 +148,10 @@ public class Main { state.MULTICORE=true; else if (option.equals("-multicoregc")) state.MULTICOREGC=true; - else if (option.equals("-mgc")) + else if (option.equals("-mgc")) { state.MGC = true; - else if (option.equals("-ownership")) + state.THREAD = true; + } else if (option.equals("-ownership")) state.OWNERSHIP=true; else if (option.equals("-ownallocdepth")) { state.OWNERSHIPALLOCDEPTH=Integer.parseInt(args[++i]); diff --git a/Robust/src/Tests/MGC/SynchonizedTest.java b/Robust/src/Tests/MGC/SynchonizedTest.java index 9b5528bc..7d322ffb 100644 --- a/Robust/src/Tests/MGC/SynchonizedTest.java +++ b/Robust/src/Tests/MGC/SynchonizedTest.java @@ -6,8 +6,10 @@ public class Counter{ this.count = 0; } - public synchronized void add(long value){ - this.count += value; + public add(long value){ + synchronized (this) { + this.count += value; + } } public synchronized long getCounter() {