DiscoverConflicts recorddc;
DCWrapper delaycomp;
CallGraph callgraph;
- Hashtable<String, ClassDescriptor> printedfieldstbl;
+ Hashtable<String, Integer> printedfieldstbl;
public BuildCode(State st, Hashtable temptovar, TypeUtil typeutil, SafetyAnalysis sa, PrefetchAnalysis pa) {
recorddc=new DiscoverConflicts(locality, st, typeanalysis, delaycomp.getCannotDelayMap(), true, true, null);
recorddc.doAnalysis();
}
- printedfieldstbl = new Hashtable<String, ClassDescriptor>();
+ printedfieldstbl = new Hashtable<String, Integer>();
}
/** The buildCode method outputs C code for all the methods. The Flat
printClassStruct(si, classdefout, /*globaldefout*/ null);
}
}
-
+
if (!fieldorder.containsKey(cn)) {
Vector fields=new Vector();
fieldorder.put(cn,fields);
}
}
}
- Vector fields=(Vector)fieldorder.get(cn);
+ //Vector fields=(Vector)fieldorder.get(cn);
- /*Vector */ fields = cn.getFieldVec();
+ Vector fields = cn.getFieldVec();
for(int i=0; i<fields.size(); i++) {
FieldDescriptor fd=(FieldDescriptor)fields.get(i);
- String fstring = fd.getSymbol();
+ String fstring = fd.isStatic()?fd.getSafeSymbol():fd.getSymbol();
if(printedfieldstbl.containsKey(fstring)) {
- printedfieldstbl.put(fstring, cn);
- continue;
+ if(!fd.isStatic()) {
+ int index = printedfieldstbl.get(fstring).intValue();
+ index++;
+ fd.changeSafeSymbol(index);
+ printedfieldstbl.put(fstring, index);
+ } else {
+ continue;
+ }
} else {
- printedfieldstbl.put(fstring, cn);
+ printedfieldstbl.put(fstring, 0);
}
if (state.MGC && fd.getType().isClass()
&& fd.getType().getClassDesc().isEnum()) {
}
}
printClassStruct(cn, classdefout, globaldefout);
- printedfieldstbl.clear();
+ printedfieldstbl.clear();// = new Hashtable<String, ClassDescriptor>();
classdefout.println("};\n");
if (state.DSM||state.SINGLETM) {
// redirect to the global_defs_p structure
if((ffn.getField().isStatic()) || (ffn.getSrc().getType().isClassNameRef())) {
// reference to the static field with Class name
- output.println(generateTemp(fm, ffn.getDst(),lb)+"=global_defs_p->"+
- ffn.getField().getClassDescriptor().getSafeSymbol()+ffn.getField().getSafeSymbol()+";");
+ output.println(generateTemp(fm, ffn.getDst(),lb)+"=global_defs_p->"+ffn.getField().getSafeSymbol()+";");
} else {
output.println(generateTemp(fm, ffn.getDst(),lb)+"=*"+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";");
}
void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) {
#ifdef MGC
#ifdef TILERA_BME
- struct ArrayObject * chararray=VAR(___s___)->___String______value___;
+ struct ArrayObject * chararray=VAR(___s___)->___value___;
int i;
- int offset=VAR(___s___)->___String______offset___;
+ int offset=VAR(___s___)->___offset___;
tprintf("");
- for(i=0; i<VAR(___s___)->___String______count___; i++) {
+ for(i=0; i<VAR(___s___)->___count___; i++) {
short sc=
((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
printf("%c", sc);
struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
struct ___String___ * strobj=allocate_new(STRINGTYPE);
#endif
- strobj->___String______value___=chararray;
- strobj->___String______count___=length;
- strobj->___String______offset___=0;
+ strobj->___value___=chararray;
+ strobj->___count___=length;
+ strobj->___offset___=0;
for(i=0; i<length; i++) {
((short*)(((char*)&chararray->___length___)+sizeof(int)))[i]=(short)str[i];