/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "runtime/virtualspace.hpp"
// VirtualSpace for the parallel scavenge collector.
//
// VirtualSpace is data structure for committing a previously reserved address
// range in smaller chunks.
friend class VMStructs;
protected:
// The space is committed/uncommited in chunks of size _alignment. The
// ReservedSpace passed to initialize() must be aligned to this value.
// Reserved area
char* _reserved_low_addr;
char* _reserved_high_addr;
// Committed area
char* _committed_low_addr;
char* _committed_high_addr;
// The entire space has been committed and pinned in memory, no
// os::commit_memory() or os::uncommit_memory().
bool _special;
// Convenience wrapper.
public:
~PSVirtualSpace();
// Eventually all instances should be created with the above 1- or 2-arg
// constructors. Then the 1st constructor below should become protected and
// the 2nd ctor and initialize() removed.
bool contains(void* p) const;
// Accessors (all sizes are bytes).
inline size_t committed_size() const;
inline size_t reserved_size() const;
inline size_t uncommitted_size() const;
// Operations.
void release();
#ifndef PRODUCT
// Debugging
bool is_aligned(char* val) const;
void verify() const;
void print() const;
virtual bool grows_up() const { return true; }
private:
public:
}
};
#endif
// Included for compatibility with the original VirtualSpace.
public:
// Committed area
// Reserved area
};
// A virtual space that grows from high addresses to low addresses.
friend class VMStructs;
public:
#ifndef PRODUCT
// Debugging
virtual bool grows_up() const { return false; }
#endif
};
//
// PSVirtualSpace inlines.
//
inline size_t
}
}
}
return reserved_size() - committed_size();
}
}
}
}
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSVIRTUALSPACE_HPP