提交 83f70acf 编写于 作者: K kamg

6865028: Illegal instructions passing verification prior to 'invokespecial Object.<init>'

Summary: Update verifier to conform to spec re: reference vs. 'Object' types
Reviewed-by: dholmes, coleenp
上级 fb36422d
...@@ -247,6 +247,10 @@ ClassVerifier::ClassVerifier( ...@@ -247,6 +247,10 @@ ClassVerifier::ClassVerifier(
ClassVerifier::~ClassVerifier() { ClassVerifier::~ClassVerifier() {
} }
VerificationType ClassVerifier::object_type() const {
return VerificationType::reference_type(vmSymbols::java_lang_Object());
}
void ClassVerifier::verify_class(TRAPS) { void ClassVerifier::verify_class(TRAPS) {
if (_verify_verbose) { if (_verify_verbose) {
tty->print_cr("Verifying class %s with new format", tty->print_cr("Verifying class %s with new format",
...@@ -726,8 +730,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { ...@@ -726,8 +730,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
} }
no_control_flow = false; break; no_control_flow = false; break;
case Bytecodes::_aastore : case Bytecodes::_aastore :
type = current_frame.pop_stack( type = current_frame.pop_stack(object_type(), CHECK_VERIFY(this));
VerificationType::reference_check(), CHECK_VERIFY(this));
type2 = current_frame.pop_stack( type2 = current_frame.pop_stack(
VerificationType::integer_type(), CHECK_VERIFY(this)); VerificationType::integer_type(), CHECK_VERIFY(this));
atype = current_frame.pop_stack( atype = current_frame.pop_stack(
...@@ -1232,8 +1235,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { ...@@ -1232,8 +1235,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
{ {
index = bcs.get_index_u2(); index = bcs.get_index_u2();
verify_cp_class_type(index, cp, CHECK_VERIFY(this)); verify_cp_class_type(index, cp, CHECK_VERIFY(this));
current_frame.pop_stack( current_frame.pop_stack(object_type(), CHECK_VERIFY(this));
VerificationType::reference_check(), CHECK_VERIFY(this));
VerificationType klass_type = cp_index_to_type( VerificationType klass_type = cp_index_to_type(
index, cp, CHECK_VERIFY(this)); index, cp, CHECK_VERIFY(this));
current_frame.push_stack(klass_type, CHECK_VERIFY(this)); current_frame.push_stack(klass_type, CHECK_VERIFY(this));
...@@ -1242,8 +1244,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { ...@@ -1242,8 +1244,7 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
case Bytecodes::_instanceof : { case Bytecodes::_instanceof : {
index = bcs.get_index_u2(); index = bcs.get_index_u2();
verify_cp_class_type(index, cp, CHECK_VERIFY(this)); verify_cp_class_type(index, cp, CHECK_VERIFY(this));
current_frame.pop_stack( current_frame.pop_stack(object_type(), CHECK_VERIFY(this));
VerificationType::reference_check(), CHECK_VERIFY(this));
current_frame.push_stack( current_frame.push_stack(
VerificationType::integer_type(), CHECK_VERIFY(this)); VerificationType::integer_type(), CHECK_VERIFY(this));
no_control_flow = false; break; no_control_flow = false; break;
...@@ -1610,9 +1611,7 @@ void ClassVerifier::verify_ldc( ...@@ -1610,9 +1611,7 @@ void ClassVerifier::verify_ldc(
verify_cp_type(index, cp, types, CHECK_VERIFY(this)); verify_cp_type(index, cp, types, CHECK_VERIFY(this));
} }
if (tag.is_string() && cp->is_pseudo_string_at(index)) { if (tag.is_string() && cp->is_pseudo_string_at(index)) {
current_frame->push_stack( current_frame->push_stack(object_type(), CHECK_VERIFY(this));
VerificationType::reference_type(
vmSymbols::java_lang_Object()), CHECK_VERIFY(this));
} else if (tag.is_string() || tag.is_unresolved_string()) { } else if (tag.is_string() || tag.is_unresolved_string()) {
current_frame->push_stack( current_frame->push_stack(
VerificationType::reference_type( VerificationType::reference_type(
......
...@@ -157,6 +157,8 @@ class ClassVerifier : public StackObj { ...@@ -157,6 +157,8 @@ class ClassVerifier : public StackObj {
bool name_in_supers(symbolOop ref_name, instanceKlassHandle current); bool name_in_supers(symbolOop ref_name, instanceKlassHandle current);
VerificationType object_type() const;
instanceKlassHandle _klass; // the class being verified instanceKlassHandle _klass; // the class being verified
methodHandle _method; // current method being verified methodHandle _method; // current method being verified
VerificationType _this_type; // the verification type of the current class VerificationType _this_type; // the verification type of the current class
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册