duke@435: /* stefank@2314: * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #include "precompiled.hpp" stefank@2314: #include "utilities/constantTag.hpp" duke@435: duke@435: #ifndef PRODUCT duke@435: duke@435: void constantTag::print_on(outputStream* st) const { jrose@1957: st->print(internal_name()); jrose@1957: } jrose@1957: jrose@1957: #endif // PRODUCT jrose@1957: jrose@1957: BasicType constantTag::basic_type() const { duke@435: switch (_tag) { jrose@1957: case JVM_CONSTANT_Integer : jrose@1957: return T_INT; jrose@1957: case JVM_CONSTANT_Float : jrose@1957: return T_FLOAT; jrose@1957: case JVM_CONSTANT_Long : jrose@1957: return T_LONG; jrose@1957: case JVM_CONSTANT_Double : jrose@1957: return T_DOUBLE; jrose@1957: duke@435: case JVM_CONSTANT_Class : duke@435: case JVM_CONSTANT_String : duke@435: case JVM_CONSTANT_UnresolvedClass : jrose@1957: case JVM_CONSTANT_UnresolvedClassInError : duke@435: case JVM_CONSTANT_ClassIndex : duke@435: case JVM_CONSTANT_UnresolvedString : duke@435: case JVM_CONSTANT_StringIndex : jrose@1957: case JVM_CONSTANT_MethodHandle : jrose@1957: case JVM_CONSTANT_MethodType : jrose@1957: case JVM_CONSTANT_Object : jrose@1957: return T_OBJECT; duke@435: default: duke@435: ShouldNotReachHere(); jrose@1957: return T_ILLEGAL; duke@435: } duke@435: } duke@435: jrose@1957: jrose@1957: jrose@1957: const char* constantTag::internal_name() const { jrose@1957: switch (_tag) { jrose@1957: case JVM_CONSTANT_Invalid : jrose@1957: return "Invalid index"; jrose@1957: case JVM_CONSTANT_Class : jrose@1957: return "Class"; jrose@1957: case JVM_CONSTANT_Fieldref : jrose@1957: return "Field"; jrose@1957: case JVM_CONSTANT_Methodref : jrose@1957: return "Method"; jrose@1957: case JVM_CONSTANT_InterfaceMethodref : jrose@1957: return "InterfaceMethod"; jrose@1957: case JVM_CONSTANT_String : jrose@1957: return "String"; jrose@1957: case JVM_CONSTANT_Integer : jrose@1957: return "Integer"; jrose@1957: case JVM_CONSTANT_Float : jrose@1957: return "Float"; jrose@1957: case JVM_CONSTANT_Long : jrose@1957: return "Long"; jrose@1957: case JVM_CONSTANT_Double : jrose@1957: return "Double"; jrose@1957: case JVM_CONSTANT_NameAndType : jrose@1957: return "NameAndType"; jrose@1957: case JVM_CONSTANT_MethodHandle : jrose@1957: return "MethodHandle"; jrose@1957: case JVM_CONSTANT_MethodType : jrose@1957: return "MethodType"; jrose@2015: case JVM_CONSTANT_InvokeDynamic : jrose@2015: return "InvokeDynamic"; jrose@1957: case JVM_CONSTANT_Object : jrose@1957: return "Object"; jrose@1957: case JVM_CONSTANT_Utf8 : jrose@1957: return "Utf8"; jrose@1957: case JVM_CONSTANT_UnresolvedClass : jrose@1957: return "Unresolved Class"; jrose@1957: case JVM_CONSTANT_UnresolvedClassInError : jrose@1957: return "Unresolved Class Error"; jrose@1957: case JVM_CONSTANT_ClassIndex : jrose@1957: return "Unresolved Class Index"; jrose@1957: case JVM_CONSTANT_UnresolvedString : jrose@1957: return "Unresolved String"; jrose@1957: case JVM_CONSTANT_StringIndex : jrose@1957: return "Unresolved String Index"; jrose@1957: default: jrose@1957: ShouldNotReachHere(); jrose@1957: return "Illegal"; jrose@1957: } jrose@1957: }