From 430d7e03d79ccb575b9bb20b3d060345bc63a610 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 9 Apr 2011 10:45:10 +0000 Subject: [PATCH] get specjbb compiling again...get rid of annoying warnings...still left with large long warning..unclear of what to do.. --- .../src/Analysis/CallGraph/JavaCallGraph.java | 1 + Robust/src/IR/Flat/BuildCode.java | 38 +++++++++------- Robust/src/IR/TypeUtil.java | 11 +++++ Robust/src/Runtime/math.c | 1 + Robust/src/Runtime/object.c | 44 ++++++++++--------- Robust/src/Runtime/socket.c | 1 + 6 files changed, 60 insertions(+), 36 deletions(-) diff --git a/Robust/src/Analysis/CallGraph/JavaCallGraph.java b/Robust/src/Analysis/CallGraph/JavaCallGraph.java index 14e9a759..c7acbbe7 100644 --- a/Robust/src/Analysis/CallGraph/JavaCallGraph.java +++ b/Robust/src/Analysis/CallGraph/JavaCallGraph.java @@ -76,6 +76,7 @@ public class JavaCallGraph extends CallGraph { HashSet ns=new HashSet(); ns.addAll(callees); ns.addAll(getMethods(tu.getRun(), fcall.getThis().getType())); + ns.addAll(getMethods(tu.getStaticStart(), fcall.getThis().getType())); callees=ns; } } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index ed6e7968..6b625a51 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2627,23 +2627,21 @@ public class BuildCode { // is a static block or is invoked in some static block ClassDescriptor cd = fm.getMethod().getClassDesc(); ClassDescriptor cn = fsfn.getDst().getType().getClassDesc(); - if(cd == cn) { - // the same class, do nothing - } else if(mgcstaticinit){ - // generate static init check code if has not done the static init in main() + if(cd != cn && mgcstaticinit){ + // generate static init check code if has not done the static init in main() if((cn.getNumStaticFields() != 0) || (cn.getNumStaticBlocks() != 0)) { // need to check if the class' static fields have been initialized and/or // its static blocks have been executed output.println("if(global_defsprim_p->" + cn.getSafeSymbol()+"static_block_exe_flag == 0) {"); if(cn.getNumStaticBlocks() != 0) { MethodDescriptor t_md = (MethodDescriptor)cn.getMethodTable().get("staticblocks"); - if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) { - output.print(" struct "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"_params __parameterlist__={"); - output.println("0, NULL};"); - output.println(" "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"(& __parameterlist__);"); - } else { - output.println(" "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"();"); - } + if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) { + output.print(" struct "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"_params __parameterlist__={"); + output.println("0, NULL};"); + output.println(" "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"(& __parameterlist__);"); + } else { + output.println(" "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"();"); + } } else { output.println(" global_defsprim_p->" + cn.getSafeSymbol()+"static_block_exe_flag = 1;"); } @@ -2652,12 +2650,16 @@ public class BuildCode { } } // redirect to the global_defs_p structure - if (fsfn.getField().getType().isPtr()) + if (fsfn.getField().getType().isPtr()) { + if (fsfn.getField().getType()!=fsfn.getSrc().getType()) output.println("global_defs_p->" + - fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";"); + fsfn.getField().getSafeSymbol()+"=(struct "+ fsfn.getField().getType().getSafeSymbol()+" *)"+generateTemp(fm,fsfn.getSrc())+";"); else - output.println("global_defsprim_p->" + + output.println("global_defs_p->" + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";"); + } else + output.println("global_defsprim_p->" + + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";"); } else { output.println("#ifdef MULTICORE_DEBUG"); output.println("if (" + generateTemp(fm,fsfn.getDst()) + " == NULL) {"); @@ -2669,8 +2671,12 @@ public class BuildCode { } output.println("}"); output.println("#endif //MULTICORE_DEBUG"); - output.println(generateTemp(fm, fsfn.getDst())+"->"+ - fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";"); + if (fsfn.getSrc().getType().isPtr()&&fsfn.getSrc().getType()!=fsfn.getField().getType()) + output.println(generateTemp(fm, fsfn.getDst())+"->"+ + fsfn.getField().getSafeSymbol()+"=(struct "+ fsfn.getField().getType().getSafeSymbol()+"*)"+generateTemp(fm,fsfn.getSrc())+";"); + else + output.println(generateTemp(fm, fsfn.getDst())+"->"+ + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";"); } } diff --git a/Robust/src/IR/TypeUtil.java b/Robust/src/IR/TypeUtil.java index 61faa673..8613bbe3 100644 --- a/Robust/src/IR/TypeUtil.java +++ b/Robust/src/IR/TypeUtil.java @@ -102,6 +102,17 @@ public class TypeUtil { } throw new Error("Can't find Thread.run"); } + + public MethodDescriptor getStaticStart() { + ClassDescriptor cd=getClass(TypeUtil.ThreadClass); + for(Iterator methodit=cd.getMethodTable().getSet("staticStart").iterator(); methodit.hasNext();) { + MethodDescriptor md=(MethodDescriptor) methodit.next(); + if (md.numParameters()!=1||!md.getModifiers().isStatic()||!md.getParamType(0).isClass()||md.getParamType(0).getClassDesc()!=cd) + continue; + return md; + } + throw new Error("Can't find Thread.run"); + } public MethodDescriptor getExecute() { ClassDescriptor cd = getClass(TypeUtil.TaskClass); diff --git a/Robust/src/Runtime/math.c b/Robust/src/Runtime/math.c index e3522446..d930413d 100644 --- a/Robust/src/Runtime/math.c +++ b/Robust/src/Runtime/math.c @@ -1,6 +1,7 @@ #include "runtime.h" #include "math.h" #include "structdefs.h" +#include "methodheaders.h" #ifdef D___Math______cos____D double CALL11(___Math______cos____D, double ___a___, double ___a___) { diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index a7e1062a..55de437a 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -44,16 +44,18 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { atomic_inc(&VAR(___this___)->lockcount); } else { while(1) { - if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) { - VAR(___this___)->___prevlockobject___=NULL; - VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); - if (VAR(___this___)->___nextlockobject___!=NULL) - VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); - pthread_setspecific(threadlocks, VAR(___this___)); - VAR(___this___)->tid=self; - pthread_mutex_unlock(&objlock); - BARRIER(); - return; + if (VAR(___this___)->lockcount==0) { + if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) { + VAR(___this___)->___prevlockobject___=NULL; + VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); + if (VAR(___this___)->___nextlockobject___!=NULL) + VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); + pthread_setspecific(threadlocks, VAR(___this___)); + VAR(___this___)->tid=self; + pthread_mutex_unlock(&objlock); + BARRIER(); + return; + } } { #ifdef PRECISE_GC @@ -109,16 +111,18 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) { #endif while(1) { - if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) { - VAR(___this___)->___prevlockobject___=NULL; - VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); - if (VAR(___this___)->___nextlockobject___!=NULL) - VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); - pthread_setspecific(threadlocks, VAR(___this___)); - VAR(___this___)->tid=self; - pthread_mutex_unlock(&objlock); - BARRIER(); - return; + if (VAR(___this___)->lockcount==0) { + if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) { + VAR(___this___)->___prevlockobject___=NULL; + VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); + if (VAR(___this___)->___nextlockobject___!=NULL) + VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); + pthread_setspecific(threadlocks, VAR(___this___)); + VAR(___this___)->tid=self; + pthread_mutex_unlock(&objlock); + BARRIER(); + return; + } } { #ifdef PRECISE_GC diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c index bc468870..f06476bd 100644 --- a/Robust/src/Runtime/socket.c +++ b/Robust/src/Runtime/socket.c @@ -11,6 +11,7 @@ #endif #include "SimpleHash.h" #include "GenericHashtable.h" +#include "methodheaders.h" struct RuntimeHash *fdtoobject; -- 2.34.1