< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/BasicType.java
Print this page
*** 22,158 ****
*
*/
package sun.jvm.hotspot.runtime;
/** Encapsulates the BasicType enum in globalDefinitions.hpp in the
VM. */
public class BasicType {
! public static final int tBoolean = 4;
! public static final int tChar = 5;
! public static final int tFloat = 6;
! public static final int tDouble = 7;
! public static final int tByte = 8;
! public static final int tShort = 9;
! public static final int tInt = 10;
! public static final int tLong = 11;
! public static final int tObject = 12;
! public static final int tArray = 13;
! public static final int tVoid = 14;
! public static final int tAddress = 15;
! public static final int tNarrowOop = 16;
! public static final int tMetadata = 17;
! public static final int tNarrowKlass = 18;
! public static final int tConflict = 19;
! public static final int tIllegal = 99;
!
! public static final BasicType T_BOOLEAN = new BasicType(tBoolean);
! public static final BasicType T_CHAR = new BasicType(tChar);
! public static final BasicType T_FLOAT = new BasicType(tFloat);
! public static final BasicType T_DOUBLE = new BasicType(tDouble);
! public static final BasicType T_BYTE = new BasicType(tByte);
! public static final BasicType T_SHORT = new BasicType(tShort);
! public static final BasicType T_INT = new BasicType(tInt);
! public static final BasicType T_LONG = new BasicType(tLong);
! public static final BasicType T_OBJECT = new BasicType(tObject);
! public static final BasicType T_ARRAY = new BasicType(tArray);
! public static final BasicType T_VOID = new BasicType(tVoid);
! public static final BasicType T_ADDRESS = new BasicType(tAddress);
! public static final BasicType T_NARROWOOP = new BasicType(tNarrowOop);
! public static final BasicType T_METADATA = new BasicType(tMetadata);
! public static final BasicType T_NARROWKLASS = new BasicType(tNarrowKlass);
! public static final BasicType T_CONFLICT = new BasicType(tConflict);
! public static final BasicType T_ILLEGAL = new BasicType(tIllegal);
public static int getTBoolean() {
! return tBoolean;
}
public static int getTChar() {
! return tChar;
}
public static int getTFloat() {
! return tFloat;
}
public static int getTDouble() {
! return tDouble;
}
public static int getTByte() {
! return tByte;
}
public static int getTShort() {
! return tShort;
}
public static int getTInt() {
! return tInt;
}
public static int getTLong() {
! return tLong;
}
public static int getTObject() {
! return tObject;
}
public static int getTArray() {
! return tArray;
}
public static int getTVoid() {
! return tVoid;
}
public static int getTAddress() {
! return tAddress;
}
public static int getTNarrowOop() {
! return tNarrowOop;
}
public static int getTMetadata() {
! return tMetadata;
}
public static int getTNarrowKlass() {
! return tNarrowKlass;
}
/** For stack value type with conflicting contents */
public static int getTConflict() {
! return tConflict;
}
public static int getTIllegal() {
! return tIllegal;
}
public static BasicType intToBasicType(int i) {
! switch(i) {
! case tBoolean: return T_BOOLEAN;
! case tChar: return T_CHAR;
! case tFloat: return T_FLOAT;
! case tDouble: return T_DOUBLE;
! case tByte: return T_BYTE;
! case tShort: return T_SHORT;
! case tInt: return T_INT;
! case tLong: return T_LONG;
! case tObject: return T_OBJECT;
! case tArray: return T_ARRAY;
! case tVoid: return T_VOID;
! case tAddress: return T_ADDRESS;
! case tNarrowOop: return T_NARROWOOP;
! case tMetadata: return T_METADATA;
! case tNarrowKlass: return T_NARROWKLASS;
! default: return T_ILLEGAL;
}
}
public static BasicType charToBasicType(char c) {
switch( c ) {
--- 22,184 ----
*
*/
package sun.jvm.hotspot.runtime;
+ import java.util.Observer;
+ import sun.jvm.hotspot.types.TypeDataBase;
+
+
/** Encapsulates the BasicType enum in globalDefinitions.hpp in the
VM. */
public class BasicType {
! public static final BasicType T_BOOLEAN = new BasicType();
! public static final BasicType T_CHAR = new BasicType();
! public static final BasicType T_FLOAT = new BasicType();
! public static final BasicType T_DOUBLE = new BasicType();
! public static final BasicType T_BYTE = new BasicType();
! public static final BasicType T_SHORT = new BasicType();
! public static final BasicType T_INT = new BasicType();
! public static final BasicType T_LONG = new BasicType();
! public static final BasicType T_OBJECT = new BasicType();
! public static final BasicType T_ARRAY = new BasicType();
! public static final BasicType T_VOID = new BasicType();
! public static final BasicType T_ADDRESS = new BasicType();
! public static final BasicType T_NARROWOOP = new BasicType();
! public static final BasicType T_METADATA = new BasicType();
! public static final BasicType T_NARROWKLASS = new BasicType();
! public static final BasicType T_CONFLICT = new BasicType();
! public static final BasicType T_ILLEGAL = new BasicType();
!
! static {
! VM.registerVMInitializedObserver(
! (o, d) -> initialize(VM.getVM().getTypeDataBase()));
! }
!
! private static synchronized void initialize(TypeDataBase db) {
! T_BOOLEAN.setType(db.lookupIntConstant("T_BOOLEAN").intValue());
! T_CHAR.setType(db.lookupIntConstant("T_CHAR").intValue());
! T_FLOAT.setType(db.lookupIntConstant("T_FLOAT").intValue());
! T_DOUBLE.setType(db.lookupIntConstant("T_DOUBLE").intValue());
! T_BYTE.setType(db.lookupIntConstant("T_BYTE").intValue());
! T_SHORT.setType(db.lookupIntConstant("T_SHORT").intValue());
! T_INT.setType(db.lookupIntConstant("T_INT").intValue());
! T_LONG.setType(db.lookupIntConstant("T_LONG").intValue());
! T_OBJECT.setType(db.lookupIntConstant("T_OBJECT").intValue());
! T_ARRAY.setType(db.lookupIntConstant("T_ARRAY").intValue());
! T_VOID.setType(db.lookupIntConstant("T_VOID").intValue());
! T_ADDRESS.setType(db.lookupIntConstant("T_ADDRESS").intValue());
! T_NARROWOOP.setType(db.lookupIntConstant("T_NARROWOOP").intValue());
! T_METADATA.setType(db.lookupIntConstant("T_METADATA").intValue());
! T_NARROWKLASS.setType(db.lookupIntConstant("T_NARROWKLASS").intValue());
! T_CONFLICT.setType(db.lookupIntConstant("T_CONFLICT").intValue());
! T_ILLEGAL.setType(db.lookupIntConstant("T_ILLEGAL").intValue());
! }
public static int getTBoolean() {
! return T_BOOLEAN.getType();
}
public static int getTChar() {
! return T_CHAR.getType();
}
public static int getTFloat() {
! return T_FLOAT.getType();
}
public static int getTDouble() {
! return T_DOUBLE.getType();
}
public static int getTByte() {
! return T_BYTE.getType();
}
public static int getTShort() {
! return T_SHORT.getType();
}
public static int getTInt() {
! return T_INT.getType();
}
public static int getTLong() {
! return T_LONG.getType();
}
public static int getTObject() {
! return T_OBJECT.getType();
}
public static int getTArray() {
! return T_ARRAY.getType();
}
public static int getTVoid() {
! return T_VOID.getType();
}
public static int getTAddress() {
! return T_ADDRESS.getType();
}
public static int getTNarrowOop() {
! return T_NARROWOOP.getType();
}
public static int getTMetadata() {
! return T_METADATA.getType();
}
public static int getTNarrowKlass() {
! return T_NARROWKLASS.getType();
}
/** For stack value type with conflicting contents */
public static int getTConflict() {
! return T_CONFLICT.getType();
}
public static int getTIllegal() {
! return T_ILLEGAL.getType();
}
public static BasicType intToBasicType(int i) {
! if (i == T_BOOLEAN.getType()) {
! return T_BOOLEAN;
! } else if (i == T_CHAR.getType()) {
! return T_CHAR;
! } else if (i == T_FLOAT.getType()) {
! return T_FLOAT;
! } else if (i == T_DOUBLE.getType()) {
! return T_DOUBLE;
! } else if (i == T_BYTE.getType()) {
! return T_BYTE;
! } else if (i == T_SHORT.getType()) {
! return T_SHORT;
! } else if (i == T_INT.getType()) {
! return T_INT;
! } else if (i == T_LONG.getType()) {
! return T_LONG;
! } else if (i == T_OBJECT.getType()) {
! return T_OBJECT;
! } else if (i == T_ARRAY.getType()) {
! return T_ARRAY;
! } else if (i == T_VOID.getType()) {
! return T_VOID;
! } else if (i == T_ADDRESS.getType()) {
! return T_ADDRESS;
! } else if (i == T_NARROWOOP.getType()) {
! return T_NARROWOOP;
! } else if (i == T_METADATA.getType()) {
! return T_METADATA;
! } else if (i == T_NARROWKLASS.getType()) {
! return T_NARROWKLASS;
! } else {
! return T_ILLEGAL;
}
}
public static BasicType charToBasicType(char c) {
switch( c ) {
*** 173,210 ****
public static int charToType(char c) {
return charToBasicType(c).getType();
}
public int getType() {
return type;
}
public String getName() {
! switch (type) {
! case tBoolean: return "boolean";
! case tChar: return "char";
! case tFloat: return "float";
! case tDouble: return "double";
! case tByte: return "byte";
! case tShort: return "short";
! case tInt: return "int";
! case tLong: return "long";
! case tObject: return "object";
! case tArray: return "array";
! case tVoid: return "void";
! case tAddress: return "address";
! case tNarrowOop: return "narrow oop";
! case tMetadata: return "metadata";
! case tNarrowKlass: return "narrow klass";
! case tConflict: return "conflict";
! default: return "ILLEGAL TYPE";
}
}
//-- Internals only below this point
! private BasicType(int type) {
! this.type = type;
}
private int type;
}
--- 199,255 ----
public static int charToType(char c) {
return charToBasicType(c).getType();
}
+ private void setType(int type) {
+ this.type = type;
+ }
+
public int getType() {
return type;
}
public String getName() {
! if (type == T_BOOLEAN.getType()) {
! return "boolean";
! } else if (type == T_CHAR.getType()) {
! return "char";
! } else if (type == T_FLOAT.getType()) {
! return "float";
! } else if (type == T_DOUBLE.getType()) {
! return "double";
! } else if (type == T_BYTE.getType()) {
! return "byte";
! } else if (type == T_SHORT.getType()) {
! return "short";
! } else if (type == T_INT.getType()) {
! return "int";
! } else if (type == T_LONG.getType()) {
! return "long";
! } else if (type == T_OBJECT.getType()) {
! return "object";
! } else if (type == T_ARRAY.getType()) {
! return "array";
! } else if (type == T_VOID.getType()) {
! return "void";
! } else if (type == T_ADDRESS.getType()) {
! return "address";
! } else if (type == T_NARROWOOP.getType()) {
! return "narrow oop";
! } else if (type == T_METADATA.getType()) {
! return "metadata";
! } else if (type == T_NARROWKLASS.getType()) {
! return "narrow klass";
! } else if (type == T_CONFLICT.getType()) {
! return "conflict";
! } else {
! return "ILLEGAL TYPE";
}
}
//-- Internals only below this point
! private BasicType() {
}
private int type;
}
< prev index next >