Package gov.nasa.jpf.vm

Examples of gov.nasa.jpf.vm.DynamicElementInfo


  public static Object obtainJVMObj (int JPFRef, MJIEnv env) throws ConversionException {
    if (JPFRef == MJIEnv.NULL) {
      return null;
    }

    DynamicElementInfo dei = (DynamicElementInfo) env.getHeap().get(JPFRef);
    ClassInfo ci = dei.getClassInfo();
    JPF2JVMConverter converter = ConverterBase.converterFactory.getJPF2JVMConverter(ci.getName());
    return converter.getJVMObj(JPFRef, env);
  }
View Full Code Here


       * If the object has not been created & the given JPF object is not NULL,
       * the corresponding JVM object is created from JPFRef
       */
      if (JVMObj == null) {
        // Used to store instance fields
        DynamicElementInfo dei = (DynamicElementInfo) env.getHeap().get(JPFRef);
        ClassInfo JPFCl = dei.getClassInfo();

        if (!JPFCl.isRegistered()){
          JPFCl.registerClass(env.getThreadInfo());
        }
       
View Full Code Here

       * If the array has not been created & the given JPF array is not NULL,
       * the corresponding JVM array is created from JPFRef
       */
      if (JVMArr == null) {
        // Used to store array elements
        DynamicElementInfo dei = (DynamicElementInfo) env.getHeap().get(JPFRef);

        // Array of primitive type
        if (dei.getClassInfo().getComponentClassInfo().isPrimitive()) {
          JVMArr = Utilities.createJVMPrimitiveArr(dei);
        }
        // Array of Non-primitives
        else {
          int[] JPFArr = ((ReferenceArrayFields) dei.getFields()).asReferenceArray();
          int arrSize = JPFArr.length;

          Class<?> compType = null;
          try {
            compType = loadClass(dei.getClassInfo().getComponentClassInfo().getName(), env);
          } catch (ClassNotFoundException e) {
            e.printStackTrace();
          }

          Object[] arrObj = (Object[]) Array.newInstance(compType, arrSize);
View Full Code Here

  }

  protected abstract Object instantiateFrom (Class<?> cl);

  protected Object createStringObject(int JPFRef, MJIEnv env) throws ConversionException {
    DynamicElementInfo str = (DynamicElementInfo) env.getHeap().get(JPFRef);
    if(!str.getClassInfo().isStringClassInfo()) {
      throw new ConversionException();
    }

    FieldInfo fi = str.getFieldInfo("value");
    int fieldValueRef = str.getFields().getReferenceValue(fi.getStorageOffset());

    // this is String.value which is of type of char[]
    Object value = this.getJVMObj(fieldValueRef, env);
    Object JVMObj = new String((char[])value);
    ConverterBase.objMapJPF2JVM.put(JPFRef, JVMObj);
View Full Code Here

          } catch (ClassNotFoundException e1){
            e1.printStackTrace();
          }
        }
       
        DynamicElementInfo dei = (DynamicElementInfo) env.getHeap().getModifiable(JPFObj);

        setInstanceFields(JVMObj, dei, env);
      }
    }
  }
View Full Code Here

      // 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);
          }
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of gov.nasa.jpf.vm.DynamicElementInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.