< prev index next >
src/hotspot/share/runtime/signature.cpp
Print this page
*** 48,69 ****
_signature = signature;
_parameter_index = 0;
}
void SignatureIterator::expect(char c) {
! if (_signature->byte_at(_index) != c) fatal("expecting %c", c);
_index++;
}
int SignatureIterator::parse_type() {
// Note: This function could be simplified by using "return T_XXX_size;"
// instead of the assignment and the break statements. However, it
// seems that the product build for win32_i486 with MS VC++ 6.0 doesn't
// 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)) {
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;
--- 48,69 ----
_signature = signature;
_parameter_index = 0;
}
void SignatureIterator::expect(char c) {
! if (_signature->char_at(_index) != c) fatal("expecting %c", c);
_index++;
}
int SignatureIterator::parse_type() {
// Note: This function could be simplified by using "return T_XXX_size;"
// instead of the assignment and the break statements. However, it
// seems that the product build for win32_i486 with MS VC++ 6.0 doesn't
// 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->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;
*** 81,104 ****
case 'V': do_void (); if (_parameter_index < 0 ) _return_type = T_VOID;
_index++; size = T_VOID_size; ; break;
case 'L':
{ int begin = ++_index;
Symbol* sig = _signature;
! while (sig->byte_at(_index++) != ';') ;
do_object(begin, _index);
}
if (_parameter_index < 0 ) _return_type = T_OBJECT;
size = T_OBJECT_size;
break;
case '[':
{ int begin = ++_index;
Symbol* sig = _signature;
! while (sig->byte_at(_index) == '[') {
_index++;
}
! if (sig->byte_at(_index) == 'L') {
! while (sig->byte_at(_index++) != ';') ;
} else {
_index++;
}
do_array(begin, _index);
if (_parameter_index < 0 ) _return_type = T_ARRAY;
--- 81,104 ----
case 'V': do_void (); if (_parameter_index < 0 ) _return_type = T_VOID;
_index++; size = T_VOID_size; ; break;
case 'L':
{ int begin = ++_index;
Symbol* sig = _signature;
! while (sig->char_at(_index++) != ';') ;
do_object(begin, _index);
}
if (_parameter_index < 0 ) _return_type = T_OBJECT;
size = T_OBJECT_size;
break;
case '[':
{ int begin = ++_index;
Symbol* sig = _signature;
! while (sig->char_at(_index) == '[') {
_index++;
}
! if (sig->char_at(_index) == 'L') {
! while (sig->char_at(_index++) != ';') ;
} else {
_index++;
}
do_array(begin, _index);
if (_parameter_index < 0 ) _return_type = T_ARRAY;
*** 135,145 ****
void SignatureIterator::iterate_parameters() {
// Parse parameters
_index = 0;
_parameter_index = 0;
expect('(');
! while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
expect(')');
_parameter_index = 0;
}
// Optimized version of iterate_parameters when fingerprint is known
--- 135,145 ----
void SignatureIterator::iterate_parameters() {
// Parse parameters
_index = 0;
_parameter_index = 0;
expect('(');
! while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
expect(')');
_parameter_index = 0;
}
// Optimized version of iterate_parameters when fingerprint is known
*** 215,226 ****
expect('(');
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->byte_at(_index) != ')') {
! switch(sig->byte_at(_index)) {
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
--- 215,226 ----
expect('(');
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) != ')') {
! switch(sig->char_at(_index)) {
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
*** 232,252 ****
_index++;
}
break;
case 'L':
{
! while (sig->byte_at(_index++) != ';') ;
}
break;
case '[':
{
int begin = ++_index;
! while (sig->byte_at(_index) == '[') {
_index++;
}
! if (sig->byte_at(_index) == 'L') {
! while (sig->byte_at(_index++) != ';') ;
} else {
_index++;
}
}
break;
--- 232,252 ----
_index++;
}
break;
case 'L':
{
! while (sig->char_at(_index++) != ';') ;
}
break;
case '[':
{
int begin = ++_index;
! while (sig->char_at(_index) == '[') {
_index++;
}
! if (sig->char_at(_index) == 'L') {
! while (sig->char_at(_index++) != ';') ;
} else {
_index++;
}
}
break;
*** 267,277 ****
void SignatureIterator::iterate() {
// Parse parameters
_parameter_index = 0;
_index = 0;
expect('(');
! while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
expect(')');
// Parse return type
_parameter_index = -1;
parse_type();
check_signature_end();
--- 267,277 ----
void SignatureIterator::iterate() {
// Parse parameters
_parameter_index = 0;
_index = 0;
expect('(');
! while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
expect(')');
// Parse return type
_parameter_index = -1;
parse_type();
check_signature_end();
*** 302,335 ****
void SignatureStream::next_non_primitive(int t) {
switch (t) {
case 'L': {
_type = T_OBJECT;
Symbol* sig = _signature;
! while (sig->byte_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) == '[') {
_end++;
! c = sig->byte_at(_end);
! while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
}
! switch(sig->byte_at(_end)) {
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':_end++; break;
default: {
! while (sig->byte_at(_end++) != ';');
break;
}
}
break;
}
--- 302,335 ----
void SignatureStream::next_non_primitive(int t) {
switch (t) {
case 'L': {
_type = T_OBJECT;
Symbol* sig = _signature;
! while (sig->char_at(_end++) != ';');
break;
}
case '[': {
_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) == '[') {
_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;
default: {
! while (sig->char_at(_end++) != ';');
break;
}
}
break;
}
*** 351,362 ****
Symbol* SignatureStream::as_symbol(TRAPS) {
// Create a symbol from for string _begin _end
int begin = _begin;
int end = _end;
! if ( _signature->byte_at(_begin) == 'L'
! && _signature->byte_at(_end-1) == ';') {
begin++;
end--;
}
// Save names for cleaning up reference count at the end of
--- 351,362 ----
Symbol* SignatureStream::as_symbol(TRAPS) {
// Create a symbol from for string _begin _end
int begin = _begin;
int end = _end;
! if ( _signature->char_at(_begin) == 'L'
! && _signature->char_at(_end-1) == ';') {
begin++;
end--;
}
// Save names for cleaning up reference count at the end of
*** 392,410 ****
ResourceMark rm;
int begin = _begin;
int end = _end;
! if ( _signature->byte_at(_begin) == 'L'
! && _signature->byte_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);
}
Symbol* result = SymbolTable::probe(buffer, end - begin);
return result;
}
--- 392,410 ----
ResourceMark rm;
int begin = _begin;
int end = _end;
! 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->char_at(index);
}
Symbol* result = SymbolTable::probe(buffer, end - begin);
return result;
}
< prev index next >