Perf & Fix: reduce ClassFileLoadHook overhead and fix retransform patch path

- Skip mutable event dispatch when no mutable listeners exist (hot path)
- Wire retransformClass bytecode into pendingRetransform so patches are applied
- Guard pendingRetransform with its mutex; check jvmti Allocate result
- Store global refs in captured ClassFileData and release on re-capture
- Add null/exception checks in defineClass/getLoadedClasses
- Extract shared find_class_by_internal_name helper
- Use CONFIGURE_DEPENDS for CMake globs; guard InitLogger; delete leaked jArgs
This commit is contained in:
xiaozhou233 committed 2026-08-14 17:07:36 +08:00
1 parent 8cf2b8330c
commit bb5b215a33
10 files changed
+198 -130

No files matched your search

+2
View File
@@ -1,4 +1,5 @@
file(GLOB_RECURSE loader_sources
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/*.c
)
@@ -7,6 +8,7 @@ if (WIN32)
message(STATUS "Detected System: Windows")
file(GLOB_RECURSE windows_sources
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/windows/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows/*.c
)
+3
View File
@@ -41,6 +41,9 @@ bool invoke_juiceagent_init(JNIEnv* env, const LoaderConfig& config) {
// Call the static method
env->CallStaticVoidMethod(cls, method_id, jArgs);
// Release the local jstring reference
env->DeleteLocalRef(jArgs);
// Check for exceptions
if (check_and_clear_exception(env, "CallStaticVoidMethod")) {
return false;