From: bdemsky Date: Thu, 7 Jul 2011 01:15:39 +0000 (+0000) Subject: hack support for pmc into compiler X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a34330ed3e4c1f493d560d41c6529bc0678bfc35;p=IRC.git hack support for pmc into compiler --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 77d444dd..5b32498f 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -339,7 +339,7 @@ public class BuildCode { 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__);"); @@ -359,7 +359,7 @@ public class BuildCode { // 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()) + ");"); @@ -368,7 +368,7 @@ public class BuildCode { + (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() + ");"); @@ -405,7 +405,7 @@ public class BuildCode { } - 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);"); @@ -416,7 +416,7 @@ public class BuildCode { 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);"); @@ -435,7 +435,7 @@ public class BuildCode { 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__);"); @@ -1194,7 +1194,7 @@ public class BuildCode { for(int i=0; i" + 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__);"); @@ -2567,7 +2567,7 @@ fldloop: 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) { @@ -2588,7 +2588,7 @@ fldloop: 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); @@ -2639,7 +2639,7 @@ fldloop: 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; } @@ -2665,12 +2665,12 @@ fldloop: 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) { @@ -2751,7 +2751,7 @@ fldloop: 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__);"); @@ -2778,7 +2778,7 @@ fldloop: 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);"); @@ -2798,7 +2798,7 @@ fldloop: 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+");"); @@ -2821,7 +2821,7 @@ fldloop: 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__);"); @@ -2852,7 +2852,7 @@ fldloop: 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);"); @@ -2913,7 +2913,7 @@ fldloop: 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+");"); @@ -2930,13 +2930,13 @@ fldloop: 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()+");"); @@ -2953,7 +2953,7 @@ fldloop: } 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())+");"); @@ -3020,7 +3020,7 @@ fldloop: 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()+");"); @@ -3105,7 +3105,7 @@ fldloop: 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 @@ -3128,7 +3128,7 @@ fldloop: 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 */ @@ -3229,7 +3229,7 @@ fldloop: 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)+");"); @@ -3241,7 +3241,7 @@ fldloop: 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)+");"); diff --git a/Robust/src/IR/Flat/BuildCodeMGC.java b/Robust/src/IR/Flat/BuildCodeMGC.java index a559b706..a88e0cb3 100644 --- a/Robust/src/IR/Flat/BuildCodeMGC.java +++ b/Robust/src/IR/Flat/BuildCodeMGC.java @@ -154,7 +154,7 @@ public class BuildCodeMGC extends BuildCode { outmethod.println("int mgc_main(int argc, const char *argv[]) {"); outmethod.println(" int i;"); - if (state.MULTICOREGC) { + if (state.MULTICOREGC||state.PMC) { outmethod.println(" global_defs_p->size="+globaldefscount+";"); outmethod.println(" global_defs_p->next=NULL;"); outmethod.println(" for(i=0;i<"+globaldefscount+";i++) {"); @@ -165,14 +165,14 @@ public class BuildCodeMGC extends BuildCode { outputStaticBlocks(outmethod); outputClassObjects(outmethod); - 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);"); } outmethod.println(" for(i=1;i