You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/01 09:28:25 UTC

svn commit: r809862 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/ main/native/os/darwin/ main/native/os/hpux/ main/native/os/linux/ main/native/os/solaris/ main/native/os/win32/ test/org/apache/commons/runtime/

Author: mturk
Date: Tue Sep  1 07:28:24 2009
New Revision: 809862

URL: http://svn.apache.org/viewvc?rev=809862&view=rev
Log:
Add pagesize alignment const

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c
    commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c
    commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java Tue Sep  1 07:28:24 2009
@@ -81,8 +81,9 @@
         MAX_PATH                        =   i[6];
         ABS_MAX_PATH                    =   i[7];
         PAGESIZE                        =   i[8];
+        PAGESIZE_ALIGN                  =   i[9];
 
-        if (i[9] == 16)
+        if (i[10] == 16)
             STRUCT_ALIGN = 4;
         else
             STRUCT_ALIGN = 8;
@@ -138,6 +139,12 @@
     public static final int PAGESIZE;
 
     /**
+     * The granualarity of the starting address at wich {@code memory} pages
+     * can be allocated.
+     */
+    public static final int PAGESIZE_ALIGN;
+
+    /**
      * Size of the {@code structure} alignment.
      */
     public static final int STRUCT_ALIGN;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c Tue Sep  1 07:28:24 2009
@@ -74,7 +74,8 @@
     ia[6]  =   PATH_MAX;
     ia[7]  =   PATH_MAX;
     ia[8]  =   (jint)acr_page_size;
-    ia[9]  =   (jint)sizeof(struct_align_t);
+    ia[9]  =   (jint)acr_page_size;
+    ia[10] =   (jint)sizeof(struct_align_t);
 
     (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c Tue Sep  1 07:28:24 2009
@@ -74,7 +74,8 @@
     ia[6]  =   PATH_MAX;
     ia[7]  =   PATH_MAX;
     ia[8]  =   (jint)acr_page_size;
-    ia[9]  =   (jint)sizeof(struct_align_t);
+    ia[9]  =   (jint)acr_page_size;
+    ia[10] =   (jint)sizeof(struct_align_t);
 
     (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c Tue Sep  1 07:28:24 2009
@@ -74,7 +74,8 @@
     ia[6]  =   PATH_MAX;
     ia[7]  =   PATH_MAX;
     ia[8]  =   (jint)acr_page_size;
-    ia[9]  =   (jint)sizeof(struct_align_t);
+    ia[9]  =   (jint)acr_page_size;
+    ia[10] =   (jint)sizeof(struct_align_t);
     (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
 
     if (acr_native_codepage == -1) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c Tue Sep  1 07:28:24 2009
@@ -74,7 +74,8 @@
     ia[6]  =   PATH_MAX;
     ia[7]  =   PATH_MAX;
     ia[8]  =   (jint)acr_page_size;
-    ia[9]  =   (jint)sizeof(struct_align_t);
+    ia[9]  =   (jint)acr_page_size;
+    ia[10] =   (jint)sizeof(struct_align_t);
 
     (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c Tue Sep  1 07:28:24 2009
@@ -97,7 +97,8 @@
     ia[6]  =   248;
     ia[7]  =   32760;
     ia[8]  =   (jint)acr_page_size;
-    ia[9]  =   (jint)sizeof(struct_align_t);
+    ia[9]  =   (jint)acr_osinf->dwAllocationGranularity;
+    ia[10] =   (jint)sizeof(struct_align_t);
 
     (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
 

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java?rev=809862&r1=809861&r2=809862&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java Tue Sep  1 07:28:24 2009
@@ -85,22 +85,10 @@
         }
         if (pa == null) {
             try {
-                pa = map.map(Platform.PAGESIZE, 128);
-                System.out.println("Map requires Platform.PAGESIZE (" +
-                                   Platform.PAGESIZE + ") bytes offset alignment");
-            } catch (IOException e) {
-                // Ignore
-            } catch (SecurityException x) {
-                // File is too small
-                // We should test with some larger file.
-                pa = map.map(0, 128);
-            }
-        }
-        if (pa == null) {
-            try {
-                // Windows requires 64k alignment
-                pa = map.map(65536, 128);
-                System.out.println("Map requires 64k offset alignment");
+                pa = map.map(Platform.PAGESIZE_ALIGN, 128);
+                System.out.println("Map requires Platform.PAGESIZE_ALIGN (" +
+                                   Platform.PAGESIZE_ALIGN +
+                                   ") bytes offset alignment");
             } catch (IOException e) {
                 // Ignore
             } catch (SecurityException x) {