6917698: os::is_allocatable Zero fix for 32-bit platforms
authortwisti
Mon, 18 Jan 2010 05:02:41 -0800
changeset 4647 51451c7e9103
parent 4646 e0683487dbe5
child 4648 22e8816b84d3
6917698: os::is_allocatable Zero fix for 32-bit platforms Summary: Recent changes call os::is_allocatable which was not implemented in Zero. Reviewed-by: twisti Contributed-by: Edward Nevill <ed@camswl.com>
hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Fri Jan 15 16:15:45 2010 -0800
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Mon Jan 18 05:02:41 2010 -0800
@@ -1,6 +1,6 @@
 /*
  * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2007, 2008 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -239,7 +239,21 @@
 }
 
 bool os::is_allocatable(size_t bytes) {
-  ShouldNotCallThis();
+#ifdef _LP64
+  return true;
+#else
+  if (bytes < 2 * G) {
+    return true;
+  }
+
+  char* addr = reserve_memory(bytes, NULL);
+
+  if (addr != NULL) {
+    release_memory(addr, bytes);
+  }
+
+  return addr != NULL;
+#endif // _LP64
 }
 
 ///////////////////////////////////////////////////////////////////////////////