< prev index next >
src/hotspot/os/windows/os_windows.cpp
Print this page
@@ -361,10 +361,42 @@
VirtualQuery(&minfo, &minfo, sizeof(minfo));
sz = (size_t)os::current_stack_base() - (size_t)minfo.AllocationBase;
return sz;
}
+bool os::committed_in_range(address start, size_t size, address& committed_start, size_t& committed_size) {
+ MEMORY_BASIC_INFORMATION minfo;
+ committed_start = NULL;
+ committed_size = 0;
+ address top = start + size;
+ const address start_addr = start;
+ while (start < top) {
+ VirtualQuery(start, &minfo, sizeof(minfo));
+ if ((minfo.State & MEM_COMMIT) == 0) { // not committed
+ if (committed_start != NULL) {
+ break;
+ }
+ } else { // committed
+ if (committed_start == NULL) {
+ committed_start = start;
+ }
+ committed_size += minfo.RegionSize;
+ }
+ start += minfo.RegionSize;
+ }
+
+ if (committed_start == NULL) {
+ assert(committed_size == 0, "Sanity");
+ return false;
+ } else {
+ assert(committed_start >= start_addr && committed_start < top, "Out of range");
+ // current region may go beyond the limit, trim to the limit
+ committed_size = MIN2(committed_size, size);
+ return true;
+ }
+}
+
struct tm* os::localtime_pd(const time_t* clock, struct tm* res) {
const struct tm* time_struct_ptr = localtime(clock);
if (time_struct_ptr != NULL) {
*res = *time_struct_ptr;
return res;
< prev index next >