src/share/vm/classfile/verificationType.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2006, 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  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_verificationType.cpp.incl"

  27 
  28 VerificationType VerificationType::from_tag(u1 tag) {
  29   switch (tag) {
  30     case ITEM_Top:     return bogus_type();
  31     case ITEM_Integer: return integer_type();
  32     case ITEM_Float:   return float_type();
  33     case ITEM_Double:  return double_type();
  34     case ITEM_Long:    return long_type();
  35     case ITEM_Null:    return null_type();
  36     default:
  37       ShouldNotReachHere();
  38       return bogus_type();
  39   }
  40 }
  41 
  42 bool VerificationType::is_reference_assignable_from(
  43     const VerificationType& from, instanceKlassHandle context, TRAPS) const {
  44   if (from.is_null()) {
  45     // null is assignable to any reference
  46     return true;


   1 /*
   2  * Copyright (c) 2003, 2010, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "classfile/verificationType.hpp"
  28 
  29 VerificationType VerificationType::from_tag(u1 tag) {
  30   switch (tag) {
  31     case ITEM_Top:     return bogus_type();
  32     case ITEM_Integer: return integer_type();
  33     case ITEM_Float:   return float_type();
  34     case ITEM_Double:  return double_type();
  35     case ITEM_Long:    return long_type();
  36     case ITEM_Null:    return null_type();
  37     default:
  38       ShouldNotReachHere();
  39       return bogus_type();
  40   }
  41 }
  42 
  43 bool VerificationType::is_reference_assignable_from(
  44     const VerificationType& from, instanceKlassHandle context, TRAPS) const {
  45   if (from.is_null()) {
  46     // null is assignable to any reference
  47     return true;