< prev index next >
src/hotspot/share/runtime/fieldType.cpp
Print this page
*** 30,54 ****
#include "oops/typeArrayKlass.hpp"
#include "runtime/fieldType.hpp"
#include "runtime/signature.hpp"
BasicType FieldType::basic_type(Symbol* signature) {
! return char2type(signature->byte_at(0));
}
// 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->byte_at(0) == '[', "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->byte_at(i) == '[') i++;
// Check type
! switch(sig->byte_at(i)) {
case 'B': // T_BYTE
case 'C': // T_CHAR
case 'D': // T_DOUBLE
case 'F': // T_FLOAT
case 'I': // T_INT
--- 30,54 ----
#include "oops/typeArrayKlass.hpp"
#include "runtime/fieldType.hpp"
#include "runtime/signature.hpp"
BasicType FieldType::basic_type(Symbol* signature) {
! return char2type(signature->char_at(0));
}
// 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");
// 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++;
// 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
*** 57,78 ****
case 'Z': // T_BOOLEAN
// If it is an array, the type is the last character
return (i + 1 == len);
case 'L':
// If it is an object, the last character must be a ';'
! return sig->byte_at(len - 1) == ';';
}
return false;
}
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->byte_at(index) == '[') {
index++;
dim++;
}
ResourceMark rm;
char *element = signature->as_C_string() + index;
--- 57,78 ----
case 'Z': // T_BOOLEAN
// If it is an array, the type is the last character
return (i + 1 == len);
case 'L':
// If it is an object, the last character must be a ';'
! return sig->char_at(len - 1) == ';';
}
return false;
}
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) == '[') {
index++;
dim++;
}
ResourceMark rm;
char *element = signature->as_C_string() + index;
< prev index next >