src/share/vm/utilities/constantTag.cpp

Tue, 25 Feb 2014 15:11:18 -0800

author
kvn
date
Tue, 25 Feb 2014 15:11:18 -0800
changeset 6507
752ba2e5f6d0
parent 5889
28ca974cc21a
child 6680
78bbf4d43a14
permissions
-rw-r--r--

Merge

duke@435 1 /*
coleenp@4643 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "utilities/constantTag.hpp"
duke@435 27
duke@435 28 #ifndef PRODUCT
duke@435 29
duke@435 30 void constantTag::print_on(outputStream* st) const {
jrose@1957 31 st->print(internal_name());
jrose@1957 32 }
jrose@1957 33
jrose@1957 34 #endif // PRODUCT
jrose@1957 35
jrose@1957 36 BasicType constantTag::basic_type() const {
duke@435 37 switch (_tag) {
jrose@1957 38 case JVM_CONSTANT_Integer :
jrose@1957 39 return T_INT;
jrose@1957 40 case JVM_CONSTANT_Float :
jrose@1957 41 return T_FLOAT;
jrose@1957 42 case JVM_CONSTANT_Long :
jrose@1957 43 return T_LONG;
jrose@1957 44 case JVM_CONSTANT_Double :
jrose@1957 45 return T_DOUBLE;
jrose@1957 46
duke@435 47 case JVM_CONSTANT_Class :
duke@435 48 case JVM_CONSTANT_String :
duke@435 49 case JVM_CONSTANT_UnresolvedClass :
jrose@1957 50 case JVM_CONSTANT_UnresolvedClassInError :
duke@435 51 case JVM_CONSTANT_ClassIndex :
duke@435 52 case JVM_CONSTANT_StringIndex :
jrose@1957 53 case JVM_CONSTANT_MethodHandle :
coleenp@5889 54 case JVM_CONSTANT_MethodHandleInError :
jrose@1957 55 case JVM_CONSTANT_MethodType :
coleenp@5889 56 case JVM_CONSTANT_MethodTypeInError :
jrose@1957 57 return T_OBJECT;
duke@435 58 default:
duke@435 59 ShouldNotReachHere();
jrose@1957 60 return T_ILLEGAL;
duke@435 61 }
duke@435 62 }
duke@435 63
jrose@1957 64
coleenp@5889 65 jbyte constantTag::non_error_value() const {
coleenp@5889 66 switch (_tag) {
coleenp@5889 67 case JVM_CONSTANT_UnresolvedClassInError:
coleenp@5889 68 return JVM_CONSTANT_UnresolvedClass;
coleenp@5889 69 case JVM_CONSTANT_MethodHandleInError:
coleenp@5889 70 return JVM_CONSTANT_MethodHandle;
coleenp@5889 71 case JVM_CONSTANT_MethodTypeInError:
coleenp@5889 72 return JVM_CONSTANT_MethodType;
coleenp@5889 73 default:
coleenp@5889 74 return _tag;
coleenp@5889 75 }
coleenp@5889 76 }
coleenp@5889 77
jrose@1957 78
jrose@1957 79 const char* constantTag::internal_name() const {
jrose@1957 80 switch (_tag) {
jrose@1957 81 case JVM_CONSTANT_Invalid :
jrose@1957 82 return "Invalid index";
jrose@1957 83 case JVM_CONSTANT_Class :
jrose@1957 84 return "Class";
jrose@1957 85 case JVM_CONSTANT_Fieldref :
jrose@1957 86 return "Field";
jrose@1957 87 case JVM_CONSTANT_Methodref :
jrose@1957 88 return "Method";
jrose@1957 89 case JVM_CONSTANT_InterfaceMethodref :
jrose@1957 90 return "InterfaceMethod";
jrose@1957 91 case JVM_CONSTANT_String :
jrose@1957 92 return "String";
jrose@1957 93 case JVM_CONSTANT_Integer :
jrose@1957 94 return "Integer";
jrose@1957 95 case JVM_CONSTANT_Float :
jrose@1957 96 return "Float";
jrose@1957 97 case JVM_CONSTANT_Long :
jrose@1957 98 return "Long";
jrose@1957 99 case JVM_CONSTANT_Double :
jrose@1957 100 return "Double";
jrose@1957 101 case JVM_CONSTANT_NameAndType :
jrose@1957 102 return "NameAndType";
jrose@1957 103 case JVM_CONSTANT_MethodHandle :
jrose@1957 104 return "MethodHandle";
coleenp@4037 105 case JVM_CONSTANT_MethodHandleInError :
coleenp@4037 106 return "MethodHandle Error";
jrose@1957 107 case JVM_CONSTANT_MethodType :
jrose@1957 108 return "MethodType";
coleenp@4037 109 case JVM_CONSTANT_MethodTypeInError :
coleenp@4037 110 return "MethodType Error";
jrose@2015 111 case JVM_CONSTANT_InvokeDynamic :
jrose@2015 112 return "InvokeDynamic";
jrose@1957 113 case JVM_CONSTANT_Utf8 :
jrose@1957 114 return "Utf8";
jrose@1957 115 case JVM_CONSTANT_UnresolvedClass :
jrose@1957 116 return "Unresolved Class";
jrose@1957 117 case JVM_CONSTANT_UnresolvedClassInError :
jrose@1957 118 return "Unresolved Class Error";
jrose@1957 119 case JVM_CONSTANT_ClassIndex :
jrose@1957 120 return "Unresolved Class Index";
jrose@1957 121 case JVM_CONSTANT_StringIndex :
jrose@1957 122 return "Unresolved String Index";
jrose@1957 123 default:
jrose@1957 124 ShouldNotReachHere();
jrose@1957 125 return "Illegal";
jrose@1957 126 }
jrose@1957 127 }

mercurial