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