1 /*
2 * Copyright (c) 1997, 2016, 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 *
677 tty->print("\n%sValues: %d nodes ---> %d/%d (%d)",
678 is_IterGVN() ? "Iter" : " ", C->unique(), made_progress(), made_transforms(), made_new_values());
679 if( made_transforms() != 0 ) {
680 tty->print_cr(" ratio %f", made_progress()/(float)made_transforms() );
681 } else {
682 tty->cr();
683 }
684 }
685 }
686 #endif
687
688 //------------------------------makecon----------------------------------------
689 ConNode* PhaseTransform::makecon(const Type *t) {
690 assert(t->singleton(), "must be a constant");
691 assert(!t->empty() || t == Type::TOP, "must not be vacuous range");
692 switch (t->base()) { // fast paths
693 case Type::Half:
694 case Type::Top: return (ConNode*) C->top();
695 case Type::Int: return intcon( t->is_int()->get_con() );
696 case Type::Long: return longcon( t->is_long()->get_con() );
697 }
698 if (t->is_zero_type())
699 return zerocon(t->basic_type());
700 return uncached_makecon(t);
701 }
702
703 //--------------------------uncached_makecon-----------------------------------
704 // Make an idealized constant - one of ConINode, ConPNode, etc.
705 ConNode* PhaseValues::uncached_makecon(const Type *t) {
706 assert(t->singleton(), "must be a constant");
707 ConNode* x = ConNode::make(t);
708 ConNode* k = (ConNode*)hash_find_insert(x); // Value numbering
709 if (k == NULL) {
710 set_type(x, t); // Missed, provide type mapping
711 GrowableArray<Node_Notes*>* nna = C->node_note_array();
712 if (nna != NULL) {
713 Node_Notes* loc = C->locate_node_notes(nna, x->_idx, true);
714 loc->clear(); // do not put debug info on constants
715 }
716 } else {
|
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 *
677 tty->print("\n%sValues: %d nodes ---> %d/%d (%d)",
678 is_IterGVN() ? "Iter" : " ", C->unique(), made_progress(), made_transforms(), made_new_values());
679 if( made_transforms() != 0 ) {
680 tty->print_cr(" ratio %f", made_progress()/(float)made_transforms() );
681 } else {
682 tty->cr();
683 }
684 }
685 }
686 #endif
687
688 //------------------------------makecon----------------------------------------
689 ConNode* PhaseTransform::makecon(const Type *t) {
690 assert(t->singleton(), "must be a constant");
691 assert(!t->empty() || t == Type::TOP, "must not be vacuous range");
692 switch (t->base()) { // fast paths
693 case Type::Half:
694 case Type::Top: return (ConNode*) C->top();
695 case Type::Int: return intcon( t->is_int()->get_con() );
696 case Type::Long: return longcon( t->is_long()->get_con() );
697 default: break;
698 }
699 if (t->is_zero_type())
700 return zerocon(t->basic_type());
701 return uncached_makecon(t);
702 }
703
704 //--------------------------uncached_makecon-----------------------------------
705 // Make an idealized constant - one of ConINode, ConPNode, etc.
706 ConNode* PhaseValues::uncached_makecon(const Type *t) {
707 assert(t->singleton(), "must be a constant");
708 ConNode* x = ConNode::make(t);
709 ConNode* k = (ConNode*)hash_find_insert(x); // Value numbering
710 if (k == NULL) {
711 set_type(x, t); // Missed, provide type mapping
712 GrowableArray<Node_Notes*>* nna = C->node_note_array();
713 if (nna != NULL) {
714 Node_Notes* loc = C->locate_node_notes(nna, x->_idx, true);
715 loc->clear(); // do not put debug info on constants
716 }
717 } else {
|