harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r454551 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore: include/ src/kernel_classes/javasrc/java/util/ src/kernel_classes/javasrc/java/util/concurrent/ src/kernel_classes/javasrc/java/util/concurrent/locks/ src/kernel_classes/javasr...
Date Mon, 09 Oct 2006 23:22:43 GMT
Author: geirm
Date: Mon Oct  9 16:22:42 2006
New Revision: 454551

URL: http://svn.apache.org/viewvc?view=rev&rev=454551
Log:
HARMONY-1567

Hi,
The attached is a final (I hope) patch integration juc and DRLVM.
It implements arrayBaseOffset and arrayIndexScale methods.
Almost all JSR166 unit tests are passed now.
Exception are CopyOnWriteArrayListTest and CopyOnWriteArraySetTest wich are not implemented
in Harmony.

PS. 1. I returned j.u.c.l.LockSupport back to the DRLVM kernel classes to make juc+DRLVM working
till 
final desing and decision regarding Objects and Threads be made.
2. This patch does not incude AtomicLong.VMSupportsCS8() implementation. Comment it to test
the patch.
3. Please apply https://issues.apache.org/jira/browse/HARMONY-1383 first. 

Ubuntu 6 - smoke, c-unit, ~kernel



Added:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java
  (with props)
Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h?view=diff&rev=454551&r1=454550&r2=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h Mon Oct  9
16:22:42 2006
@@ -18,6 +18,6 @@
 #ifndef _VERSION_SVN_TAG_
 #define _VERSION_SVN_TAG_
 
-#define VERSION_SVN_TAG  "454394"
+#define VERSION_SVN_TAG  "454528"
 
 #endif // _VERSION_SVN_TAG_

Added: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java?view=auto&rev=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java
(added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java
Mon Oct  9 16:22:42 2006
@@ -0,0 +1,28 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package java.util.concurrent.locks;
+
+public class LockSupport {
+
+    public static native void unpark(Thread thread);    
+    
+    public static native void park();    
+    
+    public static native void parkNanos(long nanos);    
+    
+    public static native void parkUntil(long deadline);
+}
+

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/util/concurrent/locks/LockSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java?view=diff&rev=454551&r1=454550&r2=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
Mon Oct  9 16:22:42 2006
@@ -33,6 +33,22 @@
 
     private Atomics() {};
 
+     /**
+      * Returns offset of the first array's element 
+      * @param arrayClass class of the array
+      *
+      * @return offset of the array's first element
+      */
+    public static native int arrayBaseOffset(Class arrayClass);
+
+     /**
+      * Returns size of the array's element
+      * @param arrayClass class of the array
+      *
+      * @return size of the array's element
+      */
+    public static native int arrayIndexScale(Class arrayClass);
+
      /*
       * Writes new value to the object's field (by given offset) in volatile manner
       * @param obj object which field needs to be set

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java?view=diff&rev=454551&r1=454550&r2=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
Mon Oct  9 16:22:42 2006
@@ -117,7 +117,7 @@
      * @return The base offset value.
      */
     public int arrayBaseOffset(Class<?> clazz) {
-        throw new UnsupportedOperationException("Not Yet Implemented");
+        return Atomics.arrayBaseOffset(clazz);
     }
 
     /**
@@ -150,7 +150,7 @@
      * @return The index scale value.
      */
     public int arrayIndexScale(Class<?> clazz) {
-        throw new UnsupportedOperationException("Not Yet Implemented");
+        return Atomics.arrayIndexScale(clazz);
     }
 
     /**
@@ -272,6 +272,7 @@
      */
     public void unpark(Thread thread) {
         throw new UnsupportedOperationException("Not Yet Implemented");
+        //LockSupport.unpark(thread);
     }
 
     /**
@@ -293,5 +294,10 @@
      */
     public void park(boolean timestamp, long nanosOrTimestamp) {
         throw new UnsupportedOperationException("Not Yet Implemented");
+        /*if (timestamp) {
+            LockSupport.parkUntil(nanosOrTimestamp);
+        } else {
+            LockSupport.parkNanos(nanosOrTimestamp);
+        }*/
     }
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp?view=diff&rev=454551&r1=454550&r2=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
Mon Oct  9 16:22:42 2006
@@ -24,6 +24,23 @@
 #include "atomics.h"
 #include "org_apache_harmony_util_concurrent_Atomics.h"
 
+JNIEXPORT jint JNICALL Java_org_apache_harmony_util_concurrent_Atomics_arrayBaseOffset
+  (JNIEnv * env, jclass self, jclass array)
+{
+    jlong array_element_size = Java_org_apache_harmony_util_concurrent_Atomics_arrayIndexScale(env,
self, array);
+    if(array_element_size < 8) {
+        return VM_VECTOR_FIRST_ELEM_OFFSET_1_2_4;
+    } else {
+        return VM_VECTOR_FIRST_ELEM_OFFSET_8;
+    }
+}
+
+JNIEXPORT jint JNICALL Java_org_apache_harmony_util_concurrent_Atomics_arrayIndexScale
+  (JNIEnv * env, jclass self, jclass array)
+{
+    Class * clz = jclass_to_struct_Class(array);
+    return clz->array_element_size;
+}
 
 JNIEXPORT void JNICALL 
 Java_org_apache_harmony_util_concurrent_Atomics_setIntVolatile__Ljava_lang_Object_2JI(JNIEnv
* env, jclass self, 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h?view=diff&rev=454551&r1=454550&r2=454551
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
Mon Oct  9 16:22:42 2006
@@ -42,6 +42,18 @@
 /* Native methods */
 
 /*
+ * Method: org.apache.harmony.util.concurrent.Atomics.arrayBaseOffset(Ljava/lang/Class;)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_harmony_util_concurrent_Atomics_arrayBaseOffset
+  (JNIEnv *, jclass, jclass);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.arrayIndexScale(Ljava/lang/Class;)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_harmony_util_concurrent_Atomics_arrayIndexScale
+  (JNIEnv *, jclass, jclass);
+
+/*
  * Method: org.apache.harmony.util.concurrent.Atomics.setIntVolatile(Ljava/lang/Object;JI)V
  */
 JNIEXPORT void JNICALL 



Mime
View raw message