Remove an unused jvmti extension and associated code
com.android.art.UNSAFE.class.structurally_redefine_class_direct was
added as a temporary entrypoint for testing. It is no longer used.
Test: art/test.py
Change-Id: Iead2248a4e2d105b39eeb2c8114bfbafe8b56391
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index 02dc9f1..2e57b5f 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -451,38 +451,6 @@
return error;
}
- // StructurallyRedefineClassDirect
- error = add_extension(
- reinterpret_cast<jvmtiExtensionFunction>(Redefiner::StructurallyRedefineClassDirect),
- "com.android.art.UNSAFE.class.structurally_redefine_class_direct",
- "Temporary prototype entrypoint for redefining a single class structurally. Currently this"
- " only supports adding new static fields to a class without any instances."
- " ClassFileLoadHook events will NOT be triggered. This does not currently support creating"
- " obsolete methods. This function only has rudimentary error checking. This should not be"
- " used except for testing.",
- {
- { "klass", JVMTI_KIND_IN, JVMTI_TYPE_JCLASS, false },
- { "new_def", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, false },
- { "new_def_len", JVMTI_KIND_IN, JVMTI_TYPE_JINT, false },
- },
- {
- ERR(CLASS_LOADER_UNSUPPORTED),
- ERR(FAILS_VERIFICATION),
- ERR(ILLEGAL_ARGUMENT),
- ERR(INVALID_CLASS),
- ERR(MUST_POSSESS_CAPABILITY),
- ERR(MUST_POSSESS_CAPABILITY),
- ERR(NULL_POINTER),
- ERR(OUT_OF_MEMORY),
- ERR(UNMODIFIABLE_CLASS),
- ERR(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED),
- ERR(UNSUPPORTED_REDEFINITION_METHOD_ADDED),
- ERR(UNSUPPORTED_REDEFINITION_METHOD_DELETED),
- ERR(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED),
- });
- if (error != ERR(NONE)) {
- return error;
- }
} else {
LOG(INFO) << "debuggable & jni-type indices are required to implement structural "
<< "class redefinition extensions.";
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index 788a5d3..c9efee6 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -648,38 +648,6 @@
return RedefineClassesGeneric<RedefinitionType::kNormal>(jenv, class_count, definitions);
}
-jvmtiError Redefiner::StructurallyRedefineClassDirect(jvmtiEnv* env,
- jclass klass,
- const unsigned char* data,
- jint data_size) {
- if (env == nullptr) {
- return ERR(INVALID_ENVIRONMENT);
- } else if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.can_redefine_classes != 1) {
- JVMTI_LOG(INFO, env) << "Does not have can_redefine_classes cap!";
- return ERR(MUST_POSSESS_CAPABILITY);
- }
- std::vector<ArtClassDefinition> acds;
- ArtClassDefinition acd;
- jvmtiError err = acd.Init(
- art::Thread::Current(),
- jvmtiClassDefinition{ .klass = klass, .class_byte_count = data_size, .class_bytes = data });
- if (err != OK) {
- return err;
- }
- acds.push_back(std::move(acd));
- std::string err_msg;
- err = RedefineClassesDirect(ArtJvmTiEnv::AsArtJvmTiEnv(env),
- art::Runtime::Current(),
- art::Thread::Current(),
- acds,
- RedefinitionType::kStructural,
- &err_msg);
- if (err != OK) {
- JVMTI_LOG(WARNING, env) << "Failed structural redefinition: " << err_msg;
- }
- return err;
-}
-
jvmtiError Redefiner::RedefineClassesDirect(ArtJvmTiEnv* env,
art::Runtime* runtime,
art::Thread* self,