Mercurial > hg > graal-jvmci-8
diff agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java @ 3838:6a991dcb52bb
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
Reviewed-by: kvn, twisti, jrose
author | never |
---|---|
date | Thu, 21 Jul 2011 08:38:25 -0700 |
parents | ed69575596ac |
children | da91efe96a93 |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Wed Jul 20 18:04:17 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Thu Jul 21 08:38:25 2011 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,31 +24,33 @@ package sun.jvm.hotspot.utilities; +import sun.jvm.hotspot.runtime.BasicType; + public class ConstantTag { // These replicated from the VM to save space - private static int JVM_CONSTANT_Utf8 = 1; - private static int JVM_CONSTANT_Unicode = 2; // unused - private static int JVM_CONSTANT_Integer = 3; - private static int JVM_CONSTANT_Float = 4; - private static int JVM_CONSTANT_Long = 5; - private static int JVM_CONSTANT_Double = 6; - private static int JVM_CONSTANT_Class = 7; - private static int JVM_CONSTANT_String = 8; - private static int JVM_CONSTANT_Fieldref = 9; - private static int JVM_CONSTANT_Methodref = 10; - private static int JVM_CONSTANT_InterfaceMethodref = 11; - private static int JVM_CONSTANT_NameAndType = 12; - private static int JVM_CONSTANT_MethodHandle = 15; // JSR 292 - private static int JVM_CONSTANT_MethodType = 16; // JSR 292 - // static int JVM_CONSTANT_(unused) = 17; // JSR 292 early drafts only - private static int JVM_CONSTANT_InvokeDynamic = 18; // JSR 292 - private static int JVM_CONSTANT_Invalid = 0; // For bad value initialization - private static int JVM_CONSTANT_UnresolvedClass = 100; // Temporary tag until actual use - private static int JVM_CONSTANT_ClassIndex = 101; // Temporary tag while constructing constant pool - private static int JVM_CONSTANT_UnresolvedString = 102; // Temporary tag until actual use - private static int JVM_CONSTANT_StringIndex = 103; // Temporary tag while constructing constant pool - private static int JVM_CONSTANT_UnresolvedClassInError = 104; // Resolution failed - private static int JVM_CONSTANT_Object = 105; // Required for BoundMethodHandle arguments. + private static final int JVM_CONSTANT_Utf8 = 1; + private static final int JVM_CONSTANT_Unicode = 2; // unused + private static final int JVM_CONSTANT_Integer = 3; + private static final int JVM_CONSTANT_Float = 4; + private static final int JVM_CONSTANT_Long = 5; + private static final int JVM_CONSTANT_Double = 6; + private static final int JVM_CONSTANT_Class = 7; + private static final int JVM_CONSTANT_String = 8; + private static final int JVM_CONSTANT_Fieldref = 9; + private static final int JVM_CONSTANT_Methodref = 10; + private static final int JVM_CONSTANT_InterfaceMethodref = 11; + private static final int JVM_CONSTANT_NameAndType = 12; + private static final int JVM_CONSTANT_MethodHandle = 15; // JSR 292 + private static final int JVM_CONSTANT_MethodType = 16; // JSR 292 + // static final int JVM_CONSTANT_(unused) = 17; // JSR 292 early drafts only + private static final int JVM_CONSTANT_InvokeDynamic = 18; // JSR 292 + private static final int JVM_CONSTANT_Invalid = 0; // For bad value initialization + private static final int JVM_CONSTANT_UnresolvedClass = 100; // Temporary tag until actual use + private static final int JVM_CONSTANT_ClassIndex = 101; // Temporary tag while constructing constant pool + private static final int JVM_CONSTANT_UnresolvedString = 102; // Temporary tag until actual use + private static final int JVM_CONSTANT_StringIndex = 103; // Temporary tag while constructing constant pool + private static final int JVM_CONSTANT_UnresolvedClassInError = 104; // Resolution failed + private static final int JVM_CONSTANT_Object = 105; // Required for BoundMethodHandle arguments. // JVM_CONSTANT_MethodHandle subtypes //FIXME: connect these to data structure private static int JVM_REF_getField = 1; @@ -99,4 +101,31 @@ public boolean isKlassReference() { return isKlassIndex() || isUnresolvedKlass(); } public boolean isFieldOrMethod() { return isField() || isMethod() || isInterfaceMethod(); } public boolean isSymbol() { return isUtf8(); } + + public BasicType basicType() { + switch (tag) { + case JVM_CONSTANT_Integer : + return BasicType.T_INT; + case JVM_CONSTANT_Float : + return BasicType.T_FLOAT; + case JVM_CONSTANT_Long : + return BasicType.T_LONG; + case JVM_CONSTANT_Double : + return BasicType.T_DOUBLE; + + case JVM_CONSTANT_Class : + case JVM_CONSTANT_String : + case JVM_CONSTANT_UnresolvedClass : + case JVM_CONSTANT_UnresolvedClassInError : + case JVM_CONSTANT_ClassIndex : + case JVM_CONSTANT_UnresolvedString : + case JVM_CONSTANT_StringIndex : + case JVM_CONSTANT_MethodHandle : + case JVM_CONSTANT_MethodType : + case JVM_CONSTANT_Object : + return BasicType.T_OBJECT; + default: + throw new InternalError("unexpected tag: " + tag); + } + } }