< prev index next >

src/hotspot/share/utilities/constantTag.cpp

Print this page


   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  *


  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 
  60     case JVM_CONSTANT_Value :
  61     case JVM_CONSTANT_ValueIndex :
  62     case JVM_CONSTANT_UnresolvedValue :
  63     case JVM_CONSTANT_UnresolvedValueInError :
  64       return T_OBJECT; // Should this eventually be migrated to T_VALUETYPE?
  65 
  66     case JVM_CONSTANT_Dynamic :
  67     case JVM_CONSTANT_DynamicInError :
  68       assert(false, "Dynamic constant has no fixed basic type");
  69 
  70     default:
  71       ShouldNotReachHere();
  72       return T_ILLEGAL;
  73   }
  74 }
  75 
  76 
  77 jbyte constantTag::non_error_value() const {
  78   switch (_tag) {
  79   case JVM_CONSTANT_UnresolvedClassInError:
  80     return JVM_CONSTANT_UnresolvedClass;
  81   case JVM_CONSTANT_UnresolvedValueInError:
  82     return JVM_CONSTANT_UnresolvedValue;
  83   case JVM_CONSTANT_MethodHandleInError:
  84     return JVM_CONSTANT_MethodHandle;
  85   case JVM_CONSTANT_MethodTypeInError:
  86     return JVM_CONSTANT_MethodType;
  87   case JVM_CONSTANT_DynamicInError:
  88     return JVM_CONSTANT_Dynamic;
  89   default:
  90     return _tag;
  91   }
  92 }
  93 
  94 
  95 jbyte constantTag::error_value() const {
  96   switch (_tag) {
  97   case JVM_CONSTANT_UnresolvedClass:
  98     return JVM_CONSTANT_UnresolvedClassInError;
  99   case JVM_CONSTANT_UnresolvedValue:
 100     return JVM_CONSTANT_UnresolvedValueInError;
 101   case JVM_CONSTANT_MethodHandle:
 102     return JVM_CONSTANT_MethodHandleInError;
 103   case JVM_CONSTANT_MethodType:
 104     return JVM_CONSTANT_MethodTypeInError;
 105   case JVM_CONSTANT_Dynamic:
 106     return JVM_CONSTANT_DynamicInError;
 107   default:
 108     ShouldNotReachHere();
 109     return JVM_CONSTANT_Invalid;
 110   }
 111 }
 112 
 113 const char* constantTag::internal_name() const {
 114   switch (_tag) {
 115     case JVM_CONSTANT_Invalid :
 116       return "Invalid index";
 117     case JVM_CONSTANT_Class :
 118       return "Class";
 119     case JVM_CONSTANT_Fieldref :
 120       return "Field";


 141     case JVM_CONSTANT_MethodType :
 142       return "MethodType";
 143     case JVM_CONSTANT_MethodTypeInError :
 144       return "MethodType Error";
 145     case JVM_CONSTANT_Dynamic :
 146       return "Dynamic";
 147     case JVM_CONSTANT_DynamicInError :
 148       return "Dynamic Error";
 149     case JVM_CONSTANT_InvokeDynamic :
 150       return "InvokeDynamic";
 151     case JVM_CONSTANT_Utf8 :
 152       return "Utf8";
 153     case JVM_CONSTANT_UnresolvedClass :
 154       return "Unresolved Class";
 155     case JVM_CONSTANT_UnresolvedClassInError :
 156       return "Unresolved Class Error";
 157     case JVM_CONSTANT_ClassIndex :
 158       return "Unresolved Class Index";
 159     case JVM_CONSTANT_StringIndex :
 160       return "Unresolved String Index";
 161     case JVM_CONSTANT_Value :
 162       return "Value Type";
 163     case JVM_CONSTANT_UnresolvedValue :
 164       return "Unresolved Value Type";
 165     case JVM_CONSTANT_UnresolvedValueInError :
 166       return "Unresolved Value Type Error";
 167     default:
 168       ShouldNotReachHere();
 169       return "Illegal";
 170   }
 171 }
   1 /*
   2  * Copyright (c) 1997, 2018, 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  *


  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 






  60     case JVM_CONSTANT_Dynamic :
  61     case JVM_CONSTANT_DynamicInError :
  62       assert(false, "Dynamic constant has no fixed basic type");
  63 
  64     default:
  65       ShouldNotReachHere();
  66       return T_ILLEGAL;
  67   }
  68 }
  69 
  70 
  71 jbyte constantTag::non_error_value() const {
  72   switch (_tag) {
  73   case JVM_CONSTANT_UnresolvedClassInError:
  74     return JVM_CONSTANT_UnresolvedClass;


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


  91   case JVM_CONSTANT_MethodHandle:
  92     return JVM_CONSTANT_MethodHandleInError;
  93   case JVM_CONSTANT_MethodType:
  94     return JVM_CONSTANT_MethodTypeInError;
  95   case JVM_CONSTANT_Dynamic:
  96     return JVM_CONSTANT_DynamicInError;
  97   default:
  98     ShouldNotReachHere();
  99     return JVM_CONSTANT_Invalid;
 100   }
 101 }
 102 
 103 const char* constantTag::internal_name() const {
 104   switch (_tag) {
 105     case JVM_CONSTANT_Invalid :
 106       return "Invalid index";
 107     case JVM_CONSTANT_Class :
 108       return "Class";
 109     case JVM_CONSTANT_Fieldref :
 110       return "Field";


 131     case JVM_CONSTANT_MethodType :
 132       return "MethodType";
 133     case JVM_CONSTANT_MethodTypeInError :
 134       return "MethodType Error";
 135     case JVM_CONSTANT_Dynamic :
 136       return "Dynamic";
 137     case JVM_CONSTANT_DynamicInError :
 138       return "Dynamic Error";
 139     case JVM_CONSTANT_InvokeDynamic :
 140       return "InvokeDynamic";
 141     case JVM_CONSTANT_Utf8 :
 142       return "Utf8";
 143     case JVM_CONSTANT_UnresolvedClass :
 144       return "Unresolved Class";
 145     case JVM_CONSTANT_UnresolvedClassInError :
 146       return "Unresolved Class Error";
 147     case JVM_CONSTANT_ClassIndex :
 148       return "Unresolved Class Index";
 149     case JVM_CONSTANT_StringIndex :
 150       return "Unresolved String Index";






 151     default:
 152       ShouldNotReachHere();
 153       return "Illegal";
 154   }
 155 }
< prev index next >