< prev index next >

hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page
rev 10452 : imported patch primitive arrays


1430                           // MergeCPCleaner clears out merge_cp_oop
1431   constantPoolHandle merge_cp(THREAD, merge_cp_oop);
1432 
1433   // Get constants() from the old class because it could have been rewritten
1434   // while we were at a safepoint allocating a new constant pool.
1435   constantPoolHandle old_cp(THREAD, the_class->constants());
1436   constantPoolHandle scratch_cp(THREAD, scratch_class->constants());
1437 
1438   // If the length changed, the class was redefined out from under us. Return
1439   // an error.
1440   if (merge_cp_length != the_class->constants()->length()
1441          + scratch_class->constants()->length()) {
1442     return JVMTI_ERROR_INTERNAL;
1443   }
1444 
1445   // Update the version number of the constant pool
1446   merge_cp->increment_and_save_version(old_cp->version());
1447 
1448   ResourceMark rm(THREAD);
1449   _index_map_count = 0;
1450   _index_map_p = new intArray(scratch_cp->length(), -1);
1451 
1452   _operands_cur_length = ConstantPool::operand_array_length(old_cp->operands());
1453   _operands_index_map_count = 0;
1454   _operands_index_map_p = new intArray(
1455     ConstantPool::operand_array_length(scratch_cp->operands()), -1);
1456 
1457   // reference to the cp holder is needed for copy_operands()
1458   merge_cp->set_pool_holder(scratch_class());
1459   bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp,
1460                   &merge_cp_length, THREAD);
1461   merge_cp->set_pool_holder(NULL);
1462 
1463   if (!result) {
1464     // The merge can fail due to memory allocation failure or due
1465     // to robustness checks.
1466     return JVMTI_ERROR_INTERNAL;
1467   }
1468 
1469   RC_TRACE_WITH_THREAD(0x00010000, THREAD,
1470     ("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count));
1471 
1472   if (_index_map_count == 0) {
1473     // there is nothing to map between the new and merged constant pools
1474 
1475     if (old_cp->length() == scratch_cp->length()) {




1430                           // MergeCPCleaner clears out merge_cp_oop
1431   constantPoolHandle merge_cp(THREAD, merge_cp_oop);
1432 
1433   // Get constants() from the old class because it could have been rewritten
1434   // while we were at a safepoint allocating a new constant pool.
1435   constantPoolHandle old_cp(THREAD, the_class->constants());
1436   constantPoolHandle scratch_cp(THREAD, scratch_class->constants());
1437 
1438   // If the length changed, the class was redefined out from under us. Return
1439   // an error.
1440   if (merge_cp_length != the_class->constants()->length()
1441          + scratch_class->constants()->length()) {
1442     return JVMTI_ERROR_INTERNAL;
1443   }
1444 
1445   // Update the version number of the constant pool
1446   merge_cp->increment_and_save_version(old_cp->version());
1447 
1448   ResourceMark rm(THREAD);
1449   _index_map_count = 0;
1450   _index_map_p = new intArray(scratch_cp->length(), scratch_cp->length(), -1);
1451 
1452   _operands_cur_length = ConstantPool::operand_array_length(old_cp->operands());
1453   _operands_index_map_count = 0;
1454   int operands_index_map_len = ConstantPool::operand_array_length(scratch_cp->operands());
1455   _operands_index_map_p = new intArray(operands_index_map_len, operands_index_map_len, -1);
1456 
1457   // reference to the cp holder is needed for copy_operands()
1458   merge_cp->set_pool_holder(scratch_class());
1459   bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp,
1460                   &merge_cp_length, THREAD);
1461   merge_cp->set_pool_holder(NULL);
1462 
1463   if (!result) {
1464     // The merge can fail due to memory allocation failure or due
1465     // to robustness checks.
1466     return JVMTI_ERROR_INTERNAL;
1467   }
1468 
1469   RC_TRACE_WITH_THREAD(0x00010000, THREAD,
1470     ("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count));
1471 
1472   if (_index_map_count == 0) {
1473     // there is nothing to map between the new and merged constant pools
1474 
1475     if (old_cp->length() == scratch_cp->length()) {


< prev index next >