summaryrefslogtreecommitdiffstats
path: root/dalvik/src
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-12-22 12:04:40 -0800
committerJesse Wilson <jessewilson@google.com>2010-12-22 12:04:40 -0800
commitb8f9285f7e67812c435bc429e07683d6b9039b0a (patch)
tree3852dc5f8bd7e745749230c1d6fdee2e986318a7 /dalvik/src
parent0b0e0bb1553816cb9ebf8932d28adf3137572535 (diff)
downloadlibcore-b8f9285f7e67812c435bc429e07683d6b9039b0a.zip
libcore-b8f9285f7e67812c435bc429e07683d6b9039b0a.tar.gz
libcore-b8f9285f7e67812c435bc429e07683d6b9039b0a.tar.bz2
Revert "Remove inline natives for an unused performance test." (libcore)
Change-Id: I7ea69f84c008c5bdbdf8af6134fb81d80f0a958e
Diffstat (limited to 'dalvik/src')
-rw-r--r--dalvik/src/main/java/org/apache/harmony/dalvik/NativeTestTarget.java68
-rw-r--r--dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp68
-rw-r--r--dalvik/src/main/native/sub.mk3
3 files changed, 138 insertions, 1 deletions
diff --git a/dalvik/src/main/java/org/apache/harmony/dalvik/NativeTestTarget.java b/dalvik/src/main/java/org/apache/harmony/dalvik/NativeTestTarget.java
new file mode 100644
index 0000000..7b46d2e
--- /dev/null
+++ b/dalvik/src/main/java/org/apache/harmony/dalvik/NativeTestTarget.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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 org.apache.harmony.dalvik;
+
+/**
+ * Methods used to test calling into native code. The methods in this
+ * class are all effectively no-ops and may be used to test the mechanisms
+ * and performance of calling native methods.
+ */
+public final class NativeTestTarget {
+ /**
+ * This class is uninstantiable.
+ */
+ private NativeTestTarget() {
+ // This space intentionally left blank.
+ }
+
+ /**
+ * This is an empty native static method with no args, hooked up using
+ * JNI.
+ */
+ public static native void emptyJniStaticMethod0();
+
+ /**
+ * This is an empty native static method with six args, hooked up using
+ * JNI.
+ */
+ public static native void emptyJniStaticMethod6(int a, int b, int c,
+ int d, int e, int f);
+
+ /**
+ * This is an empty native static method with six args, hooked up
+ * using JNI. These have more complex args to show the cost of
+ * parsing the signature. All six values should be null
+ * references.
+ */
+ public static native void emptyJniStaticMethod6L(String a, String[] b,
+ int[][] c, Object d, Object[] e, Object[][][][] f);
+
+ /**
+ * This method is intended to be "inlined" by the virtual machine
+ * (e.g., given special treatment as an intrinsic).
+ */
+ public static void emptyInlineMethod() {
+ // This space intentionally left blank.
+ }
+
+ /**
+ * This method is intended to be defined in native code and hooked
+ * up using the virtual machine's special fast-path native linkage
+ * (as opposed to being hooked up using JNI).
+ */
+ public static native void emptyInternalStaticMethod();
+}
diff --git a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
new file mode 100644
index 0000000..46e18ae
--- /dev/null
+++ b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include "JNIHelp.h"
+
+/*
+ * public static void emptyJniStaticMethod0()
+ *
+ * For benchmarks, a do-nothing JNI method with no arguments.
+ */
+static void emptyJniStaticMethod0(JNIEnv*, jclass)
+{
+ // This space intentionally left blank.
+}
+
+/*
+ * public static void emptyJniStaticMethod6(int a, int b, int c,
+ * int d, int e, int f)
+ *
+ * For benchmarks, a do-nothing JNI method with six arguments.
+ */
+static void emptyJniStaticMethod6(JNIEnv*, jclass,
+ int, int, int, int, int, int)
+{
+ // This space intentionally left blank.
+}
+
+/*
+ * public static void emptyJniStaticMethod6L(String a, String[] b,
+ * int[][] c, Object d, Object[] e, Object[][][][] f)
+ *
+ * For benchmarks, a do-nothing JNI method with six arguments.
+ */
+static void emptyJniStaticMethod6L(JNIEnv*, jclass,
+ jobject, jarray, jarray, jobject, jarray, jarray)
+{
+ // This space intentionally left blank.
+}
+
+static JNINativeMethod gMethods[] = {
+ { "emptyJniStaticMethod0", "()V", (void*)emptyJniStaticMethod0 },
+ { "emptyJniStaticMethod6", "(IIIIII)V", (void*)emptyJniStaticMethod6 },
+ { "emptyJniStaticMethod6L", "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V", (void*)emptyJniStaticMethod6L },
+};
+int register_org_apache_harmony_dalvik_NativeTestTarget(JNIEnv* env) {
+ int result = jniRegisterNativeMethods(env,
+ "org/apache/harmony/dalvik/NativeTestTarget",
+ gMethods, NELEM(gMethods));
+ if (result != 0) {
+ /* print warning, but allow to continue */
+ LOGW("WARNING: NativeTestTarget not registered\n");
+ env->ExceptionClear();
+ }
+ return 0;
+}
diff --git a/dalvik/src/main/native/sub.mk b/dalvik/src/main/native/sub.mk
index 3f8b1a3..27d4c9c 100644
--- a/dalvik/src/main/native/sub.mk
+++ b/dalvik/src/main/native/sub.mk
@@ -3,7 +3,8 @@
# or BUILD_*_LIBRARY.
LOCAL_SRC_FILES := \
- dalvik_system_TouchDex.cpp
+ dalvik_system_TouchDex.cpp \
+ org_apache_harmony_dalvik_NativeTestTarget.cpp
#LOCAL_C_INCLUDES +=