commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1091311 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/Unsafe.java native/os/unix/init.c native/shared/iofd.c native/shared/unsafe.c
Date Tue, 12 Apr 2011 06:52:11 GMT
Author: mturk
Date: Tue Apr 12 06:52:11 2011
New Revision: 1091311

URL: http://svn.apache.org/viewvc?rev=1091311&view=rev
Log:
Use less cryptic method names

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
    commons/sandbox/runtime/trunk/src/main/native/os/unix/init.c
    commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c
    commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java?rev=1091311&r1=1091310&r2=1091311&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java Tue
Apr 12 06:52:11 2011
@@ -32,12 +32,12 @@ public final class Unsafe
     }
 
     private static final  Object unsafe;
-    private static native Object get0();
-    private static native int    get1(Field f);
-    private static native int    get2(Field f);
-    private static native int    get3(Field f);
+    private static native Object init0();
+    private static native int    getOffset0(Field f);
+    private static native int    getOffset1(Field f);
+    private static native int    getBase0(Field f);
     static {
-        unsafe = get0();
+        unsafe = init0();
     }
 
     /**
@@ -68,7 +68,7 @@ public final class Unsafe
             throw new UnsupportedOperationException();
         if (field == null)
             throw new IllegalArgumentException();
-        return get1(field);
+        return getOffset0(field);
     }
 
     public static int staticFieldBase(Field field)
@@ -78,7 +78,7 @@ public final class Unsafe
             throw new UnsupportedOperationException();
         if (field == null)
             throw new IllegalArgumentException();
-        return get2(field);
+        return getBase0(field);
     }
 
     public static int staticFieldOffset(Field field)
@@ -88,6 +88,6 @@ public final class Unsafe
             throw new UnsupportedOperationException();
         if (field == null)
             throw new IllegalArgumentException();
-        return get3(field);
+        return getOffset1(field);
     }
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/init.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/init.c?rev=1091311&r1=1091310&r2=1091311&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/init.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/init.c Tue Apr 12 06:52:11 2011
@@ -26,7 +26,7 @@ static pthread_key_t   _threadkey;
 static volatile int    _threadkey_inited = 0;
 static pthread_mutex_t _lib_mutex  = PTHREAD_MUTEX_INITIALIZER;
 #if HAVE_THREAD_LOCAL
-ACR_THREAD acr_exc_t   acr_exception_frame;
+ACR_THREAD acr_exc_t   acr_exception_frame = { 0, 0, 0, 0, 0, 0 };
 #endif
 
 typedef struct tlsd_t

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c?rev=1091311&r1=1091310&r2=1091311&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c Tue Apr 12 06:52:11 2011
@@ -19,7 +19,7 @@
  * @author Mladen Turk
  */
 
-#include "acr/observer.h"
+#include "acr/iofd.h"
 #include "acr/clazz.h"
 #include "acr/memory.h"
 #include "acr/unsafe.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c?rev=1091311&r1=1091310&r2=1091311&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c Tue Apr 12 06:52:11 2011
@@ -95,6 +95,9 @@ _get_unsafe(JNI_STDENV)
 {
     if (_unsafe_instance == 0 && CLAZZ_LOADED) {
         _unsafe_instance = GET_SFIELD_O(0000, _clazzn.i);
+        /* Clear exception if any.
+         */
+        (*env)->ExceptionClear(env);
     }
     return _unsafe_instance;
 }
@@ -103,6 +106,7 @@ jint
 AcrUnsafeObjectFieldOffset(JNI_STDARGS)
 {
     jlong fo;
+
     if (_get_unsafe(env) == 0) {
         return INVALID_FIELD_OFFSET;
     }
@@ -117,6 +121,7 @@ jint
 AcrUnsafeStaticFieldBase(JNI_STDARGS)
 {
     jlong fo;
+
     if (_get_unsafe(env) == 0) {
         return INVALID_FIELD_OFFSET;
     }
@@ -131,6 +136,7 @@ jint
 AcrUnsafeStaticFieldOffset(JNI_STDARGS)
 {
     jlong fo;
+
     if (_get_unsafe(env) == 0) {
         return INVALID_FIELD_OFFSET;
     }
@@ -173,24 +179,24 @@ AcrUnsafeStaticFieldIdOffset(JNI_STDENV,
     return off;
 }
 
-ACR_JNI_EXPORT(jobject, Unsafe, get0)(JNI_STDARGS)
+ACR_JNI_EXPORT(jobject, Unsafe, init0)(JNI_STDARGS)
 {
     return _get_unsafe(env);
 }
 
-ACR_JNI_EXPORT(jint, Unsafe, get1)(JNI_STDARGS, jobject field)
+ACR_JNI_EXPORT(jint, Unsafe, getOffset0)(JNI_STDARGS, jobject field)
 {
     return AcrUnsafeObjectFieldOffset(env, field);
 }
 
-ACR_JNI_EXPORT(jint, Unsafe, get2)(JNI_STDARGS, jobject field)
+ACR_JNI_EXPORT(jint, Unsafe, getOffset1)(JNI_STDARGS, jobject field)
 {
-    return AcrUnsafeStaticFieldBase(env, field);
+    return AcrUnsafeStaticFieldOffset(env, field);
 }
 
-ACR_JNI_EXPORT(jint, Unsafe, get3)(JNI_STDARGS, jobject field)
+ACR_JNI_EXPORT(jint, Unsafe, getBase0)(JNI_STDARGS, jobject field)
 {
-    return AcrUnsafeStaticFieldOffset(env, field);
+    return AcrUnsafeStaticFieldBase(env, field);
 }
 
 #if defined(ENABLE_TEST_PRIVATE)



Mime
View raw message