1 /* 2 * Copyright (C) 2008 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 /* 18 * java.lang.String 19 */ 20 #include "Dalvik.h" 21 #include "native/InternalNativePriv.h" 22 23 static void String_charAt(const u4* args, JValue* pResult) 24 { 25 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_charAt); 26 } 27 28 static void String_compareTo(const u4* args, JValue* pResult) 29 { 30 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_compareTo); 31 } 32 33 static void String_equals(const u4* args, JValue* pResult) 34 { 35 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_equals); 36 } 37 38 static void String_fastIndexOf(const u4* args, JValue* pResult) 39 { 40 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_fastIndexOf_II); 41 } 42 43 static void String_intern(const u4* args, JValue* pResult) 44 { 45 StringObject* str = (StringObject*) args[0]; 46 StringObject* interned = dvmLookupInternedString(str); 47 RETURN_PTR(interned); 48 } 49 50 static void String_isEmpty(const u4* args, JValue* pResult) 51 { 52 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_isEmpty); 53 } 54 55 static void String_length(const u4* args, JValue* pResult) 56 { 57 MAKE_INTRINSIC_TRAMPOLINE(javaLangString_length); 58 } 59 60 const DalvikNativeMethod dvm_java_lang_String[] = { 61 { "charAt", "(I)C", String_charAt }, 62 { "compareTo", "(Ljava/lang/String;)I", String_compareTo }, 63 { "equals", "(Ljava/lang/Object;)Z", String_equals }, 64 { "fastIndexOf", "(II)I", String_fastIndexOf }, 65 { "intern", "()Ljava/lang/String;", String_intern }, 66 { "isEmpty", "()Z", String_isEmpty }, 67 { "length", "()I", String_length }, 68 { NULL, NULL, NULL }, 69 }; 70