Home | History | Annotate | Download | only in dalvik
      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 package org.apache.harmony.dalvik;
     18 
     19 import dalvik.annotation.optimization.CriticalNative;
     20 import dalvik.annotation.optimization.FastNative;
     21 
     22 /**
     23  * Methods used to test calling into native code. The methods in this
     24  * class are all effectively no-ops and may be used to test the mechanisms
     25  * and performance of calling native methods.
     26  */
     27 public final class NativeTestTarget {
     28     public NativeTestTarget() {
     29     }
     30 
     31     /**
     32      * This is used to benchmark dalvik's inline natives.
     33      */
     34     public static void emptyInlineMethod() {
     35     }
     36 
     37     /**
     38      * This is used to benchmark dalvik's inline natives.
     39      */
     40     public static native void emptyInternalStaticMethod();
     41 
     42     // Synchronized methods. Test normal JNI only.
     43     public static native synchronized void emptyJniStaticSynchronizedMethod0();
     44     public native synchronized void emptyJniSynchronizedMethod0();
     45 
     46     // Static methods without object parameters. Test all optimization combinations.
     47 
     48     // Normal native.
     49     public static native void emptyJniStaticMethod0();
     50     // Normal native.
     51     public static native void emptyJniStaticMethod6(int a, int b, int c, int d, int e, int f);
     52 
     53     @FastNative
     54     public static native void emptyJniStaticMethod0_Fast();
     55     @FastNative
     56     public static native void emptyJniStaticMethod6_Fast(int a, int b, int c, int d, int e, int f);
     57 
     58     @CriticalNative
     59     public static native void emptyJniStaticMethod0_Critical();
     60     @CriticalNative
     61     public static native void emptyJniStaticMethod6_Critical(int a, int b, int c, int d, int e, int f);
     62     // Instance methods or methods with object parameters. Test {Normal, @FastNative} combinations.
     63 
     64     // Normal native.
     65     public native void emptyJniMethod0();
     66     // Normal native.
     67     public native void emptyJniMethod6(int a, int b, int c, int d, int e, int f);
     68 
     69     /**
     70      * This is an empty native static method with six args, hooked up
     71      * using JNI. These have more complex args to show the cost of
     72      * parsing the signature. All six values should be null
     73      * references.
     74      */
     75     // Normal native.
     76     public static native void emptyJniStaticMethod6L(String a, String[] b,
     77         int[][] c, Object d, Object[] e, Object[][][][] f);
     78 
     79     // Normal native.
     80     public native void emptyJniMethod6L(String a, String[] b,
     81         int[][] c, Object d, Object[] e, Object[][][][] f);
     82 
     83     @FastNative
     84     public native void emptyJniMethod0_Fast();
     85     @FastNative
     86     public native void emptyJniMethod6_Fast(int a, int b, int c, int d, int e, int f);
     87 
     88     /**
     89      * This is an empty native static method with six args, hooked up
     90      * using JNI. These have more complex args to show the cost of
     91      * parsing the signature. All six values should be null
     92      * references.
     93      */
     94     @FastNative
     95     public static native void emptyJniStaticMethod6L_Fast(String a, String[] b,
     96         int[][] c, Object d, Object[] e, Object[][][][] f);
     97 
     98     @FastNative
     99     public native void emptyJniMethod6L_Fast(String a, String[] b,
    100         int[][] c, Object d, Object[] e, Object[][][][] f);
    101 }
    102