J_Gc.c
void jWalkObjectsFields(J_Class* jc,J_Object obj){
  int i;
  J_ClassFields* field;
  J_UtfString fname, fdesc;
  
  for(i=0;i<jc->numVars;i++){
	field = &(jc->fields[i]);
	fname = jGetUtfString(jc,field->nameIdx);
	fdesc = jGetUtfString(jc,field->descrIdx);

   /* if not simple type - object */
	if(fdesc.str[0]=='L' || fdesc.str[0]=='['){
	  J_Object fobj = vmHeap[obj].ptr[field->var.varOffs+1].obj;
	  
	  if(IS_OBJECT(fobj)){
		J_UtfString tmp;
		J_Class* fjc = J_OBJ_CLASS(fobj);
		
		if(IS_MARK(fobj)) continue;
		
		if(GC_DBG){
		  tmp = jGetClassName(jc,jc->thisClassIdx);
		  printf("-->[%s%s]",fname.str,fdesc.str);
		}
 
		if(fjc!=NULL){
		  vmHeap[fobj].marked = 1; 
		  jWalkObjectsFields(fjc,fobj);
		} else {
		 /* if array */
		  walkArray(fobj);
		  MARK(fobj);
		}
	  
	  }
	}
	if(GC_DBG){printf("\n");}
  }
}
/**
 *  Walk throught the all object's fields
 */
Walk throught the all object's fields
Walk throught the all object ' s fields
void jWalkObjectsFields(J_Class* jc,J_Object obj){
  int i;
  J_ClassFields* field;
  J_UtfString fname, fdesc;
  for(i=0;i<jc->numVars;i++){
	field = &(jc->fields[i]);
	fname = jGetUtfString(jc,field->nameIdx);
	fdesc = jGetUtfString(jc,field->descrIdx);
	if(fdesc.str[0]=='L' || fdesc.str[0]=='['){
	  J_Object fobj = vmHeap[obj].ptr[field->var.varOffs+1].obj;
	  if(IS_OBJECT(fobj)){
		J_UtfString tmp;
		J_Class* fjc = J_OBJ_CLASS(fobj);
		if(IS_MARK(fobj)) continue;
		if(GC_DBG){
		  tmp = jGetClassName(jc,jc->thisClassIdx);
		  printf("-->[%s%s]",fname.str,fdesc.str);
		}
		if(fjc!=NULL){
		  vmHeap[fobj].marked = 1; 
		  jWalkObjectsFields(fjc,fobj);
		} else {
		  walkArray(fobj);
		  MARK(fobj);
		}
	  }
	}
	if(GC_DBG){printf("\n");}
  }
}
void jWalkObjectsFields ( J_Class * jc , J_Object obj ) { int i ; J_ClassFields * field ; J_UtfString fname , fdesc ; for ( i = 0 ; i < jc -> numVars ; i ++ ) { field = & ( jc -> fields [ i ] ) ; fname = jGetUtfString ( jc , field -> nameIdx ) ; fdesc = jGetUtfString ( jc , field -> descrIdx ) ; if ( fdesc . str [ 0 ] == ' ' || fdesc . str [ 0 ] == ' ' ) { J_Object fobj = vmHeap [ obj ] . ptr [ field -> var . varOffs + 1 ] . obj ; if ( IS_OBJECT ( fobj ) ) { J_UtfString tmp ; J_Class * fjc = J_OBJ_CLASS ( fobj ) ; if ( IS_MARK ( fobj ) ) continue ; if ( GC_DBG ) { tmp = jGetClassName ( jc , jc -> thisClassIdx ) ; printf ( " " , fname . str , fdesc . str ) ; } if ( fjc != NULL ) { vmHeap [ fobj ] . marked = 1 ; jWalkObjectsFields ( fjc , fobj ) ; } else { walkArray ( fobj ) ; MARK ( fobj ) ; } } } if ( GC_DBG ) { printf ( " \n " ) ; } } }
Walk throught the all object's fields
Walk throught the all object ' s fields
/* if not simple type - object */ /* if array */