commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r810085 - in /commons/sandbox/runtime/trunk/src: main/native/include/ main/native/os/linux/ main/native/os/unix/ main/native/os/win32/ main/native/shared/ main/native/test/ test/org/apache/commons/runtime/
Date Tue, 01 Sep 2009 15:06:24 GMT
Author: mturk
Date: Tue Sep  1 15:06:23 2009
New Revision: 810085

URL: http://svn.apache.org/viewvc?rev=810085&view=rev
Log:
Add cleanup to const pointer and use const pointer for read only mmap

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h
    commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/pmmap.c
    commons/sandbox/runtime/trunk/src/main/native/shared/constp.c
    commons/sandbox/runtime/trunk/src/main/native/shared/db.c
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c
    commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
    commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
    commons/sandbox/runtime/trunk/src/main/native/shared/shm.c
    commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c
    commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestNioByteBuffer.java
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h Tue Sep  1 15:06:23
2009
@@ -45,8 +45,8 @@
  * @param len Length of the pointer.
  * @param cb callback function to use on Pointer.finalize()
  */
-ACR_DECLARE(jobject) ACR_NewPointer(JNIEnv *env, void *p, size_t len,
-                                    acr_pointer_cleanup_fn_t *cb);
+ACR_DECLARE(jobject) ACR_NewBasicPointer(JNIEnv *env, void *p, size_t len,
+                                         acr_pointer_cleanup_fn_t *cb);
 
 /**
  * Create new Pointer array
@@ -144,8 +144,8 @@
  * @param len Length of the pointer.
  * @note ConstPointer does not have callback function.
  */
-ACR_DECLARE(jobject) ACR_NewConstPointer(JNIEnv *env, const void *p,
-                                         size_t len);
+ACR_DECLARE(jobject) ACR_NewConstPointer(JNIEnv *env, const void *p, size_t len,
+                                         acr_pointer_cleanup_fn_t *cb);
 
 #ifdef __cplusplus
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c Tue Sep  1 15:06:23 2009
@@ -145,7 +145,7 @@
         EXEC_PAGE_OFF(mmw, ass) = (ptrdiff_t)mmx;
         /* Create the Pointer class with default cleanup.
          */
