Skip to content

Commit

Permalink
修复5.0的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
supern committed Aug 19, 2016
1 parent e0bf2ac commit 33efd15
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 73 deletions.
95 changes: 42 additions & 53 deletions jni/art/art_5_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ class ArtMethod: public Object {
// The class we are a part of
Class* declaring_class_;

// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
void* dex_cache_initialized_static_storage_;

// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
void* dex_cache_resolved_methods_;

Expand All @@ -164,56 +161,48 @@ class ArtMethod: public Object {

// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
void* dex_cache_strings_;

// Access flags; low 16 bits are defined by spec.
uint32_t access_flags_;

// Offset to the CodeItem.
uint32_t code_item_offset_;

// Architecture-dependent register spill mask
uint32_t core_spill_mask_;

// Compiled code associated with this method for callers from managed code.
// May be compiled managed code or a bridge for invoking a native method.
// TODO: Break apart this into portable and quick.
const void* entry_point_from_compiled_code_;

// Called by the interpreter to execute this method.
void* entry_point_from_interpreter_;

// Architecture-dependent register spill mask
uint32_t fp_spill_mask_;

// Total size in bytes of the frame
size_t frame_size_in_bytes_;

// Garbage collection map of native PC offsets (quick) or dex PCs (portable) to reference bitmaps.
const uint8_t* gc_map_;

// Mapping from native pc to dex pc
const uint32_t* mapping_table_;

// Index into method_ids of the dex file associated with this method
uint32_t method_dex_index_;

// For concrete virtual methods, this is the offset of the method in Class::vtable_.
//
// For abstract methods in an interface class, this is the offset of the method in
// "iftable_->Get(n)->GetMethodArray()".
//
// For static and direct methods this is the index in the direct methods table.
uint32_t method_index_;

// The target native method registered with this method
const void* native_method_;

// When a register is promoted into a register, the spill mask holds which registers hold dex
// registers. The first promoted register's corresponding dex register is vmap_table_[1], the Nth
// is vmap_table_[N]. vmap_table_[0] holds the length of the table.
const uint16_t* vmap_table_;

static void* java_lang_reflect_ArtMethod_;

// Method dispatch from the interpreter invokes this pointer which may cause a bridge into
// compiled code.
uint64_t entry_point_from_interpreter_;

// Pointer to JNI function registered to this method, or a function to resolve the JNI function.
uint64_t entry_point_from_jni_;

// Method dispatch from portable compiled code invokes this pointer which may cause bridging into
// quick compiled code or the interpreter.
#if defined(ART_USE_PORTABLE_COMPILER)
uint64_t entry_point_from_portable_compiled_code_;
#endif

// Method dispatch from quick compiled code invokes this pointer which may cause bridging into
// portable compiled code or the interpreter.
uint64_t entry_point_from_quick_compiled_code_;

// Pointer to a data structure created by the compiler and used by the garbage collector to
// determine which registers hold live references to objects within the heap. Keyed by native PC
// offsets for the quick compiler and dex PCs for the portable.
uint64_t gc_map_;

// Access flags; low 16 bits are defined by spec.
uint32_t access_flags_;

/* Dex file fields. The defining dex file is available via declaring_class_->dex_cache_ */

// Offset to the CodeItem.
uint32_t dex_code_item_offset_;

// Index into method_ids of the dex file associated with this method.
uint32_t dex_method_index_;

/* End of dex file fields. */

// Entry within a dispatch table for this method. For static/direct methods the index is into
// the declaringClass.directMethods, for virtual methods the vtable and for interface methods the
// ifTable.
uint32_t method_index_;

static void* java_lang_reflect_ArtMethod_;
};

}
Expand Down
35 changes: 15 additions & 20 deletions jni/art/art_method_replace_5_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,22 @@ void replace_5_0(JNIEnv* env, jobject src, jobject dest) {
dmeth->declaring_class_->status_ = smeth->declaring_class_->status_-1;

smeth->declaring_class_ = dmeth->declaring_class_;
smeth->access_flags_ = dmeth->access_flags_;
smeth->frame_size_in_bytes_ = dmeth->frame_size_in_bytes_;
smeth->dex_cache_initialized_static_storage_ =
dmeth->dex_cache_initialized_static_storage_;
smeth->dex_cache_resolved_types_ = dmeth->dex_cache_resolved_types_;
smeth->dex_cache_resolved_methods_ = dmeth->dex_cache_resolved_methods_;
smeth->vmap_table_ = dmeth->vmap_table_;
smeth->core_spill_mask_ = dmeth->core_spill_mask_;
smeth->fp_spill_mask_ = dmeth->fp_spill_mask_;
smeth->mapping_table_ = dmeth->mapping_table_;
smeth->code_item_offset_ = dmeth->code_item_offset_;
smeth->entry_point_from_compiled_code_ =
dmeth->entry_point_from_compiled_code_;
smeth->access_flags_ = dmeth->access_flags_;
smeth->dex_cache_resolved_types_ = dmeth->dex_cache_resolved_types_;
smeth->dex_cache_resolved_methods_ = dmeth->dex_cache_resolved_methods_;
smeth->dex_cache_strings_ = dmeth->dex_cache_strings_;
smeth->dex_code_item_offset_ = dmeth->dex_code_item_offset_;
smeth->dex_method_index_ = dmeth->dex_method_index_;
smeth->gc_map_ = dmeth->gc_map_;
smeth->entry_point_from_jni_ = dmeth->entry_point_from_jni_;
smeth->entry_point_from_quick_compiled_code_ = dmeth->entry_point_from_quick_compiled_code_;
smeth->entry_point_from_interpreter_ = dmeth->entry_point_from_interpreter_;
smeth->method_index_ = dmeth->method_index_;

smeth->entry_point_from_interpreter_ = dmeth->entry_point_from_interpreter_;
smeth->native_method_ = dmeth->native_method_;
smeth->method_index_ = dmeth->method_index_;
smeth->method_dex_index_ = dmeth->method_dex_index_;

LOGD("replace_5_0: %d , %d", smeth->entry_point_from_compiled_code_,
dmeth->entry_point_from_compiled_code_);
LOGD("replace_5_0: %d , %d", smeth->entry_point_from_quick_compiled_code_,
dmeth->entry_point_from_quick_compiled_code_);

}

Expand Down
Binary file modified libs/arm64-v8a/libandfix.so
Binary file not shown.
Binary file modified libs/armeabi-v7a/libandfix.so
Binary file not shown.
Binary file modified libs/armeabi/libandfix.so
Binary file not shown.
Binary file modified libs/mips/libandfix.so
Binary file not shown.
Binary file modified libs/mips64/libandfix.so
Binary file not shown.
Binary file modified libs/x86/libandfix.so
Binary file not shown.
Binary file modified libs/x86_64/libandfix.so
Binary file not shown.

0 comments on commit 33efd15

Please sign in to comment.