//System.out.println("wjw org.apache.HarmonyDRLVM.mm.mmtk.ObjectModel.getObjectType() was called " + obj);
//VM.assertions._assert(false);
boolean isDelegated = false; //scanning is *not* delegated to the VM
Class clsObj = object.getClass();
MMType mmtc = getObjTypeLookup(clsObj);
if (mmtc != null) return mmtc;
boolean isArr = clsObj.isArray();
boolean isRefArray = false;
if (isArr)
{
String clsName = clsObj.toString();
//System.out.println("getObjectType() 3:" + clsName + "_6:" + clsName.charAt(6) +
// "_7:" + clsName.charAt(7) );
VM.assertions._assert(clsName.charAt(6) == '[');
if (clsName.charAt(7) == '[') isRefArray = true;
if (clsName.charAt(7) == 'L') isRefArray = true;
}
boolean isAcyclic = false; //wjw -- I don't have a clue what this is...
Space spx = Space.getSpaceForObject(object);
MutatorContext mc = SelectedPlan.ap.mutator();
Allocator alc = mc.getAllocatorFromSpace(spx); //but alloc is an "int, not an "Allocator". Go figure...
int [] offs = new int [0];
/////888888888888888888888888888888
if (isArr == false) //build the correct offset table
{
ObjectReference or = ObjectReference.fromObject(object);
Address addr2 = or.toAddress();
int vtblPtr = addr2.loadInt();
Address addrVPtr = Address.fromInt(vtblPtr);
int vPtr = addrVPtr.loadInt();
//System.out.println("AddrVptr = " + Integer.toHexString(addrVPtr.toInt()) );
//System.out.println("vPtr = " + Integer.toHexString(vPtr) );
Address addrVPtr_0 = Address.fromInt(vPtr);
int vPtr_0 = addrVPtr_0.loadInt();
//System.out.println("vPtr_0 = " + Integer.toHexString(vPtr_0) );
int vPtr_2c = addrVPtr_0.plus(0x2c).loadInt();
//System.out.println("vPtr_2c = " + Integer.toHexString(vPtr_2c) );
Address addrElementZero = Address.fromInt(vPtr_2c);
int xx = 0;
for (xx = 0; xx < 12; xx++ )
{
int element = addrElementZero.plus(xx*4).loadInt();
//System.out.println("element [" + xx + "] = " + element );
if (element == 0) break;
}
if (xx > 10) VM.assertions._assert(false); // we ran off in the woods
if (xx > 0)
{
offs = new int[xx];
for (int yy = 0; yy < xx; yy++)
{
int element = addrElementZero.plus(yy*4).loadInt();
offs[yy] = element;
}
for (int rr = 0; rr < offs.length; rr++)
{
//System.out.println("offs[" + rr + "] = " + offs[rr] );
}
}
}
////////88888888888888888888888
//System.out.println("offs length = " + offs.length + " isRefArray = " + isRefArray);
MMType mmt = new MMType(isDelegated, isRefArray, isAcyclic, Plan.ALLOC_DEFAULT, offs);
getObjectTypeCacheInsert(clsObj, mmt);
return mmt;
}