-        ptr = ACR_NewPointer(_E, mmw, ass, execmem_pointer_cleanup);
+        ptr = ACR_NewBasicPointer(_E, mmw, ass, execmem_pointer_cleanup);
         if (!ptr) {
             munmap(mmw, ass);
             if (mmx)
@@ -170,9 +170,9 @@
 
     dp = (void *)(EXEC_PAGE_OFF(sp, sl));
     if (dp)
-        po = ACR_NewPointer(_E, dp, sl, NULL);
+        po = ACR_NewBasicPointer(_E, dp, sl, NULL);
     else
-        po = ACR_NewPointer(_E, sp, sl, NULL);
+        po = ACR_NewBasicPointer(_E, sp, sl, NULL);
     return po;
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c Tue Sep  1 15:06:23 2009
@@ -77,7 +77,7 @@
     if (mem) {
         /* Create the Pointer class with default cleanup.
          */
-        ptr = ACR_NewPointer(_E, mem, ass, execmem_pointer_cleanup);
+        ptr = ACR_NewBasicPointer(_E, mem, ass, execmem_pointer_cleanup);
         if (!ptr) {
 #ifdef ACR_USE_MMAP
             munmap(mem, ass);
@@ -96,6 +96,6 @@
     void   *sp = ACR_PointerGet(_E, src, &sl);
 
     UNREFERENCED_O;
-    return ACR_NewPointer(_E, sp, sl, NULL);
+    return ACR_NewBasicPointer(_E, sp, sl, NULL);
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c Tue Sep  1 15:06:23 2009
@@ -100,17 +100,35 @@
             else
                 rc = ACR_EBADF;
         break;
+        case ACR_DESC_FLUSH:
+            if (dp->di > 0) {
+                acr_mmap_t *m = (acr_mmap_t *)ACR_IOH(dp->di);
+                if (ACR_IOH_TYPE(dp->di) != ACR_DT_MMAP)
+                    rc = ACR_EFTYPE;
+                else {
+                    if (IS_VALID_HANDLE(m->base)) {
+                        if (msync(m->base, m->size, MS_SYNC)) {
+                            /* Error during sync */
+                            rc = ACR_GET_OS_ERROR();
+                        }
+                    }
+                }
+            }
+            else
+                rc = ACR_EBADF;
         case ACR_DESC_SYNC:
             if (dp->di > 0) {
                 acr_mmap_t *m = (acr_mmap_t *)ACR_IOH(dp->di);
                 if (ACR_IOH_TYPE(dp->di) != ACR_DT_MMAP)
                     rc = ACR_EFTYPE;
                 else {
-                    if (msync(m->base, m->size, MS_SYNC | MS_INVALIDATE)) {
-                        /* This will return ACR_EBUSY if some other memory
-                         * mapped region is locked
-                         */
-                        rc = ACR_GET_OS_ERROR();
+                    if (IS_VALID_HANDLE(m->base)) {
+                        if (msync(m->base, m->size, MS_SYNC | MS_INVALIDATE)) {
+                            /* This will return ACR_EBUSY if some other memory
+                             * mapped region is locked
+                             */
+                            rc = ACR_GET_OS_ERROR();
+                        }
                     }
                 }
             }
@@ -383,7 +401,10 @@
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
-    mptr = ACR_NewPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
+    if (m->flags & PROT_WRITE)
+        mptr = ACR_NewBasicPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
+    else
+        mptr = ACR_NewConstPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
 
     return mptr;
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c Tue Sep  1 15:06:23 2009
@@ -51,7 +51,7 @@
     if (mem) {
         /* Create the Pointer class with default cleanup.
          */
-        ptr = ACR_NewPointer(_E, mem, ass, execmem_pointer_cleanup);
+        ptr = ACR_NewBasicPointer(_E, mem, ass, execmem_pointer_cleanup);
         if (!ptr) {
             VirtualFree(mem, 0, MEM_RELEASE);
         }
@@ -68,6 +68,6 @@
     void   *sp = ACR_PointerGet(_E, src, &sl);
 
     UNREFERENCED_O;
-    return ACR_NewPointer(_E, sp, sl, NULL);
+    return ACR_NewBasicPointer(_E, sp, sl, NULL);
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pmmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pmmap.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pmmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pmmap.c Tue Sep  1 15:06:23 2009
@@ -101,16 +101,19 @@
             else
                 rc = ACR_EBADF;
         break;
+        case ACR_DESC_FLUSH:
         case ACR_DESC_SYNC:
             if (dp->di > 0) {
                 acr_mmap_t *m = (acr_mmap_t *)ACR_IOH(dp->di);
                 if (ACR_IOH_TYPE(dp->di) != ACR_DT_MMAP)
                     rc = ACR_EFTYPE;
                 else {
-                    if (!FlushViewOfFile(m->base, m->size)) {
-                        /* Error during flushing.
-                         */
-                        rc = ACR_GET_OS_ERROR();
+                    if (IS_VALID_HANDLE(m->base)) {
+                        if (!FlushViewOfFile(m->base, m->size)) {
+                            /* Error during flushing.
+                             */
+                            rc = ACR_GET_OS_ERROR();
+                        }
                     }
                 }
             }
@@ -427,7 +430,10 @@
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
-    mptr = ACR_NewPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
+    if (m->flags & FILE_MAP_WRITE)
+        mptr = ACR_NewBasicPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
+    else
+        mptr = ACR_NewConstPointer(_E, base, (size_t)size, mmap_pointer_cleanup);
 
     return mptr;
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/constp.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/constp.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/constp.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/constp.c Tue Sep  1 15:06:23 2009
@@ -25,8 +25,6 @@
 #include "acr_memory.h"
 #include "acr_pointer.h"
 #include "acr_vm.h"
-
-#define  ACR_WANT_MEMPROTECT
 #include "acr_error.h"
 
 /**
@@ -93,15 +91,15 @@
         return NULL;
 }
 
-ACR_DECLARE(jobject) ACR_NewConstPointer(JNIEnv *_E, const void *p, size_t len)
+ACR_DECLARE(jobject) ACR_NewConstPointer(JNIEnv *_E, const void *p, size_t len,
+                                         acr_pointer_cleanup_fn_t *cb)
 {
     if (_clazzn.i && J4MID(0000)) {
          return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
-                                 P2N(p), 0, (acr_ptr_t)len);
+                                 P2N(p), P2N(cb), (acr_ptr_t)len);
     }
     else {
         ACR_SET_OS_ERROR(ACR_ECLASSNOTFOUND);
         return NULL;
     }
 }
-

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/db.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/db.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/db.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/db.c Tue Sep  1 15:06:23 2009
@@ -25,8 +25,6 @@
 #include "acr_memory.h"
 #include "acr_pointer.h"
 #include "acr_vm.h"
-
-#define  ACR_WANT_MEMPROTECT
 #include "acr_error.h"
 
 /**

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Tue Sep  1 15:06:23 2009
@@ -47,7 +47,15 @@
     NULL
 };
 
+/**
+ * SEH is basically usable only on Windows.
+ * On other platforms default to disabled.
+ */
+#if defined(ACR_ENABLE_SEH) && defined(_MSC_VER)
+static acr_seh_e acr_seh_mode = ACR_SEH_THROW;
+#else
 static acr_seh_e acr_seh_mode = ACR_SEH_NONE;
+#endif
 
 /*
  * Convenience function to help throw any class

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/memory.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/memory.c Tue Sep  1 15:06:23 2009
@@ -322,7 +322,7 @@
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, nullp0)(ACR_JNISTDARGS)
 {
     UNREFERENCED_O;
-    return ACR_NewPointer(_E, NULL, 0, memory_pointer_cleanup);
+    return ACR_NewBasicPointer(_E, NULL, 0, memory_pointer_cleanup);
 }
 
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, malloc)(ACR_JNISTDARGS, jlong siz)
@@ -340,7 +340,7 @@
     if (mem) {
         /* Create the Pointer class with default cleanup.
          */
-        ptr = ACR_NewPointer(_E, mem, (size_t)siz, memory_pointer_cleanup);
+        ptr = ACR_NewBasicPointer(_E, mem, (size_t)siz, memory_pointer_cleanup);
         if (!ptr)
             free(mem);
     }
@@ -362,7 +362,7 @@
     if (mem) {
         /* Create the Pointer class with default cleanup.
          */
-        ptr = ACR_NewPointer(_E, mem, (size_t)siz, memory_pointer_cleanup);
+        ptr = ACR_NewBasicPointer(_E, mem, (size_t)siz, memory_pointer_cleanup);
         if (!ptr)
             free(mem);
     }
@@ -421,7 +421,7 @@
     /* Create the Pointer class without the cleanup.
      * Original object will clean the entire allocated memory.
      */
-    return ACR_NewPointer(_E, sp + so, ss, NULL);
+    return ACR_NewBasicPointer(_E, sp + so, ss, NULL);
 }
 
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, slice1)(ACR_JNISTDARGS,
@@ -446,7 +446,7 @@
 
     /* Create the ConstPointer class.
      */
-    return ACR_NewConstPointer(_E, sp + so, ss);
+    return ACR_NewConstPointer(_E, sp + so, ss, NULL);
 }
 
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, dup0)(ACR_JNISTDARGS,
@@ -479,7 +479,7 @@
     /* Copy the original content */
     ACR_TRY {
         memcpy(dp, sp + so, ss);
-        po = ACR_NewPointer(_E, dp, ss, memory_pointer_cleanup);
+        po = ACR_NewBasicPointer(_E, dp, ss, memory_pointer_cleanup);
     } ACR_CATCH() {
         ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, ACR_EFAULT);
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Tue Sep  1 15:06:23 2009
@@ -129,7 +129,7 @@
     if (!_clazzn.i) {
         initp0(_E);
     }
-    return ACR_NewPointer(_E, 0, 0, NULL);
+    return ACR_NewBasicPointer(_E, 0, 0, NULL);
 }
 
 ACR_JNI_EXPORT_DECLARE(void, AbstractPointer, cleanup0)(ACR_JNISTDARGS)
@@ -177,22 +177,31 @@
 
 ACR_PTR_EXPORT_DECLARE(jint, peek0)(ACR_JNISTDARGS, jniptr a)
 {
-    UNREFERENCED_STDARGS;
+    jint rv = 0;
+    UNREFERENCED_O;
 
-    return *(N2P(a, char *));
+    ACR_TRY {
+        rv = *(N2P(a, char *));
+    } ACR_CATCH() {
+        ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, ACR_EFAULT);
+    }
+    return rv;
 }
 
 ACR_PTR_EXPORT_DECLARE(void, poke0)(ACR_JNISTDARGS, jniptr a, jint v)
 {
-    UNREFERENCED_STDARGS;
-
-    *(N2P(a, char *)) = (char)v;
+    UNREFERENCED_O;
+    ACR_TRY {
+        *(N2P(a, char *)) = (char)v;
+    } ACR_CATCH() {
+        ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, ACR_EFAULT);
+    }
 }
 
 ACR_PTR_EXPORT_DECLARE(void, copy0)(ACR_JNISTDARGS, jniptr s,
                                     jniptr d, jniptr l)
 {
-    UNREFERENCED_STDARGS;
+    UNREFERENCED_O;
     ACR_TRY {
         memcpy(N2P(d, void *), N2P(s, const void *), (size_t)l);
     } ACR_CATCH() {
@@ -203,7 +212,7 @@
 ACR_PTR_EXPORT_DECLARE(void, move0)(ACR_JNISTDARGS, jniptr s,
                                     jniptr d, jniptr l)
 {
-    UNREFERENCED_STDARGS;
+    UNREFERENCED_O;
     ACR_TRY {
         memmove(N2P(d, void *), N2P(s, const void *), (size_t)l);
     } ACR_CATCH() {
@@ -215,7 +224,7 @@
                                      jniptr b, jniptr n)
 {
     int rv;
-    UNREFERENCED_STDARGS;
+    UNREFERENCED_O;
     ACR_TRY {
         rv = memcmp(N2P(a, void *), N2P(b, const void *), (size_t)n);
         if (rv)
@@ -227,8 +236,8 @@
     return rv;
 }
 
-ACR_DECLARE(jobject) ACR_NewPointer(JNIEnv *_E, void *p, size_t len,
-                                    acr_pointer_cleanup_fn_t *cb)
+ACR_DECLARE(jobject) ACR_NewBasicPointer(JNIEnv *_E, void *p, size_t len,
+                                         acr_pointer_cleanup_fn_t *cb)
 {
     if (_clazzn.i && J4MID(0000))
         return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/shm.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/shm.c Tue Sep  1 15:06:23 2009
@@ -84,7 +84,7 @@
             return NULL;
         }
         len = ACR_ShmGetSize(sd);
-        mpo = ACR_NewPointer(_E, mem, len, NULL);
+        mpo = ACR_NewBasicPointer(_E, mem, len, NULL);
     }
     return mpo;
 }
@@ -111,7 +111,7 @@
             ACR_ThrowException(_E, THROW_NMARK, ACR_EX_EINDEX, 0);
             return NULL;
         }
-        mpo = ACR_NewPointer(_E, mem + off, (size_t)siz, NULL);
+        mpo = ACR_NewBasicPointer(_E, mem + off, (size_t)siz, NULL);
     }
     return mpo;
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c Tue Sep  1 15:06:23 2009
@@ -30,8 +30,6 @@
 #include "acr_clazz.h"
 #include "acr_pointer.h"
 #include "acr_xdr.h"
