From 5ece740dddfbc9823184d9d5a5818bac06341412 Mon Sep 17 00:00:00 2001 From: jzhou Date: Tue, 10 May 2011 18:52:57 +0000 Subject: [PATCH] Make SPECjbb compile again --- Robust/src/ClassLibrary/MGC/Vector.java | 2 +- Robust/src/IR/Tree/BuildIR.java | 4 ++-- Robust/src/IR/TypeUtil.java | 22 ++++++++++++++++---- Robust/src/Runtime/bamboo/gcqueue.h | 5 ++++- Robust/src/Runtime/bamboo/multicoregarbage.c | 5 +++++ Robust/src/Runtime/bamboo/multicoregcflush.c | 5 +++++ Robust/src/Runtime/bamboo/multicoregcmark.c | 5 +++++ Robust/src/Runtime/bamboo/multicoremsg.c | 8 +++++++ Robust/src/Runtime/bamboo/multicoreruntime.c | 3 +++ Robust/src/Runtime/runtime.h | 2 +- 10 files changed, 52 insertions(+), 9 deletions(-) diff --git a/Robust/src/ClassLibrary/MGC/Vector.java b/Robust/src/ClassLibrary/MGC/Vector.java index 738b78a6..5d729f2c 100644 --- a/Robust/src/ClassLibrary/MGC/Vector.java +++ b/Robust/src/ClassLibrary/MGC/Vector.java @@ -79,7 +79,7 @@ public class Vector implements Set { } } - private ensureCapacity(int minCapacity) { + private void ensureCapacity(int minCapacity) { if (minCapacity>array.length) { int newsize; if (capacityIncrement<=0) diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index ca20689f..8b7d2585 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -49,7 +49,7 @@ public class BuildIR { } ParseNode ipn = pn.getChild("imports").getChild("import_decls_list"); - if (ipn != null) { + if ((ipn != null) && !state.MGC) { ParseNodeVector pnv = ipn.getChildren(); for (int i = 0; i < pnv.size(); i++) { ParseNode pnimport = pnv.elementAt(i); @@ -71,7 +71,7 @@ public class BuildIR { ParseNode ppn=pn.getChild("packages").getChild("package"); String packageName = null; - if (ppn!=null) { + if ((ppn!=null) && !state.MGC){ NameDescriptor nd = parseClassName(ppn.getChild("name")); packageName = nd.getPathFromRootToHere(); //Trick -> import the package directory as a multi-import and it'll diff --git a/Robust/src/IR/TypeUtil.java b/Robust/src/IR/TypeUtil.java index 9467e09c..81704720 100644 --- a/Robust/src/IR/TypeUtil.java +++ b/Robust/src/IR/TypeUtil.java @@ -44,6 +44,10 @@ public class TypeUtil { public void addNewClass(String cl, Set todo) { //search through the default locations for the file. + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } for (int i = 0; i < state.classpath.size(); i++) { String path = (String) state.classpath.get(i); File f = new File(path, cl.replace('.', '/') + ".java"); @@ -63,16 +67,26 @@ public class TypeUtil { public ClassDescriptor getClass(String classname) { - ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + String cl = classname; + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } + ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); return cd; } public ClassDescriptor getClass(String classname, HashSet todo) { - ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + String cl = classname; + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } + ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); if (cd==null) { //have to find class - addNewClass(classname, todo); - cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + addNewClass(cl, todo); + cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); System.out.println("Build class:"+cd); todo.add(cd); diff --git a/Robust/src/Runtime/bamboo/gcqueue.h b/Robust/src/Runtime/bamboo/gcqueue.h index 22353795..83ff136e 100644 --- a/Robust/src/Runtime/bamboo/gcqueue.h +++ b/Robust/src/Runtime/bamboo/gcqueue.h @@ -1,8 +1,11 @@ #ifndef GCQUEUE_H #define GCQUEUE_H - #include "stdio.h" +#ifdef MGC +#include "interrupt.h" +#endif + #define NUMPTRS 120 struct pointerblock { diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 8a42ae66..6fbbc6d2 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -9,6 +9,11 @@ #include "multicoreruntime.h" #include "multicoregcprofile.h" #include "gcqueue.h" +#ifdef MGC +#include "runtime_arch.h" + +extern int corenum; +#endif #ifdef SMEMM extern unsigned int gcmem_mixed_threshold; diff --git a/Robust/src/Runtime/bamboo/multicoregcflush.c b/Robust/src/Runtime/bamboo/multicoregcflush.c index 8a5e96d3..d2578ecf 100644 --- a/Robust/src/Runtime/bamboo/multicoregcflush.c +++ b/Robust/src/Runtime/bamboo/multicoregcflush.c @@ -4,6 +4,11 @@ #include "ObjectHash.h" #include "GenericHashtable.h" #include "gcqueue.h" +#ifdef MGC +#include "runtime_arch.h" + +extern int corenum; +#endif /* Task specific includes */ diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 84991696..08f69d5a 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -4,6 +4,11 @@ #include "multicoreruntime.h" #include "GenericHashtable.h" #include "gcqueue.h" +#ifdef MGC +#include "runtime_arch.h" + +extern int corenum; +#endif extern int corenum; #ifdef TASK diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 5d6ffb4f..67459fc5 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -4,6 +4,12 @@ #include "multicoreruntime.h" #include "multicoretaskprofile.h" #include "gcqueue.h" +#ifdef MGC +#include "structdefs.h" +#include "runtime_arch.h" + +extern int corenum; +#endif int msgsizearray[] = { 0, //MSGSTART, @@ -80,6 +86,7 @@ INLINE unsigned int checkMsgLength_I(unsigned int * type) { return msgsizearray[*type]; } +#ifdef TASK INLINE void processmsg_transobj_I(int msglength) { struct transObjInfo * transObj=RUNMALLOC_I(sizeof(struct transObjInfo)); BAMBOO_ASSERT(BAMBOO_NUM_OF_CORE <= NUMCORESACTIVE - 1); @@ -128,6 +135,7 @@ INLINE void processmsg_transobj_I(int msglength) { } #endif } +#endif INLINE void processmsg_transtall_I() { BAMBOO_ASSERT(BAMBOO_NUM_OF_CORE == STARTUPCORE); diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index 2f1d5c22..86a33bfb 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -3,6 +3,9 @@ #include "runtime.h" #include "multicoreruntime.h" #include "methodheaders.h" +#ifdef MGC +#include "runtime_arch.h" +#endif extern int classsize[]; extern int typearray[]; diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 620440cd..8f821316 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -157,7 +157,7 @@ inline void setupsmemmode(void); #endif #endif -#ifdef THREADS +#if (defined(THREADS)||defined(MGC)) #define MAXLOCKS 256 struct lockpair { -- 2.34.1