harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r504842 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H3130/ vm/interpreter/src/
Date Thu, 08 Feb 2007 10:08:58 GMT
Author: varlax
Date: Thu Feb  8 02:08:57 2007
New Revision: 504842

URL: http://svn.apache.org/viewvc?view=rev&rev=504842
Log:
HARMONY-3130 [drlvm][interpreter] segfault in interpreter_execute_method

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3130/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H3130/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c?view=auto&rev=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c Thu Feb  8 02:08:57
2007
@@ -0,0 +1,24 @@
+#include <jni.h>
+
+JNIEXPORT void JNICALL 
+Java_org_apache_harmony_drlvm_tests_regression_h3130_CallNativeTest_testCallNative(JNIEnv
*, jobject); 
+
+JNIEXPORT jobject JNICALL 
+Java_org_apache_harmony_drlvm_tests_regression_h3130_CallNativeTest_getNull(JNIEnv *, jclass);
+
+
+JNIEXPORT void JNICALL 
+Java_org_apache_harmony_drlvm_tests_regression_h3130_CallNativeTest_testCallNative(JNIEnv
*jenv, jobject obj) 
+{
+    jclass clazz = (*jenv)->GetObjectClass(jenv, obj);
+    jmethodID mid = (*jenv)->GetMethodID(jenv, clazz, "getNull", "()Ljava/lang/Object;");
+    jobject res = (*jenv)->CallObjectMethod(jenv, obj, mid);
+    if (res) {
+        (*jenv)->ThrowNew(jenv, (*jenv)->FindClass(jenv, "junit/framework/AssertionFailedError"),
"Non-null returned");
+    }
+}
+
+JNIEXPORT jobject JNICALL 
+Java_org_apache_harmony_drlvm_tests_regression_h3130_CallNativeTest_getNull(JNIEnv *jenv,
jclass jcl) {
+    return NULL;
+}

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.java?view=auto&rev=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3130/CallNativeTest.java Thu Feb  8
02:08:57 2007
@@ -0,0 +1,10 @@
+package org.apache.harmony.drlvm.tests.regression.h3130;
+
+import junit.framework.TestCase;
+
+public class CallNativeTest extends TestCase {
+   static { System.loadLibrary("CallNativeTest"); }
+
+   public native void testCallNative();
+   private native Object getNull();
+}
\ No newline at end of file

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3130/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3130/run.test.xml?view=auto&rev=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3130/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3130/run.test.xml Thu Feb  8 02:08:57
2007
@@ -0,0 +1,12 @@
+<project name="RUN HARMONY-3130 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+            test="org.apache.harmony.drlvm.tests.regression.h3130.CallNativeTest"
+            vmarg="-Xint">
+            <junit-element>
+              <sysproperty key="java.library.path" value="${reg.test.native.path}/H3130"/>
+            </junit-element>
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp?view=diff&rev=504842&r1=504841&r2=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp Thu Feb  8 02:08:57
2007
@@ -203,11 +203,16 @@
             {
                 jobject obj = (jobject) invokeJNI_Obj(out_args, n_fps, n_stacks, f);
                 hythread_suspend_disable();
-                ManagedObject *ref = obj->object;
-                M2N_FREE_MACRO;
-                ObjectHandle new_handle = oh_allocate_local_handle();
-                new_handle->object = ref;
-                resultPtr->l = new_handle;
+                if (obj) {
+                    ManagedObject *ref = obj->object;
+                    M2N_FREE_MACRO;
+                    ObjectHandle new_handle = oh_allocate_local_handle();
+                    new_handle->object = ref;
+                    resultPtr->l = new_handle;
+                } else {
+                    M2N_FREE_MACRO;
+                    resultPtr->l = NULL;
+                }
             }
             break;
 

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp?view=diff&rev=504842&r1=504841&r2=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp Thu Feb  8 02:08:57
2007
@@ -182,11 +182,16 @@
             {
                 jobject obj = (jobject) invokeJNI_Obj(arg_words, argId, f);
                 hythread_suspend_disable();
-                ManagedObject *ref = obj->object;
-                M2N_FREE_MACRO;
-                ObjectHandle new_handle = oh_allocate_local_handle();
-                new_handle->object = ref;
-                resultPtr->l = new_handle;
+                if (obj) {
+                    ManagedObject *ref = obj->object;
+                    M2N_FREE_MACRO;
+                    ObjectHandle new_handle = oh_allocate_local_handle();
+                    new_handle->object = ref;
+                    resultPtr->l = new_handle;
+                } else {
+                    M2N_FREE_MACRO;
+                    resultPtr->l = NULL;
+                }
             }
             break;
 

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp?view=diff&rev=504842&r1=504841&r2=504842
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp Thu Feb  8 02:08:57
2007
@@ -196,11 +196,16 @@
             {
                 jobject obj = (jobject) invokeJNI_Obj(arg_words, fpargs, argId, frameSize,
f);
                 hythread_suspend_disable();
-                ManagedObject *ref = obj->object;
-                M2N_FREE_MACRO;
-                ObjectHandle new_handle = oh_allocate_local_handle();
-                new_handle->object = ref;
-                resultPtr->l = new_handle;
+                if (obj) {
+                    ManagedObject *ref = obj->object;
+                    M2N_FREE_MACRO;
+                    ObjectHandle new_handle = oh_allocate_local_handle();
+                    new_handle->object = ref;
+                    resultPtr->l = new_handle;
+                } else {
+                    M2N_FREE_MACRO;
+                    resultPtr->l = NULL;
+                }
             }
             break;
 



Mime
View raw message