src/share/vm/classfile/classFileParser.cpp
Print this page
*** 310,329 ****
return cp->symbol_at(index);
else
return NULL;
}
! constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
ClassFileStream* cfs = stream();
constantPoolHandle nullHandle;
cfs->guarantee_more(3, CHECK_(nullHandle)); // length, first cp tag
u2 length = cfs->get_u2_fast();
guarantee_property(
length >= 1, "Illegal constant pool size %u in class file %s",
length, CHECK_(nullHandle));
! ConstantPool* constant_pool = ConstantPool::allocate(_loader_data, length,
CHECK_(nullHandle));
_cp = constant_pool; // save in case of errors
constantPoolHandle cp (THREAD, constant_pool);
// parsing constant pool entries
--- 310,329 ----
return cp->symbol_at(index);
else
return NULL;
}
! constantPoolHandle ClassFileParser::parse_constant_pool(bool patched, TRAPS) {
ClassFileStream* cfs = stream();
constantPoolHandle nullHandle;
cfs->guarantee_more(3, CHECK_(nullHandle)); // length, first cp tag
u2 length = cfs->get_u2_fast();
guarantee_property(
length >= 1, "Illegal constant pool size %u in class file %s",
length, CHECK_(nullHandle));
! ConstantPool* constant_pool = ConstantPool::allocate(_loader_data, length, patched,
CHECK_(nullHandle));
_cp = constant_pool; // save in case of errors
constantPoolHandle cp (THREAD, constant_pool);
// parsing constant pool entries
*** 404,413 ****
--- 404,423 ----
int string_index = cp->string_index_at(index);
check_property(valid_symbol_at(string_index),
"Invalid constant pool index %u in class file %s",
string_index, CHECK_(nullHandle));
Symbol* sym = cp->symbol_at(string_index);
+ if (sym != NULL) {
+ const char* CPH = "CONSTANT_PLACEHOLDER_";
+ int len = strlen(CPH);
+ char* utf8 = sym->as_utf8();
+ // Check if it is pseudo-string
+ if(strlen(utf8) > len && strncmp(utf8, CPH, len) == 0) {
+ // Save the Utf8 index for JvmtiConstantPoolReconstituter
+ cp->map_pseudo_string_indices((u2)index, (u2)string_index);
+ }
+ }
cp->unresolved_string_at_put(index, sym);
}
break;
case JVM_CONSTANT_MethodHandle :
{
*** 3881,3891 ****
// Check if verification needs to be relaxed for this class file
// Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
_relax_verify = Verifier::relax_verify_for(class_loader());
// Constant pool
! constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle));
int cp_size = cp->length();
cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
--- 3891,3901 ----
// Check if verification needs to be relaxed for this class file
// Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
_relax_verify = Verifier::relax_verify_for(class_loader());
// Constant pool
! constantPoolHandle cp = parse_constant_pool(cp_patches != NULL, CHECK_(nullHandle));
int cp_size = cp->length();
cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len