Path: blob/master/src/hotspot/share/ci/ciConstant.cpp
40930 views
/*1* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "ci/ciConstant.hpp"26#include "ci/ciUtilities.hpp"27#include "memory/allocation.hpp"28#include "memory/allocation.inline.hpp"2930// ciConstant31//32// This class represents a constant value.3334// ------------------------------------------------------------------35// ciConstant::print36void ciConstant::print() {37tty->print("<ciConstant type=%s value=",38basictype_to_str(basic_type()));39switch (basic_type()) {40case T_BOOLEAN:41tty->print("%s", bool_to_str(_value._int != 0));42break;43case T_CHAR:44case T_BYTE:45case T_SHORT:46case T_INT:47tty->print("%d", _value._int);48break;49case T_LONG:50tty->print(INT64_FORMAT, (int64_t)(_value._long));51break;52case T_FLOAT:53tty->print("%f", _value._float);54break;55case T_DOUBLE:56tty->print("%lf", _value._double);57break;58default:59if (is_reference_type(basic_type())) {60_value._object->print();61} else {62tty->print("ILLEGAL");63}64break;65}66tty->print(">");67}686970