@@ -62,7 +62,7 @@ typedef struct hook_info_t {
6262static std::unique_ptr<jnihook_t > g_jnihook = nullptr ;
6363static std::unordered_map<std::string, std::vector<hook_info_t >> g_hooks;
6464static std::unordered_map<std::string, std::unique_ptr<ClassFile>> g_class_file_cache;
65- static std::unordered_map<std::string, jclass> g_original_classes;
65+ // static std::unordered_map<std::string, jclass> g_original_classes;
6666static std::atomic<bool > g_force_class_caching = false ;
6767
6868static std::string
@@ -492,10 +492,6 @@ JNIHook_Init(JavaVM *jvm)
492492 auto numFlagsField = numFlagsFieldResult.value ();
493493 LOG (" NumFlags field: %p\n " , numFlagsField);
494494 LOG (" NumFlags: %llu\n " , static_cast <unsigned long long >(*numFlagsField));
495- // auto nameField = jvm_flag_type.get_field<void>("_name").value();
496- // LOG("Name field: %p\n", nameField);
497- // auto addrField = jvm_flag_type.get_field<void>("_addr").value();
498- // LOG("Addr field: %p\n", addrField);
499495
500496 auto flags_buf = *(unsigned char **)flagsField; // flagTable
501497 auto numFlags = *numFlagsField;
@@ -742,7 +738,8 @@ JNIHook_Shutdown()
742738
743739 // TODO: Fully cleanup defined classes in `g_original_classes` by deleting them from the JVM memory
744740 // (if possible without doing crazy hacks)
745- g_original_classes.clear ();
741+ // NOTE: The above is no longer needed due to changing the hooking method.
742+ // g_original_classes.clear();
746743
747744 g_jnihook->jvmti ->SetEventNotificationMode (JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL );
748745 g_jnihook->jvmti ->SetEventCallbacks (&callbacks, sizeof (callbacks));
0 commit comments