< prev index next >
src/hotspot/share/classfile/classFileParser.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -154,16 +154,10 @@
cfs->guarantee_more(3, CHECK); // name_index, tag/access_flags
const u2 name_index = cfs->get_u2_fast();
cp->klass_index_at_put(index, name_index);
break;
}
- case JVM_CONSTANT_Value: { // may be present in a retransform situation
- cfs->guarantee_more(3, CHECK); // name_index, tag/access_flags
- const u2 name_index = cfs->get_u2_fast();
- cp->value_type_index_at_put(index, name_index);
- break;
- }
case JVM_CONSTANT_Fieldref: {
cfs->guarantee_more(5, CHECK); // class_index, name_and_type_index, tag/access_flags
const u2 class_index = cfs->get_u2_fast();
const u2 name_and_type_index = cfs->get_u2_fast();
cp->field_at_put(index, class_index, name_and_type_index);
@@ -424,27 +418,23 @@
// first verification pass - validate cross references
// and fixup class and string constants
for (index = 1; index < length; index++) { // Index 0 is unused
const jbyte tag = cp->tag_at(index).value();
switch (tag) {
- case JVM_CONSTANT_Class:
- case JVM_CONSTANT_Value: {
- ShouldNotReachHere(); // Only JVM_CONSTANT_[Class|Value]Index should be present
+ case JVM_CONSTANT_Class: {
+ ShouldNotReachHere(); // Only JVM_CONSTANT_ClassIndex should be present
break;
}
case JVM_CONSTANT_Fieldref:
// fall through
case JVM_CONSTANT_Methodref:
// fall through
case JVM_CONSTANT_InterfaceMethodref: {
if (!_need_verify) break;
const int klass_ref_index = cp->klass_ref_index_at(index);
const int name_and_type_ref_index = cp->name_and_type_ref_index_at(index);
- check_property(valid_klass_reference_at(klass_ref_index) ||
- (valid_value_type_reference_at(klass_ref_index) &&
- ((EnableMVT && (tag == JVM_CONSTANT_Fieldref)) ||
- EnableValhalla)),
+ check_property(valid_klass_reference_at(klass_ref_index),
"Invalid constant pool index %u in class file %s",
klass_ref_index, CHECK);
check_property(valid_cp_range(name_and_type_ref_index, length) &&
cp->tag_at(name_and_type_ref_index).is_name_and_type(),
"Invalid constant pool index %u in class file %s",
@@ -497,18 +487,10 @@
const unsigned int name_len = name->utf8_length();
cp->unresolved_klass_at_put(index, class_index, num_klasses++);
break;
}
- case JVM_CONSTANT_ValueIndex: {
- const int class_index = cp->value_type_index_at(index);
- check_property(valid_symbol_at(class_index),
- "Invalid constant pool index %u in class file %s",
- class_index, CHECK);
- cp->unresolved_value_type_at_put(index, class_index, num_klasses++);
- break;
- }
case JVM_CONSTANT_StringIndex: {
const int string_index = cp->string_index_at(index);
check_property(valid_symbol_at(string_index),
"Invalid constant pool index %u in class file %s",
string_index, CHECK);
@@ -649,12 +631,11 @@
// second verification pass - checks the strings are of the right format.
// but not yet to the other entries
for (index = 1; index < length; index++) {
const jbyte tag = cp->tag_at(index).value();
switch (tag) {
- case JVM_CONSTANT_UnresolvedClass:
- case JVM_CONSTANT_UnresolvedValue: {
+ case JVM_CONSTANT_UnresolvedClass: {
const Symbol* const class_name = cp->klass_name_at(index);
// check the name, even if _cp_patches will overwrite it
verify_legal_class_name(class_name, CHECK);
break;
}
@@ -3186,20 +3167,18 @@
cfs->guarantee_more(8 * length, CHECK_0); // 4-tuples of u2
for (int n = 0; n < length; n++) {
// Inner class index
const u2 inner_class_info_index = cfs->get_u2_fast();
check_property(
- (valid_klass_reference_at(inner_class_info_index) ||
- (EnableValhalla && valid_value_type_reference_at(inner_class_info_index))),
+ valid_klass_reference_at(inner_class_info_index),
"inner_class_info_index %u has bad constant type in class file %s",
inner_class_info_index, CHECK_0);
// Outer class index
const u2 outer_class_info_index = cfs->get_u2_fast();
check_property(
outer_class_info_index == 0 ||
- (valid_klass_reference_at(outer_class_info_index) ||
- (EnableValhalla && valid_value_type_reference_at(outer_class_info_index))),
+ valid_klass_reference_at(outer_class_info_index),
"outer_class_info_index %u has bad constant type in class file %s",
outer_class_info_index, CHECK_0);
// Inner class name
const u2 inner_name_index = cfs->get_u2_fast();
check_property(
@@ -3684,19 +3663,18 @@
|| (_access_flags.get_flags() & JVM_ACC_VALUE),
"Invalid superclass index %u in class file %s",
super_class_index,
CHECK_NULL);
} else {
- check_property((valid_klass_reference_at(super_class_index) ||
- ((EnableValhalla || EnableMVT) && valid_value_type_reference_at(super_class_index))),
+ check_property(valid_klass_reference_at(super_class_index),
"Invalid superclass index %u in class file %s",
super_class_index,
CHECK_NULL);
// The class name should be legal because it is checked when parsing constant pool.
// However, make sure it is not an array type.
bool is_array = false;
- if (cp->tag_at(super_class_index).is_klass() || cp->tag_at(super_class_index).is_value_type()) {
+ if (cp->tag_at(super_class_index).is_klass()) {
super_klass = InstanceKlass::cast(cp->resolved_klass_at(super_class_index));
if (need_verify)
is_array = super_klass->is_array_klass();
} else if (need_verify) {
is_array = (cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
@@ -6184,13 +6162,12 @@
_access_flags.set_flags(flags);
// This class and superclass
_this_class_index = stream->get_u2_fast();
check_property(
- (valid_cp_range(_this_class_index, cp_size) &&
- (cp->tag_at(_this_class_index).is_unresolved_klass() ||
- cp->tag_at(_this_class_index).is_unresolved_value_type())),
+ valid_cp_range(_this_class_index, cp_size) &&
+ cp->tag_at(_this_class_index).is_unresolved_klass(),
"Invalid this class index %u in constant pool in class file %s",
_this_class_index, CHECK);
Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index);
assert(class_name_in_cp != NULL, "class_name can't be null");
@@ -6397,11 +6374,11 @@
);
return;
}
// For a value class, only java/lang/Object is an acceptable super class
- if ((EnableValhalla || EnableMVT) &&
+ if (EnableValhalla &&
_access_flags.get_flags() & JVM_ACC_VALUE) {
guarantee_property(_super_klass->name() == vmSymbols::java_lang_Object(),
"Value class can only inherit java/lang/Object",
CHECK);
}
< prev index next >