X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=src%2Fedu%2Fuci%2Feecs%2FspecCompiler%2FcodeGenerator%2FCodeGenerator.java;h=95637ee7ab07b64a844e8a8609ccf5a5e9f52ea5;hp=0ada8dd96710437d63cf42646816f4c539175bc3;hb=fc0b24243f667dc9938d081305aa66dac66dc6ed;hpb=74da3442bd935d6667dd7ee45571b8c9a249d71c diff --git a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeGenerator.java b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeGenerator.java index 0ada8dd..95637ee 100644 --- a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeGenerator.java +++ b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeGenerator.java @@ -11,6 +11,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import edu.uci.eecs.specCompiler.specExtraction.CPClearConstruct; import edu.uci.eecs.specCompiler.specExtraction.CPDefineCheckConstruct; import edu.uci.eecs.specCompiler.specExtraction.CPDefineConstruct; import edu.uci.eecs.specCompiler.specExtraction.ClassEndConstruct; @@ -183,6 +184,19 @@ public class CodeGenerator { } codeAdditions.get(construct.file).add(addition); } + + private void CPClear2Code(CPClearConstruct construct) { + int lineNum = construct.beginLineNum; + ArrayList newCode = CodeVariables.generateCPClear( + _semantics, construct); + + CodeAddition addition = new CodeAddition(lineNum, newCode); + if (!codeAdditions.containsKey(construct.file)) { + codeAdditions.put(construct.file, new ArrayList()); + } + codeAdditions.get(construct.file).add(addition); + } + /** * private void ClassEnd2Code(ClassEndConstruct construct) { int lineNum = @@ -243,6 +257,8 @@ public class CodeGenerator { CPDefine2Code((CPDefineConstruct) construct); } else if (construct instanceof CPDefineCheckConstruct) { CPDefineCheck2Code((CPDefineCheckConstruct) construct); + } else if (construct instanceof CPClearConstruct) { + CPClear2Code((CPClearConstruct) construct); } else if (construct instanceof EntryPointConstruct) { EntryPoint2Code((EntryPointConstruct) construct); } @@ -272,44 +288,52 @@ public class CodeGenerator { public static void main(String[] argvs) { String homeDir = Environment.HOME_DIRECTORY; - File[] srcLinuxRWLocks = { new File(homeDir - + "/benchmark/linuxrwlocks/linuxrwlocks.c") }; - +// File[] srcLinuxRWLocks = { new File(homeDir +// + "/benchmark/linuxrwlocks/linuxrwlocks.c") }; +// File[] srcHashtable = { new File(homeDir - + "/benchmark/cliffc-hashtable/cliffc_hashtable.h"), - new File(homeDir + "/benchmark/cliffc-hashtable/main.cc") }; + + "/benchmark/concurrent-hashmap/hashmap.h"), + new File(homeDir + "/benchmark/concurrent-hashmap/testcase1.cc"), + new File(homeDir + "/benchmark/concurrent-hashmap/main.cc")}; File[] srcMSQueue = { new File(homeDir + "/benchmark/ms-queue/my_queue.c"), + new File(homeDir + "/benchmark/ms-queue/testcase1.c"), + new File(homeDir + "/benchmark/ms-queue/testcase2.c"), + new File(homeDir + "/benchmark/ms-queue/testcase3.c"), new File(homeDir + "/benchmark/ms-queue/main.c"), new File(homeDir + "/benchmark/ms-queue/my_queue.h") }; - File[] srcRCU = { new File(homeDir - + "/benchmark/read-copy-update/rcu.cc") }; - - File[] srcDeque = { - new File(homeDir + "/benchmark/chase-lev-deque-bugfix/deque.c"), - new File(homeDir + "/benchmark/chase-lev-deque-bugfix/main.c"), - new File(homeDir + "/benchmark/chase-lev-deque-bugfix/deque.h") }; - - File[] srcMCSLock = { - new File(homeDir + "/benchmark/mcs-lock/mcs-lock.cc"), - new File(homeDir + "/benchmark/mcs-lock/mcs-lock.h") }; - - File[] srcSPSCQueue = { - new File(homeDir + "/benchmark/spsc-bugfix/spsc-queue.cc"), - new File(homeDir + "/benchmark/spsc-bugfix/eventcount.h"), - new File(homeDir + "/benchmark/spsc-bugfix/queue.h") }; - - File[] srcMPMCQueue = { - new File(homeDir + "/benchmark/mpmc-queue/mpmc-queue.h"), - new File(homeDir + "/benchmark/mpmc-queue/mpmc-queue.cc") }; - - File[][] sources = { srcLinuxRWLocks, srcMSQueue, srcRCU, - srcDeque, srcMCSLock, srcSPSCQueue, srcMPMCQueue, srcHashtable }; - -// File[][] sources = { srcMPMCQueue }; +// File[] srcRCU = { new File(homeDir +// + "/benchmark/read-copy-update/rcu.cc") }; +// +// File[] srcTrylock = { new File(homeDir +// + "/benchmark/trylock/trylock.c") }; + +// File[] srcDeque = { +// new File(homeDir + "/benchmark/chase-lev-deque-bugfix/deque.c"), +// new File(homeDir + "/benchmark/chase-lev-deque-bugfix/main.c"), +// new File(homeDir + "/benchmark/chase-lev-deque-bugfix/testcase.c"), +// new File(homeDir + "/benchmark/chase-lev-deque-bugfix/deque.h") }; +// +// File[] srcMCSLock = { +// new File(homeDir + "/benchmark/mcs-lock/mcs-lock.cc"), +// new File(homeDir + "/benchmark/mcs-lock/mcs-lock.h") }; +// +// File[] srcSPSCQueue = { +// new File(homeDir + "/benchmark/spsc-bugfix/spsc-queue.cc"), +// new File(homeDir + "/benchmark/spsc-bugfix/eventcount.h"), +// new File(homeDir + "/benchmark/spsc-bugfix/queue.h") }; +// +// File[] srcMPMCQueue = { +// new File(homeDir + "/benchmark/mpmc-queue/mpmc-queue.h"), +// new File(homeDir + "/benchmark/mpmc-queue/mpmc-queue.cc") }; +// +// File[][] sources = { srcLinuxRWLocks, srcMSQueue, srcRCU, +// srcDeque, srcMCSLock, srcSPSCQueue, srcMPMCQueue, srcHashtable }; + + File[][] sources = {srcMSQueue, srcHashtable}; // Compile all the benchmarks for (int i = 0; i < sources.length; i++) { CodeGenerator gen = new CodeGenerator(sources[i]);