977 _curr_data = new_data; 978 _curr_len = new_len; 979 // Save the current agent env we need this to deallocate the 980 // memory allocated by this agent. 981 _curr_env = env; 982 } 983 } 984 985 void copy_modified_data() { 986 // if one of the agent has modified class file data. 987 // Copy modified class data to new resources array. 988 if (_curr_data != *_data_ptr) { 989 *_data_ptr = NEW_RESOURCE_ARRAY(u1, _curr_len); 990 memcpy(*_data_ptr, _curr_data, _curr_len); 991 *_end_ptr = *_data_ptr + _curr_len; 992 _curr_env->Deallocate(_curr_data); 993 } 994 } 995 }; 996 997 bool JvmtiExport::_should_post_class_file_load_hook = false; 998 999 // this entry is for class file load hook on class load, redefine and retransform 1000 bool JvmtiExport::post_class_file_load_hook(Symbol* h_name, 1001 Handle class_loader, 1002 Handle h_protection_domain, 1003 unsigned char **data_ptr, 1004 unsigned char **end_ptr, 1005 JvmtiCachedClassFileData **cache_ptr) { 1006 if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { 1007 return false; 1008 } 1009 1010 JvmtiClassFileLoadHookPoster poster(h_name, class_loader, 1011 h_protection_domain, 1012 data_ptr, end_ptr, 1013 cache_ptr); 1014 poster.post(); 1015 return poster.has_been_modified(); 1016 } | 977 _curr_data = new_data; 978 _curr_len = new_len; 979 // Save the current agent env we need this to deallocate the 980 // memory allocated by this agent. 981 _curr_env = env; 982 } 983 } 984 985 void copy_modified_data() { 986 // if one of the agent has modified class file data. 987 // Copy modified class data to new resources array. 988 if (_curr_data != *_data_ptr) { 989 *_data_ptr = NEW_RESOURCE_ARRAY(u1, _curr_len); 990 memcpy(*_data_ptr, _curr_data, _curr_len); 991 *_end_ptr = *_data_ptr + _curr_len; 992 _curr_env->Deallocate(_curr_data); 993 } 994 } 995 }; 996 997 bool JvmtiExport::early_class_hook_env() { 998 JvmtiEnvIterator it; 999 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { 1000 if (env->early_class_hook_env()) { 1001 return true; 1002 } 1003 } 1004 return false; 1005 } 1006 1007 bool JvmtiExport::_should_post_class_file_load_hook = false; 1008 1009 // this entry is for class file load hook on class load, redefine and retransform 1010 bool JvmtiExport::post_class_file_load_hook(Symbol* h_name, 1011 Handle class_loader, 1012 Handle h_protection_domain, 1013 unsigned char **data_ptr, 1014 unsigned char **end_ptr, 1015 JvmtiCachedClassFileData **cache_ptr) { 1016 if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { 1017 return false; 1018 } 1019 1020 JvmtiClassFileLoadHookPoster poster(h_name, class_loader, 1021 h_protection_domain, 1022 data_ptr, end_ptr, 1023 cache_ptr); 1024 poster.post(); 1025 return poster.has_been_modified(); 1026 } |