diff options
author | 2016-12-02 11:40:56 -0800 | |
---|---|---|
committer | 2016-12-02 14:17:16 -0800 | |
commit | 1e07ca6d50d35abc70ed5c72025ec8f48ae01f25 (patch) | |
tree | b56db69c12b4a1b474ca451175fd8fc86647c310 /runtime/openjdkjvmti/transform.cc | |
parent | 75d564e45061e1a9d28a89d3c8fa60af04ef28a8 (diff) |
Cleanup of redefinition testing
Move redefine logic into a single common function and perform some
other cleanup.
Test: mma -j40 test-art-host
Change-Id: I8618bda4f392b683ce198374066e356b87578e7b
Diffstat (limited to 'runtime/openjdkjvmti/transform.cc')
-rw-r--r-- | runtime/openjdkjvmti/transform.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/openjdkjvmti/transform.cc b/runtime/openjdkjvmti/transform.cc index f7b8b92a75..f5451254c0 100644 --- a/runtime/openjdkjvmti/transform.cc +++ b/runtime/openjdkjvmti/transform.cc @@ -58,6 +58,21 @@ namespace openjdkjvmti { +jvmtiError GetClassLocation(ArtJvmTiEnv* env, jclass klass, /*out*/std::string* location) { + JNIEnv* jni_env = nullptr; + jint ret = env->art_vm->GetEnv(reinterpret_cast<void**>(&jni_env), JNI_VERSION_1_1); + if (ret != JNI_OK) { + // TODO Different error might be better? + return ERR(INTERNAL); + } + art::ScopedObjectAccess soa(jni_env); + art::StackHandleScope<1> hs(art::Thread::Current()); + art::Handle<art::mirror::Class> hs_klass(hs.NewHandle(soa.Decode<art::mirror::Class>(klass))); + const art::DexFile& dex = hs_klass->GetDexFile(); + *location = dex.GetLocation(); + return OK; +} + // TODO Move this function somewhere more appropriate. // Gets the data surrounding the given class. jvmtiError GetTransformationData(ArtJvmTiEnv* env, |