comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 12207:ff8a09595db3

8017230: Internal Error (jvmtiRedefineClasses.cpp:1662): guarantee(false) failed: insert_space_at() failed Summary: Handle pending exceptions instead of firing a guarantee() Reviewed-by: coleenp, dholmes Contributed-by: serguei.spitsyn@oracle.com
author sspitsyn
date Fri, 13 Sep 2013 12:46:40 -0700
parents ff2520b97b00
children ce5ee9de50ce
comparison
equal deleted inserted replaced
12204:225cedaf9a4b 12207:ff8a09595db3
1588 1588
1589 // rewrite constant pool references in the methods: 1589 // rewrite constant pool references in the methods:
1590 for (int i = methods->length() - 1; i >= 0; i--) { 1590 for (int i = methods->length() - 1; i >= 0; i--) {
1591 methodHandle method(THREAD, methods->at(i)); 1591 methodHandle method(THREAD, methods->at(i));
1592 methodHandle new_method; 1592 methodHandle new_method;
1593 rewrite_cp_refs_in_method(method, &new_method, CHECK_false); 1593 rewrite_cp_refs_in_method(method, &new_method, THREAD);
1594 if (!new_method.is_null()) { 1594 if (!new_method.is_null()) {
1595 // the method has been replaced so save the new method version 1595 // the method has been replaced so save the new method version
1596 // even in the case of an exception. original method is on the
1597 // deallocation list.
1596 methods->at_put(i, new_method()); 1598 methods->at_put(i, new_method());
1599 }
1600 if (HAS_PENDING_EXCEPTION) {
1601 Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
1602 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark
1603 RC_TRACE_WITH_THREAD(0x00000002, THREAD,
1604 ("rewrite_cp_refs_in_method exception: '%s'", ex_name->as_C_string()));
1605 // Need to clear pending exception here as the super caller sets
1606 // the JVMTI_ERROR_INTERNAL if the returned value is false.
1607 CLEAR_PENDING_EXCEPTION;
1608 return false;
1597 } 1609 }
1598 } 1610 }
1599 1611
1600 return true; 1612 return true;
1601 } 1613 }
1672 methodHandle m; 1684 methodHandle m;
1673 { 1685 {
1674 Pause_No_Safepoint_Verifier pnsv(&nsv); 1686 Pause_No_Safepoint_Verifier pnsv(&nsv);
1675 1687
1676 // ldc is 2 bytes and ldc_w is 3 bytes 1688 // ldc is 2 bytes and ldc_w is 3 bytes
1677 m = rc.insert_space_at(bci, 3, inst_buffer, THREAD); 1689 m = rc.insert_space_at(bci, 3, inst_buffer, CHECK);
1678 if (m.is_null() || HAS_PENDING_EXCEPTION) {
1679 guarantee(false, "insert_space_at() failed");
1680 }
1681 } 1690 }
1682 1691
1683 // return the new method so that the caller can update 1692 // return the new method so that the caller can update
1684 // the containing class 1693 // the containing class
1685 *new_method_p = method = m; 1694 *new_method_p = method = m;