Mercurial > hg > truffle
diff src/share/vm/utilities/constantTag.cpp @ 1602:136b78722a08
6939203: JSR 292 needs method handle constants
Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode.
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Wed, 09 Jun 2010 18:50:45 -0700 |
parents | c18cbe5936b8 |
children | 083fde3b838e |
line wrap: on
line diff
--- a/src/share/vm/utilities/constantTag.cpp Mon Jun 07 14:17:01 2010 -0700 +++ b/src/share/vm/utilities/constantTag.cpp Wed Jun 09 18:50:45 2010 -0700 @@ -28,56 +28,85 @@ #ifndef PRODUCT void constantTag::print_on(outputStream* st) const { + st->print(internal_name()); +} + +#endif // PRODUCT + +BasicType constantTag::basic_type() const { switch (_tag) { - case JVM_CONSTANT_Class : - st->print("Class"); - break; - case JVM_CONSTANT_Fieldref : - st->print("Field"); - break; - case JVM_CONSTANT_Methodref : - st->print("Method"); - break; - case JVM_CONSTANT_InterfaceMethodref : - st->print("InterfaceMethod"); - break; - case JVM_CONSTANT_String : - st->print("String"); - break; case JVM_CONSTANT_Integer : - st->print("Integer"); - break; + return T_INT; case JVM_CONSTANT_Float : - st->print("Float"); - break; + return T_FLOAT; case JVM_CONSTANT_Long : - st->print("Long"); - break; + return T_LONG; case JVM_CONSTANT_Double : - st->print("Double"); - break; - case JVM_CONSTANT_NameAndType : - st->print("NameAndType"); - break; - case JVM_CONSTANT_Utf8 : - st->print("Utf8"); - break; + return T_DOUBLE; + + case JVM_CONSTANT_Class : + case JVM_CONSTANT_String : case JVM_CONSTANT_UnresolvedClass : - st->print("Unresolved class"); - break; + case JVM_CONSTANT_UnresolvedClassInError : case JVM_CONSTANT_ClassIndex : - st->print("Unresolved class index"); - break; case JVM_CONSTANT_UnresolvedString : - st->print("Unresolved string"); - break; case JVM_CONSTANT_StringIndex : - st->print("Unresolved string index"); - break; + case JVM_CONSTANT_MethodHandle : + case JVM_CONSTANT_MethodType : + case JVM_CONSTANT_Object : + return T_OBJECT; default: ShouldNotReachHere(); - break; + return T_ILLEGAL; } } -#endif // PRODUCT + + +const char* constantTag::internal_name() const { + switch (_tag) { + case JVM_CONSTANT_Invalid : + return "Invalid index"; + case JVM_CONSTANT_Class : + return "Class"; + case JVM_CONSTANT_Fieldref : + return "Field"; + case JVM_CONSTANT_Methodref : + return "Method"; + case JVM_CONSTANT_InterfaceMethodref : + return "InterfaceMethod"; + case JVM_CONSTANT_String : + return "String"; + case JVM_CONSTANT_Integer : + return "Integer"; + case JVM_CONSTANT_Float : + return "Float"; + case JVM_CONSTANT_Long : + return "Long"; + case JVM_CONSTANT_Double : + return "Double"; + case JVM_CONSTANT_NameAndType : + return "NameAndType"; + case JVM_CONSTANT_MethodHandle : + return "MethodHandle"; + case JVM_CONSTANT_MethodType : + return "MethodType"; + case JVM_CONSTANT_Object : + return "Object"; + case JVM_CONSTANT_Utf8 : + return "Utf8"; + case JVM_CONSTANT_UnresolvedClass : + return "Unresolved Class"; + case JVM_CONSTANT_UnresolvedClassInError : + return "Unresolved Class Error"; + case JVM_CONSTANT_ClassIndex : + return "Unresolved Class Index"; + case JVM_CONSTANT_UnresolvedString : + return "Unresolved String"; + case JVM_CONSTANT_StringIndex : + return "Unresolved String Index"; + default: + ShouldNotReachHere(); + return "Illegal"; + } +}