diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/class_linker_test.cc | 1 | ||||
| -rw-r--r-- | src/dex_file.cc | 39 | ||||
| -rw-r--r-- | src/dex_file.h | 12 | ||||
| -rw-r--r-- | src/java_lang_Class.cc | 25 | ||||
| -rw-r--r-- | src/object.h | 5 |
5 files changed, 17 insertions, 65 deletions
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc index 31a39c3782..a92000733d 100644 --- a/src/class_linker_test.cc +++ b/src/class_linker_test.cc @@ -648,6 +648,7 @@ struct MethodClassOffsets : public CheckOffsets { class_descriptor = "Ljava/lang/reflect/Method;"; // alphabetical references + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(MethodClass, NO_ANNOTATIONS_), "NO_ANNOTATIONS")); offsets.push_back(CheckOffset(OFFSETOF_MEMBER(MethodClass, ORDER_BY_SIGNATURE_), "ORDER_BY_SIGNATURE")); }; }; diff --git a/src/dex_file.cc b/src/dex_file.cc index b47be1fd14..924953facc 100644 --- a/src/dex_file.cc +++ b/src/dex_file.cc @@ -386,44 +386,7 @@ const DexFile* DexFile::Open(const byte* dex_bytes, size_t length, } } -DexFile::~DexFile() { - if (dex_object_ != NULL) { - UNIMPLEMENTED(WARNING) << "leaked a global reference to an com.android.dex.Dex instance"; - } -} - -jobject DexFile::GetDexObject(JNIEnv* env) const { - MutexLock mu(dex_object_lock_); - if (dex_object_ != NULL) { - return dex_object_; - } - - void* address = const_cast<void*>(reinterpret_cast<const void*>(base_)); - jobject byte_buffer = env->NewDirectByteBuffer(address, length_); - if (byte_buffer == NULL) { - return NULL; - } - - jclass c = env->FindClass("com/android/dex/Dex"); - if (c == NULL) { - return NULL; - } - - jmethodID mid = env->GetStaticMethodID(c, "create", "(Ljava/nio/ByteBuffer;)Lcom/android/dex/Dex;"); - if (mid == NULL) { - return NULL; - } - - jvalue args[1]; - args[0].l = byte_buffer; - jobject local = env->CallStaticObjectMethodA(c, mid, args); - if (local == NULL) { - return NULL; - } - - dex_object_ = env->NewGlobalRef(local); - return dex_object_; -} +DexFile::~DexFile() {} bool DexFile::Init() { InitMembers(); diff --git a/src/dex_file.h b/src/dex_file.h index 4ad701f96b..359825a9b1 100644 --- a/src/dex_file.h +++ b/src/dex_file.h @@ -9,10 +9,8 @@ #include "UniquePtr.h" #include "globals.h" -#include "jni.h" #include "leb128.h" #include "logging.h" -#include "mutex.h" #include "stringpiece.h" #include "strutil.h" #include "utils.h" @@ -350,10 +348,6 @@ class DexFile { return location_; } - // Returns a com.android.dex.Dex object corresponding to the mapped-in dex file. - // Used by managed code to implement annotations. - jobject GetDexObject(JNIEnv* env) const; - const Header& GetHeader() const { CHECK(header_ != NULL); return *header_; @@ -880,8 +874,6 @@ class DexFile { length_(length), location_(location), closer_(closer), - dex_object_lock_("a dex_object_lock_"), - dex_object_(NULL), header_(0), string_ids_(0), type_ids_(0), @@ -928,10 +920,6 @@ class DexFile { // Helper object to free the underlying allocation. UniquePtr<Closer> closer_; - // A cached com.android.dex.Dex instance, possibly NULL. Use GetDexObject. - mutable Mutex dex_object_lock_; - mutable jobject dex_object_; - // Points to the header section. const Header* header_; diff --git a/src/java_lang_Class.cc b/src/java_lang_Class.cc index 32941be0c0..9ca171b717 100644 --- a/src/java_lang_Class.cc +++ b/src/java_lang_Class.cc @@ -57,17 +57,6 @@ jboolean Class_desiredAssertionStatus(JNIEnv* env, jobject javaThis) { return JNI_FALSE; } -jobject Class_getDex(JNIEnv* env, jobject javaClass) { - Class* c = Decode<Class*>(env, javaClass); - - DexCache* dex_cache = c->GetDexCache(); - if (dex_cache == NULL) { - return NULL; - } - - return Runtime::Current()->GetClassLinker()->FindDexFile(dex_cache).GetDexObject(env); -} - jobject Class_getClassLoader(JNIEnv* env, jclass, jobject javaClass) { Class* c = Decode<Class*>(env, javaClass); Object* result = reinterpret_cast<Object*>(const_cast<ClassLoader*>(c->GetClassLoader())); @@ -156,6 +145,16 @@ jclass Class_getDeclaringClass(JNIEnv* env, jobject javaThis) { return NULL; } +jobject Class_getEnclosingConstructor(JNIEnv* env, jobject javaThis) { + UNIMPLEMENTED(WARNING) << "needs annotations"; + return NULL; +} + +jobject Class_getEnclosingMethod(JNIEnv* env, jobject javaThis) { + UNIMPLEMENTED(WARNING) << "needs annotations"; + return NULL; +} + /* * private native String getNameNative() * @@ -323,7 +322,9 @@ static JNINativeMethod gMethods[] = { //NATIVE_METHOD(Class, getDeclaredFields, "(Ljava/lang/Class;Z)[Ljava/lang/reflect/Field;"), //NATIVE_METHOD(Class, getDeclaredMethods, "(Ljava/lang/Class;Z)[Ljava/lang/reflect/Method;"), NATIVE_METHOD(Class, getDeclaringClass, "()Ljava/lang/Class;"), - NATIVE_METHOD(Class, getDex, "()Lcom/android/dex/Dex;"), + //NATIVE_METHOD(Class, getEnclosingClass, "()Ljava/lang/Class;"), + NATIVE_METHOD(Class, getEnclosingConstructor, "()Ljava/lang/reflect/Constructor;"), + NATIVE_METHOD(Class, getEnclosingMethod, "()Ljava/lang/reflect/Method;"), //NATIVE_METHOD(Class, getInnerClassName, "()Ljava/lang/String;"), //NATIVE_METHOD(Class, getInterfaces, "()[Ljava/lang/Class;"), //NATIVE_METHOD(Class, getModifiers, "(Ljava/lang/Class;Z)I"), diff --git a/src/object.h b/src/object.h index 7da6a5d147..51b9213c02 100644 --- a/src/object.h +++ b/src/object.h @@ -1989,8 +1989,7 @@ class MANAGED Class : public StaticStorageBase { // access flags; low 16 bits are defined by VM spec uint32_t access_flags_; - // Total size of the Class instance; used when allocating storage on gc heap. - // See also object_size_. + // Total class size; used when allocating storage on gc heap. size_t class_size_; // tid used to check for recursive <clinit> invocation @@ -2004,7 +2003,6 @@ class MANAGED Class : public StaticStorageBase { // Total object size; used when allocating storage on gc heap. // (For interfaces and abstract classes this will be zero.) - // See also class_size_. size_t object_size_; // primitive type index, or kPrimNot (0); set for generated prim classes @@ -2275,6 +2273,7 @@ class MANAGED FieldClass : public Class { class MANAGED MethodClass : public Class { private: + ObjectArray<Object>* NO_ANNOTATIONS_; Object* ORDER_BY_SIGNATURE_; friend struct MethodClassOffsets; // for verifying offset information DISALLOW_IMPLICIT_CONSTRUCTORS(MethodClass); |