< prev index next >

src/share/vm/utilities/constantTag.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  38   switch (_tag) {
  39     case JVM_CONSTANT_Integer :
  40       return T_INT;
  41     case JVM_CONSTANT_Float :
  42       return T_FLOAT;
  43     case JVM_CONSTANT_Long :
  44       return T_LONG;
  45     case JVM_CONSTANT_Double :
  46       return T_DOUBLE;
  47 
  48     case JVM_CONSTANT_Class :
  49     case JVM_CONSTANT_String :
  50     case JVM_CONSTANT_UnresolvedClass :
  51     case JVM_CONSTANT_UnresolvedClassInError :
  52     case JVM_CONSTANT_ClassIndex :
  53     case JVM_CONSTANT_StringIndex :
  54     case JVM_CONSTANT_MethodHandle :
  55     case JVM_CONSTANT_MethodHandleInError :
  56     case JVM_CONSTANT_MethodType :
  57     case JVM_CONSTANT_MethodTypeInError :

  58       return T_OBJECT;
  59     default:
  60       ShouldNotReachHere();
  61       return T_ILLEGAL;
  62   }
  63 }
  64 
  65 
  66 jbyte constantTag::non_error_value() const {
  67   switch (_tag) {
  68   case JVM_CONSTANT_UnresolvedClassInError:
  69     return JVM_CONSTANT_UnresolvedClass;
  70   case JVM_CONSTANT_MethodHandleInError:
  71     return JVM_CONSTANT_MethodHandle;
  72   case JVM_CONSTANT_MethodTypeInError:
  73     return JVM_CONSTANT_MethodType;


  74   default:
  75     return _tag;
  76   }
  77 }
  78 
  79 
  80 jbyte constantTag::error_value() const {
  81   switch (_tag) {
  82   case JVM_CONSTANT_UnresolvedClass:
  83     return JVM_CONSTANT_UnresolvedClassInError;
  84   case JVM_CONSTANT_MethodHandle:
  85     return JVM_CONSTANT_MethodHandleInError;
  86   case JVM_CONSTANT_MethodType:
  87     return JVM_CONSTANT_MethodTypeInError;


  88   default:
  89     ShouldNotReachHere();
  90     return JVM_CONSTANT_Invalid;
  91   }
  92 }
  93 
  94 const char* constantTag::internal_name() const {
  95   switch (_tag) {
  96     case JVM_CONSTANT_Invalid :
  97       return "Invalid index";
  98     case JVM_CONSTANT_Class :
  99       return "Class";
 100     case JVM_CONSTANT_Fieldref :
 101       return "Field";
 102     case JVM_CONSTANT_Methodref :
 103       return "Method";
 104     case JVM_CONSTANT_InterfaceMethodref :
 105       return "InterfaceMethod";
 106     case JVM_CONSTANT_String :
 107       return "String";
 108     case JVM_CONSTANT_Integer :
 109       return "Integer";
 110     case JVM_CONSTANT_Float :
 111       return "Float";
 112     case JVM_CONSTANT_Long :
 113       return "Long";
 114     case JVM_CONSTANT_Double :
 115       return "Double";
 116     case JVM_CONSTANT_NameAndType :
 117       return "NameAndType";
 118     case JVM_CONSTANT_MethodHandle :
 119       return "MethodHandle";
 120     case JVM_CONSTANT_MethodHandleInError :
 121       return "MethodHandle Error";
 122     case JVM_CONSTANT_MethodType :
 123       return "MethodType";
 124     case JVM_CONSTANT_MethodTypeInError :
 125       return "MethodType Error";
 126     case JVM_CONSTANT_InvokeDynamic :
 127       return "InvokeDynamic";


 128     case JVM_CONSTANT_Utf8 :
 129       return "Utf8";
 130     case JVM_CONSTANT_UnresolvedClass :
 131       return "Unresolved Class";
 132     case JVM_CONSTANT_UnresolvedClassInError :
 133       return "Unresolved Class Error";
 134     case JVM_CONSTANT_ClassIndex :
 135       return "Unresolved Class Index";
 136     case JVM_CONSTANT_StringIndex :
 137       return "Unresolved String Index";
 138     default:
 139       ShouldNotReachHere();
 140       return "Illegal";
 141   }
 142 }
   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  38   switch (_tag) {
  39     case JVM_CONSTANT_Integer :
  40       return T_INT;
  41     case JVM_CONSTANT_Float :
  42       return T_FLOAT;
  43     case JVM_CONSTANT_Long :
  44       return T_LONG;
  45     case JVM_CONSTANT_Double :
  46       return T_DOUBLE;
  47 
  48     case JVM_CONSTANT_Class :
  49     case JVM_CONSTANT_String :
  50     case JVM_CONSTANT_UnresolvedClass :
  51     case JVM_CONSTANT_UnresolvedClassInError :
  52     case JVM_CONSTANT_ClassIndex :
  53     case JVM_CONSTANT_StringIndex :
  54     case JVM_CONSTANT_MethodHandle :
  55     case JVM_CONSTANT_MethodHandleInError :
  56     case JVM_CONSTANT_MethodType :
  57     case JVM_CONSTANT_MethodTypeInError :
  58     case JVM_CONSTANT_InvokeDynamicInError :
  59       return T_OBJECT;
  60     default:
  61       ShouldNotReachHere();
  62       return T_ILLEGAL;
  63   }
  64 }
  65 
  66 
  67 jbyte constantTag::non_error_value() const {
  68   switch (_tag) {
  69   case JVM_CONSTANT_UnresolvedClassInError:
  70     return JVM_CONSTANT_UnresolvedClass;
  71   case JVM_CONSTANT_MethodHandleInError:
  72     return JVM_CONSTANT_MethodHandle;
  73   case JVM_CONSTANT_MethodTypeInError:
  74     return JVM_CONSTANT_MethodType;
  75   case JVM_CONSTANT_InvokeDynamicInError:
  76     return JVM_CONSTANT_InvokeDynamic;
  77   default:
  78     return _tag;
  79   }
  80 }
  81 
  82 
  83 jbyte constantTag::error_value() const {
  84   switch (_tag) {
  85   case JVM_CONSTANT_UnresolvedClass:
  86     return JVM_CONSTANT_UnresolvedClassInError;
  87   case JVM_CONSTANT_MethodHandle:
  88     return JVM_CONSTANT_MethodHandleInError;
  89   case JVM_CONSTANT_MethodType:
  90     return JVM_CONSTANT_MethodTypeInError;
  91   case JVM_CONSTANT_InvokeDynamic:
  92     return JVM_CONSTANT_InvokeDynamicInError;
  93   default:
  94     ShouldNotReachHere();
  95     return JVM_CONSTANT_Invalid;
  96   }
  97 }
  98 
  99 const char* constantTag::internal_name() const {
 100   switch (_tag) {
 101     case JVM_CONSTANT_Invalid :
 102       return "Invalid index";
 103     case JVM_CONSTANT_Class :
 104       return "Class";
 105     case JVM_CONSTANT_Fieldref :
 106       return "Field";
 107     case JVM_CONSTANT_Methodref :
 108       return "Method";
 109     case JVM_CONSTANT_InterfaceMethodref :
 110       return "InterfaceMethod";
 111     case JVM_CONSTANT_String :
 112       return "String";
 113     case JVM_CONSTANT_Integer :
 114       return "Integer";
 115     case JVM_CONSTANT_Float :
 116       return "Float";
 117     case JVM_CONSTANT_Long :
 118       return "Long";
 119     case JVM_CONSTANT_Double :
 120       return "Double";
 121     case JVM_CONSTANT_NameAndType :
 122       return "NameAndType";
 123     case JVM_CONSTANT_MethodHandle :
 124       return "MethodHandle";
 125     case JVM_CONSTANT_MethodHandleInError :
 126       return "MethodHandle Error";
 127     case JVM_CONSTANT_MethodType :
 128       return "MethodType";
 129     case JVM_CONSTANT_MethodTypeInError :
 130       return "MethodType Error";
 131     case JVM_CONSTANT_InvokeDynamic :
 132       return "InvokeDynamic";
 133     case JVM_CONSTANT_InvokeDynamicInError :
 134       return "InvokeDynamic Error";
 135     case JVM_CONSTANT_Utf8 :
 136       return "Utf8";
 137     case JVM_CONSTANT_UnresolvedClass :
 138       return "Unresolved Class";
 139     case JVM_CONSTANT_UnresolvedClassInError :
 140       return "Unresolved Class Error";
 141     case JVM_CONSTANT_ClassIndex :
 142       return "Unresolved Class Index";
 143     case JVM_CONSTANT_StringIndex :
 144       return "Unresolved String Index";
 145     default:
 146       ShouldNotReachHere();
 147       return "Illegal";
 148   }
 149 }
< prev index next >