diff options
author | Elliott Hughes <enh@google.com> | 2011-02-16 16:12:03 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-16 16:12:03 -0800 |
commit | d8dc6b738a5b531e4ed39e696754bfecb2533c62 (patch) | |
tree | 0f2ab6575b54dea346b8f20a21f28841bb18664c | |
parent | a933e1adcf7b3801fc63fd60389e85f4af78c9b1 (diff) | |
parent | 69ee8f605ad4139c8b9a39821fd7a4cadb9d9337 (diff) | |
download | android_dalvik-d8dc6b738a5b531e4ed39e696754bfecb2533c62.tar.gz android_dalvik-d8dc6b738a5b531e4ed39e696754bfecb2533c62.tar.bz2 android_dalvik-d8dc6b738a5b531e4ed39e696754bfecb2533c62.zip |
Merge "Ensure we always call inline natives." into dalvik-dev
-rw-r--r-- | vm/Dvm.mk | 3 | ||||
-rw-r--r-- | vm/InlineNative.c | 42 | ||||
-rw-r--r-- | vm/InlineNative.h | 6 | ||||
-rw-r--r-- | vm/compiler/codegen/arm/CalloutHelper.h | 17 | ||||
-rw-r--r-- | vm/compiler/codegen/x86/CalloutHelper.h | 17 | ||||
-rw-r--r-- | vm/native/InternalNative.c | 3 | ||||
-rw-r--r-- | vm/native/InternalNativePriv.h | 15 | ||||
-rw-r--r-- | vm/native/java_lang_Double.c | 40 | ||||
-rw-r--r-- | vm/native/java_lang_Float.c | 40 | ||||
-rw-r--r-- | vm/native/java_lang_Math.c | 76 | ||||
-rw-r--r-- | vm/native/java_lang_String.c | 49 |
11 files changed, 241 insertions, 67 deletions
@@ -160,6 +160,9 @@ LOCAL_SRC_FILES := \ native/dalvik_system_VMStack.c \ native/dalvik_system_Zygote.c \ native/java_lang_Class.c \ + native/java_lang_Double.c \ + native/java_lang_Float.c \ + native/java_lang_Math.c \ native/java_lang_Object.c \ native/java_lang_Runtime.c \ native/java_lang_String.c \ diff --git a/vm/InlineNative.c b/vm/InlineNative.c index 07a981d39..ddd3e30ed 100644 --- a/vm/InlineNative.c +++ b/vm/InlineNative.c @@ -124,7 +124,7 @@ static bool org_apache_harmony_dalvik_NativeTestTarget_emptyInlineMethod( /* * public char charAt(int index) */ -static bool javaLangString_charAt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_charAt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { int count, offset; @@ -197,7 +197,7 @@ static void badMatch(StringObject* thisStrObj, StringObject* compStrObj, /* * public int compareTo(String s) */ -static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { /* @@ -292,7 +292,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public boolean equals(Object anObject) */ -static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { /* @@ -401,7 +401,7 @@ static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public int length() */ -static bool javaLangString_length(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_length(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { //LOGI("String.length this=0x%08x pResult=%p\n", arg0, pResult); @@ -419,7 +419,7 @@ static bool javaLangString_length(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public boolean isEmpty() */ -static bool javaLangString_isEmpty(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_isEmpty(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { //LOGI("String.isEmpty this=0x%08x pResult=%p\n", arg0, pResult); @@ -492,7 +492,7 @@ static inline int indexOfCommon(Object* strObj, int ch, int start) * The character must be <= 0xffff; this method does not handle supplementary * characters. */ -static bool javaLangString_fastIndexOf_II(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangString_fastIndexOf_II(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { /* null reference check on "this" */ @@ -526,7 +526,7 @@ typedef union { /* * public static int abs(int) */ -static bool javaLangMath_abs_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_abs_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { s4 val = (s4) arg0; @@ -537,7 +537,7 @@ static bool javaLangMath_abs_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static long abs(long) */ -static bool javaLangMath_abs_long(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_abs_long(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert64 convert; @@ -551,7 +551,7 @@ static bool javaLangMath_abs_long(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static float abs(float) */ -static bool javaLangMath_abs_float(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_abs_float(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert32 convert; @@ -564,7 +564,7 @@ static bool javaLangMath_abs_float(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static double abs(double) */ -static bool javaLangMath_abs_double(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_abs_double(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert64 convert; @@ -579,7 +579,7 @@ static bool javaLangMath_abs_double(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static int min(int) */ -static bool javaLangMath_min_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_min_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { pResult->i = ((s4) arg0 < (s4) arg1) ? arg0 : arg1; @@ -589,7 +589,7 @@ static bool javaLangMath_min_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static int max(int) */ -static bool javaLangMath_max_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_max_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { pResult->i = ((s4) arg0 > (s4) arg1) ? arg0 : arg1; @@ -603,7 +603,7 @@ static bool javaLangMath_max_int(u4 arg0, u4 arg1, u4 arg2, u4 arg3, * by an fcmpd of the result against itself. If it doesn't match (i.e. * it's NaN), the libm sqrt() is invoked. */ -static bool javaLangMath_sqrt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_sqrt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert64 convert; @@ -616,7 +616,7 @@ static bool javaLangMath_sqrt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static double cos(double) */ -static bool javaLangMath_cos(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_cos(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert64 convert; @@ -629,7 +629,7 @@ static bool javaLangMath_cos(u4 arg0, u4 arg1, u4 arg2, u4 arg3, /* * public static double sin(double) */ -static bool javaLangMath_sin(u4 arg0, u4 arg1, u4 arg2, u4 arg3, +bool javaLangMath_sin(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) { Convert64 convert; @@ -645,7 +645,7 @@ static bool javaLangMath_sin(u4 arg0, u4 arg1, u4 arg2, u4 arg3, * =========================================================================== */ -static bool javaLangFloat_floatToIntBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, +bool javaLangFloat_floatToIntBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { Convert32 convert; @@ -654,14 +654,14 @@ static bool javaLangFloat_floatToIntBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, return true; } -static bool javaLangFloat_floatToRawIntBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, +bool javaLangFloat_floatToRawIntBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { pResult->i = arg0; return true; } -static bool javaLangFloat_intBitsToFloat(u4 arg0, u4 arg1, u4 arg2, u4 arg, +bool javaLangFloat_intBitsToFloat(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { Convert32 convert; @@ -676,7 +676,7 @@ static bool javaLangFloat_intBitsToFloat(u4 arg0, u4 arg1, u4 arg2, u4 arg, * =========================================================================== */ -static bool javaLangDouble_doubleToLongBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, +bool javaLangDouble_doubleToLongBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { Convert64 convert; @@ -686,7 +686,7 @@ static bool javaLangDouble_doubleToLongBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, return true; } -static bool javaLangDouble_doubleToRawLongBits(u4 arg0, u4 arg1, u4 arg2, +bool javaLangDouble_doubleToRawLongBits(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { Convert64 convert; @@ -696,7 +696,7 @@ static bool javaLangDouble_doubleToRawLongBits(u4 arg0, u4 arg1, u4 arg2, return true; } -static bool javaLangDouble_longBitsToDouble(u4 arg0, u4 arg1, u4 arg2, u4 arg, +bool javaLangDouble_longBitsToDouble(u4 arg0, u4 arg1, u4 arg2, u4 arg, JValue* pResult) { Convert64 convert; diff --git a/vm/InlineNative.h b/vm/InlineNative.h index fc8602759..280f6af02 100644 --- a/vm/InlineNative.h +++ b/vm/InlineNative.h @@ -52,7 +52,11 @@ typedef struct InlineOperation { const char* methodSignature; } InlineOperation; -/* Must be kept in sync w/ gDvmInlineOpsTable in InlineNative.c */ +/* + * Must be kept in sync w/ gDvmInlineOpsTable in InlineNative.c + * + * You should also add a test to libcore's IntrinsicTest. + */ typedef enum NativeInlineOps { INLINE_EMPTYINLINEMETHOD = 0, INLINE_STRING_CHARAT = 1, diff --git a/vm/compiler/codegen/arm/CalloutHelper.h b/vm/compiler/codegen/arm/CalloutHelper.h index c432f820f..414f8c5c3 100644 --- a/vm/compiler/codegen/arm/CalloutHelper.h +++ b/vm/compiler/codegen/arm/CalloutHelper.h @@ -109,23 +109,6 @@ Object* dvmAllocObject(ClassObject* clazz, int flags); // OP_NEW_INSTANCE /* * Functions declared in gDvmInlineOpsTable[] are used for * OP_EXECUTE_INLINE & OP_EXECUTE_INLINE_RANGE. - * - * org_apache_harmony_dalvik_NativeTestTarget_emptyInlineMethod - * javaLangString_charAt - * javaLangString_compareTo - * javaLangString_equals - * javaLangString_indexOf_I - * javaLangString_indexOf_II - * javaLangString_length - * javaLangMath_abs_int - * javaLangMath_abs_long - * javaLangMath_abs_float - * javaLangMath_abs_double - * javaLangMath_min_int - * javaLangMath_max_int - * javaLangMath_sqrt - * javaLangMath_cos - * javaLangMath_sin */ double sqrt(double x); // INLINE_MATH_SQRT diff --git a/vm/compiler/codegen/x86/CalloutHelper.h b/vm/compiler/codegen/x86/CalloutHelper.h index 3229a267b..a64f017fe 100644 --- a/vm/compiler/codegen/x86/CalloutHelper.h +++ b/vm/compiler/codegen/x86/CalloutHelper.h @@ -53,23 +53,6 @@ Object* dvmAllocObject(ClassObject* clazz, int flags); // OP_NEW_INSTANCE /* * Functions declared in gDvmInlineOpsTable[] are used for * OP_EXECUTE_INLINE & OP_EXECUTE_INLINE_RANGE. - * - * org_apache_harmony_dalvik_NativeTestTarget_emptyInlineMethod - * javaLangString_charAt - * javaLangString_compareTo - * javaLangString_equals - * javaLangString_indexOf_I - * javaLangString_indexOf_II - * javaLangString_length - * javaLangMath_abs_int - * javaLangMath_abs_long - * javaLangMath_abs_float - * javaLangMath_abs_double - * javaLangMath_min_int - * javaLangMath_max_int - * javaLangMath_sqrt - * javaLangMath_cos - * javaLangMath_sin */ double sqrt(double x); // INLINE_MATH_SQRT diff --git a/vm/native/InternalNative.c b/vm/native/InternalNative.c index 595fb7edc..c37f0bc50 100644 --- a/vm/native/InternalNative.c +++ b/vm/native/InternalNative.c @@ -28,6 +28,9 @@ static DalvikNativeClass gDvmNativeMethodSet[] = { { "Ljava/lang/Object;", dvm_java_lang_Object, 0 }, { "Ljava/lang/Class;", dvm_java_lang_Class, 0 }, + { "Ljava/lang/Double;", dvm_java_lang_Double, 0 }, + { "Ljava/lang/Float;", dvm_java_lang_Float, 0 }, + { "Ljava/lang/Math;", dvm_java_lang_Math, 0 }, { "Ljava/lang/Runtime;", dvm_java_lang_Runtime, 0 }, { "Ljava/lang/String;", dvm_java_lang_String, 0 }, { "Ljava/lang/System;", dvm_java_lang_System, 0 }, diff --git a/vm/native/InternalNativePriv.h b/vm/native/InternalNativePriv.h index 79ef14c49..f619d7e34 100644 --- a/vm/native/InternalNativePriv.h +++ b/vm/native/InternalNativePriv.h @@ -36,6 +36,18 @@ #define RETURN_DOUBLE(_val) do { pResult->d = (_val); return; } while(0) #define RETURN_PTR(_val) do { pResult->l = (_val); return; } while(0) +/* + * Normally a method that has an "inline native" will be invoked using + * execute-inline. If the method is invoked via reflection, JNI, or by + * virtual dispatch (in the case of String.equals, which we may arrive + * at via Object.equals), we need a non-"inline native" implementation. + * + * This macro is used to implement the native methods that bridge this gap. + */ +#define MAKE_INTRINSIC_TRAMPOLINE(INTRINSIC_FN) \ + extern bool INTRINSIC_FN(u4 arg0, u4 arg1, u4 arg2, u4 arg3, \ + JValue* pResult); \ + INTRINSIC_FN(args[0], args[1], args[2], args[3], pResult); /* * Verify that "obj" is non-null and is an instance of "clazz". @@ -83,6 +95,9 @@ bool dvmIsPrivilegedMethod(const Method* method); */ extern const DalvikNativeMethod dvm_java_lang_Object[]; extern const DalvikNativeMethod dvm_java_lang_Class[]; +extern const DalvikNativeMethod dvm_java_lang_Double[]; +extern const DalvikNativeMethod dvm_java_lang_Float[]; +extern const DalvikNativeMethod dvm_java_lang_Math[]; extern const DalvikNativeMethod dvm_java_lang_Runtime[]; extern const DalvikNativeMethod dvm_java_lang_String[]; extern const DalvikNativeMethod dvm_java_lang_System[]; diff --git a/vm/native/java_lang_Double.c b/vm/native/java_lang_Double.c new file mode 100644 index 000000000..b019c8c39 --- /dev/null +++ b/vm/native/java_lang_Double.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011 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 "Dalvik.h" +#include "native/InternalNativePriv.h" + +static void Double_doubleToLongBits(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangDouble_doubleToLongBits); +} + +static void Double_doubleToRawLongBits(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangDouble_doubleToRawLongBits); +} + +static void Double_longBitsToDouble(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangDouble_longBitsToDouble); +} + +const DalvikNativeMethod dvm_java_lang_Double[] = { + { "doubleToLongBits", "(D)J", Double_doubleToLongBits }, + { "doubleToRawLongBits", "(D)J", Double_doubleToRawLongBits }, + { "longBitsToDouble", "(J)D", Double_longBitsToDouble }, + { NULL, NULL, NULL }, +}; diff --git a/vm/native/java_lang_Float.c b/vm/native/java_lang_Float.c new file mode 100644 index 000000000..e99e4aaa2 --- /dev/null +++ b/vm/native/java_lang_Float.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011 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 "Dalvik.h" +#include "native/InternalNativePriv.h" + +static void Float_floatToIntBits(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangFloat_floatToIntBits); +} + +static void Float_floatToRawIntBits(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangFloat_floatToRawIntBits); +} + +static void Float_intBitsToFloat(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangFloat_intBitsToFloat); +} + +const DalvikNativeMethod dvm_java_lang_Float[] = { + { "floatToIntBits", "(F)I", Float_floatToIntBits }, + { "floatToRawIntBits", "(F)I", Float_floatToRawIntBits }, + { "intBitsToFloat", "(I)F", Float_intBitsToFloat }, + { NULL, NULL, NULL }, +}; diff --git a/vm/native/java_lang_Math.c b/vm/native/java_lang_Math.c new file mode 100644 index 000000000..7c17242a1 --- /dev/null +++ b/vm/native/java_lang_Math.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2011 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 "Dalvik.h" +#include "native/InternalNativePriv.h" + +static void Math_absD(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_double); +} + +static void Math_absF(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_float); +} + +static void Math_absI(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_int); +} + +static void Math_absJ(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_long); +} + +static void Math_cos(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_cos); +} + +static void Math_maxI(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_max_int); +} + +static void Math_minI(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_min_int); +} + +static void Math_sin(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_sin); +} + +static void Math_sqrt(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_sqrt); +} + +const DalvikNativeMethod dvm_java_lang_Math[] = { + { "abs", "(D)D", Math_absD }, + { "abs", "(F)F", Math_absF }, + { "abs", "(I)I", Math_absI }, + { "abs", "(J)J", Math_absJ }, + { "cos", "(D)D", Math_cos }, + { "max", "(II)I", Math_maxI }, + { "min", "(II)I", Math_minI }, + { "sin", "(D)D", Math_sin }, + { "sqrt", "(D)D", Math_sqrt }, + { NULL, NULL, NULL }, +}; diff --git a/vm/native/java_lang_String.c b/vm/native/java_lang_String.c index b3cb7ec82..38f9e3161 100644 --- a/vm/native/java_lang_String.c +++ b/vm/native/java_lang_String.c @@ -20,23 +20,50 @@ #include "Dalvik.h" #include "native/InternalNativePriv.h" +static void String_charAt(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_charAt); +} -/* - * public String intern() - * - * Intern a string in the VM string table. - */ -static void Dalvik_java_lang_String_intern(const u4* args, JValue* pResult) +static void String_compareTo(const u4* args, JValue* pResult) { - StringObject* str = (StringObject*) args[0]; - StringObject* interned; + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_compareTo); +} - interned = dvmLookupInternedString(str); +static void String_equals(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_equals); +} + +static void String_fastIndexOf(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_fastIndexOf_II); +} + +static void String_intern(const u4* args, JValue* pResult) +{ + StringObject* str = (StringObject*) args[0]; + StringObject* interned = dvmLookupInternedString(str); RETURN_PTR(interned); } +static void String_isEmpty(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_isEmpty); +} + +static void String_length(const u4* args, JValue* pResult) +{ + MAKE_INTRINSIC_TRAMPOLINE(javaLangString_length); +} + const DalvikNativeMethod dvm_java_lang_String[] = { - { "intern", "()Ljava/lang/String;", - Dalvik_java_lang_String_intern }, + { "charAt", "(I)C", String_charAt }, + { "compareTo", "(Ljava/lang/String;)I", String_compareTo }, + { "equals", "(Ljava/lang/Object;)Z", String_equals }, + { "fastIndexOf", "(II)I", String_fastIndexOf }, + { "intern", "()Ljava/lang/String;", String_intern }, + { "isEmpty", "()Z", String_isEmpty }, + { "length", "()I", String_length }, { NULL, NULL, NULL }, }; |