Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename verifier related value-types, rename JVM_SIGNATURE_VALUETYPE, … #83

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -469,7 +469,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
if (Signature::is_array(sym) &&
(sym->char_at(1) == JVM_SIGNATURE_ARRAY ||
sym->char_at(1) == JVM_SIGNATURE_CLASS ||
sym->char_at(1) == JVM_SIGNATURE_INLINETYPE )) {
sym->char_at(1) == JVM_SIGNATURE_INLINE_TYPE )) {
// We have an unloaded array.
// Build it on the fly if the element class exists.
SignatureStream ss(sym, false);
@@ -512,7 +512,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
while (sym->char_at(i) == JVM_SIGNATURE_ARRAY) {
i++;
}
if (i > 0 && sym->char_at(i) == JVM_SIGNATURE_INLINETYPE) {
if (i > 0 && sym->char_at(i) == JVM_SIGNATURE_INLINE_TYPE) {
// An unloaded array class of value types is an ObjArrayKlass, an
// unloaded value type class is an InstanceKlass. For consistency,
// make the signature of the unloaded array of value type use L
@@ -116,7 +116,7 @@ ciSymbol* ciObjArrayKlass::construct_array_name(ciSymbol* element_name,
name[pos] = JVM_SIGNATURE_ARRAY;
}
Symbol* base_name_sym = element_name->get_symbol();
assert(base_name_sym->char_at(0) != JVM_SIGNATURE_INLINETYPE, "unloaded array klass element should not have Q-type");
assert(base_name_sym->char_at(0) != JVM_SIGNATURE_INLINE_TYPE, "unloaded array klass element should not have Q-type");
if (Signature::is_array(base_name_sym) ||
Signature::has_envelope(base_name_sym)) {
strncpy(&name[pos], (char*)element_name->base(), element_len);
@@ -912,7 +912,7 @@ class CompileReplay : public StackObj {
Klass* kelem = resolve_klass(field_signature + 1, CHECK_(true));
value = oopFactory::new_objArray(kelem, length, CHECK_(true));
} else if (field_signature[0] == JVM_SIGNATURE_ARRAY &&
field_signature[1] == JVM_SIGNATURE_INLINETYPE) {
field_signature[1] == JVM_SIGNATURE_INLINE_TYPE) {
Klass* kelem = resolve_klass(field_signature + 1, CHECK_(true));
value = oopFactory::new_valueArray(kelem, length, CHECK_(true));
} else {
@@ -999,7 +999,7 @@ class CompileReplay : public StackObj {
const char* string_value = parse_escaped_string();
double value = atof(string_value);
java_mirror->double_field_put(fd.offset(), value);
} else if (field_signature[0] == JVM_SIGNATURE_INLINETYPE) {
} else if (field_signature[0] == JVM_SIGNATURE_INLINE_TYPE) {
Klass* kelem = resolve_klass(field_signature, CHECK);
ValueKlass* vk = ValueKlass::cast(kelem);
oop value = vk->allocate_instance(CHECK);
@@ -114,7 +114,7 @@ ciSymbol* ciValueArrayKlass::construct_array_name(ciSymbol* element_name,
for ( ; pos < dimension; pos++) {
name[pos] = JVM_SIGNATURE_ARRAY;
}
name[pos++] = JVM_SIGNATURE_INLINETYPE;
name[pos++] = JVM_SIGNATURE_INLINE_TYPE;
strncpy(name+pos, (char*)element_name->base(), element_len);
name[new_len-2] = JVM_SIGNATURE_ENDCLASS;
name[new_len-1] = '\0';
@@ -5768,7 +5768,7 @@ const char* ClassFileParser::skip_over_field_signature(const char* signature,
case JVM_SIGNATURE_LONG:
case JVM_SIGNATURE_DOUBLE:
return signature + 1;
case JVM_SIGNATURE_INLINETYPE:
case JVM_SIGNATURE_INLINE_TYPE:
// Can't enable this check until JDK upgrades the bytecode generators
// if (_major_version < CONSTANT_CLASS_DESCRIPTORS ) {
// classfile_parse_error("Class name contains illegal Q-signature "
@@ -202,7 +202,7 @@ Symbol* ClassLoader::package_from_class_name(const Symbol* name, bool* bad_class
// Set bad_class_name to true to indicate that the package name
// could not be obtained due to an error condition.
// In this situation, is_same_class_package returns false.
if (*start == JVM_SIGNATURE_CLASS || *start == JVM_SIGNATURE_INLINETYPE) {
if (*start == JVM_SIGNATURE_CLASS || *start == JVM_SIGNATURE_INLINE_TYPE) {
if (bad_class_name != NULL) {
*bad_class_name = true;
}
@@ -242,7 +242,7 @@ class VerificationType {
bool is_double_array() const { return is_x_array(JVM_SIGNATURE_DOUBLE); }
bool is_object_array() const { return is_x_array(JVM_SIGNATURE_CLASS); }
bool is_array_array() const { return is_x_array(JVM_SIGNATURE_ARRAY); }
bool is_inline_array() const { return is_x_array(JVM_SIGNATURE_INLINETYPE); }
bool is_inline_array() const { return is_x_array(JVM_SIGNATURE_INLINE_TYPE); }
Copy link
Collaborator

@fparain fparain Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "inline" alone can be misleading (is it about the element being an inline type, is it about the elements of the array being inlined in the array, is it about the array being inlined in something else, etc).
Here, the check is about the kind of elements stored in the array, so I would suggest "is_inline_type_array()".

bool is_reference_array() const
{ return is_object_array() || is_array_array(); }
bool is_nonscalar_array() const
@@ -60,7 +60,7 @@
#define NOFAILOVER_MAJOR_VERSION 51
#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51
#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52
#define INLINETYPE_MAJOR_VERSION 56
#define INLINE_TYPE_MAJOR_VERSION 56
#define MAX_ARRAY_DIMENSIONS 255

// Access to external entry for VerifyClassForMajorVersion - old byte code verifier
@@ -1708,7 +1708,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
&bcs, &current_frame, cp, false, CHECK_VERIFY(this));
no_control_flow = false; break;
case Bytecodes::_withfield :
if (_klass->major_version() < INLINETYPE_MAJOR_VERSION) {
if (_klass->major_version() < INLINE_TYPE_MAJOR_VERSION) {
class_format_error(
"withfield not supported by this class file version (%d.%d), class %s",
_klass->major_version(), _klass->minor_version(), _klass->external_name());
@@ -1745,7 +1745,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
}
case Bytecodes::_defaultvalue :
{
if (_klass->major_version() < INLINETYPE_MAJOR_VERSION) {
if (_klass->major_version() < INLINE_TYPE_MAJOR_VERSION) {
class_format_error(
"defaultvalue not supported by this class file version (%d.%d), class %s",
_klass->major_version(), _klass->minor_version(), _klass->external_name());
@@ -3119,7 +3119,7 @@ void ClassVerifier::verify_anewarray(
assert(n == length, "Unexpected number of characters in string");
} else { // it's an object or interface
const char* component_name = component_type.name()->as_utf8();
char Q_or_L = component_type.is_inlinetype() ? JVM_SIGNATURE_INLINETYPE : JVM_SIGNATURE_CLASS;
char Q_or_L = component_type.is_inlinetype() ? JVM_SIGNATURE_INLINE_TYPE : JVM_SIGNATURE_CLASS;
// add one dimension to component with 'L' or 'Q' prepended and ';' appended.
length = (int)strlen(component_name) + 3;
arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
@@ -1511,7 +1511,7 @@ JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,

// Both Q-signatures and L-signatures are mapped to atos
if (cp_entry->flag_state() == atos && ik->field_signature(index)->is_Q_signature()) {
sig_type = JVM_SIGNATURE_INLINETYPE;
sig_type = JVM_SIGNATURE_INLINE_TYPE;
}

bool is_static = (obj == NULL);
@@ -110,7 +110,7 @@ Symbol* ArrayKlass::create_element_klass_array_name(Klass* element_klass, TRAPS)
new_str[idx++] = JVM_SIGNATURE_ARRAY;
if (element_klass->is_instance_klass()) { // it could be an array or simple type
if (is_qtype) {
new_str[idx++] = JVM_SIGNATURE_INLINETYPE;
new_str[idx++] = JVM_SIGNATURE_INLINE_TYPE;
} else {
new_str[idx++] = JVM_SIGNATURE_CLASS;
}
@@ -2893,7 +2893,7 @@ const char* InstanceKlass::signature_name() const {

// Add L or Q as type indicator
int dest_index = 0;
dest[dest_index++] = is_value() ? JVM_SIGNATURE_INLINETYPE : JVM_SIGNATURE_CLASS;
dest[dest_index++] = is_value() ? JVM_SIGNATURE_INLINE_TYPE : JVM_SIGNATURE_CLASS;

// Add the actual class name
for (int src_index = 0; src_index < src_length; ) {
@@ -107,7 +107,7 @@ void Symbol::set_permanent() {

bool Symbol::is_Q_signature() const {
int len = utf8_length();
return len > 2 && char_at(0) == JVM_SIGNATURE_INLINETYPE && char_at(len - 1) == JVM_SIGNATURE_ENDCLASS;
return len > 2 && char_at(0) == JVM_SIGNATURE_INLINE_TYPE && char_at(len - 1) == JVM_SIGNATURE_ENDCLASS;
}

bool Symbol::is_Q_array_signature() const {
@@ -117,7 +117,7 @@ bool Symbol::is_Q_array_signature() const {
}
for (int i = 1; i < (l - 2); i++) {
char c = char_at(i);
if (c == JVM_SIGNATURE_INLINETYPE) {
if (c == JVM_SIGNATURE_INLINE_TYPE) {
return true;
}
if (c != JVM_SIGNATURE_ARRAY) {
@@ -132,7 +132,7 @@ bool Symbol::is_Q_method_signature() const {
int len = utf8_length();
if (len > 4 && char_at(0) == JVM_SIGNATURE_FUNC) {
for (int i=1; i<len-3; i++) { // Must end with ")Qx;", where x is at least one character or more.
if (char_at(i) == JVM_SIGNATURE_ENDFUNC && char_at(i+1) == JVM_SIGNATURE_INLINETYPE) {
if (char_at(i) == JVM_SIGNATURE_ENDFUNC && char_at(i+1) == JVM_SIGNATURE_INLINE_TYPE) {
return true;
}
}
@@ -142,12 +142,12 @@ bool Symbol::is_Q_method_signature() const {

bool Symbol::is_Q_singledim_array_signature() const {
int len = utf8_length();
return len > 3 && char_at(0) == JVM_SIGNATURE_ARRAY && char_at(1) == JVM_SIGNATURE_INLINETYPE &&
return len > 3 && char_at(0) == JVM_SIGNATURE_ARRAY && char_at(1) == JVM_SIGNATURE_INLINE_TYPE &&
char_at(len - 1) == JVM_SIGNATURE_ENDCLASS;
}

Symbol* Symbol::fundamental_name(TRAPS) {
if ((char_at(0) == JVM_SIGNATURE_INLINETYPE || char_at(0) == JVM_SIGNATURE_CLASS) && ends_with(JVM_SIGNATURE_ENDCLASS)) {
if ((char_at(0) == JVM_SIGNATURE_INLINE_TYPE || char_at(0) == JVM_SIGNATURE_CLASS) && ends_with(JVM_SIGNATURE_ENDCLASS)) {
return SymbolTable::new_symbol(this, 1, utf8_length() - 1);
} else {
// reference count is incremented to be consistent with the behavior with
@@ -162,15 +162,15 @@ bool Symbol::is_same_fundamental_type(Symbol* s) const {
if (utf8_length() < 3) return false;
int offset1, offset2, len;
if (ends_with(JVM_SIGNATURE_ENDCLASS)) {
if (char_at(0) != JVM_SIGNATURE_INLINETYPE && char_at(0) != JVM_SIGNATURE_CLASS) return false;
if (char_at(0) != JVM_SIGNATURE_INLINE_TYPE && char_at(0) != JVM_SIGNATURE_CLASS) return false;
offset1 = 1;
len = utf8_length() - 2;
} else {
offset1 = 0;
len = utf8_length();
}
if (ends_with(JVM_SIGNATURE_ENDCLASS)) {
if (s->char_at(0) != JVM_SIGNATURE_INLINETYPE && s->char_at(0) != JVM_SIGNATURE_CLASS) return false;
if (s->char_at(0) != JVM_SIGNATURE_INLINE_TYPE && s->char_at(0) != JVM_SIGNATURE_CLASS) return false;
offset2 = 1;
} else {
offset2 = 0;
@@ -513,7 +513,7 @@ bool VM_GetOrSetLocal::is_assignable(const char* ty_sign, Klass* klass, Thread*

int len = (int) strlen(ty_sign);
if ((ty_sign[0] == JVM_SIGNATURE_CLASS ||
ty_sign[0] == JVM_SIGNATURE_INLINETYPE) &&
ty_sign[0] == JVM_SIGNATURE_INLINE_TYPE) &&
ty_sign[len-1] == JVM_SIGNATURE_ENDCLASS) { // Need pure class/interface name
ty_sign++;
len -= 2;
@@ -298,7 +298,7 @@ bool Signature::is_valid_array_signature(const Symbol* sig) {
// If it is an array, the type is the last character
return (i + 1 == len);
case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_INLINETYPE:
case JVM_SIGNATURE_INLINE_TYPE:
// If it is an object, the last character must be a ';'
return sig->char_at(len - 1) == JVM_SIGNATURE_ENDCLASS;
}
@@ -548,7 +548,7 @@ ssize_t SignatureVerifier::is_valid_type(const char* type, ssize_t limit) {
case JVM_SIGNATURE_BOOLEAN:
case JVM_SIGNATURE_VOID:
return index + 1;
case JVM_SIGNATURE_INLINETYPE: // fall through
case JVM_SIGNATURE_INLINE_TYPE: // fall through
case JVM_SIGNATURE_CLASS:
for (index = index + 1; index < limit; ++index) {
char c = type[index];
@@ -124,7 +124,7 @@ class Signature : AllStatic {
// Determine if this signature char introduces an
// envelope, which is a class name plus ';'.
static bool has_envelope(char signature_char) {
return (signature_char == JVM_SIGNATURE_CLASS) || (signature_char == JVM_SIGNATURE_INLINETYPE);
return (signature_char == JVM_SIGNATURE_CLASS) || (signature_char == JVM_SIGNATURE_INLINE_TYPE);
}

// Assuming has_envelope is true, return the symbol
@@ -206,7 +206,7 @@ char type2char_tab[T_CONFLICT+1] = {
JVM_SIGNATURE_BYTE, JVM_SIGNATURE_SHORT,
JVM_SIGNATURE_INT, JVM_SIGNATURE_LONG,
JVM_SIGNATURE_CLASS, JVM_SIGNATURE_ARRAY,
JVM_SIGNATURE_INLINETYPE, JVM_SIGNATURE_VOID,
JVM_SIGNATURE_INLINE_TYPE, JVM_SIGNATURE_VOID,
0, 0, 0, 0, 0
};

@@ -223,7 +223,7 @@ const char* type2name_tab[T_CONFLICT+1] = {
"long",
"object",
"array",
"valuetype",
"inline_type",
"void",
"*address*",
"*narrowoop*",
@@ -646,7 +646,7 @@ enum BasicType {
F(JVM_SIGNATURE_LONG, T_LONG, N) \
F(JVM_SIGNATURE_CLASS, T_OBJECT, N) \
F(JVM_SIGNATURE_ARRAY, T_ARRAY, N) \
F(JVM_SIGNATURE_INLINETYPE, T_VALUETYPE, N) \
F(JVM_SIGNATURE_INLINE_TYPE, T_VALUETYPE, N) \
F(JVM_SIGNATURE_VOID, T_VOID, N) \
/*end*/

@@ -153,7 +153,7 @@ enum {
JVM_SIGNATURE_BYTE = 'B',
JVM_SIGNATURE_CHAR = 'C',
JVM_SIGNATURE_CLASS = 'L',
JVM_SIGNATURE_INLINETYPE = 'Q',
JVM_SIGNATURE_INLINE_TYPE = 'Q',
JVM_SIGNATURE_ENDCLASS = ';',
JVM_SIGNATURE_ENUM = 'E',
JVM_SIGNATURE_FLOAT = 'F',
@@ -195,7 +195,7 @@ skip_over_field_signature(char *name, jboolean void_okay,
return name + 1;

case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_INLINETYPE: {
case JVM_SIGNATURE_INLINE_TYPE: {
/* Skip over the classname, if one is there. */
char *p =
skip_over_fieldname(name + 1, JNI_TRUE, --length);
@@ -3723,13 +3723,13 @@ static const char* get_result_signature(const char* signature) {
case JVM_SIGNATURE_FUNC: /* ignore initial (, if given */
break;
case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_INLINETYPE:
case JVM_SIGNATURE_INLINE_TYPE:
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
break;
case JVM_SIGNATURE_ARRAY:
while (*p == JVM_SIGNATURE_ARRAY) p++;
/* If an array of classes, skip over class name, too. */
if (*p == JVM_SIGNATURE_CLASS || *p == JVM_SIGNATURE_INLINETYPE) {
if (*p == JVM_SIGNATURE_CLASS || *p == JVM_SIGNATURE_INLINE_TYPE) {
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
}
break;
@@ -3809,7 +3809,7 @@ signature_to_fieldtype(context_type *context,
continue; /* only time we ever do the loop > 1 */

case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_INLINETYPE: {
case JVM_SIGNATURE_INLINE_TYPE: {
char buffer_space[256];
char *buffer = buffer_space;
char *finish = strchr(p, JVM_SIGNATURE_ENDCLASS);
@@ -4192,15 +4192,15 @@ static int signature_to_args_size(const char *method_signature)
args_size += 1;
break;
case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_INLINETYPE:
case JVM_SIGNATURE_INLINE_TYPE:
args_size += 1;
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
break;
case JVM_SIGNATURE_ARRAY:
args_size += 1;
while ((*p == JVM_SIGNATURE_ARRAY)) p++;
/* If an array of classes, skip over class name, too. */
if (*p == JVM_SIGNATURE_CLASS || *p == JVM_SIGNATURE_INLINETYPE) {
if (*p == JVM_SIGNATURE_CLASS || *p == JVM_SIGNATURE_INLINE_TYPE) {
while (*p != JVM_SIGNATURE_ENDCLASS)
p++;
}