diff options
-rw-r--r-- | vm/Dvm.mk | 1 | ||||
-rw-r--r-- | vm/native/InternalNative.c | 1 | ||||
-rw-r--r-- | vm/native/InternalNativePriv.h | 1 | ||||
-rw-r--r-- | vm/native/dalvik_bytecode_OpcodeInfo.c | 43 |
4 files changed, 46 insertions, 0 deletions
@@ -159,6 +159,7 @@ LOCAL_SRC_FILES := \ mterp/out/InterpC-portstd.c.arm \ mterp/out/InterpC-portdbg.c.arm \ native/InternalNative.c \ + native/dalvik_bytecode_OpcodeInfo.c \ native/dalvik_system_DexFile.c \ native/dalvik_system_VMDebug.c \ native/dalvik_system_VMRuntime.c \ diff --git a/vm/native/InternalNative.c b/vm/native/InternalNative.c index 06ed665f2..12c8d0f5d 100644 --- a/vm/native/InternalNative.c +++ b/vm/native/InternalNative.c @@ -47,6 +47,7 @@ static DalvikNativeClass gDvmNativeMethodSet[] = { dvm_java_security_AccessController, 0 }, { "Ljava/util/concurrent/atomic/AtomicLong;", dvm_java_util_concurrent_atomic_AtomicLong, 0 }, + { "Ldalvik/bytecode/OpcodeInfo;", dvm_dalvik_bytecode_OpcodeInfo, 0 }, { "Ldalvik/system/VMDebug;", dvm_dalvik_system_VMDebug, 0 }, { "Ldalvik/system/DexFile;", dvm_dalvik_system_DexFile, 0 }, { "Ldalvik/system/VMRuntime;", dvm_dalvik_system_VMRuntime, 0 }, diff --git a/vm/native/InternalNativePriv.h b/vm/native/InternalNativePriv.h index 6f8d6c9ba..0e5408133 100644 --- a/vm/native/InternalNativePriv.h +++ b/vm/native/InternalNativePriv.h @@ -98,6 +98,7 @@ extern const DalvikNativeMethod dvm_java_lang_reflect_Method[]; extern const DalvikNativeMethod dvm_java_lang_reflect_Proxy[]; extern const DalvikNativeMethod dvm_java_security_AccessController[]; extern const DalvikNativeMethod dvm_java_util_concurrent_atomic_AtomicLong[]; +extern const DalvikNativeMethod dvm_dalvik_bytecode_OpcodeInfo[]; extern const DalvikNativeMethod dvm_dalvik_system_SamplingProfiler[]; extern const DalvikNativeMethod dvm_dalvik_system_VMDebug[]; extern const DalvikNativeMethod dvm_dalvik_system_DexFile[]; diff --git a/vm/native/dalvik_bytecode_OpcodeInfo.c b/vm/native/dalvik_bytecode_OpcodeInfo.c new file mode 100644 index 000000000..d5f22ca02 --- /dev/null +++ b/vm/native/dalvik_bytecode_OpcodeInfo.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 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. + */ + +/* + * dalvik.bytecode.OpcodeInfo + * + * This file mostly exists in its current form so that we don't have + * to have duplicate definitions for things both in libcore and in + * libdex. + */ + +#include "Dalvik.h" +#include "native/InternalNativePriv.h" + +/* + * public static native boolean isInvoke(int opcode); + */ +static void Dalvik_dalvik_bytecode_OpcodeInfo_isInvoke(const u4* args, + JValue* pResult) +{ + jint opcode = (jint) args[0]; + int flags = dexGetInstrFlags(opcode); + bool result = (flags & kInstrInvoke) != 0; + RETURN_BOOLEAN(result); +} + +const DalvikNativeMethod dvm_dalvik_bytecode_OpcodeInfo[] = { + { "isInvoke", "(I)Z", Dalvik_dalvik_bytecode_OpcodeInfo_isInvoke }, + { NULL, NULL, NULL }, +}; |