src/share/vm/classfile/verifier.cpp

Print this page
rev 3 : [mq]: anonk.patch


1583   return false;
1584 }
1585 
1586 void ClassVerifier::verify_ldc(
1587     int opcode, u2 index, StackMapFrame *current_frame,
1588      constantPoolHandle cp, u2 bci, TRAPS) {
1589   verify_cp_index(cp, index, CHECK_VERIFY(this));
1590   constantTag tag = cp->tag_at(index);
1591   unsigned int types;
1592   if (opcode == Bytecodes::_ldc || opcode == Bytecodes::_ldc_w) {
1593     if (!tag.is_unresolved_string() && !tag.is_unresolved_klass()) {
1594       types = (1 << JVM_CONSTANT_Integer) | (1 << JVM_CONSTANT_Float)
1595             | (1 << JVM_CONSTANT_String)  | (1 << JVM_CONSTANT_Class);
1596       verify_cp_type(index, cp, types, CHECK_VERIFY(this));
1597     }
1598   } else {
1599     assert(opcode == Bytecodes::_ldc2_w, "must be ldc2_w");
1600     types = (1 << JVM_CONSTANT_Double) | (1 << JVM_CONSTANT_Long);
1601     verify_cp_type(index, cp, types, CHECK_VERIFY(this));
1602   }
1603   if (tag.is_string() || tag.is_unresolved_string()) {
1604     current_frame->push_stack(
1605       VerificationType::reference_type(




1606         vmSymbols::java_lang_String()), CHECK_VERIFY(this));
1607   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
1608     current_frame->push_stack(
1609       VerificationType::reference_type(
1610         vmSymbols::java_lang_Class()), CHECK_VERIFY(this));
1611   } else if (tag.is_int()) {
1612     current_frame->push_stack(
1613       VerificationType::integer_type(), CHECK_VERIFY(this));
1614   } else if (tag.is_float()) {
1615     current_frame->push_stack(
1616       VerificationType::float_type(), CHECK_VERIFY(this));
1617   } else if (tag.is_double()) {
1618     current_frame->push_stack_2(
1619       VerificationType::double_type(),
1620       VerificationType::double2_type(), CHECK_VERIFY(this));
1621   } else if (tag.is_long()) {
1622     current_frame->push_stack_2(
1623       VerificationType::long_type(),
1624       VerificationType::long2_type(), CHECK_VERIFY(this));
1625   } else {




1583   return false;
1584 }
1585 
1586 void ClassVerifier::verify_ldc(
1587     int opcode, u2 index, StackMapFrame *current_frame,
1588      constantPoolHandle cp, u2 bci, TRAPS) {
1589   verify_cp_index(cp, index, CHECK_VERIFY(this));
1590   constantTag tag = cp->tag_at(index);
1591   unsigned int types;
1592   if (opcode == Bytecodes::_ldc || opcode == Bytecodes::_ldc_w) {
1593     if (!tag.is_unresolved_string() && !tag.is_unresolved_klass()) {
1594       types = (1 << JVM_CONSTANT_Integer) | (1 << JVM_CONSTANT_Float)
1595             | (1 << JVM_CONSTANT_String)  | (1 << JVM_CONSTANT_Class);
1596       verify_cp_type(index, cp, types, CHECK_VERIFY(this));
1597     }
1598   } else {
1599     assert(opcode == Bytecodes::_ldc2_w, "must be ldc2_w");
1600     types = (1 << JVM_CONSTANT_Double) | (1 << JVM_CONSTANT_Long);
1601     verify_cp_type(index, cp, types, CHECK_VERIFY(this));
1602   }
1603   if (tag.is_string() && cp->is_pseudo_string_at(index)) {
1604     current_frame->push_stack(
1605       VerificationType::reference_type(
1606         vmSymbols::java_lang_Object()), CHECK_VERIFY(this));
1607   } else if (tag.is_string() || tag.is_unresolved_string()) {
1608     current_frame->push_stack(
1609       VerificationType::reference_type(
1610         vmSymbols::java_lang_String()), CHECK_VERIFY(this));
1611   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
1612     current_frame->push_stack(
1613       VerificationType::reference_type(
1614         vmSymbols::java_lang_Class()), CHECK_VERIFY(this));
1615   } else if (tag.is_int()) {
1616     current_frame->push_stack(
1617       VerificationType::integer_type(), CHECK_VERIFY(this));
1618   } else if (tag.is_float()) {
1619     current_frame->push_stack(
1620       VerificationType::float_type(), CHECK_VERIFY(this));
1621   } else if (tag.is_double()) {
1622     current_frame->push_stack_2(
1623       VerificationType::double_type(),
1624       VerificationType::double2_type(), CHECK_VERIFY(this));
1625   } else if (tag.is_long()) {
1626     current_frame->push_stack_2(
1627       VerificationType::long_type(),
1628       VerificationType::long2_type(), CHECK_VERIFY(this));
1629   } else {