Path: blob/master/src/hotspot/share/opto/connode.cpp
40930 views
/*1* Copyright (c) 1997, 2017, 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 "memory/allocation.inline.hpp"26#include "opto/addnode.hpp"27#include "opto/compile.hpp"28#include "opto/connode.hpp"29#include "opto/machnode.hpp"30#include "opto/matcher.hpp"31#include "opto/memnode.hpp"32#include "opto/phaseX.hpp"33#include "opto/subnode.hpp"34#include "runtime/sharedRuntime.hpp"3536// Optimization - Graph Style3738//=============================================================================39//------------------------------hash-------------------------------------------40uint ConNode::hash() const {41return (uintptr_t)in(TypeFunc::Control) + _type->hash();42}4344//------------------------------make-------------------------------------------45ConNode *ConNode::make(const Type *t) {46switch( t->basic_type() ) {47case T_INT: return new ConINode( t->is_int() );48case T_LONG: return new ConLNode( t->is_long() );49case T_FLOAT: return new ConFNode( t->is_float_constant() );50case T_DOUBLE: return new ConDNode( t->is_double_constant() );51case T_VOID: return new ConNode ( Type::TOP );52case T_OBJECT: return new ConPNode( t->is_ptr() );53case T_ARRAY: return new ConPNode( t->is_aryptr() );54case T_ADDRESS: return new ConPNode( t->is_ptr() );55case T_NARROWOOP: return new ConNNode( t->is_narrowoop() );56case T_NARROWKLASS: return new ConNKlassNode( t->is_narrowklass() );57case T_METADATA: return new ConPNode( t->is_ptr() );58// Expected cases: TypePtr::NULL_PTR, any is_rawptr()59// Also seen: AnyPtr(TopPTR *+top);60// %%%% Stop using TypePtr::NULL_PTR to represent nulls: use either TypeRawPtr::NULL_PTR61// or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL62default:63ShouldNotReachHere();64return NULL;65}66}676869