src/share/vm/prims/jvmtiRedefineClasses.cpp

changeset 7692
5b2cd065dfc6
parent 7636
fdde6a70ea85
child 7795
157895117ad5
equal deleted inserted replaced
7691:e3d76b57a655 7692:5b2cd065dfc6
3977 // should get cleared in the_class too. 3977 // should get cleared in the_class too.
3978 if (the_class->get_cached_class_file_bytes() == 0) { 3978 if (the_class->get_cached_class_file_bytes() == 0) {
3979 // the_class doesn't have a cache yet so copy it 3979 // the_class doesn't have a cache yet so copy it
3980 the_class->set_cached_class_file(scratch_class->get_cached_class_file()); 3980 the_class->set_cached_class_file(scratch_class->get_cached_class_file());
3981 } 3981 }
3982 #ifndef PRODUCT 3982 else if (scratch_class->get_cached_class_file_bytes() !=
3983 else { 3983 the_class->get_cached_class_file_bytes()) {
3984 assert(the_class->get_cached_class_file_bytes() == 3984 // The same class can be present twice in the scratch classes list or there
3985 scratch_class->get_cached_class_file_bytes(), "cache ptrs must match"); 3985 // are multiple concurrent RetransformClasses calls on different threads.
3986 assert(the_class->get_cached_class_file_len() == 3986 // In such cases we have to deallocate scratch_class cached_class_file_bytes.
3987 scratch_class->get_cached_class_file_len(), "cache lens must match"); 3987 os::free(scratch_class->get_cached_class_file_bytes());
3988 } 3988 }
3989 #endif
3990 3989
3991 // NULL out in scratch class to not delete twice. The class to be redefined 3990 // NULL out in scratch class to not delete twice. The class to be redefined
3992 // always owns these bytes. 3991 // always owns these bytes.
3993 scratch_class->set_cached_class_file(NULL); 3992 scratch_class->set_cached_class_file(NULL);
3994 3993

mercurial