< prev index next >

src/hotspot/share/classfile/verifier.cpp

Print this page




1613               current_frame.flag_this_uninit()) {
1614             verify_error(ErrorContext::bad_code(bci),
1615                          "Constructor must call super() or this() "
1616                          "before return");
1617             return;
1618           }
1619           no_control_flow = true; break;
1620         case Bytecodes::_getstatic :
1621         case Bytecodes::_putstatic :
1622           // pass TRUE, operand can be an array type for getstatic/putstatic.
1623           verify_field_instructions(
1624             &bcs, &current_frame, cp, true, CHECK_VERIFY(this));
1625           no_control_flow = false; break;
1626         case Bytecodes::_getfield :
1627         case Bytecodes::_putfield :
1628           // pass FALSE, operand can't be an array type for getfield/putfield.
1629           verify_field_instructions(
1630             &bcs, &current_frame, cp, false, CHECK_VERIFY(this));
1631           no_control_flow = false; break;
1632         case Bytecodes::_withfield :






1633           if (_klass->major_version() < VALUETYPE_MAJOR_VERSION) {
1634             class_format_error(
1635               "withfield not supported by this class file version (%d.%d), class %s",
1636               _klass->major_version(), _klass->minor_version(), _klass->external_name());
1637             return;
1638           }
1639           // pass FALSE, operand can't be an array type for withfield.
1640           verify_field_instructions(
1641             &bcs, &current_frame, cp, false, CHECK_VERIFY(this));
1642           no_control_flow = false; break;
1643         case Bytecodes::_invokevirtual :
1644         case Bytecodes::_invokespecial :
1645         case Bytecodes::_invokestatic :
1646           verify_invoke_instructions(
1647             &bcs, code_length, &current_frame, (bci >= ex_min && bci < ex_max),
1648             &this_uninit, return_type, cp, &stackmap_table, CHECK_VERIFY(this));
1649           no_control_flow = false; break;
1650         case Bytecodes::_invokeinterface :
1651         case Bytecodes::_invokedynamic :
1652           verify_invoke_instructions(


1659           verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
1660           VerificationType new_class_type =
1661             cp_index_to_type(index, cp, CHECK_VERIFY(this));
1662           if (!new_class_type.is_object()) {
1663             verify_error(ErrorContext::bad_type(bci,
1664                 TypeOrigin::cp(index, new_class_type)),
1665                 "Illegal new instruction");
1666             return;
1667           }
1668           if (_klass->is_declared_value_type(index)) {
1669             verify_error(ErrorContext::bad_code(bci),
1670               "Illegal use of value type as operand for new instruction");
1671             return;
1672           }
1673           type = VerificationType::uninitialized_type(bci);
1674           current_frame.push_stack(type, CHECK_VERIFY(this));
1675           no_control_flow = false; break;
1676         }
1677         case Bytecodes::_defaultvalue :
1678         {






1679           if (_klass->major_version() < VALUETYPE_MAJOR_VERSION) {
1680             class_format_error(
1681               "defaultvalue not supported by this class file version (%d.%d), class %s",
1682               _klass->major_version(), _klass->minor_version(), _klass->external_name());
1683             return;
1684           }
1685           index = bcs.get_index_u2();
1686           verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
1687           VerificationType vtype = cp_index_to_type(index, cp, CHECK_VERIFY(this));
1688           if (!vtype.is_object()) {
1689             verify_error(ErrorContext::bad_type(bci,
1690                 TypeOrigin::cp(index, vtype)),
1691                 "Illegal defaultvalue instruction");
1692             return;
1693           }
1694           if (!_klass->is_declared_value_type(index)) {
1695             verify_error(ErrorContext::bad_code(bci),
1696               "Illegal use of an object as operand for defaultvalue instruction");
1697             return;
1698           }




1613               current_frame.flag_this_uninit()) {
1614             verify_error(ErrorContext::bad_code(bci),
1615                          "Constructor must call super() or this() "
1616                          "before return");
1617             return;
1618           }
1619           no_control_flow = true; break;
1620         case Bytecodes::_getstatic :
1621         case Bytecodes::_putstatic :
1622           // pass TRUE, operand can be an array type for getstatic/putstatic.
1623           verify_field_instructions(
1624             &bcs, &current_frame, cp, true, CHECK_VERIFY(this));
1625           no_control_flow = false; break;
1626         case Bytecodes::_getfield :
1627         case Bytecodes::_putfield :
1628           // pass FALSE, operand can't be an array type for getfield/putfield.
1629           verify_field_instructions(
1630             &bcs, &current_frame, cp, false, CHECK_VERIFY(this));
1631           no_control_flow = false; break;
1632         case Bytecodes::_withfield :
1633           if (!EnableValhalla) {
1634             verify_error(ErrorContext::bad_code(bci),
1635               "The withfield instruction in class %s requires option -XX:+EnableValhalla",
1636               _klass->external_name());
1637             return;
1638           }
1639           if (_klass->major_version() < VALUETYPE_MAJOR_VERSION) {
1640             class_format_error(
1641               "withfield not supported by this class file version (%d.%d), class %s",
1642               _klass->major_version(), _klass->minor_version(), _klass->external_name());
1643             return;
1644           }
1645           // pass FALSE, operand can't be an array type for withfield.
1646           verify_field_instructions(
1647             &bcs, &current_frame, cp, false, CHECK_VERIFY(this));
1648           no_control_flow = false; break;
1649         case Bytecodes::_invokevirtual :
1650         case Bytecodes::_invokespecial :
1651         case Bytecodes::_invokestatic :
1652           verify_invoke_instructions(
1653             &bcs, code_length, &current_frame, (bci >= ex_min && bci < ex_max),
1654             &this_uninit, return_type, cp, &stackmap_table, CHECK_VERIFY(this));
1655           no_control_flow = false; break;
1656         case Bytecodes::_invokeinterface :
1657         case Bytecodes::_invokedynamic :
1658           verify_invoke_instructions(


1665           verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
1666           VerificationType new_class_type =
1667             cp_index_to_type(index, cp, CHECK_VERIFY(this));
1668           if (!new_class_type.is_object()) {
1669             verify_error(ErrorContext::bad_type(bci,
1670                 TypeOrigin::cp(index, new_class_type)),
1671                 "Illegal new instruction");
1672             return;
1673           }
1674           if (_klass->is_declared_value_type(index)) {
1675             verify_error(ErrorContext::bad_code(bci),
1676               "Illegal use of value type as operand for new instruction");
1677             return;
1678           }
1679           type = VerificationType::uninitialized_type(bci);
1680           current_frame.push_stack(type, CHECK_VERIFY(this));
1681           no_control_flow = false; break;
1682         }
1683         case Bytecodes::_defaultvalue :
1684         {
1685           if (!EnableValhalla) {
1686             verify_error(ErrorContext::bad_code(bci),
1687               "The defaultvalue instruction in class %s requires option -XX:+EnableValhalla",
1688               _klass->external_name());
1689             return;
1690           }
1691           if (_klass->major_version() < VALUETYPE_MAJOR_VERSION) {
1692             class_format_error(
1693               "defaultvalue not supported by this class file version (%d.%d), class %s",
1694               _klass->major_version(), _klass->minor_version(), _klass->external_name());
1695             return;
1696           }
1697           index = bcs.get_index_u2();
1698           verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
1699           VerificationType vtype = cp_index_to_type(index, cp, CHECK_VERIFY(this));
1700           if (!vtype.is_object()) {
1701             verify_error(ErrorContext::bad_type(bci,
1702                 TypeOrigin::cp(index, vtype)),
1703                 "Illegal defaultvalue instruction");
1704             return;
1705           }
1706           if (!_klass->is_declared_value_type(index)) {
1707             verify_error(ErrorContext::bad_code(bci),
1708               "Illegal use of an object as operand for defaultvalue instruction");
1709             return;
1710           }


< prev index next >