コード例 #1
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
PSVirtualSpace::PSVirtualSpace(ReservedSpace rs) :
  _alignment(os::vm_page_size())
{
  set_reserved(rs);
  set_committed(reserved_low_addr(), reserved_low_addr());
  DEBUG_ONLY(verify());
}
コード例 #2
0
PSVirtualSpace::PSVirtualSpace(ReservedSpace rs) :
    _alignment(os::vm_page_size()), _account(os::CHEAP_COMMITTED_MEMORY_ACCOUNT)
{
    set_reserved(rs);
    set_committed(reserved_low_addr(), reserved_low_addr());
    DEBUG_ONLY(verify());
}
コード例 #3
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
  _alignment(alignment)
{
  set_reserved(rs);
  set_committed(reserved_low_addr(), reserved_low_addr());
  DEBUG_ONLY(verify());
}
コード例 #4
0
void PSVirtualSpace::release() {
    DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
    if (reserved_low_addr() != NULL) {
        os::release_memory(reserved_low_addr(),reserved_size());
    }
    _reserved_low_addr = _reserved_high_addr = NULL;
    _committed_low_addr = _committed_high_addr = NULL;
}
コード例 #5
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
// Deprecated.
bool PSVirtualSpace::initialize(ReservedSpace rs,
                                size_t commit_size) {
  set_reserved(rs);
  set_committed(reserved_low_addr(), reserved_low_addr());

  // Commit to initial size.
  assert(commit_size <= rs.size(), "commit_size too big");
  bool result = commit_size > 0 ? expand_by(commit_size) : true;
  DEBUG_ONLY(verify());
  return result;
}
コード例 #6
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
size_t PSVirtualSpaceHighToLow::expand_into(PSVirtualSpace* other_space,
                                            size_t bytes) {
  assert(is_aligned(bytes), "arg not aligned");
  assert(grows_down(), "this space must grow down");
  assert(other_space->grows_up(), "other space must grow up");
  assert(reserved_low_addr() == other_space->reserved_high_addr(),
         "spaces not contiguous");
  assert(special() == other_space->special(), "one space is special in memory, the other is not");
  DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
  DEBUG_ONLY(PSVirtualSpaceVerifier other_verifier(other_space));

  size_t bytes_needed = bytes;

  // First use the uncommitted region in this space.
  size_t tmp_bytes = MIN2(uncommitted_size(), bytes_needed);
  if (tmp_bytes > 0) {
    if (expand_by(tmp_bytes)) {
      bytes_needed -= tmp_bytes;
    } else {
      return 0;
    }
  }

  // Next take from the uncommitted region in the other space, and commit it.
  tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed);
  if (tmp_bytes > 0) {
    char* const commit_base = committed_low_addr() - tmp_bytes;
    if (other_space->special() ||
        os::commit_memory(commit_base, tmp_bytes, alignment(), !ExecMem)) {
      // Reduce the reserved region in the other space.
      other_space->set_reserved(other_space->reserved_low_addr(),
                                other_space->reserved_high_addr() - tmp_bytes,
                                other_space->special());

      // Grow both reserved and committed in this space.
      _reserved_low_addr -= tmp_bytes;
      _committed_low_addr -= tmp_bytes;
      bytes_needed -= tmp_bytes;
    } else {
      return bytes - bytes_needed;
    }
  }

  // Finally take from the already committed region in the other space.
  tmp_bytes = bytes_needed;
  if (tmp_bytes > 0) {
    // Reduce both committed and reserved in the other space.
    other_space->set_committed(other_space->committed_low_addr(),
                               other_space->committed_high_addr() - tmp_bytes);
    other_space->set_reserved(other_space->reserved_low_addr(),
                              other_space->reserved_high_addr() - tmp_bytes,
                              other_space->special());

    // Grow both reserved and committed in this space.
    _reserved_low_addr -= tmp_bytes;
    _committed_low_addr -= tmp_bytes;
  }

  return bytes;
}
コード例 #7
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
void PSVirtualSpace::verify() const {
  assert(is_aligned(alignment(), os::vm_page_size()), "bad alignment");
  assert(is_aligned(reserved_low_addr()), "bad reserved_low_addr");
  assert(is_aligned(reserved_high_addr()), "bad reserved_high_addr");
  assert(is_aligned(committed_low_addr()), "bad committed_low_addr");
  assert(is_aligned(committed_high_addr()), "bad committed_high_addr");

  // Reserved region must be non-empty or both addrs must be 0.
  assert(reserved_low_addr() < reserved_high_addr() ||
         reserved_low_addr() == NULL && reserved_high_addr() == NULL,
         "bad reserved addrs");
  assert(committed_low_addr() <= committed_high_addr(), "bad committed addrs");

  if (grows_up()) {
    assert(reserved_low_addr() == committed_low_addr(), "bad low addrs");
    assert(reserved_high_addr() >= committed_high_addr(), "bad high addrs");
  } else {
    assert(reserved_high_addr() == committed_high_addr(), "bad high addrs");
    assert(reserved_low_addr() <= committed_low_addr(), "bad low addrs");
  }
}
コード例 #8
0
void PSVirtualSpace::print() const {
  gclog_or_tty->print_cr("virtual space [" PTR_FORMAT "]:  alignment="
			 SIZE_FORMAT "K grows %s",
			 this, alignment() / K, grows_up() ? "up" : "down");
  gclog_or_tty->print_cr("    reserved=" SIZE_FORMAT "K"
			 " [" PTR_FORMAT "," PTR_FORMAT "]"
			 " committed=" SIZE_FORMAT "K"
			 " [" PTR_FORMAT "," PTR_FORMAT "]",
			 reserved_size() / K,
			 reserved_low_addr(), reserved_high_addr(),
			 committed_size() / K,
			 committed_low_addr(), committed_high_addr());
}
コード例 #9
0
ファイル: psVirtualspace.cpp プロジェクト: shelan/jdk9-mirror
void PSVirtualSpace::print() const {
  gclog_or_tty->print_cr("virtual space [" PTR_FORMAT "]:  alignment="
                         SIZE_FORMAT "K grows %s%s",
                         p2i(this), alignment() / K, grows_up() ? "up" : "down",
                         special() ? " (pinned in memory)" : "");
  gclog_or_tty->print_cr("    reserved=" SIZE_FORMAT "K"
                         " [" PTR_FORMAT "," PTR_FORMAT "]"
                         " committed=" SIZE_FORMAT "K"
                         " [" PTR_FORMAT "," PTR_FORMAT "]",
                         reserved_size() / K,
                         p2i(reserved_low_addr()), p2i(reserved_high_addr()),
                         committed_size() / K,
                         p2i(committed_low_addr()), p2i(committed_high_addr()));
}
コード例 #10
0
ファイル: psVirtualspace.hpp プロジェクト: gaoxiaojun/dync
inline size_t PSVirtualSpace::reserved_size() const {
  return pointer_delta(reserved_high_addr(), reserved_low_addr());
}
コード例 #11
0
ファイル: psVirtualspace.hpp プロジェクト: gaoxiaojun/dync
 // Reserved area
 char* low_boundary()  const { return reserved_low_addr(); }