Home | History | Annotate | Download | only in native
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "JNIHelp.h"
     18 
     19 /*
     20  * public static void emptyJniStaticMethod0()
     21  *
     22  * For benchmarks, a do-nothing JNI method with no arguments.
     23  */
     24 static void emptyJniStaticMethod0(JNIEnv*, jclass)
     25 {
     26     // This space intentionally left blank.
     27 }
     28 
     29 /*
     30  * public static void emptyJniStaticMethod6(int a, int b, int c,
     31  *   int d, int e, int f)
     32  *
     33  * For benchmarks, a do-nothing JNI method with six arguments.
     34  */
     35 static void emptyJniStaticMethod6(JNIEnv*, jclass,
     36     int, int, int, int, int, int)
     37 {
     38     // This space intentionally left blank.
     39 }
     40 
     41 /*
     42  * public static void emptyJniStaticMethod6L(String a, String[] b,
     43  *   int[][] c, Object d, Object[] e, Object[][][][] f)
     44  *
     45  * For benchmarks, a do-nothing JNI method with six arguments.
     46  */
     47 static void emptyJniStaticMethod6L(JNIEnv*, jclass,
     48     jobject, jarray, jarray, jobject, jarray, jarray)
     49 {
     50     // This space intentionally left blank.
     51 }
     52 
     53 static JNINativeMethod gMethods[] = {
     54   { "emptyJniStaticMethod0",  "()V",       (void*)emptyJniStaticMethod0 },
     55   { "emptyJniStaticMethod6",  "(IIIIII)V", (void*)emptyJniStaticMethod6 },
     56   { "emptyJniStaticMethod6L", "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V", (void*)emptyJniStaticMethod6L },
     57 };
     58 int register_org_apache_harmony_dalvik_NativeTestTarget(JNIEnv* env) {
     59     int result = jniRegisterNativeMethods(env,
     60             "org/apache/harmony/dalvik/NativeTestTarget",
     61             gMethods, NELEM(gMethods));
     62     if (result != 0) {
     63         /* print warning, but allow to continue */
     64         LOGW("WARNING: NativeTestTarget not registered\n");
     65         env->ExceptionClear();
     66     }
     67     return 0;
     68 }
     69