当前位置: 首页>>代码示例>>Java>>正文


Java CID类代码示例

本文整理汇总了Java中com.sun.squawk.vm.CID的典型用法代码示例。如果您正苦于以下问题:Java CID类的具体用法?Java CID怎么用?Java CID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CID类属于com.sun.squawk.vm包,在下文中一共展示了CID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Suite

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
     * Creates a new <code>Suite</code> instance.
     *
     * @param  name        the name of the suite
     * @param  parent      suite whose classes are linked to by the classes of this suite
     */
    Suite(String name, Suite parent, int type) {
        this.name = name;
        this.parent = parent;
/*if[BOOTSTRAP_SUITE_ONLY]*/
		int count = CID.LAST_SYSTEM_ID + 1;
/*else[BOOTSTRAP_SUITE_ONLY]*/
//        int count = (isBootstrap() ? CID.LAST_SYSTEM_ID + 1 : 0);
/*end[BOOTSTRAP_SUITE_ONLY]*/
        classes = new Klass[count];
        metadatas = new KlassMetadata[0];
        resourceFiles = new ResourceFile[0];
		manifestProperties = new ManifestProperty [0];
        if (type < 0 || type > METADATA) {
            throw new IllegalArgumentException("type: " + type);
        }
        this.type = type;
        this.configuration = "complete symbolic information available";
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:25,代码来源:Suite.java

示例2: getLocalTypeFor

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Gets the type of a local variable that is used to store a value of a
 * given class. This method partitions all classes into one of the
 * following categories:
 * <p><blockquote><pre>
 *
 *     Local Variable Type  |  Types
 *     ---------------------+-------
 *     INT                  | boolean, byte, short, int
 *     FLOAT                | float
 *     LONG                 | long
 *     DOUBLE               | double
 *     ADDRESS              | Address
 *     UWORD                | UWord
 *     OFFSET               | Offset
 *     REFERENCE            | types in java.lang.Object hierarchy
 *
 * </pre></blockquote><p>
 *
 * @param   type   the type of a value that will be stored in a local variable
 * @return  the local variable type for storing values of type <code>type</code>
 */
public static Klass getLocalTypeFor(Klass type) {
    switch (type.getSystemID()) {
        case CID.BOOLEAN:
        case CID.BYTE:
        case CID.SHORT:
        case CID.CHAR:
        case CID.INT: {
            return Klass.INT;
        }
        case CID.FLOAT:
        case CID.LONG:
        case CID.DOUBLE: {
            return type;
        }
        case CID.UWORD:
        case CID.OFFSET:
        case CID.ADDRESS: {
            return type;
        }
        default: {
            Assert.that(Klass.REFERENCE.isAssignableFrom(type));
            return Klass.REFERENCE;
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:48,代码来源:Frame.java

示例3: toString

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Gets a string representation for the local variable. The value returned
 * will have the prefix "loc" for a javac local variable and the prefix "tmp" for
 * a stack local variable. The suffix indicates the type of the local variable.
 *
 * @return a string representation of the local variable
 */
public String toString() {
    String suffix;
    switch (type.getSystemID()) {
        case CID.INT:       suffix = "_i";  break;
        case CID.FLOAT:     suffix = "_f";  break;
        case CID.LONG:      suffix = "_l";  break;
        case CID.DOUBLE:    suffix = "_d";  break;
        default:            suffix = "_o";  break;
    }
    if (isParameter()) {
        return "parm" + getSquawkParameterIndex() + suffix;
    }
    if (slot != null) {
        int ndx = getSquawkLocalIndex();
        if (ndx >= 0) {
            suffix += " (slot " + ndx + ")";
        }
    }
    if (javacIndex < 0) {
        return "tmp" + (0-javacIndex) + suffix;
    } else {
        return "loc" +    javacIndex  + suffix;
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:32,代码来源:Local.java

示例4: getFieldConstantValue

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Gets the object corresponding to the ConstantValue attribute for a field
 * if it has one.
 *
 * @param   fieldType the type of the field currently being loaded
 * @param   constantValueIndex the index of the ConstantValue attribute
 * @return  the value of the ConstantValue attribute or null if there is
 *                    no such attribute
 */
private Object getFieldConstantValue(Klass fieldType, int constantValueIndex) {
    if (constantValueIndex != 0) {
        /*
         * Verify that the initial value is of the right klass for the field
         */
        switch (fieldType.getSystemID()) {
            case CID.LONG:    return pool.getEntry(constantValueIndex, ConstantPool.CONSTANT_Long);
            case CID.FLOAT:   return pool.getEntry(constantValueIndex, ConstantPool.CONSTANT_Float);
            case CID.DOUBLE:  return pool.getEntry(constantValueIndex, ConstantPool.CONSTANT_Double);
            case CID.INT:     // fall through ...
            case CID.SHORT:   // fall through ...
            case CID.CHAR:    // fall through ...
            case CID.BYTE:    // fall through ...
            case CID.BOOLEAN: return pool.getEntry(constantValueIndex, ConstantPool.CONSTANT_Integer);
            case CID.STRING:  return pool.getEntry(constantValueIndex, ConstantPool.CONSTANT_String);
            default:          throw cfr.formatError("invalid ConstantValue attribute value");
        }
    } else {
        return null;
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:31,代码来源:ClassFileLoader.java

示例5: setString

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Copy string value to the location at <code>offset</code>. Convert the data in <code>value</code> to a
 * NULL-terminated C string, converted to native encoding.
 * 
 * @param offset the byte offset of the c string from the base of this pointer
 * @param value the string to copy
 */
public final void setString(int offset, String value) {
    // optimize for 8-bit strings.
    if (GC.getKlass(value).getSystemID() == CID.STRING_OF_BYTES) {
        int len = value.length();
        checkMultiWrite(offset, len + 1, 1);
        VM.setData(getAddress(), offset, value, 0, len, 1);
        setByte((long) len, (byte) 0); // null terminate   
    } else {
        setString(offset, value.getBytes());
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:19,代码来源:Pointer.java

示例6: serializeFields

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Serialize the symbolic information for a set of fields into a byte buffer.
 *
 * @param category the category of the fields (must be INSTANCE_FIELDS or STATIC_FIELDS).
 * @param fields   the set of fields to serialize
 * @param types    the collection to which the types in the signatures of the fields should be added
 */
private static void serializeFields(int category, ClassFileField[] fields, SquawkVector types) {
    Assert.that(category == INSTANCE_FIELDS || category == STATIC_FIELDS);
    if (fields.length != 0) {
        symbolsBuffer.addUnsignedByte(category);
        for (int i = 0; i != fields.length; ++i) {
            ClassFileField field = fields[i];
            int modifiers = field.getModifiers();
            Klass type = field.getType();
            membersBuffer.reset();
            membersBuffer.addUnsignedShort(modifiers);
            membersBuffer.addUnsignedShort(field.getOffset());
            membersBuffer.addUtf8(field.getName());
            membersBuffer.addUnsignedShort(KlassMetadata.addSignatureType(types, type));
            if (Modifier.hasConstant(modifiers)) {
                if (type.getSystemID() == CID.STRING) {
                    membersBuffer.addUtf8(((ClassFileConstantField)field).stringConstantValue);
                } else {
                    long value = ((ClassFileConstantField)field).primitiveConstantValue;
                    int dataSize = type.getDataSize();
                    for (int bite = 0; bite != dataSize; ++bite) {
                        membersBuffer.addUnencodedByte((byte)value);
                        value = value >> 8;
                    }
                }
            }
            symbolsBuffer.add(membersBuffer);
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:37,代码来源:SymbolParser.java

示例7: getPrimitiveConstantValue

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
     * Gets the constant value of a primitive static field.
     *
     * @return the constant value of this primitive static field
     */
    public long getPrimitiveConstantValue() {
        Assert.that(Modifier.hasConstant(modifiers));
        pos = signatureStart;
        int id = getSignatureType(readTypeID()).getSystemID();
        int dataSize = (signatureCount - 1);
        Assert.that(dataSize > 0);
        long value = 0;
        for (int bite = 0; bite != dataSize; ++bite) {
            int shift = bite * 8;
            long b = nextByte() & 0xFF;
            value |= (b << shift);
        }
        switch (id) {
            case CID.BOOLEAN:
            case CID.BYTE:    return (byte)value;
            case CID.CHAR:    return (char)value;
            case CID.SHORT:   return (short)value;
/*if[FLOATS]*/
            case CID.FLOAT:
/*end[FLOATS]*/
            case CID.INT:     return (int)value;
/*if[FLOATS]*/
            case CID.DOUBLE:
/*end[FLOATS]*/
            case CID.LONG:  return value;
            default:
                Assert.shouldNotReachHere(
/*if[DEBUG_CODE_ENABLED]*/
                                            "id = " + id
/*end[DEBUG_CODE_ENABLED]*/
                        );
                return 0;
        }
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:40,代码来源:SymbolParser.java

示例8: getStringConstantValue

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Gets the constant value of a String static field.
 *
 * @return the constant value of this String static field
 */
public String getStringConstantValue() {
    Assert.that(Modifier.hasConstant(modifiers));
    pos = signatureStart;
    int id = readTypeID();
    Assert.that(getSignatureType(id).getSystemID() == CID.STRING);
    return readUtf8();
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:13,代码来源:SymbolParser.java

示例9: Suite

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
   * Creates a new <code>Suite</code> instance.
   *
   * @param  name        the name of the suite
   * @param  parent      suite whose classes are linked to by the classes of this suite
   */
  Suite(String name, Suite parent, int type) {
      this.name = name;
      this.parent = parent;
      int count = (isBootstrap() ? CID.LAST_SYSTEM_ID + 1 : 0);
      classes = new Klass[count];
      metadatas = new KlassMetadata[0];
      resourceFiles = new ResourceFile[0];
manifestProperties = new ManifestProperty [0];
      if (type < 0 || type > METADATA) {
          throw new IllegalArgumentException("type: " + type);
      }
      this.type = type;
      this.configuration = "complete symbolic information available";
  }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:21,代码来源:Suite.java

示例10: verifyNonSquawkPrimitive

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Make sure actualType is NOT a Squawk Primitive (Address, UWord, etc) being passed as a parameter of type Object.
 * 
 * @param callee
 * @param actualType
 * @param expectedType
 */
private void verifyNonSquawkPrimitive(Method callee, Klass actualType, Klass expectedType) {
    if (actualType.isSquawkPrimitive() && (actualType != expectedType)) {
        Klass definingClass = callee.getDefiningClass();
        if (expectedType.getSystemID() == CID.OBJECT 
                && (definingClass.getSystemID() == CID.NATIVEUNSAFE || definingClass.getInternalName().equals("com.sun.squawk.GC"))) {
            return; // NATIVEUNSAFE and GC methods are passed objects and addresses interchangably.
        }
        
        System.err.println("name: " + definingClass.getInternalName());
        String type = actualType.getName();
        throw codeParser.verifyError("In call to " + callee + ", " + type + " values can only be passsed as parameters of type " +
                type + " not as type " + expectedType.getName());
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:22,代码来源:IRBuilder.java

示例11: serializeFields

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Serialize the symbolic information for a set of fields into a byte buffer.
 *
 * @param category the category of the fields (must be INSTANCE_FIELDS or STATIC_FIELDS).
 * @param fields   the set of fields to serialize
 * @param types    the collection to which the types in the signatures of the fields should be added
 */
private static void serializeFields(int category, ClassFileField[] fields, SquawkVector types) {
    if (false) Assert.that(category == INSTANCE_FIELDS || category == STATIC_FIELDS);
    if (fields.length != 0) {
        symbolsBuffer.addUnsignedByte(category);
        for (int i = 0; i != fields.length; ++i) {
            ClassFileField field = fields[i];
            int modifiers = field.getModifiers();
            Klass type = field.getType();
            membersBuffer.reset();
            membersBuffer.addUnsignedShort(modifiers);
            membersBuffer.addUnsignedShort(field.getOffset());
            membersBuffer.addUtf8(field.getName());
            membersBuffer.addUnsignedShort(KlassMetadata.addSignatureType(types, type));
            if (Modifier.hasConstant(modifiers)) {
                if (type.getSystemID() == CID.STRING) {
                    membersBuffer.addUtf8(((ClassFileConstantField)field).stringConstantValue);
                } else {
                    long value = ((ClassFileConstantField)field).primitiveConstantValue;
                    int dataSize = type.getDataSize();
                    for (int bite = 0; bite != dataSize; ++bite) {
                        membersBuffer.addUnencodedByte((byte)value);
                        value = value >> 8;
                    }
                }
            }
            symbolsBuffer.add(membersBuffer);
        }
    }
}
 
开发者ID:sics-sse,项目名称:moped,代码行数:37,代码来源:SymbolParser.java

示例12: getPrimitiveConstantValue

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
     * Gets the constant value of a primitive static field.
     *
     * @return the constant value of this primitive static field
     */
    public long getPrimitiveConstantValue() {
        if (false) Assert.that(Modifier.hasConstant(modifiers));
        pos = signatureStart;
        int id = getSignatureType(readTypeID()).getSystemID();
        int dataSize = (signatureCount - 1);
        if (false) Assert.that(dataSize > 0);
        long value = 0;
        for (int bite = 0; bite != dataSize; ++bite) {
            int shift = bite * 8;
            long b = nextByte() & 0xFF;
            value |= (b << shift);
        }
        switch (id) {
            case CID.BOOLEAN:
            case CID.BYTE:    return (byte)value;
            case CID.CHAR:    return (char)value;
            case CID.SHORT:   return (short)value;

            case CID.FLOAT:

            case CID.INT:     return (int)value;

            case CID.DOUBLE:

            case CID.LONG:  return value;
            default:
                if (Assert.SHOULD_NOT_REACH_HERE_ALWAYS_ENABLED) Assert.shouldNotReachHere(

//                                            "id = " + id

                        );
                return 0;
        }
    }
 
开发者ID:sics-sse,项目名称:moped,代码行数:40,代码来源:SymbolParser.java

示例13: getStringConstantValue

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
 * Gets the constant value of a String static field.
 *
 * @return the constant value of this String static field
 */
public String getStringConstantValue() {
    if (false) Assert.that(Modifier.hasConstant(modifiers));
    pos = signatureStart;
    int id = readTypeID();
    if (false) Assert.that(getSignatureType(id).getSystemID() == CID.STRING);
    return readUtf8();
}
 
开发者ID:sics-sse,项目名称:moped,代码行数:13,代码来源:SymbolParser.java

示例14: opc_getstatic

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
     * Processes an instruction that pushes the value of a static field to
     * the operand stack.
     *
     * @param field  the referenced field
     */
    private void opc_getstatic(Field field) {
        if (field.hasConstant()) {
            if (VM.getCurrentIsolate().getLeafSuite().contains(field.getDefiningClass())) {
                // Class structure can be modified so set the flag indicating that it
                // should reify its constant fields when it is initialized.
            	// Assume that a class defined in another suite is NOT modifiable.
                field.getDefiningClass().updateModifiers(Modifier.COMPLETE_RUNTIME_STATICS);
            } else {
                // The Class object is read-only so replace 'getstatic' with
                // the appropriate load constant instruction
                if (field.getType().isPrimitive()) {
                    long value = field.getPrimitiveConstantValue();
                    switch (field.getType().getSystemID()) {
                        case CID.BYTE:
                        case CID.BOOLEAN:
                        case CID.SHORT:
                        case CID.CHAR:
                        case CID.INT: {
                            append(new ConstantInt(new Integer((int)value)));
                            return;
                        }
                        case CID.LONG:  {
                            append(new ConstantLong(new Long(value)));
                            return;
                        }
/*if[FLOATS]*/
                        case CID.FLOAT: {
                            append(new ConstantFloat(new Float(Float.intBitsToFloat((int)value))));
                            return;
                        }
                        case CID.DOUBLE: {
                            append(new ConstantDouble(new Double(Double.longBitsToDouble(value))));
                            return;
                        }
/*else[FLOATS]*/
//                          case CID.FLOAT:
//                          case CID.DOUBLE:
//                              Assert.shouldNotReachHere("floats not supported");
/*end[FLOATS]*/
                        default:
                            throw Assert.shouldNotReachHere();
                    }
                } else {
                    append(new ConstantObject(Klass.STRING, field.getStringConstantValue()));
                    return;
                }
            }
        }

        // java   getstatic stack ops: ... -> value (stack usage: 1)
        // squawk getstatic stack ops: ... -> value, or class_object -> value  (stack usage: 1)
        // so should not change max stack.

        GetStatic instruction = new GetStatic(field);
        append(instruction);
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:63,代码来源:IRBuilder.java

示例15: opc_getstatic

import com.sun.squawk.vm.CID; //导入依赖的package包/类
/**
     * Processes an instruction that pushes the value of a static field to
     * the operand stack.
     *
     * @param field  the referenced field
     */
    private void opc_getstatic(Field field) {
        if (field.hasConstant()) {
            if (VM.getCurrentIsolate().getLeafSuite().contains(field.getDefiningClass())) {
                // Class structure can be modified so set the flag indicating that it
                // should reify its constant fields when it is initialized.
            	// Assume that a class defined in another suite is NOT modifiable.
                field.getDefiningClass().updateModifiers(Modifier.COMPLETE_RUNTIME_STATICS);
            } else {
                // The Class object is read-only so replace 'getstatic' with
                // the appropriate load constant instruction
                if (field.getType().isPrimitive()) {
                    long value = field.getPrimitiveConstantValue();
                    switch (field.getType().getSystemID()) {
                        case CID.BYTE:
                        case CID.BOOLEAN:
                        case CID.SHORT:
                        case CID.CHAR:
                        case CID.INT: {
                            append(new ConstantInt(new Integer((int)value)));
                            return;
                        }
                        case CID.LONG:  {
                            append(new ConstantLong(new Long(value)));
                            return;
                        }

                        case CID.FLOAT: {
                            append(new ConstantFloat(new Float(Float.intBitsToFloat((int)value))));
                            return;
                        }
                        case CID.DOUBLE: {
                            append(new ConstantDouble(new Double(Double.longBitsToDouble(value))));
                            return;
                        }

////                          case CID.FLOAT:
////                          case CID.DOUBLE:
////                              Assert.shouldNotReachHere("floats not supported");

                        default:
                            throw Assert.shouldNotReachHere();
                    }
                } else {
                    append(new ConstantObject(Klass.STRING, field.getStringConstantValue()));
                    return;
                }
            }
        }

        // java   getstatic stack ops: ... -> value (stack usage: 1)
        // squawk getstatic stack ops: ... -> value, or class_object -> value  (stack usage: 1)
        // so should not change max stack.

        GetStatic instruction = new GetStatic(field);
        append(instruction);
    }
 
开发者ID:sics-sse,项目名称:moped,代码行数:63,代码来源:IRBuilder.java


注:本文中的com.sun.squawk.vm.CID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。