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 // Optimization - Graph Style 26 27 #include "incls/_precompiled.incl" 28 #include "incls/_block.cpp.incl" 29 30 31 //----------------------------------------------------------------------------- 32 void Block_Array::grow( uint i ) { 33 assert(i >= Max(), "must be an overflow"); 34 debug_only(_limit = i+1); 35 if( i < _size ) return; 36 if( !_size ) { 37 _size = 1; 38 _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) ); 39 _blocks[0] = NULL; 40 } 41 uint old = _size; 42 while( i >= _size ) _size <<= 1; // Double to fit 43 _blocks = (Block**)_arena->Arealloc( _blocks, old*sizeof(Block*),_size*sizeof(Block*)); 44 Copy::zero_to_bytes( &_blocks[old], (_size-old)*sizeof(Block*) ); 45 } 46 47 //============================================================================= 48 void Block_List::remove(uint i) { | 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 "libadt/vectset.hpp" 27 #include "memory/allocation.inline.hpp" 28 #include "opto/block.hpp" 29 #include "opto/cfgnode.hpp" 30 #include "opto/chaitin.hpp" 31 #include "opto/loopnode.hpp" 32 #include "opto/machnode.hpp" 33 #include "opto/matcher.hpp" 34 #include "opto/opcodes.hpp" 35 #include "opto/rootnode.hpp" 36 #include "utilities/copy.hpp" 37 38 // Optimization - Graph Style 39 40 41 //----------------------------------------------------------------------------- 42 void Block_Array::grow( uint i ) { 43 assert(i >= Max(), "must be an overflow"); 44 debug_only(_limit = i+1); 45 if( i < _size ) return; 46 if( !_size ) { 47 _size = 1; 48 _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) ); 49 _blocks[0] = NULL; 50 } 51 uint old = _size; 52 while( i >= _size ) _size <<= 1; // Double to fit 53 _blocks = (Block**)_arena->Arealloc( _blocks, old*sizeof(Block*),_size*sizeof(Block*)); 54 Copy::zero_to_bytes( &_blocks[old], (_size-old)*sizeof(Block*) ); 55 } 56 57 //============================================================================= 58 void Block_List::remove(uint i) { |