void *cpy;
RuntimeHashget(forward, (int) ptr, (int *) &cpy);
unsigned int * pointer=pointerarray[type];
+#ifdef TASK
+ if (type==TAGTYPE) {
+ void *objptr=((struct ___TagDescriptor___*)ptr)->flagptr;
+ if (objptr!=NULL) {
+ void * copy=createcopy(objptr);
+ RuntimeHashadd(forward, (int) objptr, (int) copy);
+ RuntimeHashadd(reverse, (int) copy, (int) objptr);
+ RuntimeHashadd(todo, (int) objptr, (int) objptr);
+ ((struct ___TagDescriptor___*)cpy)->flagptr=copy;
+ }
+ } else
+#endif
if (pointer==0) {
/* Array of primitives */
/* Do nothing */
RuntimeHashget(reverse, (int) ptr, (int *) &cpy);
pointer=pointerarray[type];
size=classsize[type];
-
+#ifdef TASK
+ if (type==TAGTYPE) {
+ void *objptr=((struct ___TagDescriptor___*)ptr)->flagptr;
+ memcpy(cpy, ptr, size);
+ if (objptr!=NULL) {
+ if (!RuntimeHashcontainskey(visited, (int) objptr)) {
+ RuntimeHashadd(visited, (int) objptr, (int) objptr);
+ RuntimeHashadd(todo, (int) objptr, (int) objptr);
+ }
+ RuntimeHashget(reverse, (int) objptr, (int *) & (((struct ___TagDescriptor___ *)cpy)->flagptr));
+ }
+ } else
+#endif
if (pointer==0) {
/* Array of primitives */
struct ArrayObject *ao=(struct ArrayObject *) ptr;
}
#ifdef TASK
+
+/* Fix up the references from tags. This can't be done earlier,
+ because we don't want tags to keep objects alive */
void fixtags() {
while(taghead!=NULL) {
int i;
struct ___TagDescriptor___ *tagd=taghead->ptrs[i];
struct ___Object___ *obj=tagd->flagptr;
struct ___TagDescriptor___ *copy=((struct ___TagDescriptor___**)tagd)[1];
- if (obj->type==-1) {
+ if (obj==NULL) {
+ /* Zero object case */
+ } else if (obj->type==-1) {
/* Single object case */
copy->flagptr=((struct ___Object___**)obj)[1];
} else if (obj->type==OBJECTARRAYTYPE) {
ARRAYSET(aonew, struct ___Object___*, i, ARRAYGET(ao, struct ___Object___*, i));
}
ARRAYSET(aonew, struct ___Object___ *, ao->___cachedCode___, obj);
- tagd->flagptr=(struct ___Object___ *) ao;
+ tagd->flagptr=(struct ___Object___ *) aonew;
}
}
}
}
ENDCLEAR:
return;
-
}
/* This function allocates a new tag. */