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 *
867 }
868 return false;
869 }
870
871 #ifndef PRODUCT
872 //------------------------------dump2------------------------------------------
873 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
874 st->print("%s", _type_info[_base].msg);
875 }
876
877 //------------------------------dump-------------------------------------------
878 void Type::dump_on(outputStream *st) const {
879 ResourceMark rm;
880 Dict d(cmpkey,hashkey); // Stop recursive type dumping
881 dump2(d,1, st);
882 if (is_ptr_to_narrowoop()) {
883 st->print(" [narrow]");
884 } else if (is_ptr_to_narrowklass()) {
885 st->print(" [narrowklass]");
886 }
887 }
888 #endif
889
890 //------------------------------singleton--------------------------------------
891 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
892 // constants (Ldi nodes). Singletons are integer, float or double constants.
893 bool Type::singleton(void) const {
894 return _base == Top || _base == Half;
895 }
896
897 //------------------------------empty------------------------------------------
898 // TRUE if Type is a type with no values, FALSE otherwise.
899 bool Type::empty(void) const {
900 switch (_base) {
901 case DoubleTop:
902 case FloatTop:
903 case Top:
904 return true;
905
906 case Half:
|
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 *
867 }
868 return false;
869 }
870
871 #ifndef PRODUCT
872 //------------------------------dump2------------------------------------------
873 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
874 st->print("%s", _type_info[_base].msg);
875 }
876
877 //------------------------------dump-------------------------------------------
878 void Type::dump_on(outputStream *st) const {
879 ResourceMark rm;
880 Dict d(cmpkey,hashkey); // Stop recursive type dumping
881 dump2(d,1, st);
882 if (is_ptr_to_narrowoop()) {
883 st->print(" [narrow]");
884 } else if (is_ptr_to_narrowklass()) {
885 st->print(" [narrowklass]");
886 }
887 }
888
889 //-----------------------------------------------------------------------------
890 const char* Type::str(const Type* t) {
891 stringStream ss;
892 t->dump_on(&ss);
893 return ss.as_string();
894 }
895 #endif
896
897 //------------------------------singleton--------------------------------------
898 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
899 // constants (Ldi nodes). Singletons are integer, float or double constants.
900 bool Type::singleton(void) const {
901 return _base == Top || _base == Half;
902 }
903
904 //------------------------------empty------------------------------------------
905 // TRUE if Type is a type with no values, FALSE otherwise.
906 bool Type::empty(void) const {
907 switch (_base) {
908 case DoubleTop:
909 case FloatTop:
910 case Top:
911 return true;
912
913 case Half:
|