本文整理汇总了Java中com.sun.squawk.vm.CID.LONG属性的典型用法代码示例。如果您正苦于以下问题:Java CID.LONG属性的具体用法?Java CID.LONG怎么用?Java CID.LONG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.squawk.vm.CID
的用法示例。
在下文中一共展示了CID.LONG属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLocalTypeFor
/**
* 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;
}
}
}
示例2: toString
/**
* 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;
}
}
示例3: getFieldConstantValue
/**
* 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;
}
}
示例4: getPrimitiveConstantValue
/**
* 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;
}
}
示例5: getPrimitiveConstantValue
/**
* 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;
}
}
示例6: opc_getstatic
/**
* 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);
}
示例7: opc_getstatic
/**
* 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);
}