harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r576759 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
Date Tue, 18 Sep 2007 07:53:36 GMT
Author: xli
Date: Tue Sep 18 00:53:36 2007
New Revision: 576759

URL: http://svn.apache.org/viewvc?rev=576759&view=rev
Log:
HARMONY-3997 : second patch 0002-Fast-version-of-class-unloading-support-in-lazy-stac.patch
for performance optimization

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp?rev=576759&r1=576758&r2=576759&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
Tue Sep 18 00:53:36 2007
@@ -35,6 +35,7 @@
 #include "environment.h"
 #include "exceptions.h"
 #include "vm_strings.h"
+#include "vm_arrays.h"
 #include "thread_generic.h"
 
 #include "java_lang_VMClassRegistry.h"
@@ -288,36 +289,46 @@
 
     Global_Env* genv = jni_get_vm_env(jenv);
 
-     // state object contains raw data as long array
+    // get class array class
+    static Class *arr_class = (Class *)class_get_array_of_class(genv->JavaLangClass_Class);
+    assert(arr_class);
+
+    // state object contains raw data as long array
     jlongArray array = (jlongArray)state;
     assert(array);
 
-    // copy data to array
-    jlong* array_data = jenv->GetLongArrayElements(array, NULL);
-
     // get depth of the stack
-    StackTraceFrame* frames = (StackTraceFrame*) array_data;
     unsigned size = jenv->GetArrayLength(array) * 8 / sizeof(StackTraceFrame);
 
-    // get class array class
-    jclass cac = struct_Class_to_java_lang_Class_Handle(genv->JavaLangClass_Class);
-    assert(cac);
+    tmn_suspend_disable();       //---------------------------------v
 
     // create java array
-    jobjectArray arr = jenv->NewObjectArray(size, cac, NULL);
+    Vector_Handle arr = vm_new_vector(arr_class, size);
     if (arr == NULL) {
+        tmn_suspend_enable();
         return NULL;
     }
 
+    // copy data to array
+    Vector_Handle ja = (Vector_Handle)array->object;
+    StackTraceFrame* frames = (StackTraceFrame*)get_vector_element_address_int64(ja, 0);
+
     // find and store classes of the methods on the stack
     for (unsigned i=0; i < size; i++) {
         Method* m = frames[i].method;
         Class* c = m->get_class();
-        jclass jc = struct_Class_to_java_lang_Class_Handle(c);
-        jenv->SetObjectArrayElement(arr, i, jc);
+
+        ManagedObject *elem= struct_Class_to_java_lang_Class(c);
+        STORE_REFERENCE((ManagedObject *)arr, get_vector_element_address_ref(arr, i), elem);
     }
 
-    return arr;
+    ObjectHandle java_array = oh_allocate_local_handle();
+    java_array->object = (ManagedObject*)arr;
+
+    tmn_suspend_enable();        //---------------------------------^
+
+    return (jobjectArray)java_array;
+
 }
 
 /*



Mime
View raw message