// First check if the JPF array has been already updated
if (!ConverterBase.updatedJPFObj.containsKey(JPFArr)){
ConverterBase.updatedJPFObj.put(JPFArr, JVMArr);
ConverterBase.objMapJPF2JVM.put(JPFArr, JVMArr);
DynamicElementInfo dei = (DynamicElementInfo) env.getHeap().getModifiable(JPFArr);
ArrayFields fields = (ArrayFields) dei.getFields();
// Array of primitive type
if (dei.getClassInfo().getComponentClassInfo().isPrimitive()){
Utilities.setJPFPrimitiveArr(dei, JVMArr, env);
}
// Array of Non-primitives
else{
int arrSize = fields.arrayLength();
Object[] arrObj = (Object[]) JVMArr;
for (int i = 0; i < arrSize; i++){
int elementValueRef = dei.getReferenceElement(i);
if (arrObj[i] == null){
elementValueRef = MJIEnv.NULL;
} else if (elementValueRef == MJIEnv.NULL || ConverterBase.objMapJPF2JVM.get(elementValueRef) != arrObj[i]){
elementValueRef = obtainJPFObj(arrObj[i], env);
} else if (ConverterBase.objMapJPF2JVM.get(elementValueRef) == arrObj[i]){
updateJPFObj(arrObj[i], elementValueRef, env);
} else{
throw new ConversionException("Unconsidered case observed! - JVM2JPF.updateArr()");
}
dei.setReferenceElement(i, elementValueRef);
}
}
}
}
}