if(t_md != null&&callgraph.isInit(t_cd)) {
outmethod.println(" {");
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.print(" struct "+t_cd.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"_params __parameterlist__={");
outmethod.println("0, NULL};");
outmethod.println(" "+t_cd.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"(& __parameterlist__);");
// create a global classobj array
outmethod.println(" {");
outmethod.println(" int i = 0;");
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.println(" struct garbagelist dummy={0,NULL};");
outmethod.println(" global_defs_p->classobjs = allocate_newarray(&dummy, OBJECTARRAYTYPE, "
+ (state.numClasses()+state.numArrays()+state.numInterfaces()) + ");");
+ (state.numClasses()+state.numArrays()+state.numInterfaces()) + ");");
}
outmethod.println(" for(i = 0; i < " + (state.numClasses()+state.numArrays()+state.numInterfaces()) + "; i++) {");
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.println(" ((void **)(((char *) &(global_defs_p->classobjs->___length___))+sizeof(int)))[i] = allocate_new(NULL, " +typeutil.getClass(TypeUtil.ObjectClass).getId() + ");");
} else {
outmethod.println(" ((void **)(((char *) &(global_defs_p->classobjs->___length___))+sizeof(int)))[i] = allocate_new(" +typeutil.getClass(TypeUtil.ObjectClass).getId() + ");");
}
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1);");
} else {
outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1);");
ClassDescriptor stringclass=typeutil.getClass(TypeUtil.StringClass);
String stringclassstring="struct "+stringclass.getSafeSymbol();
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.println(" "+stringclassstring+" *newstring=NewString(NULL, argv[i], length);");
} else {
outmethod.println(" "+stringclassstring+" *newstring=NewString(argv[i], length);");
ClassDescriptor cd=typeutil.getMainClass();
outmethod.println(" {");
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
outmethod.print(" struct "+cd.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={");
outmethod.println("1, NULL,"+"stringarray};");
outmethod.println(" "+cd.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(& __parameterlist__);");
for(int i=0; i<fm.numParameters(); i++) {
TempDescriptor temp=fm.getParameter(i);
TypeDescriptor type=temp.getType();
- if (type.isPtr()&&((GENERATEPRECISEGC) || (this.state.MULTICOREGC)))
+ if (type.isPtr()&&((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC))
objectparams.addPtr(temp);
else
objectparams.addPrim(temp);
for(int i=0; i<fm.numTags(); i++) {
TempDescriptor temp=fm.getTag(i);
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC))
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC)
objectparams.addPtr(temp);
else
objectparams.addPrim(temp);
for(int i=0; i<writes.length; i++) {
TempDescriptor temp=writes[i];
TypeDescriptor type=temp.getType();
- if (type.isPtr()&&((GENERATEPRECISEGC) || (this.state.MULTICOREGC)))
+ if (type.isPtr()&&((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC))
objecttemps.addPtr(temp);
else
objecttemps.addPrim(temp);
protected void generateMethodParam(ClassDescriptor cn, MethodDescriptor md, PrintWriter output) {
/* Output parameter structure */
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
if(md.isInvokedByStatic() && !md.isStaticBlock() && !md.getModifiers().isNative()) {
// generate the staticinit version
String mdstring = md.getSafeMethodDescriptor() + "staticinit";
String mdstring = md.getSafeMethodDescriptor() + "staticinit";
/* Output temp structure */
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_locals {");
output.println(" int size;");
output.println(" void * next;");
/* Next the method name */
headersout.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"(");
printcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
headersout.print("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_params * "+paramsprefix);
printcomma=true;
}
}
/* Output temp structure */
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_locals {");
output.println(" int size;");
output.println(" void * next;");
/* Next the method name */
headersout.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(");
printcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
headersout.print("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params * "+paramsprefix);
printcomma=true;
}
TempObject objecttemps=(TempObject) tempstable.get(task);
/* Output parameter structure */
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println("struct "+task.getSafeSymbol()+"_params {");
output.println(" int size;");
output.println(" void * next;");
}
/* Output temp structure */
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println("struct "+task.getSafeSymbol()+"_locals {");
output.println(" int size;");
output.println(" void * next;");
headersout.print("void " + task.getSafeSymbol()+"(");
boolean printcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
headersout.print("struct "+task.getSafeSymbol()+"_params * "+paramsprefix);
} else
headersout.print("void * parameterarray[]");
generateHeader(fm, md!=null?md:task,output);
TempObject objecttemp=(TempObject) tempstable.get(md!=null?md:task);
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.print(" struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_locals "+localsprefix+"={");
output.print(objecttemp.numPointers()+",");
output.print(paramsprefix);
/* Check to see if we need to do a GC if this is a
* multi-threaded program...*/
- if (((state.OOOJAVA||state.THREAD)&&GENERATEPRECISEGC) || state.MULTICOREGC) {
+ if (((state.OOOJAVA||state.THREAD)&&GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
//Don't bother if we aren't in recursive methods...The loops case will catch it
if (callgraph.getAllMethods(md).contains(md)) {
- if (this.state.MULTICOREGC) {
+ if (state.MULTICOREGC||state.PMC) {
output.println("GCCHECK("+localsprefixaddr+");");
} else {
output.println("if (unlikely(needtocollect)) checkcollect("+localsprefixaddr+");");
mgcstaticinit = true;
}
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
if (md!=null)
output.print(" struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_locals "+localsprefix+"={");
else
* multi-threaded program...*/
if (((state.OOOJAVA||state.THREAD)&&GENERATEPRECISEGC)
- || this.state.MULTICOREGC) {
+ || state.MULTICOREGC||state.PMC) {
//Don't bother if we aren't in recursive methods...The loops case will catch it
if (callgraph.getAllMethods(md).contains(md)) {
- if (this.state.MULTICOREGC) {
+ if (state.MULTICOREGC||state.PMC) {
output.println("GCCHECK("+localsprefixaddr+");");
} else {
output.println("if (unlikely(needtocollect)) checkcollect("+localsprefixaddr+");");
public void generateFlatBackEdge(FlatMethod fm, FlatBackEdge fn, PrintWriter output) {
if (((state.OOOJAVA||state.THREAD)&&GENERATEPRECISEGC)
- || (this.state.MULTICOREGC)) {
- if(this.state.MULTICOREGC) {
+ || state.MULTICOREGC||state.PMC) {
+ if (state.MULTICOREGC||state.PMC) {
output.println("GCCHECK("+localsprefixaddr+");");
} else {
output.println("if (unlikely(needtocollect)) checkcollect("+localsprefixaddr+");");
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)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
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__);");
output.println("int monitorenterline = __LINE__;");
}
// call MonitorEnter/MonitorExit on a class obj
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.print(" struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={");
output.println("1," + localsprefixaddr + ", ((void **)(((char *) &(global_defs_p->classobjs->___length___))+sizeof(int)))[" + fc.getThis().getType().getClassDesc().getId() + "]};");
if(md.getSymbol().equals("MonitorEnter") && state.OBJECTLOCKDEBUG) {
if(md.getSymbol().equals("MonitorEnter")) {
output.println("int monitorenterline = __LINE__;");
}
- if (GENERATEPRECISEGC || state.MULTICOREGC) {
+ if (GENERATEPRECISEGC || state.MULTICOREGC||state.PMC) {
output.print(" struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_params __parameterlist__={");
output.print(objectparams.numPointers());
output.print(", "+localsprefixaddr);
output.print("(*)(");
boolean printcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.print("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_params * ");
printcomma=true;
}
output.print("(");
boolean needcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.print("&__parameterlist__");
needcomma=true;
}
- if (!GENERATEPRECISEGC && !this.state.MULTICOREGC) {
+ if (!GENERATEPRECISEGC && !state.MULTICOREGC&&!state.PMC) {
if (fc.getThis()!=null) {
TypeDescriptor ptd=null;
if(md.getThis() != null) {
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)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
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__);");
output.println("#ifdef CAPTURE_NULL_DEREFERENCES");
output.println("if (" + generateTemp(fm,ffn.getSrc()) + " == NULL) {");
output.println("printf(\" NULL ptr error: %s, %s, %d \\n\", __FILE__, __func__, __LINE__);");
- if(state.MULTICOREGC) {
+ if(state.MULTICOREGC||state.PMC) {
output.println("failednullptr(&___locals___);");
} else {
output.println("failednullptr(NULL);");
String dst=generateTemp(fm, fsfn.getDst());
output.println("if(!"+dst+"->"+localcopystr+") {");
/* Link object into list */
- if (GENERATEPRECISEGC || this.state.MULTICOREGC)
+ if (GENERATEPRECISEGC || state.MULTICOREGC||state.PMC)
output.println("COPY_OBJ((struct garbagelist *)"+localsprefixaddr+",(struct ___Object___ *)"+dst+");");
else
output.println("COPY_OBJ("+dst+");");
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)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
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__);");
output.println("#ifdef CAPTURE_NULL_DEREFERENCES");
output.println("if (" + generateTemp(fm,fsfn.getDst()) + " == NULL) {");
output.println("printf(\" NULL ptr error: %s, %s, %d \\n\", __FILE__, __func__, __LINE__);");
- if(state.MULTICOREGC) {
+ if(state.MULTICOREGC||state.PMC) {
output.println("failednullptr(&___locals___);");
} else {
output.println("failednullptr(NULL);");
String dst=generateTemp(fm, fsen.getDst());
output.println("if(!"+dst+"->"+localcopystr+") {");
/* Link object into list */
- if (GENERATEPRECISEGC || this.state.MULTICOREGC)
+ if (GENERATEPRECISEGC || state.MULTICOREGC||state.PMC)
output.println("COPY_OBJ((struct garbagelist *)"+localsprefixaddr+",(struct ___Object___ *)"+dst+");");
else
output.println("COPY_OBJ("+dst+");");
if (fn.getType().isArray()) {
int arrayid=state.getArrayNumber(fn.getType())+state.numClasses();
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println(generateTemp(fm,fn.getDst())+"=allocate_newarray("+localsprefixaddr+", "+arrayid+", "+generateTemp(fm, fn.getSize())+");");
} else {
output.println(generateTemp(fm,fn.getDst())+"=allocate_newarray("+arrayid+", "+generateTemp(fm, fn.getSize())+");");
}
} else {
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println(generateTemp(fm,fn.getDst())+"=allocate_new("+localsprefixaddr+", "+fn.getType().getClassDesc().getId()+");");
} else {
output.println(generateTemp(fm,fn.getDst())+"=allocate_new("+fn.getType().getClassDesc().getId()+");");
}
protected void generateFlatTagDeclaration(FlatMethod fm, FlatTagDeclaration fn, PrintWriter output) {
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println(generateTemp(fm,fn.getDst())+"=allocate_tag("+localsprefixaddr+", "+state.getTagId(fn.getType())+");");
} else {
output.println(generateTemp(fm,fn.getDst())+"=allocate_tag("+state.getTagId(fn.getType())+");");
output.print(((int)str.charAt(i)));
}
output.println("};");
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
output.println(generateTemp(fm, fln.getDst())+"=NewStringShort("+localsprefixaddr+", str"+flncount+", "+((String)fln.getValue()).length()+");");
} else {
output.println(generateTemp(fm, fln.getDst())+"=NewStringShort(str"+flncount+" ,"+((String)fln.getValue()).length()+");");
output.print(task.getSafeSymbol()+"(");
boolean printcomma=false;
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC) {
if (md!=null) {
output.print("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"_params * "+paramsprefix);
} else
output.print(temp.getType().getSafeSymbol()+" "+temp.getSafeSymbol());
}
output.println(") {");
- } else if (!GENERATEPRECISEGC && !this.state.MULTICOREGC) {
+ } else if (!GENERATEPRECISEGC && !state.MULTICOREGC && ! state.PMC) {
/* Imprecise Task */
output.println("void * parameterarray[]) {");
/* Unpack variables */
Iterator tagit=tagtmps.iterator();
while(tagit.hasNext()) {
TempDescriptor tagtmp=(TempDescriptor)tagit.next();
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC))
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC)
output.println("tagclear("+localsprefixaddr+", (struct ___Object___ *)"+generateTemp(fm, temp)+", "+generateTemp(fm,tagtmp)+");");
else
output.println("tagclear((struct ___Object___ *)"+generateTemp(fm, temp)+", "+generateTemp(fm,tagtmp)+");");
Iterator tagit=tagtmps.iterator();
while(tagit.hasNext()) {
TempDescriptor tagtmp=(TempDescriptor)tagit.next();
- if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC))
+ if ((GENERATEPRECISEGC) || state.MULTICOREGC||state.PMC)
output.println("tagset("+localsprefixaddr+", (struct ___Object___ *)"+generateTemp(fm, temp)+", "+generateTemp(fm,tagtmp)+");");
else
output.println("tagset((struct ___Object___ *)"+generateTemp(fm, temp)+", "+generateTemp(fm,tagtmp)+");");