Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e52ded

Browse files
Aleksei VoitylovMBaesken
Aleksei Voitylov
authored andcommitted
8270398: Enhance canonicalization
Reviewed-by: mbaeskenBackport-of: 0a6c6a2c954d7889934d3caa4256124a1c5662a0
1 parentf677a4c commit0e52ded

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎src/hotspot/share/classfile/verifier.cpp‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
22442244
// Get field name and signature
22452245
Symbol* field_name = cp->name_ref_at(index);
22462246
Symbol* field_sig = cp->signature_ref_at(index);
2247+
bool is_getfield =false;
22472248

22482249
if (!SignatureVerifier::is_valid_type_signature(field_sig)) {
22492250
class_format_error(
@@ -2294,11 +2295,9 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
22942295
break;
22952296
}
22962297
case Bytecodes::_getfield: {
2298+
is_getfield =true;
22972299
stack_object_type = current_frame->pop_stack(
22982300
target_class_type,CHECK_VERIFY(this));
2299-
for (int i =0; i < n; i++) {
2300-
current_frame->push_stack(field_type[i],CHECK_VERIFY(this));
2301-
}
23022301
goto check_protected;
23032302
}
23042303
case Bytecodes::_putfield: {
@@ -2328,7 +2327,15 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
23282327
check_protected: {
23292328
if (_this_type == stack_object_type)
23302329
break;// stack_object_type must be assignable to _current_class_type
2331-
if (was_recursively_verified())return;
2330+
if (was_recursively_verified()) {
2331+
if (is_getfield) {
2332+
// Push field type for getfield.
2333+
for (int i =0; i < n; i++) {
2334+
current_frame->push_stack(field_type[i],CHECK_VERIFY(this));
2335+
}
2336+
}
2337+
return;
2338+
}
23322339
Symbol* ref_class_name =
23332340
cp->klass_name_at(cp->klass_ref_index_at(index));
23342341
if (!name_in_supers(ref_class_name,current_class()))
@@ -2357,6 +2364,12 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
23572364
}
23582365
default:ShouldNotReachHere();
23592366
}
2367+
if (is_getfield) {
2368+
// Push field type for getfield after doing protection check.
2369+
for (int i =0; i < n; i++) {
2370+
current_frame->push_stack(field_type[i],CHECK_VERIFY(this));
2371+
}
2372+
}
23602373
}
23612374

23622375
// Look at the method's handlers. If the bci is in the handler's try block

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp