< prev index next > src/hotspot/share/opto/block.hpp
Print this page
DEBUG_ONLY(uint _limit;) // limit to formal domain
Arena *_arena; // Arena to allocate in
ReallocMark _nesting; // Safety checks for arena reallocation
protected:
Block **_blocks;
! void grow( uint i ); // Grow array node to fit
public:
Block_Array(Arena *a) : _size(OptoBlockListSize), _arena(a) {
DEBUG_ONLY(_limit=0);
_blocks = NEW_ARENA_ARRAY( a, Block *, OptoBlockListSize );
DEBUG_ONLY(uint _limit;) // limit to formal domain
Arena *_arena; // Arena to allocate in
ReallocMark _nesting; // Safety checks for arena reallocation
protected:
Block **_blocks;
! void maybe_grow(uint i) {
+ _nesting.check(_arena); // Check if a potential reallocation in the arena is safe
+ if (i >= Max()) {
+ grow(i);
+ }
+ }
+ void grow(uint i); // Grow array node to fit
public:
Block_Array(Arena *a) : _size(OptoBlockListSize), _arena(a) {
DEBUG_ONLY(_limit=0);
_blocks = NEW_ARENA_ARRAY( a, Block *, OptoBlockListSize );
Block *lookup( uint i ) const // Lookup, or null for not mapped
{ return (i<Max()) ? _blocks[i] : (Block*)nullptr; }
Block *operator[] ( uint i ) const // Lookup, or assert for not mapped
{ assert( i < Max(), "oob" ); return _blocks[i]; }
// Extend the mapping: index i maps to Block *n.
! void map( uint i, Block *n ) { grow(i); _blocks[i] = n; }
uint Max() const { DEBUG_ONLY(return _limit); return _size; }
};
class Block_List : public Block_Array {
Block *lookup( uint i ) const // Lookup, or null for not mapped
{ return (i<Max()) ? _blocks[i] : (Block*)nullptr; }
Block *operator[] ( uint i ) const // Lookup, or assert for not mapped
{ assert( i < Max(), "oob" ); return _blocks[i]; }
// Extend the mapping: index i maps to Block *n.
! void map( uint i, Block *n ) { maybe_grow(i); _blocks[i] = n; }
uint Max() const { DEBUG_ONLY(return _limit); return _size; }
};
class Block_List : public Block_Array {
< prev index next >