for(int i=0;i<length;i++)
charstr[i]=(char)str[i+offset];
this.value=charstr;
- this.count=str.length;
+ this.count=length;
this.offset=0;
}
/* Classify parameters */
MethodDescriptor md=(MethodDescriptor)methodit.next();
FlatMethod fm=state.getMethodFlat(md);
- if (!md.getModifiers().isNative())
+ if (!md.getModifiers().isNative()) {
generateFlatMethod(fm, null, outmethod);
+ }
}
}
}
}
+ //CHECK OVER THIS -- THERE COULD BE SOME ERRORS HERE
int generateOptionalPredicate(Predicate predicate, OptionalTaskDescriptor otd, ClassDescriptor cdtemp, PrintWriter output) {
int predicateindex = 0;
//iterate through the classes concerned by the predicate
public String toString() {
String st="";
- if (dst==null)
- st+=method.getSymbol()+"(";
- else
+ if (dst==null) {
+ if (method==null)
+ st+="null(";
+ else
+ st+=method.getSymbol()+"(";
+ } else
st+=dst+"="+method.getSymbol()+"(";
if (this_temp!=null) {
st+=this_temp;
//Make sure the variable is declared as a parameter to the task
VarDescriptor vd=(VarDescriptor)td.getParameterTable().get(varname);
if (vd==null)
- throw new Error("Parameter "+varname+" in Flag Effects not declared");
+ throw new Error("Parameter "+varname+" in Flag Effects not declared in "+td);
fe.setVar(vd);
//Make sure it correspods to a class
(d instanceof FieldDescriptor)) {
nametable.add(vd);
} else
- throw new Error(vd.getSymbol()+" defined a second time");
+ throw new Error(vd.getSymbol()+" in "+md+" defined a second time");
if (dn.getExpression()!=null)
checkExpressionNode(md, nametable, dn.getExpression(), vd.getType());
}
else
fd=(FieldDescriptor) ltd.getClassDesc().getFieldTable().get(fieldname);
if (fd==null)
- throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0));
+ throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0)+" in "+md);
fan.setField(fd);
if (td!=null)
if (!typeutil.isSuperorType(td,fan.getType()))
}
}
if (bestmd==null)
- throw new Error("No method found for "+con.printNode(0));
+ throw new Error("No method found for "+con.printNode(0)+" in "+md);
con.setConstructor(bestmd);
}
}
}
}
if (bestmd==null)
- throw new Error("No method found for :"+min.printNode(0)+" in class: " + classtolookin);
+ throw new Error("No method found for :"+min.printNode(0)+" in class: " + classtolookin+" in "+md);
min.setMethod(bestmd);
if ((td!=null)&&(min.getType()!=null)&&!typeutil.isSuperorType(td, min.getType()))
inline int Objnext(struct ObjectIterator *thisvar) {
int curr=thisvar->cur->data;
thisvar->cur=thisvar->cur->next;
+ return curr;
}
inline int Objkey(struct ObjectIterator *thisvar) {
inline struct ObjectIterator * allocateObjectIterator(struct ObjectNode *start);
-inline int ObjasNext(struct ObjectIterator *thisvar);
+inline int ObjhasNext(struct ObjectIterator *thisvar);
inline int Objnext(struct ObjectIterator *thisvar);
}
}
-
void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * forward, struct RuntimeHash * reverse) {
#ifdef PRECISE_GC
void **newarray=cpmalloc(sizeof(void *)*numparams);
for(i=0;i<length;i++) {
void *objptr=((void **)(((char *)& ao->___length___)+sizeof(int)))[i];
if (objptr==NULL) {
- ((void **)(((char *)& ao->___length___)+sizeof(int)))[i]=NULL;
+ ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL;
} else if (RuntimeHashcontainskey(forward, (int) objptr))
RuntimeHashget(forward,(int) objptr,(int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]);
else {
int length=ao->___length___;
int cpysize=sizeof(struct ArrayObject)+length*size;
memcpy(cpy, ptr, cpysize);
-
} else if ((int)pointer==1) {
/* Array of pointers */
struct ArrayObject *ao=(struct ArrayObject *) ptr;
int tagid=parameter->tagarray[2*i+1];
int j;
for(j=0;j<ao->___cachedCode___;j++) {
- if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, i)->flag)
+ if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, j)->flag)
goto foundtag;
}
goto nextloop;
}
/* Actually call task */
#ifdef PRECISE_GC
- ((int *)taskpointerarray)[0]=currtpd->task->numParameters;
+ ((int *)taskpointerarray)[0]=currtpd->numParameters;
taskpointerarray[1]=NULL;
#endif
#ifdef OPTIONAL
}
}
-
+ void printdebug() {
+ int i;
+ int j;
+ for(i=0;i<numtasks;i++) {
+ struct taskdescriptor * task=taskarray[i];
+ printf("%s\n", task->name);
+ for(j=0;j<task->numParameters;j++) {
+ struct parameterdescriptor *param=task->descriptorarray[j];
+ struct parameterwrapper *parameter=param->queue;
+ struct ObjectHash * set=parameter->objectset;
+ struct ObjectIterator objit;
+ printf(" Parameter %d\n", j);
+ ObjectHashiterator(set, &objit);
+ while(ObjhasNext(&objit)) {
+ struct ___Object___ * obj=(struct ___Object___ *)Objkey(&objit);
+ struct ___Object___ * tagptr=obj->___tags___;
+ Objnext(&objit);
+ printf(" Contains %lx\n", obj);
+ printf(" flag=%d\n", obj->flag);
+ if (tagptr==NULL) {
+ } else if (tagptr->type==TAGTYPE) {
+ printf(" tag=%lx\n",tagptr);
+ } else {
+ int tagindex=0;
+ struct ArrayObject *ao=(struct ArrayObject *)tagptr;
+ for(;tagindex<ao->___cachedCode___;tagindex++) {
+ printf(" tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex));
+ }
+ }
+ }
+ }
+ }
+ }
/* This function processes the task information to create queues for