< prev index next >
src/hotspot/share/classfile/verifier.cpp
Print this page
@@ -239,11 +239,10 @@
return (should_verify_for(klass->class_loader(), should_verify_class) &&
// return if the class is a bootstrapping class
// or defineClass specified not to verify by default (flags override passed arg)
// We need to skip the following few for bootstrapping
name != vmSymbols::java_lang_Object() &&
- name != vmSymbols::java_lang____Value() &&
name != vmSymbols::java_lang_Class() &&
name != vmSymbols::java_lang_String() &&
name != vmSymbols::java_lang_Throwable() &&
// Can not verify the bytecodes for shared classes because they have
@@ -588,14 +587,10 @@
VerificationType ClassVerifier::object_type() const {
return VerificationType::reference_type(vmSymbols::java_lang_Object());
}
-VerificationType ClassVerifier::__value_type() const {
- return VerificationType::valuetype_type(vmSymbols::java_lang____Value());
-}
-
TypeOrigin ClassVerifier::ref_ctx(const char* sig, TRAPS) {
VerificationType vt = VerificationType::reference_type(
create_temporary_symbol(sig, (int)strlen(sig), THREAD));
return TypeOrigin::implicit(vt);
}
@@ -746,12 +741,11 @@
if (opcode != Bytecodes::_iinc && opcode != Bytecodes::_iload &&
opcode != Bytecodes::_aload && opcode != Bytecodes::_lload &&
opcode != Bytecodes::_istore && opcode != Bytecodes::_astore &&
opcode != Bytecodes::_lstore && opcode != Bytecodes::_fload &&
opcode != Bytecodes::_dload && opcode != Bytecodes::_fstore &&
- opcode != Bytecodes::_dstore && opcode != Bytecodes::_vstore &&
- opcode != Bytecodes::_vload) {
+ opcode != Bytecodes::_dstore) {
/* Unreachable? RawBytecodeStream's raw_next() returns 'illegal'
* if we encounter a wide instruction that modifies an invalid
* opcode (not one of the ones listed above) */
verify_error(ErrorContext::bad_code(bci), "Bad wide instruction");
return;
@@ -862,19 +856,10 @@
case Bytecodes::_dload_2 :
case Bytecodes::_dload_3 :
index = opcode - Bytecodes::_dload_0;
verify_dload(index, ¤t_frame, CHECK_VERIFY(this));
no_control_flow = false; break;
- case Bytecodes::_vload :
- if (!vbytecodes_allowed) {
- class_format_error(
- "vload not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- verify_vload(bcs.get_index(), ¤t_frame, CHECK_VERIFY(this));
- no_control_flow = false; break;
case Bytecodes::_aload :
verify_aload(bcs.get_index(), ¤t_frame, CHECK_VERIFY(this));
no_control_flow = false; break;
case Bytecodes::_aload_0 :
case Bytecodes::_aload_1 :
@@ -1003,41 +988,41 @@
atype.get_component(this, CHECK_VERIFY(this));
current_frame.push_stack(component, CHECK_VERIFY(this));
}
no_control_flow = false; break;
}
- case Bytecodes::_vaload : {
- if (!vbytecodes_allowed) {
- class_format_error(
- "vaload not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- type = current_frame.pop_stack(
- VerificationType::integer_type(), CHECK_VERIFY(this));
- atype = current_frame.pop_stack(
- VerificationType::reference_check(), CHECK_VERIFY(this));
- // The null check is strictly not be necessary, left in for future proofing.
- // Will be reconsidered if type indexes are removed.
- if (atype.is_null() || !atype.is_value_array()) {
- verify_error(ErrorContext::bad_type(bci,
- current_frame.stack_top_ctx(),
- TypeOrigin::implicit(VerificationType::reference_check())),
- bad_type_msg, "vaload");
- return;
- }
- VerificationType component = atype.get_component(this, CHECK_VERIFY(this));
- if (!component.is_valuetype()) {
- verify_error(ErrorContext::bad_type(bci,
- current_frame.stack_top_ctx(),
- TypeOrigin::implicit(VerificationType::valuetype_check())),
- bad_type_msg, "vaload");
- return;
- }
- current_frame.push_stack(component, CHECK_VERIFY(this));
- no_control_flow = false; break;
- }
+// case Bytecodes::_vaload : {
+// if (!vbytecodes_allowed) {
+// class_format_error(
+// "vaload not supported by this class file version (%d.%d), class %s",
+// _klass->major_version(), _klass->minor_version(), _klass->external_name());
+// return;
+// }
+// type = current_frame.pop_stack(
+// VerificationType::integer_type(), CHECK_VERIFY(this));
+// atype = current_frame.pop_stack(
+// VerificationType::reference_check(), CHECK_VERIFY(this));
+// // The null check is strictly not be necessary, left in for future proofing.
+// // Will be reconsidered if type indexes are removed.
+// if (atype.is_null() || !atype.is_value_array()) {
+// verify_error(ErrorContext::bad_type(bci,
+// current_frame.stack_top_ctx(),
+// TypeOrigin::implicit(VerificationType::reference_check())),
+// bad_type_msg, "vaload");
+// return;
+// }
+// VerificationType component = atype.get_component(this, CHECK_VERIFY(this));
+// if (!component.is_valuetype()) {
+// verify_error(ErrorContext::bad_type(bci,
+// current_frame.stack_top_ctx(),
+// TypeOrigin::implicit(VerificationType::valuetype_check())),
+// bad_type_msg, "vaload");
+// return;
+// }
+// current_frame.push_stack(component, CHECK_VERIFY(this));
+// no_control_flow = false; break;
+// }
case Bytecodes::_istore :
verify_istore(bcs.get_index(), ¤t_frame, CHECK_VERIFY(this));
no_control_flow = false; break;
case Bytecodes::_istore_0 :
case Bytecodes::_istore_1 :
@@ -1074,19 +1059,10 @@
case Bytecodes::_dstore_2 :
case Bytecodes::_dstore_3 :
index = opcode - Bytecodes::_dstore_0;
verify_dstore(index, ¤t_frame, CHECK_VERIFY(this));
no_control_flow = false; break;
- case Bytecodes::_vstore :
- if (!vbytecodes_allowed) {
- class_format_error(
- "vstore not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- verify_vstore(bcs.get_index(), ¤t_frame, CHECK_VERIFY(this));
- no_control_flow = false; break;
case Bytecodes::_astore :
verify_astore(bcs.get_index(), ¤t_frame, CHECK_VERIFY(this));
no_control_flow = false; break;
case Bytecodes::_astore_0 :
case Bytecodes::_astore_1 :
@@ -1209,32 +1185,32 @@
bad_type_msg, "aastore");
return;
}
// 4938384: relaxed constraint in JVMS 3nd edition.
no_control_flow = false; break;
- case Bytecodes::_vastore :
- if (!vbytecodes_allowed) {
- class_format_error(
- "vastore not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- type = current_frame.pop_stack(__value_type(), CHECK_VERIFY(this));
- type2 = current_frame.pop_stack(
- VerificationType::integer_type(), CHECK_VERIFY(this));
- atype = current_frame.pop_stack(
- VerificationType::reference_check(), CHECK_VERIFY(this));
- // The null check is strictly not be necessary, left in for future proofing.
- // Will be reconsidered if type indexes are removed.
- if (atype.is_null() || !atype.is_value_array()) {
- verify_error(ErrorContext::bad_type(bci,
- current_frame.stack_top_ctx(),
- TypeOrigin::implicit(VerificationType::reference_check())),
- bad_type_msg, "vastore");
- return;
- }
- no_control_flow = false; break;
+// case Bytecodes::_vastore :
+// if (!vbytecodes_allowed) {
+// class_format_error(
+// "vastore not supported by this class file version (%d.%d), class %s",
+// _klass->major_version(), _klass->minor_version(), _klass->external_name());
+// return;
+// }
+// type = current_frame.pop_stack(__value_type(), CHECK_VERIFY(this));
+// type2 = current_frame.pop_stack(
+// VerificationType::integer_type(), CHECK_VERIFY(this));
+// atype = current_frame.pop_stack(
+// VerificationType::reference_check(), CHECK_VERIFY(this));
+// // The null check is strictly not be necessary, left in for future proofing.
+// // Will be reconsidered if type indexes are removed.
+// if (atype.is_null() || !atype.is_value_array()) {
+// verify_error(ErrorContext::bad_type(bci,
+// current_frame.stack_top_ctx(),
+// TypeOrigin::implicit(VerificationType::reference_check())),
+// bad_type_msg, "vastore");
+// return;
+// }
+// no_control_flow = false; break;
case Bytecodes::_pop :
current_frame.pop_stack(
VerificationType::category1_check(), CHECK_VERIFY(this));
no_control_flow = false; break;
case Bytecodes::_pop2 :
@@ -1682,22 +1658,22 @@
type = current_frame.pop_stack(
VerificationType::reference_check(), CHECK_VERIFY(this));
verify_return_value(return_type, type, bci,
¤t_frame, CHECK_VERIFY(this));
no_control_flow = true; break;
- case Bytecodes::_vreturn :
- if (!vbytecodes_allowed) {
- class_format_error(
- "vreturn not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- type = current_frame.pop_stack(
- VerificationType::valuetype_check(), CHECK_VERIFY(this));
- verify_return_value(return_type, type, bci,
- ¤t_frame, CHECK_VERIFY(this));
- no_control_flow = true; break;
+// case Bytecodes::_vreturn :
+// if (!vbytecodes_allowed) {
+// class_format_error(
+// "vreturn not supported by this class file version (%d.%d), class %s",
+// _klass->major_version(), _klass->minor_version(), _klass->external_name());
+// return;
+// }
+// type = current_frame.pop_stack(
+// VerificationType::valuetype_check(), CHECK_VERIFY(this));
+// verify_return_value(return_type, type, bci,
+// ¤t_frame, CHECK_VERIFY(this));
+// no_control_flow = true; break;
case Bytecodes::_return :
if (return_type != VerificationType::bogus_type()) {
verify_error(ErrorContext::bad_code(bci),
"Method expects a return value");
return;
@@ -1722,11 +1698,11 @@
case Bytecodes::_putfield :
// pass FALSE, operand can't be an array type for getfield/putfield.
verify_field_instructions(
&bcs, ¤t_frame, cp, false, CHECK_VERIFY(this));
no_control_flow = false; break;
- case Bytecodes::_vwithfield :
+ case Bytecodes::_withfield :
if (!vbytecodes_allowed) {
class_format_error(
"vwithfield not supported by this class file version (%d.%d), class %s",
_klass->major_version(), _klass->minor_version(), _klass->external_name());
return;
@@ -1760,11 +1736,11 @@
}
type = VerificationType::uninitialized_type(bci);
current_frame.push_stack(type, CHECK_VERIFY(this));
no_control_flow = false; break;
}
- case Bytecodes::_vdefault :
+ case Bytecodes::_defaultvalue :
{
if (!vbytecodes_allowed) {
class_format_error(
"vdefault not supported by this class file version (%d.%d), class %s",
_klass->major_version(), _klass->minor_version(), _klass->external_name());
@@ -1820,40 +1796,10 @@
current_frame.pop_stack(object_type(), CHECK_VERIFY(this));
current_frame.push_stack(
VerificationType::integer_type(), CHECK_VERIFY(this));
no_control_flow = false; break;
}
- case Bytecodes::_vbox : {
- if (!EnableMVT || !vbytecodes_allowed) {
- class_format_error(
- "vbox not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- index = bcs.get_index_u2();
- verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
- current_frame.pop_stack(VerificationType::valuetype_check(), CHECK_VERIFY(this));
- VerificationType klass_type = cp_index_to_reference_type(
- index, cp, CHECK_VERIFY(this));
- current_frame.push_stack(klass_type, CHECK_VERIFY(this));
- no_control_flow = false; break;
- }
- case Bytecodes::_vunbox : {
- if (!EnableMVT || !vbytecodes_allowed) {
- class_format_error(
- "vunbox not supported by this class file version (%d.%d), class %s",
- _klass->major_version(), _klass->minor_version(), _klass->external_name());
- return;
- }
- index = bcs.get_index_u2();
- verify_cp_value_type(bci, index, cp, CHECK_VERIFY(this));
- current_frame.pop_stack(object_type(), CHECK_VERIFY(this));
- VerificationType value_type = cp_index_to_valuetype(
- index, cp, CHECK_VERIFY(this));
- current_frame.push_stack(value_type, CHECK_VERIFY(this));
- no_control_flow = false; break;
- }
case Bytecodes::_monitorenter :
case Bytecodes::_monitorexit :
current_frame.pop_stack(
VerificationType::reference_check(), CHECK_VERIFY(this));
no_control_flow = false; break;
@@ -3331,16 +3277,10 @@
VerificationType type = current_frame->get_local(
index, VerificationType::reference_check(), CHECK_VERIFY(this));
current_frame->push_stack(type, CHECK_VERIFY(this));
}
-void ClassVerifier::verify_vload(u2 index, StackMapFrame* current_frame, TRAPS) {
- VerificationType type = current_frame->get_local(
- index, VerificationType::valuetype_check(), CHECK_VERIFY(this));
- current_frame->push_stack(type, CHECK_VERIFY(this));
-}
-
void ClassVerifier::verify_istore(u2 index, StackMapFrame* current_frame, TRAPS) {
current_frame->pop_stack(
VerificationType::integer_type(), CHECK_VERIFY(this));
current_frame->set_local(
index, VerificationType::integer_type(), CHECK_VERIFY(this));
@@ -3374,16 +3314,10 @@
VerificationType type = current_frame->pop_stack(
VerificationType::reference_check(), CHECK_VERIFY(this));
current_frame->set_local(index, type, CHECK_VERIFY(this));
}
-void ClassVerifier::verify_vstore(u2 index, StackMapFrame* current_frame, TRAPS) {
- VerificationType type = current_frame->pop_stack(
- VerificationType::valuetype_check(), CHECK_VERIFY(this));
- current_frame->set_local(index, type, CHECK_VERIFY(this));
-}
-
void ClassVerifier::verify_iinc(u2 index, StackMapFrame* current_frame, TRAPS) {
VerificationType type = current_frame->get_local(
index, VerificationType::integer_type(), CHECK_VERIFY(this));
current_frame->set_local(index, type, CHECK_VERIFY(this));
}
< prev index next >