SF.net SVN: jikesrvm:[15769] rvmroot/trunk/testing/tests/jni

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: jikesrvm:[15769] rvmroot/trunk/testing/tests/jni

by dframpton-oss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 15769
          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15769&view=rev
Author:   dframpton-oss
Date:     2009-08-19 04:36:18 +0000 (Wed, 19 Aug 2009)

Log Message:
-----------
Add a trivial (failing) test that is the cause of RVM-827. Seems to be a problem related to nested JNI and Java frames wrt. GC.

Modified Paths:
--------------
    rvmroot/trunk/testing/tests/jni/build.xml

Added Paths:
-----------
    rvmroot/trunk/testing/tests/jni/src/TestNestedGC.c
    rvmroot/trunk/testing/tests/jni/src/TestNestedGC.java

Modified: rvmroot/trunk/testing/tests/jni/build.xml
===================================================================
--- rvmroot/trunk/testing/tests/jni/build.xml 2009-08-18 10:48:14 UTC (rev 15768)
+++ rvmroot/trunk/testing/tests/jni/build.xml 2009-08-19 04:36:18 UTC (rev 15769)
@@ -94,6 +94,7 @@
     <jniTest class="NullIdentity"/>
     <jniTest class="StringFunctions"/>
     <jniTest class="TestGC"/>
+    <jniTest class="TestNestedGC"/>
     <jniTest class="t3GT3"/>
 
     <!-- JNI 1.2 -->

Added: rvmroot/trunk/testing/tests/jni/src/TestNestedGC.c
===================================================================
--- rvmroot/trunk/testing/tests/jni/src/TestNestedGC.c                        (rev 0)
+++ rvmroot/trunk/testing/tests/jni/src/TestNestedGC.c 2009-08-19 04:36:18 UTC (rev 15769)
@@ -0,0 +1,57 @@
+/*
+ *  This file is part of the Jikes RVM project (http://jikesrvm.org).
+ *
+ *  This file is licensed to You under the Eclipse Public License (EPL);
+ *  You may not use this file except in compliance with the License. You
+ *  may obtain a copy of the License at
+ *
+ *      http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ *  See the COPYRIGHT.txt file distributed with this work for information
+ *  regarding copyright ownership.
+ */
+/* Test GC with Native frames on stack
+ */
+
+#include <stdio.h>
+#include "TestNestedGC.h"
+#include <jni.h>
+
+int verbose=1;
+
+/*
+ * Class:     TestNestedGC
+ * Method:    level0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_TestNestedGC_level0
+  (JNIEnv * env, jclass cls) {
+
+  jmethodID methodID = (*env) -> GetStaticMethodID(env, cls, "level1", "()V");
+  if (methodID == NULL) {
+    if (verbose)
+      printf("> GetStaticMethodID: fail to get method ID for static method level1()\n");
+    return NULL;
+  }
+
+  (*env) -> CallStaticVoidMethodA(env, cls, methodID, NULL);
+}
+
+/*
+ * Class:     TestNestedGC
+ * Method:    level2
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_TestNestedGC_level2
+  (JNIEnv * env, jclass cls) {
+
+  jmethodID methodID = (*env) -> GetStaticMethodID(env, cls, "level3", "()V");
+  if (methodID == NULL) {
+    if (verbose)
+      printf("> GetStaticMethodID: fail to get method ID for static method level3()\n");
+    return NULL;
+  }
+
+  (*env) -> CallStaticVoidMethodA(env, cls, methodID, NULL);
+}
+

Added: rvmroot/trunk/testing/tests/jni/src/TestNestedGC.java
===================================================================
--- rvmroot/trunk/testing/tests/jni/src/TestNestedGC.java                        (rev 0)
+++ rvmroot/trunk/testing/tests/jni/src/TestNestedGC.java 2009-08-19 04:36:18 UTC (rev 15769)
@@ -0,0 +1,42 @@
+/*
+ *  This file is part of the Jikes RVM project (http://jikesrvm.org).
+ *
+ *  This file is licensed to You under the Eclipse Public License (EPL);
+ *  You may not use this file except in compliance with the License. You
+ *  may obtain a copy of the License at
+ *
+ *      http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ *  See the COPYRIGHT.txt file distributed with this work for information
+ *  regarding copyright ownership.
+ */
+
+import org.jikesrvm.VM;
+import org.jikesrvm.runtime.Magic;
+import org.vmmagic.unboxed.Address;
+
+/**
+ * Test GC with nested Native and Java frames on stack
+ */
+class TestNestedGC {
+
+  static native void level0();
+
+  public static void level1() {
+    System.gc();
+    System.out.println("First gc triggered.");
+    level2();
+  }
+
+  static native void level2();
+
+  public static void level3() {
+    System.gc();
+    System.out.println("PASS: Second gc triggered.");
+  }
+
+  public static void main(String[] args) {
+    System.loadLibrary("TestNestedGC");
+    level0();
+  }
+}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits