src/share/vm/utilities/constantTag.cpp

Fri, 29 Apr 2016 00:06:10 +0800

author
aoqi
date
Fri, 29 Apr 2016 00:06:10 +0800
changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS 64-bit port.

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

mercurial