8231844: Enhance type signature characters in classfile_constants.h and improve the JVM to use type signature characters more consistently
Increase the use of type signature constants instead of hard coded characters within the JVM. Co-authored-by: John Rose <john.r.rose@oracle.com> Reviewed-by: coleenp, dholmes, fparain
This commit is contained in:
parent
0192c5a02f
commit
fce4320369
src
hotspot/share
aot
c1
ci
classfile
classFileParser.cppclassLoader.cppjavaAssertions.cppjavaClasses.hppmodules.cppsystemDictionary.cppverificationType.cppverificationType.hppverifier.cppvmSymbols.cpp
compiler
interpreter
jvmci
memory
oops
prims
jni.cppjvmtiEnvBase.cppjvmtiExport.cppjvmtiImpl.cppjvmtiRedefineClasses.cppjvmtiTagMap.cppmethodHandles.cppnativeLookup.cpp
runtime
utilities
java.base/share/native/include
@ -93,7 +93,7 @@ Klass* AOTCodeHeap::lookup_klass(const char* name, int len, const Method* method
|
||||
Handle protection_domain(thread, caller->method_holder()->protection_domain());
|
||||
|
||||
// Ignore wrapping L and ;
|
||||
if (name[0] == 'L') {
|
||||
if (name[0] == JVM_SIGNATURE_CLASS) {
|
||||
assert(len > 2, "small name %s", name);
|
||||
name++;
|
||||
len -= 2;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2019, 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
|
||||
@ -33,19 +33,11 @@
|
||||
#ifndef PRODUCT
|
||||
|
||||
const char* InstructionPrinter::basic_type_name(BasicType type) {
|
||||
switch (type) {
|
||||
case T_BOOLEAN: return "boolean";
|
||||
case T_BYTE : return "byte";
|
||||
case T_CHAR : return "char";
|
||||
case T_SHORT : return "short";
|
||||
case T_INT : return "int";
|
||||
case T_LONG : return "long";
|
||||
case T_FLOAT : return "float";
|
||||
case T_DOUBLE : return "double";
|
||||
case T_ARRAY : return "array";
|
||||
case T_OBJECT : return "object";
|
||||
default : return "???";
|
||||
const char* n = type2name(type);
|
||||
if (n == NULL || type > T_VOID) {
|
||||
return "???";
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
@ -413,8 +413,8 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
|
||||
// Now we need to check the SystemDictionary
|
||||
Symbol* sym = name->get_symbol();
|
||||
if (sym->char_at(0) == 'L' &&
|
||||
sym->char_at(sym->utf8_length()-1) == ';') {
|
||||
if (sym->char_at(0) == JVM_SIGNATURE_CLASS &&
|
||||
sym->char_at(sym->utf8_length()-1) == JVM_SIGNATURE_ENDCLASS) {
|
||||
// This is a name from a signature. Strip off the trimmings.
|
||||
// Call recursive to keep scope of strippedsym.
|
||||
TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
|
||||
@ -440,7 +440,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
|
||||
// setup up the proper type to return on OOM
|
||||
ciKlass* fail_type;
|
||||
if (sym->char_at(0) == '[') {
|
||||
if (sym->char_at(0) == JVM_SIGNATURE_ARRAY) {
|
||||
fail_type = _unloaded_ciobjarrayklass;
|
||||
} else {
|
||||
fail_type = _unloaded_ciinstance_klass;
|
||||
@ -466,8 +466,8 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
// we must build an array type around it. The CI requires array klasses
|
||||
// to be loaded if their element klasses are loaded, except when memory
|
||||
// is exhausted.
|
||||
if (sym->char_at(0) == '[' &&
|
||||
(sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
|
||||
if (sym->char_at(0) == JVM_SIGNATURE_ARRAY &&
|
||||
(sym->char_at(1) == JVM_SIGNATURE_ARRAY || sym->char_at(1) == JVM_SIGNATURE_CLASS)) {
|
||||
// We have an unloaded array.
|
||||
// Build it on the fly if the element class exists.
|
||||
TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2019, 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
|
||||
@ -116,7 +116,7 @@ ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
|
||||
jobject loader, jobject protection_domain)
|
||||
: ciKlass(name, T_OBJECT)
|
||||
{
|
||||
assert(name->char_at(0) != '[', "not an instance klass");
|
||||
assert(name->char_at(0) != JVM_SIGNATURE_ARRAY, "not an instance klass");
|
||||
_init_state = (InstanceKlass::ClassState)0;
|
||||
_nonstatic_field_size = -1;
|
||||
_has_nonstatic_fields = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2019, 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
|
||||
@ -112,16 +112,16 @@ ciSymbol* ciObjArrayKlass::construct_array_name(ciSymbol* element_name,
|
||||
Symbol* base_name_sym = element_name->get_symbol();
|
||||
char* name;
|
||||
|
||||
if (base_name_sym->char_at(0) == '[' ||
|
||||
(base_name_sym->char_at(0) == 'L' && // watch package name 'Lxx'
|
||||
base_name_sym->char_at(element_len-1) == ';')) {
|
||||
if (base_name_sym->char_at(0) == JVM_SIGNATURE_ARRAY ||
|
||||
(base_name_sym->char_at(0) == JVM_SIGNATURE_CLASS && // watch package name 'Lxx'
|
||||
base_name_sym->char_at(element_len-1) == JVM_SIGNATURE_ENDCLASS)) {
|
||||
|
||||
int new_len = element_len + dimension + 1; // for the ['s and '\0'
|
||||
name = CURRENT_THREAD_ENV->name_buffer(new_len);
|
||||
|
||||
int pos = 0;
|
||||
for ( ; pos < dimension; pos++) {
|
||||
name[pos] = '[';
|
||||
name[pos] = JVM_SIGNATURE_ARRAY;
|
||||
}
|
||||
strncpy(name+pos, (char*)element_name->base(), element_len);
|
||||
name[new_len-1] = '\0';
|
||||
@ -133,11 +133,11 @@ ciSymbol* ciObjArrayKlass::construct_array_name(ciSymbol* element_name,
|
||||
name = CURRENT_THREAD_ENV->name_buffer(new_len);
|
||||
int pos = 0;
|
||||
for ( ; pos < dimension; pos++) {
|
||||
name[pos] = '[';
|
||||
name[pos] = JVM_SIGNATURE_ARRAY;
|
||||
}
|
||||
name[pos++] = 'L';
|
||||
name[pos++] = JVM_SIGNATURE_CLASS;
|
||||
strncpy(name+pos, (char*)element_name->base(), element_len);
|
||||
name[new_len-2] = ';';
|
||||
name[new_len-2] = JVM_SIGNATURE_ENDCLASS;
|
||||
name[new_len-1] = '\0';
|
||||
}
|
||||
return ciSymbol::make(name);
|
||||
|
@ -486,7 +486,7 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
|
||||
|
||||
// Two cases: this is an unloaded ObjArrayKlass or an
|
||||
// unloaded InstanceKlass. Deal with both.
|
||||
if (name->char_at(0) == '[') {
|
||||
if (name->char_at(0) == JVM_SIGNATURE_ARRAY) {
|
||||
// Decompose the name.'
|
||||
FieldArrayInfo fd;
|
||||
BasicType element_type = FieldType::get_array_info(name->get_symbol(),
|
||||
|
@ -814,18 +814,18 @@ class CompileReplay : public StackObj {
|
||||
}
|
||||
|
||||
oop java_mirror = k->java_mirror();
|
||||
if (field_signature[0] == '[') {
|
||||
if (field_signature[0] == JVM_SIGNATURE_ARRAY) {
|
||||
int length = parse_int("array length");
|
||||
oop value = NULL;
|
||||
|
||||
if (field_signature[1] == '[') {
|
||||
if (field_signature[1] == JVM_SIGNATURE_ARRAY) {
|
||||
// multi dimensional array
|
||||
ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK);
|
||||
if (kelem == NULL) {
|
||||
return;
|
||||
}
|
||||
int rank = 0;
|
||||
while (field_signature[rank] == '[') {
|
||||
while (field_signature[rank] == JVM_SIGNATURE_ARRAY) {
|
||||
rank++;
|
||||
}
|
||||
jint* dims = NEW_RESOURCE_ARRAY(jint, rank);
|
||||
@ -851,7 +851,8 @@ class CompileReplay : public StackObj {
|
||||
value = oopFactory::new_intArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[J") == 0) {
|
||||
value = oopFactory::new_longArray(length, CHECK);
|
||||
} else if (field_signature[0] == '[' && field_signature[1] == 'L') {
|
||||
} else if (field_signature[0] == JVM_SIGNATURE_ARRAY &&
|
||||
field_signature[1] == JVM_SIGNATURE_CLASS) {
|
||||
Klass* kelem = resolve_klass(field_signature + 1, CHECK);
|
||||
value = oopFactory::new_objArray(kelem, length, CHECK);
|
||||
} else {
|
||||
@ -892,7 +893,7 @@ class CompileReplay : public StackObj {
|
||||
} else if (strcmp(field_signature, "Ljava/lang/String;") == 0) {
|
||||
Handle value = java_lang_String::create_from_str(string_value, CHECK);
|
||||
java_mirror->obj_field_put(fd.offset(), value());
|
||||
} else if (field_signature[0] == 'L') {
|
||||
} else if (field_signature[0] == JVM_SIGNATURE_CLASS) {
|
||||
Klass* k = resolve_klass(string_value, CHECK);
|
||||
oop value = InstanceKlass::cast(k)->allocate_instance(CHECK);
|
||||
java_mirror->obj_field_put(fd.offset(), value);
|
||||
|
@ -731,7 +731,7 @@ void ClassFileParser::parse_constant_pool(const ClassFileStream* const stream,
|
||||
const unsigned int name_len = name->utf8_length();
|
||||
if (tag == JVM_CONSTANT_Methodref &&
|
||||
name_len != 0 &&
|
||||
name->char_at(0) == '<' &&
|
||||
name->char_at(0) == JVM_SIGNATURE_SPECIAL &&
|
||||
name != vmSymbols::object_initializer_name()) {
|
||||
classfile_parse_error(
|
||||
"Bad method name at constant pool index %u in class file %s",
|
||||
@ -4961,24 +4961,25 @@ bool ClassFileParser::verify_unqualified_name(const char* name,
|
||||
if (length == 0) return false; // Must have at least one char.
|
||||
for (const char* p = name; p != name + length; p++) {
|
||||
switch(*p) {
|
||||
case '.':
|
||||
case ';':
|
||||
case '[':
|
||||
case JVM_SIGNATURE_DOT:
|
||||
case JVM_SIGNATURE_ENDCLASS:
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
// do not permit '.', ';', or '['
|
||||
return false;
|
||||
case '/':
|
||||
case JVM_SIGNATURE_SLASH:
|
||||
// check for '//' or leading or trailing '/' which are not legal
|
||||
// unqualified name must not be empty
|
||||
if (type == ClassFileParser::LegalClass) {
|
||||
if (p == name || p+1 >= name+length || *(p+1) == '/') {
|
||||
if (p == name || p+1 >= name+length ||
|
||||
*(p+1) == JVM_SIGNATURE_SLASH) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false; // do not permit '/' unless it's class name
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
case '>':
|
||||
case JVM_SIGNATURE_SPECIAL:
|
||||
case JVM_SIGNATURE_ENDSPECIAL:
|
||||
// do not permit '<' or '>' in method names
|
||||
if (type == ClassFileParser::LegalMethod) {
|
||||
return false;
|
||||
@ -5015,7 +5016,7 @@ static const char* skip_over_field_name(const char* const name,
|
||||
last_is_slash = false;
|
||||
continue;
|
||||
}
|
||||
if (slash_ok && ch == '/') {
|
||||
if (slash_ok && ch == JVM_SIGNATURE_SLASH) {
|
||||
if (last_is_slash) {
|
||||
return NULL; // Don't permit consecutive slashes
|
||||
}
|
||||
@ -5095,14 +5096,14 @@ const char* ClassFileParser::skip_over_field_signature(const char* signature,
|
||||
const char* const p = skip_over_field_name(signature + 1, true, --length);
|
||||
|
||||
// The next character better be a semicolon
|
||||
if (p && (p - signature) > 1 && p[0] == ';') {
|
||||
if (p && (p - signature) > 1 && p[0] == JVM_SIGNATURE_ENDCLASS) {
|
||||
return p + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Skip leading 'L' and ignore first appearance of ';'
|
||||
signature++;
|
||||
const char* c = (const char*) memchr(signature, ';', length - 1);
|
||||
const char* c = (const char*) memchr(signature, JVM_SIGNATURE_ENDCLASS, length - 1);
|
||||
// Format check signature
|
||||
if (c != NULL) {
|
||||
int newlen = c - (char*) signature;
|
||||
@ -5151,7 +5152,7 @@ void ClassFileParser::verify_legal_class_name(const Symbol* name, TRAPS) const {
|
||||
p = skip_over_field_signature(bytes, false, length, CHECK);
|
||||
legal = (p != NULL) && ((p - bytes) == (int)length);
|
||||
} else if (_major_version < JAVA_1_5_VERSION) {
|
||||
if (bytes[0] != '<') {
|
||||
if (bytes[0] != JVM_SIGNATURE_SPECIAL) {
|
||||
p = skip_over_field_name(bytes, true, length);
|
||||
legal = (p != NULL) && ((p - bytes) == (int)length);
|
||||
}
|
||||
@ -5186,7 +5187,7 @@ void ClassFileParser::verify_legal_field_name(const Symbol* name, TRAPS) const {
|
||||
|
||||
if (length > 0) {
|
||||
if (_major_version < JAVA_1_5_VERSION) {
|
||||
if (bytes[0] != '<') {
|
||||
if (bytes[0] != JVM_SIGNATURE_SPECIAL) {
|
||||
const char* p = skip_over_field_name(bytes, false, length);
|
||||
legal = (p != NULL) && ((p - bytes) == (int)length);
|
||||
}
|
||||
@ -5219,7 +5220,7 @@ void ClassFileParser::verify_legal_method_name(const Symbol* name, TRAPS) const
|
||||
bool legal = false;
|
||||
|
||||
if (length > 0) {
|
||||
if (bytes[0] == '<') {
|
||||
if (bytes[0] == JVM_SIGNATURE_SPECIAL) {
|
||||
if (name == vmSymbols::object_initializer_name() || name == vmSymbols::class_initializer_name()) {
|
||||
legal = true;
|
||||
}
|
||||
@ -5303,7 +5304,7 @@ int ClassFileParser::verify_legal_method_signature(const Symbol* name,
|
||||
// The first non-signature thing better be a ')'
|
||||
if ((length > 0) && (*p++ == JVM_SIGNATURE_ENDFUNC)) {
|
||||
length--;
|
||||
if (name->utf8_length() > 0 && name->char_at(0) == '<') {
|
||||
if (name->utf8_length() > 0 && name->char_at(0) == JVM_SIGNATURE_SPECIAL) {
|
||||
// All internal methods must return void
|
||||
if ((length == 1) && (p[0] == JVM_SIGNATURE_VOID)) {
|
||||
return args_size;
|
||||
@ -5705,7 +5706,7 @@ void ClassFileParser::update_class_name(Symbol* new_class_name) {
|
||||
// its _class_name field.
|
||||
void ClassFileParser::prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host, TRAPS) {
|
||||
ResourceMark rm(THREAD);
|
||||
assert(strrchr(_class_name->as_C_string(), '/') == NULL,
|
||||
assert(strrchr(_class_name->as_C_string(), JVM_SIGNATURE_SLASH) == NULL,
|
||||
"Unsafe anonymous class should not be in a package");
|
||||
const char* host_pkg_name =
|
||||
ClassLoader::package_from_name(unsafe_anonymous_host->name()->as_C_string(), NULL);
|
||||
@ -5738,7 +5739,7 @@ void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) {
|
||||
assert(_unsafe_anonymous_host != NULL, "Expected an unsafe anonymous class");
|
||||
|
||||
const jbyte* anon_last_slash = UTF8::strrchr((const jbyte*)_class_name->base(),
|
||||
_class_name->utf8_length(), '/');
|
||||
_class_name->utf8_length(), JVM_SIGNATURE_SLASH);
|
||||
if (anon_last_slash == NULL) { // Unnamed package
|
||||
prepend_host_package_name(_unsafe_anonymous_host, CHECK);
|
||||
} else {
|
||||
@ -6343,7 +6344,7 @@ bool ClassFileParser::is_internal_format(Symbol* class_name) {
|
||||
if (class_name != NULL) {
|
||||
ResourceMark rm;
|
||||
char* name = class_name->as_C_string();
|
||||
return strchr(name, '.') == NULL;
|
||||
return strchr(name, JVM_SIGNATURE_DOT) == NULL;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ const char* ClassLoader::package_from_name(const char* const class_name, bool* b
|
||||
*bad_class_name = false;
|
||||
}
|
||||
|
||||
const char* const last_slash = strrchr(class_name, '/');
|
||||
const char* const last_slash = strrchr(class_name, JVM_SIGNATURE_SLASH);
|
||||
if (last_slash == NULL) {
|
||||
// No package name
|
||||
return NULL;
|
||||
@ -195,16 +195,16 @@ const char* ClassLoader::package_from_name(const char* const class_name, bool* b
|
||||
|
||||
char* class_name_ptr = (char*) class_name;
|
||||
// Skip over '['s
|
||||
if (*class_name_ptr == '[') {
|
||||
if (*class_name_ptr == JVM_SIGNATURE_ARRAY) {
|
||||
do {
|
||||
class_name_ptr++;
|
||||
} while (*class_name_ptr == '[');
|
||||
} while (*class_name_ptr == JVM_SIGNATURE_ARRAY);
|
||||
|
||||
// Fully qualified class names should not contain a 'L'.
|
||||
// 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 (*class_name_ptr == 'L') {
|
||||
if (*class_name_ptr == JVM_SIGNATURE_CLASS) {
|
||||
if (bad_class_name != NULL) {
|
||||
*bad_class_name = true;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ void JavaAssertions::addOption(const char* name, bool enable) {
|
||||
// JVM_DesiredAssertionStatus pass the external_name() to
|
||||
// JavaAssertion::enabled(), but that is done once per loaded class.
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (name_copy[i] == '.') name_copy[i] = '/';
|
||||
if (name_copy[i] == JVM_SIGNATURE_DOT) name_copy[i] = JVM_SIGNATURE_SLASH;
|
||||
}
|
||||
|
||||
if (TraceJavaAssertions) {
|
||||
@ -135,7 +135,7 @@ objArrayHandle names, typeArrayHandle enabled, TRAPS) {
|
||||
for (index = len - 1; p != 0; p = p->next(), --index) {
|
||||
assert(index >= 0, "length does not match list");
|
||||
Handle s = java_lang_String::create_from_str(p->name(), CHECK);
|
||||
s = java_lang_String::char_converter(s, '/', '.', CHECK);
|
||||
s = java_lang_String::char_converter(s, JVM_SIGNATURE_SLASH, JVM_SIGNATURE_DOT, CHECK);
|
||||
names->obj_at_put(index, s());
|
||||
enabled->bool_at_put(index, p->enabled());
|
||||
}
|
||||
@ -163,10 +163,10 @@ JavaAssertions::match_package(const char* classname) {
|
||||
// does not include a package, length will be 0 which will match items for the
|
||||
// default package (from options "-ea:..." or "-da:...").
|
||||
size_t len = strlen(classname);
|
||||
for (/* empty */; len > 0 && classname[len] != '/'; --len) /* empty */;
|
||||
for (/* empty */; len > 0 && classname[len] != JVM_SIGNATURE_SLASH; --len) /* empty */;
|
||||
|
||||
do {
|
||||
assert(len == 0 || classname[len] == '/', "not a package name");
|
||||
assert(len == 0 || classname[len] == JVM_SIGNATURE_SLASH, "not a package name");
|
||||
for (OptionList* p = _packages; p != 0; p = p->next()) {
|
||||
if (strncmp(p->name(), classname, len) == 0 && p->name()[len] == '\0') {
|
||||
return p;
|
||||
@ -175,7 +175,7 @@ JavaAssertions::match_package(const char* classname) {
|
||||
|
||||
// Find the length of the next package, taking care to avoid decrementing
|
||||
// past 0 (len is unsigned).
|
||||
while (len > 0 && classname[--len] != '/') /* empty */;
|
||||
while (len > 0 && classname[--len] != JVM_SIGNATURE_SLASH) /* empty */;
|
||||
} while (len > 0);
|
||||
|
||||
return 0;
|
||||
|
@ -201,7 +201,9 @@ class java_lang_String : AllStatic {
|
||||
static inline bool value_equals(typeArrayOop str_value1, typeArrayOop str_value2);
|
||||
|
||||
// Conversion between '.' and '/' formats
|
||||
static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
|
||||
static Handle externalize_classname(Handle java_string, TRAPS) {
|
||||
return char_converter(java_string, JVM_SIGNATURE_SLASH, JVM_SIGNATURE_DOT, THREAD);
|
||||
}
|
||||
|
||||
// Conversion
|
||||
static Symbol* as_symbol(oop java_string);
|
||||
|
@ -331,7 +331,7 @@ void Modules::define_module(jobject module, jboolean is_open, jstring version,
|
||||
if (!h_loader.is_null() &&
|
||||
!SystemDictionary::is_platform_class_loader(h_loader()) &&
|
||||
(strncmp(package_name, JAVAPKG, JAVAPKG_LEN) == 0 &&
|
||||
(package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) {
|
||||
(package_name[JAVAPKG_LEN] == JVM_SIGNATURE_SLASH || package_name[JAVAPKG_LEN] == '\0'))) {
|
||||
const char* class_loader_name = loader_data->loader_name_and_id();
|
||||
size_t pkg_len = strlen(package_name);
|
||||
char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len + 1);
|
||||
|
@ -2533,7 +2533,7 @@ Handle SystemDictionary::find_java_mirror_for_type(Symbol* signature,
|
||||
|
||||
// It's a primitive. (Void has a primitive mirror too.)
|
||||
char ch = type->char_at(0);
|
||||
assert(is_java_primitive(char2type(ch)) || ch == 'V', "");
|
||||
assert(is_java_primitive(char2type(ch)) || ch == JVM_SIGNATURE_VOID, "");
|
||||
return Handle(THREAD, find_java_mirror_for_type(ch));
|
||||
|
||||
} else if (FieldType::is_obj(type) || FieldType::is_array(type)) {
|
||||
|
@ -122,19 +122,19 @@ VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS)
|
||||
assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
|
||||
Symbol* component;
|
||||
switch (name()->char_at(1)) {
|
||||
case 'Z': return VerificationType(Boolean);
|
||||
case 'B': return VerificationType(Byte);
|
||||
case 'C': return VerificationType(Char);
|
||||
case 'S': return VerificationType(Short);
|
||||
case 'I': return VerificationType(Integer);
|
||||
case 'J': return VerificationType(Long);
|
||||
case 'F': return VerificationType(Float);
|
||||
case 'D': return VerificationType(Double);
|
||||
case '[':
|
||||
case JVM_SIGNATURE_BOOLEAN: return VerificationType(Boolean);
|
||||
case JVM_SIGNATURE_BYTE: return VerificationType(Byte);
|
||||
case JVM_SIGNATURE_CHAR: return VerificationType(Char);
|
||||
case JVM_SIGNATURE_SHORT: return VerificationType(Short);
|
||||
case JVM_SIGNATURE_INT: return VerificationType(Integer);
|
||||
case JVM_SIGNATURE_LONG: return VerificationType(Long);
|
||||
case JVM_SIGNATURE_FLOAT: return VerificationType(Float);
|
||||
case JVM_SIGNATURE_DOUBLE: return VerificationType(Double);
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
component = context->create_temporary_symbol(
|
||||
name(), 1, name()->utf8_length());
|
||||
return VerificationType::reference_type(component);
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
component = context->create_temporary_symbol(
|
||||
name(), 2, name()->utf8_length() - 1);
|
||||
return VerificationType::reference_type(component);
|
||||
|
@ -209,24 +209,24 @@ class VerificationType {
|
||||
bool is_x_array(char sig) const {
|
||||
return is_null() || (is_array() && (name()->char_at(1) == sig));
|
||||
}
|
||||
bool is_int_array() const { return is_x_array('I'); }
|
||||
bool is_byte_array() const { return is_x_array('B'); }
|
||||
bool is_bool_array() const { return is_x_array('Z'); }
|
||||
bool is_char_array() const { return is_x_array('C'); }
|
||||
bool is_short_array() const { return is_x_array('S'); }
|
||||
bool is_long_array() const { return is_x_array('J'); }
|
||||
bool is_float_array() const { return is_x_array('F'); }
|
||||
bool is_double_array() const { return is_x_array('D'); }
|
||||
bool is_object_array() const { return is_x_array('L'); }
|
||||
bool is_array_array() const { return is_x_array('['); }
|
||||
bool is_int_array() const { return is_x_array(JVM_SIGNATURE_INT); }
|
||||
bool is_byte_array() const { return is_x_array(JVM_SIGNATURE_BYTE); }
|
||||
bool is_bool_array() const { return is_x_array(JVM_SIGNATURE_BOOLEAN); }
|
||||
bool is_char_array() const { return is_x_array(JVM_SIGNATURE_CHAR); }
|
||||
bool is_short_array() const { return is_x_array(JVM_SIGNATURE_SHORT); }
|
||||
bool is_long_array() const { return is_x_array(JVM_SIGNATURE_LONG); }
|
||||
bool is_float_array() const { return is_x_array(JVM_SIGNATURE_FLOAT); }
|
||||
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_reference_array() const
|
||||
{ return is_object_array() || is_array_array(); }
|
||||
bool is_object() const
|
||||
{ return (is_reference() && !is_null() && name()->utf8_length() >= 1 &&
|
||||
name()->char_at(0) != '['); }
|
||||
name()->char_at(0) != JVM_SIGNATURE_ARRAY); }
|
||||
bool is_array() const
|
||||
{ return (is_reference() && !is_null() && name()->utf8_length() >= 2 &&
|
||||
name()->char_at(0) == '['); }
|
||||
name()->char_at(0) == JVM_SIGNATURE_ARRAY); }
|
||||
bool is_uninitialized() const
|
||||
{ return ((_u._data & Uninitialized) == Uninitialized); }
|
||||
bool is_uninitialized_this() const
|
||||
@ -322,7 +322,7 @@ class VerificationType {
|
||||
int dimensions() const {
|
||||
assert(is_array(), "Must be an array");
|
||||
int index = 0;
|
||||
while (name()->char_at(index) == '[') index++;
|
||||
while (name()->char_at(index) == JVM_SIGNATURE_ARRAY) index++;
|
||||
return index;
|
||||
}
|
||||
|
||||
|
@ -2852,7 +2852,7 @@ void ClassVerifier::verify_invoke_instructions(
|
||||
}
|
||||
}
|
||||
|
||||
if (method_name->char_at(0) == '<') {
|
||||
if (method_name->char_at(0) == JVM_SIGNATURE_SPECIAL) {
|
||||
// Make sure <init> can only be invoked by invokespecial
|
||||
if (opcode != Bytecodes::_invokespecial ||
|
||||
method_name != vmSymbols::object_initializer_name()) {
|
||||
@ -3028,21 +3028,23 @@ void ClassVerifier::verify_anewarray(
|
||||
// Check for more than MAX_ARRAY_DIMENSIONS
|
||||
length = (int)strlen(component_name);
|
||||
if (length > MAX_ARRAY_DIMENSIONS &&
|
||||
component_name[MAX_ARRAY_DIMENSIONS - 1] == '[') {
|
||||
component_name[MAX_ARRAY_DIMENSIONS - 1] == JVM_SIGNATURE_ARRAY) {
|
||||
verify_error(ErrorContext::bad_code(bci),
|
||||
"Illegal anewarray instruction, array has more than 255 dimensions");
|
||||
}
|
||||
// add one dimension to component
|
||||
length++;
|
||||
arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
|
||||
int n = os::snprintf(arr_sig_str, length + 1, "[%s", component_name);
|
||||
int n = os::snprintf(arr_sig_str, length + 1, "%c%s",
|
||||
JVM_SIGNATURE_ARRAY, component_name);
|
||||
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();
|
||||
// add one dimension to component with 'L' prepended and ';' postpended.
|
||||
length = (int)strlen(component_name) + 3;
|
||||
arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
|
||||
int n = os::snprintf(arr_sig_str, length + 1, "[L%s;", component_name);
|
||||
int n = os::snprintf(arr_sig_str, length + 1, "%c%c%s;",
|
||||
JVM_SIGNATURE_ARRAY, JVM_SIGNATURE_CLASS, component_name);
|
||||
assert(n == length, "Unexpected number of characters in string");
|
||||
}
|
||||
Symbol* arr_sig = create_temporary_symbol(arr_sig_str, length);
|
||||
|
@ -970,7 +970,7 @@ const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf,
|
||||
case F_RNY:fname = "native synchronized "; break;
|
||||
default: break;
|
||||
}
|
||||
const char* kptr = strrchr(kname, '/');
|
||||
const char* kptr = strrchr(kname, JVM_SIGNATURE_SLASH);
|
||||
if (kptr != NULL) kname = kptr + 1;
|
||||
int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
|
||||
str, fname, kname, mname, sname);
|
||||
|
@ -264,11 +264,13 @@ void MethodMatcher::parse_method_pattern(char*& line, const char*& error_msg, Me
|
||||
c_match = check_mode(class_name, error_msg);
|
||||
m_match = check_mode(method_name, error_msg);
|
||||
|
||||
if ((strchr(class_name, '<') != NULL) || (strchr(class_name, '>') != NULL)) {
|
||||
if ((strchr(class_name, JVM_SIGNATURE_SPECIAL) != NULL) ||
|
||||
(strchr(class_name, JVM_SIGNATURE_ENDSPECIAL) != NULL)) {
|
||||
error_msg = "Chars '<' and '>' not allowed in class name";
|
||||
return;
|
||||
}
|
||||
if ((strchr(method_name, '<') != NULL) || (strchr(method_name, '>') != NULL)) {
|
||||
if ((strchr(method_name, JVM_SIGNATURE_SPECIAL) != NULL) ||
|
||||
(strchr(method_name, JVM_SIGNATURE_ENDSPECIAL) != NULL)) {
|
||||
if ((strncmp("<init>", method_name, 255) != 0) && (strncmp("<clinit>", method_name, 255) != 0)) {
|
||||
error_msg = "Chars '<' and '>' only allowed in <init> and <clinit>";
|
||||
return;
|
||||
|
@ -1249,15 +1249,15 @@ JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
|
||||
char sig_type = '\0';
|
||||
|
||||
switch(cp_entry->flag_state()) {
|
||||
case btos: sig_type = 'B'; break;
|
||||
case ztos: sig_type = 'Z'; break;
|
||||
case ctos: sig_type = 'C'; break;
|
||||
case stos: sig_type = 'S'; break;
|
||||
case itos: sig_type = 'I'; break;
|
||||
case ftos: sig_type = 'F'; break;
|
||||
case atos: sig_type = 'L'; break;
|
||||
case ltos: sig_type = 'J'; break;
|
||||
case dtos: sig_type = 'D'; break;
|
||||
case btos: sig_type = JVM_SIGNATURE_BYTE; break;
|
||||
case ztos: sig_type = JVM_SIGNATURE_BOOLEAN; break;
|
||||
case ctos: sig_type = JVM_SIGNATURE_CHAR; break;
|
||||
case stos: sig_type = JVM_SIGNATURE_SHORT; break;
|
||||
case itos: sig_type = JVM_SIGNATURE_INT; break;
|
||||
case ftos: sig_type = JVM_SIGNATURE_FLOAT; break;
|
||||
case atos: sig_type = JVM_SIGNATURE_CLASS; break;
|
||||
case ltos: sig_type = JVM_SIGNATURE_LONG; break;
|
||||
case dtos: sig_type = JVM_SIGNATURE_DOUBLE; break;
|
||||
default: ShouldNotReachHere(); return;
|
||||
}
|
||||
bool is_static = (obj == NULL);
|
||||
|
@ -73,7 +73,7 @@ Klass* CompilerRuntime::resolve_klass_helper(JavaThread *thread, const char* nam
|
||||
Handle protection_domain(THREAD, caller->method_holder()->protection_domain());
|
||||
|
||||
// Ignore wrapping L and ;
|
||||
if (name[0] == 'L') {
|
||||
if (name[0] == JVM_SIGNATURE_CLASS) {
|
||||
assert(len > 2, "small name %s", name);
|
||||
name++;
|
||||
len -= 2;
|
||||
|
@ -535,8 +535,8 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, jcla
|
||||
JVMCI_THROW_MSG_NULL(ClassNotFoundException, str);
|
||||
}
|
||||
} else {
|
||||
if (class_name->char_at(0) == 'L' &&
|
||||
class_name->char_at(class_name->utf8_length()-1) == ';') {
|
||||
if (class_name->char_at(0) == JVM_SIGNATURE_CLASS &&
|
||||
class_name->char_at(class_name->utf8_length()-1) == JVM_SIGNATURE_ENDCLASS) {
|
||||
// This is a name from a signature. Strip off the trimmings.
|
||||
// Call recursive to keep scope of strippedsym.
|
||||
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
|
||||
|
@ -980,8 +980,8 @@ Klass* JVMCIRuntime::get_klass_by_name_impl(Klass*& accessing_klass,
|
||||
JVMCI_EXCEPTION_CONTEXT;
|
||||
|
||||
// Now we need to check the SystemDictionary
|
||||
if (sym->char_at(0) == 'L' &&
|
||||
sym->char_at(sym->utf8_length()-1) == ';') {
|
||||
if (sym->char_at(0) == JVM_SIGNATURE_CLASS &&
|
||||
sym->char_at(sym->utf8_length()-1) == JVM_SIGNATURE_ENDCLASS) {
|
||||
// This is a name from a signature. Strip off the trimmings.
|
||||
// Call recursive to keep scope of strippedsym.
|
||||
TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
|
||||
@ -1013,8 +1013,8 @@ Klass* JVMCIRuntime::get_klass_by_name_impl(Klass*& accessing_klass,
|
||||
// we must build an array type around it. The CI requires array klasses
|
||||
// to be loaded if their element klasses are loaded, except when memory
|
||||
// is exhausted.
|
||||
if (sym->char_at(0) == '[' &&
|
||||
(sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
|
||||
if (sym->char_at(0) == JVM_SIGNATURE_ARRAY &&
|
||||
(sym->char_at(1) == JVM_SIGNATURE_ARRAY || sym->char_at(1) == JVM_SIGNATURE_CLASS)) {
|
||||
// We have an unloaded array.
|
||||
// Build it on the fly if the element class exists.
|
||||
TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2019, 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
|
||||
@ -72,8 +72,8 @@ int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) {
|
||||
ResourceMark rm;
|
||||
const char* name1 = e1->klass()->external_name();
|
||||
const char* name2 = e2->klass()->external_name();
|
||||
bool d1 = (name1[0] == '[');
|
||||
bool d2 = (name2[0] == '[');
|
||||
bool d1 = (name1[0] == JVM_SIGNATURE_ARRAY);
|
||||
bool d2 = (name2[0] == JVM_SIGNATURE_ARRAY);
|
||||
if (d1 && !d2) {
|
||||
return -1;
|
||||
} else if (d2 && !d1) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
@ -1993,14 +1993,14 @@ void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci
|
||||
// This is used to parse the signature for fields, since they are very simple...
|
||||
CellTypeState *GenerateOopMap::sigchar_to_effect(char sigch, int bci, CellTypeState *out) {
|
||||
// Object and array
|
||||
if (sigch=='L' || sigch=='[') {
|
||||
if (sigch==JVM_SIGNATURE_CLASS || sigch==JVM_SIGNATURE_ARRAY) {
|
||||
out[0] = CellTypeState::make_line_ref(bci);
|
||||
out[1] = CellTypeState::bottom;
|
||||
return out;
|
||||
}
|
||||
if (sigch == 'J' || sigch == 'D' ) return vvCTS; // Long and Double
|
||||
if (sigch == 'V' ) return epsilonCTS; // Void
|
||||
return vCTS; // Otherwise
|
||||
if (sigch == JVM_SIGNATURE_LONG || sigch == JVM_SIGNATURE_DOUBLE) return vvCTS; // Long and Double
|
||||
if (sigch == JVM_SIGNATURE_VOID) return epsilonCTS; // Void
|
||||
return vCTS; // Otherwise
|
||||
}
|
||||
|
||||
long GenerateOopMap::_total_byte_count = 0;
|
||||
|
@ -2594,7 +2594,7 @@ const char* InstanceKlass::signature_name() const {
|
||||
|
||||
// Add L as type indicator
|
||||
int dest_index = 0;
|
||||
dest[dest_index++] = 'L';
|
||||
dest[dest_index++] = JVM_SIGNATURE_CLASS;
|
||||
|
||||
// Add the actual class name
|
||||
for (int src_index = 0; src_index < src_length; ) {
|
||||
@ -2607,7 +2607,7 @@ const char* InstanceKlass::signature_name() const {
|
||||
}
|
||||
|
||||
// Add the semicolon and the NULL
|
||||
dest[dest_index++] = ';';
|
||||
dest[dest_index++] = JVM_SIGNATURE_ENDCLASS;
|
||||
dest[dest_index] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
@ -106,14 +106,14 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
|
||||
int len = element_klass->name()->utf8_length();
|
||||
char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
|
||||
int idx = 0;
|
||||
new_str[idx++] = '[';
|
||||
new_str[idx++] = JVM_SIGNATURE_ARRAY;
|
||||
if (element_klass->is_instance_klass()) { // it could be an array or simple type
|
||||
new_str[idx++] = 'L';
|
||||
new_str[idx++] = JVM_SIGNATURE_CLASS;
|
||||
}
|
||||
memcpy(&new_str[idx], name_str, len * sizeof(char));
|
||||
idx += len;
|
||||
if (element_klass->is_instance_klass()) {
|
||||
new_str[idx++] = ';';
|
||||
new_str[idx++] = JVM_SIGNATURE_ENDCLASS;
|
||||
}
|
||||
new_str[idx++] = '\0';
|
||||
name = SymbolTable::new_permanent_symbol(new_str);
|
||||
|
@ -201,8 +201,8 @@ const char* Symbol::as_klass_external_name() const {
|
||||
int length = (int)strlen(str);
|
||||
// Turn all '/'s into '.'s (also for array klasses)
|
||||
for (int index = 0; index < length; index++) {
|
||||
if (str[index] == '/') {
|
||||
str[index] = '.';
|
||||
if (str[index] == JVM_SIGNATURE_SLASH) {
|
||||
str[index] = JVM_SIGNATURE_DOT;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
@ -210,8 +210,8 @@ const char* Symbol::as_klass_external_name() const {
|
||||
|
||||
static void print_class(outputStream *os, char *class_str, int len) {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (class_str[i] == '/') {
|
||||
os->put('.');
|
||||
if (class_str[i] == JVM_SIGNATURE_SLASH) {
|
||||
os->put(JVM_SIGNATURE_DOT);
|
||||
} else {
|
||||
os->put(class_str[i]);
|
||||
}
|
||||
@ -221,9 +221,9 @@ static void print_class(outputStream *os, char *class_str, int len) {
|
||||
static void print_array(outputStream *os, char *array_str, int len) {
|
||||
int dimensions = 0;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (array_str[i] == '[') {
|
||||
if (array_str[i] == JVM_SIGNATURE_ARRAY) {
|
||||
dimensions++;
|
||||
} else if (array_str[i] == 'L') {
|
||||
} else if (array_str[i] == JVM_SIGNATURE_CLASS) {
|
||||
// Expected format: L<type name>;. Skip 'L' and ';' delimiting the type name.
|
||||
print_class(os, array_str+i+1, len-i-2);
|
||||
break;
|
||||
|
@ -2151,7 +2151,7 @@ JNI_ENTRY_NO_PRESERVE(void, jni_SetObjectField(JNIEnv *env, jobject obj, jfieldI
|
||||
if (JvmtiExport::should_post_field_modification()) {
|
||||
jvalue field_value;
|
||||
field_value.l = value;
|
||||
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, 'L', (jvalue *)&field_value);
|
||||
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, JVM_SIGNATURE_CLASS, (jvalue *)&field_value);
|
||||
}
|
||||
HeapAccess<ON_UNKNOWN_OOP_REF>::oop_store_at(o, offset, JNIHandles::resolve(value));
|
||||
HOTSPOT_JNI_SETOBJECTFIELD_RETURN();
|
||||
@ -2177,34 +2177,34 @@ JNI_ENTRY_NO_PRESERVE(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfi
|
||||
field_value.unionType = value; \
|
||||
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
|
||||
} \
|
||||
if (SigType == 'Z') { value = ((jboolean)value) & 1; } \
|
||||
if (SigType == JVM_SIGNATURE_BOOLEAN) { value = ((jboolean)value) & 1; } \
|
||||
o->Fieldname##_field_put(offset, value); \
|
||||
ReturnProbe; \
|
||||
JNI_END
|
||||
|
||||
DEFINE_SETFIELD(jboolean, bool, Boolean, 'Z', z
|
||||
DEFINE_SETFIELD(jboolean, bool, Boolean, JVM_SIGNATURE_BOOLEAN, z
|
||||
, HOTSPOT_JNI_SETBOOLEANFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETBOOLEANFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jbyte, byte, Byte, 'B', b
|
||||
DEFINE_SETFIELD(jbyte, byte, Byte, JVM_SIGNATURE_BYTE, b
|
||||
, HOTSPOT_JNI_SETBYTEFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETBYTEFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jchar, char, Char, 'C', c
|
||||
DEFINE_SETFIELD(jchar, char, Char, JVM_SIGNATURE_CHAR, c
|
||||
, HOTSPOT_JNI_SETCHARFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETCHARFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jshort, short, Short, 'S', s
|
||||
DEFINE_SETFIELD(jshort, short, Short, JVM_SIGNATURE_SHORT, s
|
||||
, HOTSPOT_JNI_SETSHORTFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETSHORTFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jint, int, Int, 'I', i
|
||||
DEFINE_SETFIELD(jint, int, Int, JVM_SIGNATURE_INT, i
|
||||
, HOTSPOT_JNI_SETINTFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETINTFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jlong, long, Long, 'J', j
|
||||
DEFINE_SETFIELD(jlong, long, Long, JVM_SIGNATURE_LONG, j
|
||||
, HOTSPOT_JNI_SETLONGFIELD_ENTRY(env, obj, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETLONGFIELD_RETURN())
|
||||
// Float and double probes don't return value because dtrace doesn't currently support it
|
||||
DEFINE_SETFIELD(jfloat, float, Float, 'F', f
|
||||
DEFINE_SETFIELD(jfloat, float, Float, JVM_SIGNATURE_FLOAT, f
|
||||
, HOTSPOT_JNI_SETFLOATFIELD_ENTRY(env, obj, (uintptr_t)fieldID),
|
||||
HOTSPOT_JNI_SETFLOATFIELD_RETURN())
|
||||
DEFINE_SETFIELD(jdouble, double, Double, 'D', d
|
||||
DEFINE_SETFIELD(jdouble, double, Double, JVM_SIGNATURE_DOUBLE, d
|
||||
, HOTSPOT_JNI_SETDOUBLEFIELD_ENTRY(env, obj, (uintptr_t)fieldID),
|
||||
HOTSPOT_JNI_SETDOUBLEFIELD_RETURN())
|
||||
|
||||
@ -2352,7 +2352,7 @@ JNI_ENTRY(void, jni_SetStaticObjectField(JNIEnv *env, jclass clazz, jfieldID fie
|
||||
if (JvmtiExport::should_post_field_modification()) {
|
||||
jvalue field_value;
|
||||
field_value.l = value;
|
||||
JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, 'L', (jvalue *)&field_value);
|
||||
JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, JVM_SIGNATURE_CLASS, (jvalue *)&field_value);
|
||||
}
|
||||
id->holder()->java_mirror()->obj_field_put(id->offset(), JNIHandles::resolve(value));
|
||||
HOTSPOT_JNI_SETSTATICOBJECTFIELD_RETURN();
|
||||
@ -2376,34 +2376,34 @@ JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID
|
||||
field_value.unionType = value; \
|
||||
JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, SigType, (jvalue *)&field_value); \
|
||||
} \
|
||||
if (SigType == 'Z') { value = ((jboolean)value) & 1; } \
|
||||
if (SigType == JVM_SIGNATURE_BOOLEAN) { value = ((jboolean)value) & 1; } \
|
||||
id->holder()->java_mirror()-> Fieldname##_field_put (id->offset(), value); \
|
||||
ReturnProbe;\
|
||||
JNI_END
|
||||
|
||||
DEFINE_SETSTATICFIELD(jboolean, bool, Boolean, 'Z', z
|
||||
DEFINE_SETSTATICFIELD(jboolean, bool, Boolean, JVM_SIGNATURE_BOOLEAN, z
|
||||
, HOTSPOT_JNI_SETSTATICBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICBOOLEANFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jbyte, byte, Byte, 'B', b
|
||||
DEFINE_SETSTATICFIELD(jbyte, byte, Byte, JVM_SIGNATURE_BYTE, b
|
||||
, HOTSPOT_JNI_SETSTATICBYTEFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICBYTEFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jchar, char, Char, 'C', c
|
||||
DEFINE_SETSTATICFIELD(jchar, char, Char, JVM_SIGNATURE_CHAR, c
|
||||
, HOTSPOT_JNI_SETSTATICCHARFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICCHARFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jshort, short, Short, 'S', s
|
||||
DEFINE_SETSTATICFIELD(jshort, short, Short, JVM_SIGNATURE_SHORT, s
|
||||
, HOTSPOT_JNI_SETSTATICSHORTFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICSHORTFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jint, int, Int, 'I', i
|
||||
DEFINE_SETSTATICFIELD(jint, int, Int, JVM_SIGNATURE_INT, i
|
||||
, HOTSPOT_JNI_SETSTATICINTFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICINTFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jlong, long, Long, 'J', j
|
||||
DEFINE_SETSTATICFIELD(jlong, long, Long, JVM_SIGNATURE_LONG, j
|
||||
, HOTSPOT_JNI_SETSTATICLONGFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
|
||||
HOTSPOT_JNI_SETSTATICLONGFIELD_RETURN())
|
||||
// Float and double probes don't return value because dtrace doesn't currently support it
|
||||
DEFINE_SETSTATICFIELD(jfloat, float, Float, 'F', f
|
||||
DEFINE_SETSTATICFIELD(jfloat, float, Float, JVM_SIGNATURE_FLOAT, f
|
||||
, HOTSPOT_JNI_SETSTATICFLOATFIELD_ENTRY(env, clazz, (uintptr_t) fieldID),
|
||||
HOTSPOT_JNI_SETSTATICFLOATFIELD_RETURN())
|
||||
DEFINE_SETSTATICFIELD(jdouble, double, Double, 'D', d
|
||||
DEFINE_SETSTATICFIELD(jdouble, double, Double, JVM_SIGNATURE_DOUBLE, d
|
||||
, HOTSPOT_JNI_SETSTATICDOUBLEFIELD_ENTRY(env, clazz, (uintptr_t) fieldID),
|
||||
HOTSPOT_JNI_SETSTATICDOUBLEFIELD_RETURN())
|
||||
|
||||
|
@ -1361,7 +1361,7 @@ JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_threa
|
||||
NULL_CHECK(ob_k, JVMTI_ERROR_INVALID_OBJECT);
|
||||
|
||||
// Method return type signature.
|
||||
char* ty_sign = 1 + strchr(signature->as_C_string(), ')');
|
||||
char* ty_sign = 1 + strchr(signature->as_C_string(), JVM_SIGNATURE_ENDFUNC);
|
||||
|
||||
if (!VM_GetOrSetLocal::is_assignable(ty_sign, ob_k, current_thread)) {
|
||||
return JVMTI_ERROR_TYPE_MISMATCH;
|
||||
|
@ -1994,7 +1994,9 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
|
||||
address location, Klass* field_klass, Handle object, jfieldID field,
|
||||
char sig_type, jvalue *value) {
|
||||
|
||||
if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'B' || sig_type == 'C' || sig_type == 'S') {
|
||||
if (sig_type == JVM_SIGNATURE_INT || sig_type == JVM_SIGNATURE_BOOLEAN ||
|
||||
sig_type == JVM_SIGNATURE_BYTE || sig_type == JVM_SIGNATURE_CHAR ||
|
||||
sig_type == JVM_SIGNATURE_SHORT) {
|
||||
// 'I' instructions are used for byte, char, short and int.
|
||||
// determine which it really is, and convert
|
||||
fieldDescriptor fd;
|
||||
@ -2005,22 +2007,22 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
|
||||
// convert value from int to appropriate type
|
||||
switch (fd.field_type()) {
|
||||
case T_BOOLEAN:
|
||||
sig_type = 'Z';
|
||||
sig_type = JVM_SIGNATURE_BOOLEAN;
|
||||
value->i = 0; // clear it
|
||||
value->z = (jboolean)ival;
|
||||
break;
|
||||
case T_BYTE:
|
||||
sig_type = 'B';
|
||||
sig_type = JVM_SIGNATURE_BYTE;
|
||||
value->i = 0; // clear it
|
||||
value->b = (jbyte)ival;
|
||||
break;
|
||||
case T_CHAR:
|
||||
sig_type = 'C';
|
||||
sig_type = JVM_SIGNATURE_CHAR;
|
||||
value->i = 0; // clear it
|
||||
value->c = (jchar)ival;
|
||||
break;
|
||||
case T_SHORT:
|
||||
sig_type = 'S';
|
||||
sig_type = JVM_SIGNATURE_SHORT;
|
||||
value->i = 0; // clear it
|
||||
value->s = (jshort)ival;
|
||||
break;
|
||||
@ -2035,11 +2037,11 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
|
||||
}
|
||||
}
|
||||
|
||||
assert(sig_type != '[', "array should have sig_type == 'L'");
|
||||
assert(sig_type != JVM_SIGNATURE_ARRAY, "array should have sig_type == 'L'");
|
||||
bool handle_created = false;
|
||||
|
||||
// convert oop to JNI handle.
|
||||
if (sig_type == 'L') {
|
||||
if (sig_type == JVM_SIGNATURE_CLASS) {
|
||||
handle_created = true;
|
||||
value->l = (jobject)JNIHandles::make_local(thread, (oop)value->l);
|
||||
}
|
||||
|
@ -588,7 +588,8 @@ bool VM_GetOrSetLocal::is_assignable(const char* ty_sign, Klass* klass, Thread*
|
||||
assert(klass != NULL, "klass must not be NULL");
|
||||
|
||||
int len = (int) strlen(ty_sign);
|
||||
if (ty_sign[0] == 'L' && ty_sign[len-1] == ';') { // Need pure class/interface name
|
||||
if (ty_sign[0] == JVM_SIGNATURE_CLASS &&
|
||||
ty_sign[len-1] == JVM_SIGNATURE_ENDCLASS) { // Need pure class/interface name
|
||||
ty_sign++;
|
||||
len -= 2;
|
||||
}
|
||||
|
@ -2166,14 +2166,14 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value(
|
||||
|
||||
switch (tag) {
|
||||
// These BaseType tag values are from Table 4.2 in VM spec:
|
||||
case 'B': // byte
|
||||
case 'C': // char
|
||||
case 'D': // double
|
||||
case 'F': // float
|
||||
case 'I': // int
|
||||
case 'J': // long
|
||||
case 'S': // short
|
||||
case 'Z': // boolean
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_BOOLEAN:
|
||||
|
||||
// The remaining tag values are from Table 4.8 in the 2nd-edition of
|
||||
// the VM spec:
|
||||
@ -2244,7 +2244,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value(
|
||||
}
|
||||
break;
|
||||
|
||||
case '[':
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
{
|
||||
if ((byte_i_ref + 2) > annotations_typeArray->length()) {
|
||||
// not enough room for a num_values field
|
||||
|
@ -1032,7 +1032,7 @@ static inline bool is_filtered_by_klass_filter(oop obj, Klass* klass_filter) {
|
||||
|
||||
// helper function to tell if a field is a primitive field or not
|
||||
static inline bool is_primitive_field_type(char type) {
|
||||
return (type != 'L' && type != '[');
|
||||
return (type != JVM_SIGNATURE_CLASS && type != JVM_SIGNATURE_ARRAY);
|
||||
}
|
||||
|
||||
// helper function to copy the value from location addr to jvalue.
|
||||
|
@ -542,18 +542,22 @@ bool MethodHandles::is_basic_type_signature(Symbol* sig) {
|
||||
const int len = sig->utf8_length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
switch (sig->char_at(i)) {
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
// only java/lang/Object is valid here
|
||||
if (sig->index_of_at(i, OBJ_SIG, OBJ_SIG_LEN) != i)
|
||||
return false;
|
||||
i += OBJ_SIG_LEN-1; //-1 because of i++ in loop
|
||||
continue;
|
||||
case '(': case ')': case 'V':
|
||||
case 'I': case 'J': case 'F': case 'D':
|
||||
case JVM_SIGNATURE_FUNC:
|
||||
case JVM_SIGNATURE_ENDFUNC:
|
||||
case JVM_SIGNATURE_VOID:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
continue;
|
||||
//case '[':
|
||||
//case 'Z': case 'B': case 'C': case 'S':
|
||||
default:
|
||||
// subword types (T_BYTE etc.), arrays
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -567,7 +571,7 @@ Symbol* MethodHandles::lookup_basic_type_signature(Symbol* sig, bool keep_last_a
|
||||
} else if (is_basic_type_signature(sig)) {
|
||||
sig->increment_refcount();
|
||||
return sig; // that was easy
|
||||
} else if (sig->char_at(0) != '(') {
|
||||
} else if (sig->char_at(0) != JVM_SIGNATURE_FUNC) {
|
||||
BasicType bt = char2type(sig->char_at(0));
|
||||
if (is_subword_type(bt)) {
|
||||
bsig = vmSymbols::int_signature();
|
||||
@ -578,7 +582,7 @@ Symbol* MethodHandles::lookup_basic_type_signature(Symbol* sig, bool keep_last_a
|
||||
} else {
|
||||
ResourceMark rm;
|
||||
stringStream buffer(128);
|
||||
buffer.put('(');
|
||||
buffer.put(JVM_SIGNATURE_FUNC);
|
||||
int arg_pos = 0, keep_arg_pos = -1;
|
||||
if (keep_last_arg)
|
||||
keep_arg_pos = ArgumentCount(sig).size() - 1;
|
||||
@ -586,7 +590,7 @@ Symbol* MethodHandles::lookup_basic_type_signature(Symbol* sig, bool keep_last_a
|
||||
BasicType bt = ss.type();
|
||||
size_t this_arg_pos = buffer.size();
|
||||
if (ss.at_return_type()) {
|
||||
buffer.put(')');
|
||||
buffer.put(JVM_SIGNATURE_ENDFUNC);
|
||||
}
|
||||
if (arg_pos == keep_arg_pos) {
|
||||
buffer.write((char*) ss.raw_bytes(),
|
||||
@ -621,25 +625,26 @@ void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
|
||||
for (int i = 0; i < len; i++) {
|
||||
char ch = sig->char_at(i);
|
||||
switch (ch) {
|
||||
case '(': case ')':
|
||||
case JVM_SIGNATURE_FUNC:
|
||||
case JVM_SIGNATURE_ENDFUNC:
|
||||
prev_type = false;
|
||||
st->put(ch);
|
||||
continue;
|
||||
case '[':
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
if (!keep_basic_names && keep_arrays)
|
||||
st->put(ch);
|
||||
array++;
|
||||
continue;
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
{
|
||||
if (prev_type) st->put(',');
|
||||
int start = i+1, slash = start;
|
||||
while (++i < len && (ch = sig->char_at(i)) != ';') {
|
||||
if (ch == '/' || ch == '.' || ch == '$') slash = i+1;
|
||||
while (++i < len && (ch = sig->char_at(i)) != JVM_SIGNATURE_ENDCLASS) {
|
||||
if (ch == JVM_SIGNATURE_SLASH || ch == JVM_SIGNATURE_DOT || ch == '$') slash = i+1;
|
||||
}
|
||||
if (slash < i) start = slash;
|
||||
if (!keep_basic_names) {
|
||||
st->put('L');
|
||||
st->put(JVM_SIGNATURE_CLASS);
|
||||
} else {
|
||||
for (int j = start; j < i; j++)
|
||||
st->put(sig->char_at(j));
|
||||
@ -650,7 +655,7 @@ void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
|
||||
default:
|
||||
{
|
||||
if (array && char2type(ch) != T_ILLEGAL && !keep_arrays) {
|
||||
ch = '[';
|
||||
ch = JVM_SIGNATURE_ARRAY;
|
||||
array = 0;
|
||||
}
|
||||
if (prev_type) st->put(',');
|
||||
@ -978,7 +983,7 @@ int MethodHandles::find_MemberNames(Klass* k,
|
||||
}
|
||||
if (sig != NULL) {
|
||||
if (sig->utf8_length() == 0) return 0; // a match is not possible
|
||||
if (sig->char_at(0) == '(')
|
||||
if (sig->char_at(0) == JVM_SIGNATURE_FUNC)
|
||||
match_flags &= ~(IS_FIELD | IS_TYPE);
|
||||
else
|
||||
match_flags &= ~(IS_CONSTRUCTOR | IS_METHOD);
|
||||
@ -1456,7 +1461,7 @@ JVM_ENTRY(void, MHN_copyOutBootstrapArguments(JNIEnv* env, jobject igcls,
|
||||
{
|
||||
Symbol* type = caller->constants()->signature_ref_at(bss_index_in_pool);
|
||||
Handle th;
|
||||
if (type->char_at(0) == '(') {
|
||||
if (type->char_at(0) == JVM_SIGNATURE_FUNC) {
|
||||
th = SystemDictionary::find_method_handle_type(type, caller, CHECK);
|
||||
} else {
|
||||
th = SystemDictionary::find_java_mirror_for_type(type, caller, SignatureStream::NCDFError, CHECK);
|
||||
|
@ -106,7 +106,7 @@ char* NativeLookup::long_jni_name(const methodHandle& method) {
|
||||
st.print("__");
|
||||
// find ')'
|
||||
int end;
|
||||
for (end = 0; end < signature->utf8_length() && signature->char_at(end) != ')'; end++);
|
||||
for (end = 0; end < signature->utf8_length() && signature->char_at(end) != JVM_SIGNATURE_ENDFUNC; end++);
|
||||
// skip first '('
|
||||
mangle_name_on(&st, signature, 1, end);
|
||||
return st.as_string();
|
||||
|
@ -39,28 +39,28 @@ BasicType FieldType::basic_type(Symbol* signature) {
|
||||
// Check if it is a valid array signature
|
||||
bool FieldType::is_valid_array_signature(Symbol* sig) {
|
||||
assert(sig->utf8_length() > 1, "this should already have been checked");
|
||||
assert(sig->char_at(0) == '[', "this should already have been checked");
|
||||
assert(sig->char_at(0) == JVM_SIGNATURE_ARRAY, "this should already have been checked");
|
||||
// The first character is already checked
|
||||
int i = 1;
|
||||
int len = sig->utf8_length();
|
||||
// First skip all '['s
|
||||
while(i < len - 1 && sig->char_at(i) == '[') i++;
|
||||
while(i < len - 1 && sig->char_at(i) == JVM_SIGNATURE_ARRAY) i++;
|
||||
|
||||
// Check type
|
||||
switch(sig->char_at(i)) {
|
||||
case 'B': // T_BYTE
|
||||
case 'C': // T_CHAR
|
||||
case 'D': // T_DOUBLE
|
||||
case 'F': // T_FLOAT
|
||||
case 'I': // T_INT
|
||||
case 'J': // T_LONG
|
||||
case 'S': // T_SHORT
|
||||
case 'Z': // T_BOOLEAN
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_BOOLEAN:
|
||||
// If it is an array, the type is the last character
|
||||
return (i + 1 == len);
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
// If it is an object, the last character must be a ';'
|
||||
return sig->char_at(len - 1) == ';';
|
||||
return sig->char_at(len - 1) == JVM_SIGNATURE_ENDCLASS;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -71,7 +71,7 @@ BasicType FieldType::get_array_info(Symbol* signature, FieldArrayInfo& fd, TRAPS
|
||||
assert(basic_type(signature) == T_ARRAY, "must be array");
|
||||
int index = 1;
|
||||
int dim = 1;
|
||||
while (signature->char_at(index) == '[') {
|
||||
while (signature->char_at(index) == JVM_SIGNATURE_ARRAY) {
|
||||
index++;
|
||||
dim++;
|
||||
}
|
||||
@ -80,7 +80,7 @@ BasicType FieldType::get_array_info(Symbol* signature, FieldArrayInfo& fd, TRAPS
|
||||
BasicType element_type = char2type(element[0]);
|
||||
if (element_type == T_OBJECT) {
|
||||
int len = (int)strlen(element);
|
||||
assert(element[len-1] == ';', "last char should be a semicolon");
|
||||
assert(element[len-1] == JVM_SIGNATURE_ENDCLASS, "last char should be a semicolon");
|
||||
element[len-1] = '\0'; // chop off semicolon
|
||||
fd._object_key = SymbolTable::new_symbol(element + 1);
|
||||
}
|
||||
|
@ -58,14 +58,16 @@ class FieldType: public AllStatic {
|
||||
static BasicType basic_type(Symbol* signature);
|
||||
|
||||
// Testing
|
||||
static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->char_at(0) == '[' && is_valid_array_signature(signature); }
|
||||
static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 &&
|
||||
signature->char_at(0) == JVM_SIGNATURE_ARRAY &&
|
||||
is_valid_array_signature(signature); }
|
||||
|
||||
static bool is_obj(Symbol* signature) {
|
||||
int sig_length = signature->utf8_length();
|
||||
// Must start with 'L' and end with ';'
|
||||
return (sig_length >= 2 &&
|
||||
(signature->char_at(0) == 'L') &&
|
||||
(signature->char_at(sig_length - 1) == ';'));
|
||||
(signature->char_at(0) == JVM_SIGNATURE_CLASS) &&
|
||||
(signature->char_at(sig_length - 1) == JVM_SIGNATURE_ENDCLASS));
|
||||
}
|
||||
|
||||
// Parse field and extract array information. Works for T_ARRAY only.
|
||||
|
@ -2990,28 +2990,28 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
|
||||
sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
|
||||
}
|
||||
|
||||
while (*s != ')') { // Find closing right paren
|
||||
switch (*s++) { // Switch on signature character
|
||||
case 'B': sig_bt[cnt++] = T_BYTE; break;
|
||||
case 'C': sig_bt[cnt++] = T_CHAR; break;
|
||||
case 'D': sig_bt[cnt++] = T_DOUBLE; sig_bt[cnt++] = T_VOID; break;
|
||||
case 'F': sig_bt[cnt++] = T_FLOAT; break;
|
||||
case 'I': sig_bt[cnt++] = T_INT; break;
|
||||
case 'J': sig_bt[cnt++] = T_LONG; sig_bt[cnt++] = T_VOID; break;
|
||||
case 'S': sig_bt[cnt++] = T_SHORT; break;
|
||||
case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
|
||||
case 'V': sig_bt[cnt++] = T_VOID; break;
|
||||
case 'L': // Oop
|
||||
while (*s++ != ';'); // Skip signature
|
||||
while (*s != JVM_SIGNATURE_ENDFUNC) { // Find closing right paren
|
||||
switch (*s++) { // Switch on signature character
|
||||
case JVM_SIGNATURE_BYTE: sig_bt[cnt++] = T_BYTE; break;
|
||||
case JVM_SIGNATURE_CHAR: sig_bt[cnt++] = T_CHAR; break;
|
||||
case JVM_SIGNATURE_DOUBLE: sig_bt[cnt++] = T_DOUBLE; sig_bt[cnt++] = T_VOID; break;
|
||||
case JVM_SIGNATURE_FLOAT: sig_bt[cnt++] = T_FLOAT; break;
|
||||
case JVM_SIGNATURE_INT: sig_bt[cnt++] = T_INT; break;
|
||||
case JVM_SIGNATURE_LONG: sig_bt[cnt++] = T_LONG; sig_bt[cnt++] = T_VOID; break;
|
||||
case JVM_SIGNATURE_SHORT: sig_bt[cnt++] = T_SHORT; break;
|
||||
case JVM_SIGNATURE_BOOLEAN: sig_bt[cnt++] = T_BOOLEAN; break;
|
||||
case JVM_SIGNATURE_VOID: sig_bt[cnt++] = T_VOID; break;
|
||||
case JVM_SIGNATURE_CLASS: // Oop
|
||||
while (*s++ != JVM_SIGNATURE_ENDCLASS); // Skip signature
|
||||
sig_bt[cnt++] = T_OBJECT;
|
||||
break;
|
||||
case '[': { // Array
|
||||
case JVM_SIGNATURE_ARRAY: { // Array
|
||||
do { // Skip optional size
|
||||
while (*s >= '0' && *s <= '9') s++;
|
||||
} while (*s++ == '['); // Nested arrays?
|
||||
} while (*s++ == JVM_SIGNATURE_ARRAY); // Nested arrays?
|
||||
// Skip element type
|
||||
if (s[-1] == 'L')
|
||||
while (*s++ != ';'); // Skip signature
|
||||
if (s[-1] == JVM_SIGNATURE_CLASS)
|
||||
while (*s++ != JVM_SIGNATURE_ENDCLASS); // Skip signature
|
||||
sig_bt[cnt++] = T_ARRAY;
|
||||
break;
|
||||
}
|
||||
|
@ -63,41 +63,41 @@ int SignatureIterator::parse_type() {
|
||||
// compiler bug (was problem - gri 4/27/2000).
|
||||
int size = -1;
|
||||
switch(_signature->char_at(_index)) {
|
||||
case 'B': do_byte (); if (_parameter_index < 0 ) _return_type = T_BYTE;
|
||||
_index++; size = T_BYTE_size ; break;
|
||||
case 'C': do_char (); if (_parameter_index < 0 ) _return_type = T_CHAR;
|
||||
_index++; size = T_CHAR_size ; break;
|
||||
case 'D': do_double(); if (_parameter_index < 0 ) _return_type = T_DOUBLE;
|
||||
_index++; size = T_DOUBLE_size ; break;
|
||||
case 'F': do_float (); if (_parameter_index < 0 ) _return_type = T_FLOAT;
|
||||
_index++; size = T_FLOAT_size ; break;
|
||||
case 'I': do_int (); if (_parameter_index < 0 ) _return_type = T_INT;
|
||||
_index++; size = T_INT_size ; break;
|
||||
case 'J': do_long (); if (_parameter_index < 0 ) _return_type = T_LONG;
|
||||
_index++; size = T_LONG_size ; break;
|
||||
case 'S': do_short (); if (_parameter_index < 0 ) _return_type = T_SHORT;
|
||||
_index++; size = T_SHORT_size ; break;
|
||||
case 'Z': do_bool (); if (_parameter_index < 0 ) _return_type = T_BOOLEAN;
|
||||
_index++; size = T_BOOLEAN_size; break;
|
||||
case 'V': do_void (); if (_parameter_index < 0 ) _return_type = T_VOID;
|
||||
_index++; size = T_VOID_size; ; break;
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_BYTE: do_byte(); if (_parameter_index < 0 ) _return_type = T_BYTE;
|
||||
_index++; size = T_BYTE_size; break;
|
||||
case JVM_SIGNATURE_CHAR: do_char(); if (_parameter_index < 0 ) _return_type = T_CHAR;
|
||||
_index++; size = T_CHAR_size; break;
|
||||
case JVM_SIGNATURE_DOUBLE: do_double(); if (_parameter_index < 0 ) _return_type = T_DOUBLE;
|
||||
_index++; size = T_DOUBLE_size; break;
|
||||
case JVM_SIGNATURE_FLOAT: do_float(); if (_parameter_index < 0 ) _return_type = T_FLOAT;
|
||||
_index++; size = T_FLOAT_size; break;
|
||||
case JVM_SIGNATURE_INT: do_int(); if (_parameter_index < 0 ) _return_type = T_INT;
|
||||
_index++; size = T_INT_size; break;
|
||||
case JVM_SIGNATURE_LONG: do_long(); if (_parameter_index < 0 ) _return_type = T_LONG;
|
||||
_index++; size = T_LONG_size; break;
|
||||
case JVM_SIGNATURE_SHORT: do_short(); if (_parameter_index < 0 ) _return_type = T_SHORT;
|
||||
_index++; size = T_SHORT_size; break;
|
||||
case JVM_SIGNATURE_BOOLEAN: do_bool(); if (_parameter_index < 0 ) _return_type = T_BOOLEAN;
|
||||
_index++; size = T_BOOLEAN_size; break;
|
||||
case JVM_SIGNATURE_VOID: do_void(); if (_parameter_index < 0 ) _return_type = T_VOID;
|
||||
_index++; size = T_VOID_size; break;
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
{ int begin = ++_index;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
while (sig->char_at(_index++) != JVM_SIGNATURE_ENDCLASS) ;
|
||||
do_object(begin, _index);
|
||||
}
|
||||
if (_parameter_index < 0 ) _return_type = T_OBJECT;
|
||||
size = T_OBJECT_size;
|
||||
break;
|
||||
case '[':
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
{ int begin = ++_index;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->char_at(_index) == '[') {
|
||||
while (sig->char_at(_index) == JVM_SIGNATURE_ARRAY) {
|
||||
_index++;
|
||||
}
|
||||
if (sig->char_at(_index) == 'L') {
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
if (sig->char_at(_index) == JVM_SIGNATURE_CLASS) {
|
||||
while (sig->char_at(_index++) != JVM_SIGNATURE_ENDCLASS) ;
|
||||
} else {
|
||||
_index++;
|
||||
}
|
||||
@ -128,9 +128,9 @@ void SignatureIterator::iterate_parameters() {
|
||||
// Parse parameters
|
||||
_index = 0;
|
||||
_parameter_index = 0;
|
||||
expect('(');
|
||||
while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
|
||||
expect(')');
|
||||
expect(JVM_SIGNATURE_FUNC);
|
||||
while (_signature->char_at(_index) != JVM_SIGNATURE_ENDFUNC) _parameter_index += parse_type();
|
||||
expect(JVM_SIGNATURE_ENDFUNC);
|
||||
_parameter_index = 0;
|
||||
}
|
||||
|
||||
@ -202,36 +202,36 @@ void SignatureIterator::iterate_parameters( uint64_t fingerprint ) {
|
||||
void SignatureIterator::iterate_returntype() {
|
||||
// Ignore parameters
|
||||
_index = 0;
|
||||
expect('(');
|
||||
expect(JVM_SIGNATURE_FUNC);
|
||||
Symbol* sig = _signature;
|
||||
// Need to skip over each type in the signature's argument list until a
|
||||
// closing ')' is found., then get the return type. We cannot just scan
|
||||
// for the first ')' because ')' is a legal character in a type name.
|
||||
while (sig->char_at(_index) != ')') {
|
||||
while (sig->char_at(_index) != JVM_SIGNATURE_ENDFUNC) {
|
||||
switch(sig->char_at(_index)) {
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'S':
|
||||
case 'Z':
|
||||
case 'V':
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_BOOLEAN:
|
||||
case JVM_SIGNATURE_VOID:
|
||||
{
|
||||
_index++;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
{
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
while (sig->char_at(_index++) != JVM_SIGNATURE_ENDCLASS) ;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
{
|
||||
while (sig->char_at(++_index) == '[') ;
|
||||
if (sig->char_at(_index) == 'L') {
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
while (sig->char_at(++_index) == JVM_SIGNATURE_ARRAY) ;
|
||||
if (sig->char_at(_index) == JVM_SIGNATURE_CLASS) {
|
||||
while (sig->char_at(_index++) != JVM_SIGNATURE_ENDCLASS) ;
|
||||
} else {
|
||||
_index++;
|
||||
}
|
||||
@ -242,7 +242,7 @@ void SignatureIterator::iterate_returntype() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
expect(')');
|
||||
expect(JVM_SIGNATURE_ENDFUNC);
|
||||
// Parse return type
|
||||
_parameter_index = -1;
|
||||
parse_type();
|
||||
@ -255,9 +255,9 @@ void SignatureIterator::iterate() {
|
||||
// Parse parameters
|
||||
_parameter_index = 0;
|
||||
_index = 0;
|
||||
expect('(');
|
||||
while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
|
||||
expect(')');
|
||||
expect(JVM_SIGNATURE_FUNC);
|
||||
while (_signature->char_at(_index) != JVM_SIGNATURE_ENDFUNC) _parameter_index += parse_type();
|
||||
expect(JVM_SIGNATURE_ENDFUNC);
|
||||
// Parse return type
|
||||
_parameter_index = -1;
|
||||
parse_type();
|
||||
@ -289,39 +289,39 @@ bool SignatureStream::is_done() const {
|
||||
|
||||
void SignatureStream::next_non_primitive(int t) {
|
||||
switch (t) {
|
||||
case 'L': {
|
||||
case JVM_SIGNATURE_CLASS: {
|
||||
_type = T_OBJECT;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->char_at(_end++) != ';');
|
||||
while (sig->char_at(_end++) != JVM_SIGNATURE_ENDCLASS);
|
||||
break;
|
||||
}
|
||||
case '[': {
|
||||
case JVM_SIGNATURE_ARRAY: {
|
||||
_type = T_ARRAY;
|
||||
Symbol* sig = _signature;
|
||||
char c = sig->char_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->char_at(_end++);
|
||||
while (sig->char_at(_end) == '[') {
|
||||
while (sig->char_at(_end) == JVM_SIGNATURE_ARRAY) {
|
||||
_end++;
|
||||
c = sig->char_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->char_at(_end++);
|
||||
}
|
||||
switch(sig->char_at(_end)) {
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'S':
|
||||
case 'Z':_end++; break;
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_BOOLEAN:_end++; break;
|
||||
default: {
|
||||
while (sig->char_at(_end++) != ';');
|
||||
while (sig->char_at(_end++) != JVM_SIGNATURE_ENDCLASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ')': _end++; next(); _at_return_type = true; break;
|
||||
case JVM_SIGNATURE_ENDFUNC: _end++; next(); _at_return_type = true; break;
|
||||
default : ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
@ -341,8 +341,8 @@ Symbol* SignatureStream::as_symbol() {
|
||||
int begin = _begin;
|
||||
int end = _end;
|
||||
|
||||
if ( _signature->char_at(_begin) == 'L'
|
||||
&& _signature->char_at(_end-1) == ';') {
|
||||
if ( _signature->char_at(_begin) == JVM_SIGNATURE_CLASS
|
||||
&& _signature->char_at(_end-1) == JVM_SIGNATURE_ENDCLASS) {
|
||||
begin++;
|
||||
end--;
|
||||
}
|
||||
@ -407,8 +407,8 @@ Symbol* SignatureStream::as_symbol_or_null() {
|
||||
int begin = _begin;
|
||||
int end = _end;
|
||||
|
||||
if ( _signature->char_at(_begin) == 'L'
|
||||
&& _signature->char_at(_end-1) == ';') {
|
||||
if ( _signature->char_at(_begin) == JVM_SIGNATURE_CLASS
|
||||
&& _signature->char_at(_end-1) == JVM_SIGNATURE_ENDCLASS) {
|
||||
begin++;
|
||||
end--;
|
||||
}
|
||||
@ -436,9 +436,9 @@ bool SignatureVerifier::is_valid_method_signature(Symbol* sig) {
|
||||
const char* method_sig = (const char*)sig->bytes();
|
||||
ssize_t len = sig->utf8_length();
|
||||
ssize_t index = 0;
|
||||
if (method_sig != NULL && len > 1 && method_sig[index] == '(') {
|
||||
if (method_sig != NULL && len > 1 && method_sig[index] == JVM_SIGNATURE_FUNC) {
|
||||
++index;
|
||||
while (index < len && method_sig[index] != ')') {
|
||||
while (index < len && method_sig[index] != JVM_SIGNATURE_ENDFUNC) {
|
||||
ssize_t res = is_valid_type(&method_sig[index], len - index);
|
||||
if (res == -1) {
|
||||
return false;
|
||||
@ -446,7 +446,7 @@ bool SignatureVerifier::is_valid_method_signature(Symbol* sig) {
|
||||
index += res;
|
||||
}
|
||||
}
|
||||
if (index < len && method_sig[index] == ')') {
|
||||
if (index < len && method_sig[index] == JVM_SIGNATURE_ENDFUNC) {
|
||||
// check the return type
|
||||
++index;
|
||||
return (is_valid_type(&method_sig[index], len - index) == (len - index));
|
||||
@ -469,21 +469,28 @@ ssize_t SignatureVerifier::is_valid_type(const char* type, ssize_t limit) {
|
||||
ssize_t index = 0;
|
||||
|
||||
// Iterate over any number of array dimensions
|
||||
while (index < limit && type[index] == '[') ++index;
|
||||
while (index < limit && type[index] == JVM_SIGNATURE_ARRAY) ++index;
|
||||
if (index >= limit) {
|
||||
return -1;
|
||||
}
|
||||
switch (type[index]) {
|
||||
case 'B': case 'C': case 'D': case 'F': case 'I':
|
||||
case 'J': case 'S': case 'Z': case 'V':
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_BOOLEAN:
|
||||
case JVM_SIGNATURE_VOID:
|
||||
return index + 1;
|
||||
case 'L':
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
for (index = index + 1; index < limit; ++index) {
|
||||
char c = type[index];
|
||||
switch (c) {
|
||||
case ';':
|
||||
case JVM_SIGNATURE_ENDCLASS:
|
||||
return index + 1;
|
||||
case '\0': case '.': case '[':
|
||||
case '\0': case JVM_SIGNATURE_DOT: case JVM_SIGNATURE_ARRAY:
|
||||
return -1;
|
||||
default: ; // fall through
|
||||
}
|
||||
|
@ -379,15 +379,15 @@ class SignatureStream : public StackObj {
|
||||
_begin = _end;
|
||||
int t = sig->char_at(_begin);
|
||||
switch (t) {
|
||||
case 'B': _type = T_BYTE; break;
|
||||
case 'C': _type = T_CHAR; break;
|
||||
case 'D': _type = T_DOUBLE; break;
|
||||
case 'F': _type = T_FLOAT; break;
|
||||
case 'I': _type = T_INT; break;
|
||||
case 'J': _type = T_LONG; break;
|
||||
case 'S': _type = T_SHORT; break;
|
||||
case 'Z': _type = T_BOOLEAN; break;
|
||||
case 'V': _type = T_VOID; break;
|
||||
case JVM_SIGNATURE_BYTE: _type = T_BYTE; break;
|
||||
case JVM_SIGNATURE_CHAR: _type = T_CHAR; break;
|
||||
case JVM_SIGNATURE_DOUBLE: _type = T_DOUBLE; break;
|
||||
case JVM_SIGNATURE_FLOAT: _type = T_FLOAT; break;
|
||||
case JVM_SIGNATURE_INT: _type = T_INT; break;
|
||||
case JVM_SIGNATURE_LONG: _type = T_LONG; break;
|
||||
case JVM_SIGNATURE_SHORT: _type = T_SHORT; break;
|
||||
case JVM_SIGNATURE_BOOLEAN: _type = T_BOOLEAN; break;
|
||||
case JVM_SIGNATURE_VOID: _type = T_VOID; break;
|
||||
default : next_non_primitive(t);
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
@ -178,7 +178,16 @@ void basic_types_init() {
|
||||
|
||||
|
||||
// Map BasicType to signature character
|
||||
char type2char_tab[T_CONFLICT+1]={ 0, 0, 0, 0, 'Z', 'C', 'F', 'D', 'B', 'S', 'I', 'J', 'L', '[', 'V', 0, 0, 0, 0, 0};
|
||||
char type2char_tab[T_CONFLICT+1] = {
|
||||
0, 0, 0, 0,
|
||||
JVM_SIGNATURE_BOOLEAN, JVM_SIGNATURE_CHAR,
|
||||
JVM_SIGNATURE_FLOAT, JVM_SIGNATURE_DOUBLE,
|
||||
JVM_SIGNATURE_BYTE, JVM_SIGNATURE_SHORT,
|
||||
JVM_SIGNATURE_INT, JVM_SIGNATURE_LONG,
|
||||
JVM_SIGNATURE_CLASS, JVM_SIGNATURE_ARRAY,
|
||||
JVM_SIGNATURE_VOID, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
// Map BasicType to Java type name
|
||||
const char* type2name_tab[T_CONFLICT+1] = {
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
// Get constants like JVM_T_CHAR and JVM_SIGNATURE_INT, before pulling in <jvm.h>.
|
||||
#include "classfile_constants.h"
|
||||
|
||||
#include COMPILER_HEADER(utilities/globalDefinitions)
|
||||
|
||||
// Defaults for macros that might be defined per compiler.
|
||||
@ -570,14 +573,22 @@ void basic_types_init(); // cannot define here; uses assert
|
||||
|
||||
// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/runtime/BasicType.java
|
||||
enum BasicType {
|
||||
T_BOOLEAN = 4,
|
||||
T_CHAR = 5,
|
||||
T_FLOAT = 6,
|
||||
T_DOUBLE = 7,
|
||||
T_BYTE = 8,
|
||||
T_SHORT = 9,
|
||||
T_INT = 10,
|
||||
T_LONG = 11,
|
||||
// The values T_BOOLEAN..T_LONG (4..11) are derived from the JVMS.
|
||||
T_BOOLEAN = JVM_T_BOOLEAN,
|
||||
T_CHAR = JVM_T_CHAR,
|
||||
T_FLOAT = JVM_T_FLOAT,
|
||||
T_DOUBLE = JVM_T_DOUBLE,
|
||||
T_BYTE = JVM_T_BYTE,
|
||||
T_SHORT = JVM_T_SHORT,
|
||||
T_INT = JVM_T_INT,
|
||||
T_LONG = JVM_T_LONG,
|
||||
// The remaining values are not part of any standard.
|
||||
// T_OBJECT and T_VOID denote two more semantic choices
|
||||
// for method return values.
|
||||
// T_OBJECT and T_ARRAY describe signature syntax.
|
||||
// T_ADDRESS, T_METADATA, T_NARROWOOP, T_NARROWKLASS describe
|
||||
// internal references within the JVM as if they were Java
|
||||
// types in their own right.
|
||||
T_OBJECT = 12,
|
||||
T_ARRAY = 13,
|
||||
T_VOID = 14,
|
||||
@ -602,6 +613,10 @@ inline bool is_signed_subword_type(BasicType t) {
|
||||
return (t == T_BYTE || t == T_SHORT);
|
||||
}
|
||||
|
||||
inline bool is_double_word_type(BasicType t) {
|
||||
return (t == T_DOUBLE || t == T_LONG);
|
||||
}
|
||||
|
||||
inline bool is_reference_type(BasicType t) {
|
||||
return (t == T_OBJECT || t == T_ARRAY);
|
||||
}
|
||||
@ -609,17 +624,17 @@ inline bool is_reference_type(BasicType t) {
|
||||
// Convert a char from a classfile signature to a BasicType
|
||||
inline BasicType char2type(char c) {
|
||||
switch( c ) {
|
||||
case 'B': return T_BYTE;
|
||||
case 'C': return T_CHAR;
|
||||
case 'D': return T_DOUBLE;
|
||||
case 'F': return T_FLOAT;
|
||||
case 'I': return T_INT;
|
||||
case 'J': return T_LONG;
|
||||
case 'S': return T_SHORT;
|
||||
case 'Z': return T_BOOLEAN;
|
||||
case 'V': return T_VOID;
|
||||
case 'L': return T_OBJECT;
|
||||
case '[': return T_ARRAY;
|
||||
case JVM_SIGNATURE_BYTE: return T_BYTE;
|
||||
case JVM_SIGNATURE_CHAR: return T_CHAR;
|
||||
case JVM_SIGNATURE_DOUBLE: return T_DOUBLE;
|
||||
case JVM_SIGNATURE_FLOAT: return T_FLOAT;
|
||||
case JVM_SIGNATURE_INT: return T_INT;
|
||||
case JVM_SIGNATURE_LONG: return T_LONG;
|
||||
case JVM_SIGNATURE_SHORT: return T_SHORT;
|
||||
case JVM_SIGNATURE_BOOLEAN: return T_BOOLEAN;
|
||||
case JVM_SIGNATURE_VOID: return T_VOID;
|
||||
case JVM_SIGNATURE_CLASS: return T_OBJECT;
|
||||
case JVM_SIGNATURE_ARRAY: return T_ARRAY;
|
||||
}
|
||||
return T_ILLEGAL;
|
||||
}
|
||||
|
@ -144,6 +144,10 @@ enum {
|
||||
/* Type signatures */
|
||||
|
||||
enum {
|
||||
JVM_SIGNATURE_SLASH = '/',
|
||||
JVM_SIGNATURE_DOT = '.',
|
||||
JVM_SIGNATURE_SPECIAL = '<',
|
||||
JVM_SIGNATURE_ENDSPECIAL = '>',
|
||||
JVM_SIGNATURE_ARRAY = '[',
|
||||
JVM_SIGNATURE_BYTE = 'B',
|
||||
JVM_SIGNATURE_CHAR = 'C',
|
||||
|
Loading…
x
Reference in New Issue
Block a user