mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8209138: Symbol constructor uses u1 as the element type of its name argument
Maske u1 the type for Symbol values and add a function to return it as a char. Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
a3cd6a1a70
commit
221005a3d4
28 changed files with 120 additions and 116 deletions
|
@ -50,7 +50,7 @@ SignatureIterator::SignatureIterator(Symbol* signature) {
|
|||
}
|
||||
|
||||
void SignatureIterator::expect(char c) {
|
||||
if (_signature->byte_at(_index) != c) fatal("expecting %c", c);
|
||||
if (_signature->char_at(_index) != c) fatal("expecting %c", c);
|
||||
_index++;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ int SignatureIterator::parse_type() {
|
|||
// work (stack underflow for some tests) - this seems to be a VC++ 6.0
|
||||
// compiler bug (was problem - gri 4/27/2000).
|
||||
int size = -1;
|
||||
switch(_signature->byte_at(_index)) {
|
||||
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;
|
||||
|
@ -83,7 +83,7 @@ int SignatureIterator::parse_type() {
|
|||
case 'L':
|
||||
{ int begin = ++_index;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
do_object(begin, _index);
|
||||
}
|
||||
if (_parameter_index < 0 ) _return_type = T_OBJECT;
|
||||
|
@ -92,11 +92,11 @@ int SignatureIterator::parse_type() {
|
|||
case '[':
|
||||
{ int begin = ++_index;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->byte_at(_index) == '[') {
|
||||
while (sig->char_at(_index) == '[') {
|
||||
_index++;
|
||||
}
|
||||
if (sig->byte_at(_index) == 'L') {
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
if (sig->char_at(_index) == 'L') {
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
} else {
|
||||
_index++;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ void SignatureIterator::iterate_parameters() {
|
|||
_index = 0;
|
||||
_parameter_index = 0;
|
||||
expect('(');
|
||||
while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
|
||||
while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
|
||||
expect(')');
|
||||
_parameter_index = 0;
|
||||
}
|
||||
|
@ -217,8 +217,8 @@ void SignatureIterator::iterate_returntype() {
|
|||
// 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->byte_at(_index) != ')') {
|
||||
switch(sig->byte_at(_index)) {
|
||||
while (sig->char_at(_index) != ')') {
|
||||
switch(sig->char_at(_index)) {
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
|
@ -234,17 +234,17 @@ void SignatureIterator::iterate_returntype() {
|
|||
break;
|
||||
case 'L':
|
||||
{
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
{
|
||||
int begin = ++_index;
|
||||
while (sig->byte_at(_index) == '[') {
|
||||
while (sig->char_at(_index) == '[') {
|
||||
_index++;
|
||||
}
|
||||
if (sig->byte_at(_index) == 'L') {
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
if (sig->char_at(_index) == 'L') {
|
||||
while (sig->char_at(_index++) != ';') ;
|
||||
} else {
|
||||
_index++;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void SignatureIterator::iterate() {
|
|||
_parameter_index = 0;
|
||||
_index = 0;
|
||||
expect('(');
|
||||
while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
|
||||
while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
|
||||
expect(')');
|
||||
// Parse return type
|
||||
_parameter_index = -1;
|
||||
|
@ -304,20 +304,20 @@ void SignatureStream::next_non_primitive(int t) {
|
|||
case 'L': {
|
||||
_type = T_OBJECT;
|
||||
Symbol* sig = _signature;
|
||||
while (sig->byte_at(_end++) != ';');
|
||||
while (sig->char_at(_end++) != ';');
|
||||
break;
|
||||
}
|
||||
case '[': {
|
||||
_type = T_ARRAY;
|
||||
Symbol* sig = _signature;
|
||||
char c = sig->byte_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
|
||||
while (sig->byte_at(_end) == '[') {
|
||||
char c = sig->char_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->char_at(_end++);
|
||||
while (sig->char_at(_end) == '[') {
|
||||
_end++;
|
||||
c = sig->byte_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
|
||||
c = sig->char_at(_end);
|
||||
while ('0' <= c && c <= '9') c = sig->char_at(_end++);
|
||||
}
|
||||
switch(sig->byte_at(_end)) {
|
||||
switch(sig->char_at(_end)) {
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
|
@ -327,7 +327,7 @@ void SignatureStream::next_non_primitive(int t) {
|
|||
case 'S':
|
||||
case 'Z':_end++; break;
|
||||
default: {
|
||||
while (sig->byte_at(_end++) != ';');
|
||||
while (sig->char_at(_end++) != ';');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ Symbol* SignatureStream::as_symbol(TRAPS) {
|
|||
int begin = _begin;
|
||||
int end = _end;
|
||||
|
||||
if ( _signature->byte_at(_begin) == 'L'
|
||||
&& _signature->byte_at(_end-1) == ';') {
|
||||
if ( _signature->char_at(_begin) == 'L'
|
||||
&& _signature->char_at(_end-1) == ';') {
|
||||
begin++;
|
||||
end--;
|
||||
}
|
||||
|
@ -394,15 +394,15 @@ Symbol* SignatureStream::as_symbol_or_null() {
|
|||
int begin = _begin;
|
||||
int end = _end;
|
||||
|
||||
if ( _signature->byte_at(_begin) == 'L'
|
||||
&& _signature->byte_at(_end-1) == ';') {
|
||||
if ( _signature->char_at(_begin) == 'L'
|
||||
&& _signature->char_at(_end-1) == ';') {
|
||||
begin++;
|
||||
end--;
|
||||
}
|
||||
|
||||
char* buffer = NEW_RESOURCE_ARRAY(char, end - begin);
|
||||
for (int index = begin; index < end; index++) {
|
||||
buffer[index - begin] = _signature->byte_at(index);
|
||||
buffer[index - begin] = _signature->char_at(index);
|
||||
}
|
||||
Symbol* result = SymbolTable::probe(buffer, end - begin);
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue