49 assert(sig->byte_at(0) == '[', "this should already have been checked");
50 // The first character is already checked
51 int i = 1;
52 int len = sig->utf8_length();
53 // First skip all '['s
54 while(i < len - 1 && sig->byte_at(i) == '[') i++;
55
56 // Check type
57 switch(sig->byte_at(i)) {
58 case 'B': // T_BYTE
59 case 'C': // T_CHAR
60 case 'D': // T_DOUBLE
61 case 'F': // T_FLOAT
62 case 'I': // T_INT
63 case 'J': // T_LONG
64 case 'S': // T_SHORT
65 case 'Z': // T_BOOLEAN
66 // If it is an array, the type is the last character
67 return (i + 1 == len);
68 case 'L':
69 case 'Q':
70 // If it is an object or a value type, the last character must be a ';'
71 return sig->byte_at(len - 1) == ';';
72 }
73
74 return false;
75 }
76
77 static const char dvt_postfix[] = "$Value";
78 static const int dvt_postfix_len = 6;
79
80 bool FieldType::is_dvt_postfix(Symbol* signature) {
81 assert(strlen(dvt_postfix) == dvt_postfix_len, "Invariant");
82 int sig_length = signature->utf8_length();
83 int pos = sig_length - dvt_postfix_len;
84 if (pos <= 0) {
85 return false;
86 }
87 for (int i = 0; i < dvt_postfix_len; i++) {
88 if (signature->byte_at(pos) != dvt_postfix[i]) {
89 return false;
90 }
|
49 assert(sig->byte_at(0) == '[', "this should already have been checked");
50 // The first character is already checked
51 int i = 1;
52 int len = sig->utf8_length();
53 // First skip all '['s
54 while(i < len - 1 && sig->byte_at(i) == '[') i++;
55
56 // Check type
57 switch(sig->byte_at(i)) {
58 case 'B': // T_BYTE
59 case 'C': // T_CHAR
60 case 'D': // T_DOUBLE
61 case 'F': // T_FLOAT
62 case 'I': // T_INT
63 case 'J': // T_LONG
64 case 'S': // T_SHORT
65 case 'Z': // T_BOOLEAN
66 // If it is an array, the type is the last character
67 return (i + 1 == len);
68 case 'L':
69 // If it is a class name, the last character must be a ';'
70 return sig->byte_at(len - 1) == ';';
71 }
72
73 return false;
74 }
75
76 static const char dvt_postfix[] = "$Value";
77 static const int dvt_postfix_len = 6;
78
79 bool FieldType::is_dvt_postfix(Symbol* signature) {
80 assert(strlen(dvt_postfix) == dvt_postfix_len, "Invariant");
81 int sig_length = signature->utf8_length();
82 int pos = sig_length - dvt_postfix_len;
83 if (pos <= 0) {
84 return false;
85 }
86 for (int i = 0; i < dvt_postfix_len; i++) {
87 if (signature->byte_at(pos) != dvt_postfix[i]) {
88 return false;
89 }
|