Package org.apache.kato.jvmti.javaruntime.model

Examples of org.apache.kato.jvmti.javaruntime.model.JObject


      }
     
      // Remove first reference and process.
      long pos = unresolvedReferences.remove(0);
     
      JObject jobj = (JObject) model.getObjectAtAddress(pos);
     
      if (jobj == null) {
        model.putObject(pos, nreadObject(pos));
      }
    }
View Full Code Here


    int numInstanceFields = variablesIn.readInt();
    long offset = variablesIn.getStreamPosition();
    // log.log(Level.FINEST,"objectID " + Long.toHexString(objectID));
    JClass c = nreadClass(classRef);
    log.log(Level.FINEST, "Obj id " + Long.toHexString(objectID));
    JObject obj = model.getObject(classRef, objectID);

    if (obj.isVisited())
      return obj; // Prevent reference loop
    obj.setVisited(true);

    // Calculate how many instance fields the reader can see on the class hierarchy
    int instanceFieldCount = 0;
    JClass superClass = c;
    while (superClass != null) {
      for (JField jf : (List<JField>) superClass.getDeclaredFields()) {
        if (!jf.staticField)
          instanceFieldCount++;
      }
      superClass = model.getClass(superClass.superClassID);
    }

    // Check they match the dump files recoard
    if (numInstanceFields != instanceFieldCount) {
      log.log(Level.FINEST, "Non-matching " + numInstanceFields
          + " found " + instanceFieldCount);
      System.exit(0);
    }

    // Now read in all the references
    long instanceRefs[] = new long[instanceFieldCount];
    variablesIn.seek(offset);
    int countUp = 0;
    while (countUp < instanceFieldCount) {
      instanceRefs[countUp] = variablesIn.readLong();
      countUp++;
    }
    offset = variablesIn.getStreamPosition();


    // Follow the references grabbing the correct jfield for the hierarchy of classes
    int fieldCount = 0;
    int fieldOffset;
    fieldOffset = 0;
    superClass = c;
    while (superClass != null) {
      for (JField jf : (List<JField>) superClass.getDeclaredFields()) {
        if (!jf.staticField) {
          fieldCount++;
          if (instanceRefs[fieldOffset +jf.index] == 0x9999999999999999L){
            log.fine("Error, unwritten reference");
          }
          log.finest("Reading in "+fieldCount);

          long position = instanceRefs[fieldOffset + jf.index];
         
          variablesIn.seek(position);                 
          byte type = variablesIn.readByte();
         
          if (type == CJVMTI_OBJECT) {
            // Don't follow field references. Instead store a "deferred" reference           
            // as the field value,
            JObject refObj = (JObject) model.getObjectAtAddress(position);
           
            if (refObj == null) {
              unresolvedReferences.add(position);
            }           
           
View Full Code Here

    }
    try {
      // log.log(Level.FINEST,"Read at "+Long.toHexString(position));
      variablesIn.seek(position);
      int length = 0;
      JObject obj;
      byte type = variablesIn.readByte();
      switch (type) {
      case CJVMTI_CLASS:
        return nreadClass();
      case CJVMTI_OBJECT:
        return nreadObject();
      case CJVMTI_BYTE:
        return variablesIn.readByte();
      case CJVMTI_CHAR:
        return variablesIn.readChar();
      case CJVMTI_DOUBLE:
        return variablesIn.readDouble();
      case CJVMTI_FLOAT:
        return variablesIn.readFloat();
      case CJVMTI_INT:
        return variablesIn.readInt();
      case CJVMTI_LONG:
        return variablesIn.readLong();
      case CJVMTI_SHORT:
        return variablesIn.readShort();
      case CJVMTI_BOOLEAN:
        return variablesIn.readBoolean();
      case CJVMTI_OBJECT_ARRAY:
        long classType = variablesIn.readLong();
        length = variablesIn.readInt();
        long currentReadPos = variablesIn.getStreamPosition();
        log.log(Level.FINEST, "Object Array " + classType);
        JClass arrayClass = nreadClass(classType);
        variablesIn.seek(currentReadPos);
        JObject objA[] = new JObject[length];
        currentReadPos = variablesIn.getStreamPosition();
        for (int counter = 0; counter < length; counter++) {
          long objReference = variablesIn.readLong();
          if (objReference == CJVMTI_NULL_OBJECT_ARRAY) {
            objA[counter] = (JObject) null;
View Full Code Here

    selfGeneratedIDs++;
    bootJCL = (JClassLoader) model.getSystemClassLoader();
    JClass bootCLC = model.getClass(selfGeneratedIDs);
    bootCLC.classSig = "Ljava/lang/CJVMTISystemClassLoader;";
    JObject bootObj = model.getObject(selfGeneratedIDs, selfGeneratedIDs);
    bootJCL.obj = bootObj;
    // rootJCL.addClass(bootCLC);
    bootCLC.classloader = null;
    readerJCL = bootJCL;
  }
View Full Code Here

TOP

Related Classes of org.apache.kato.jvmti.javaruntime.model.JObject

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.