-
-#define  ACR_WANT_MEMPROTECT
 #include "acr_error.h"
 
 #define CHECK_FOR_OVERFLOW(S)                        \

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testcase.c?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testcase.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testcase.c Tue Sep  1 15:06:23 2009
@@ -251,7 +251,7 @@
 ACR_JNI_EXPORT_DECLARE(jobject, TestPrivate, test017)(ACR_JNISTDARGS, jint d)
 {
 
-    return  ACR_NewPointer(_E, I2P(d, void *), 0, callback);
+    return  ACR_NewBasicPointer(_E, I2P(d, void *), 0, callback);
 }
 
 ACR_JNI_EXPORT_DECLARE(jobject, TestPrivate, test038)(ACR_JNISTDARGS, jint d)
@@ -269,7 +269,7 @@
 ACR_JNI_EXPORT_DECLARE(jobject, TestPrivate, test041)(ACR_JNISTDARGS, jint d)
 {
 
-    return  ACR_NewConstPointer(_E, "Hello World", sizeof("Hello World"));
+    return  ACR_NewConstPointer(_E, "Hello World", sizeof("Hello World"), NULL);
 }
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test018)(ACR_JNISTDARGS, jobject p)

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=810085&r1=810084&r2=810085&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 15:06:23 2009
@@ -81,7 +81,7 @@
         if (pa == null) {
             try {
                 p4 = map.map(4096, 128);
-                System.out.println("Map allows Platform.PAGESIZE ("
+                System.out.println("Map allows Platform.PAGESIZE (" +
                                    Platform.PAGESIZE +
                                    " bytes) offset alignment");
             } catch (IOException e) {
@@ -106,6 +106,11 @@
         assertEquals("Class header [1]", (byte)0xFE, (byte)p2.peek(1));
         assertEquals("Class header [2]", (byte)0xBA, (byte)p1.peek(2));
         assertEquals("Class header [3]", (byte)0xBE, (byte)p2.peek(3));
+        try {
+            p1.poke(0, (byte)0xCA);
+        } catch (Throwable t) {
+            System.out.println("Throwed " + t);
+        }
         map.close();
     }
 

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestNioByteBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestNioByteBuffer.java?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestNioByteBuffer.java
(original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestNioByteBuffer.java
Tue Sep  1 15:06:23 2009
@@ -90,6 +90,7 @@
             ptr.free();
             // This is double free. Don't do this!
             // Exception handler won't help here.
+            test_me = false;
             if (test_me) {
                 NioByteBuffer.free(bb);
             }

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java?rev=810085&r1=810084&r2=810085&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Tue
Sep  1 15:06:23 2009
@@ -757,10 +757,10 @@
         throws Throwable
     {
         test054(0);
-        int numThreads = 100;
+        int numThreads = 10;
         IohParallelWorker wo = new IohParallelWorker();
         TestParallel pt = new TestParallel(numThreads);
-        int rv = pt.run(wo, wo, 1000);
+        int rv = pt.run(wo, wo, 100);
         int nc = test054(0);
         System.out.println();
         System.out.println("Parallel test status " + rv);



Mime
View raw message