1 /* 2 * Copyright (c) 1997, 2009, 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/_phaseX.cpp.incl" 27 28 //============================================================================= 29 #define NODE_HASH_MINIMUM_SIZE 255 30 //------------------------------NodeHash--------------------------------------- 31 NodeHash::NodeHash(uint est_max_size) : 32 _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ), 33 _a(Thread::current()->resource_area()), 34 _table( NEW_ARENA_ARRAY( _a , Node* , _max ) ), // (Node**)_a->Amalloc(_max * sizeof(Node*)) ), 35 _inserts(0), _insert_limit( insert_limit() ), 36 _look_probes(0), _lookup_hits(0), _lookup_misses(0), 37 _total_insert_probes(0), _total_inserts(0), 38 _insert_probes(0), _grows(0) { 39 // _sentinel must be in the current node space 40 _sentinel = new (Compile::current(), 1) ProjNode(NULL, TypeFunc::Control); 41 memset(_table,0,sizeof(Node*)*_max); 42 } 43 44 //------------------------------NodeHash--------------------------------------- 45 NodeHash::NodeHash(Arena *arena, uint est_max_size) : 46 _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ), | 1 /* 2 * Copyright (c) 1997, 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 "memory/allocation.inline.hpp" 27 #include "opto/block.hpp" 28 #include "opto/callnode.hpp" 29 #include "opto/cfgnode.hpp" 30 #include "opto/connode.hpp" 31 #include "opto/idealGraphPrinter.hpp" 32 #include "opto/loopnode.hpp" 33 #include "opto/machnode.hpp" 34 #include "opto/opcodes.hpp" 35 #include "opto/phaseX.hpp" 36 #include "opto/regalloc.hpp" 37 #include "opto/rootnode.hpp" 38 39 //============================================================================= 40 #define NODE_HASH_MINIMUM_SIZE 255 41 //------------------------------NodeHash--------------------------------------- 42 NodeHash::NodeHash(uint est_max_size) : 43 _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ), 44 _a(Thread::current()->resource_area()), 45 _table( NEW_ARENA_ARRAY( _a , Node* , _max ) ), // (Node**)_a->Amalloc(_max * sizeof(Node*)) ), 46 _inserts(0), _insert_limit( insert_limit() ), 47 _look_probes(0), _lookup_hits(0), _lookup_misses(0), 48 _total_insert_probes(0), _total_inserts(0), 49 _insert_probes(0), _grows(0) { 50 // _sentinel must be in the current node space 51 _sentinel = new (Compile::current(), 1) ProjNode(NULL, TypeFunc::Control); 52 memset(_table,0,sizeof(Node*)*_max); 53 } 54 55 //------------------------------NodeHash--------------------------------------- 56 NodeHash::NodeHash(Arena *arena, uint est_max_size) : 57 _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ), |