< prev index next >

src/share/vm/runtime/signature.cpp

Print this page




 369     default : ShouldNotReachHere();
 370   }
 371 }
 372 
 373 
 374 bool SignatureStream::is_object() const {
 375   return _type == T_OBJECT
 376       || _type == T_ARRAY
 377       || _type == T_VALUETYPE;
 378 }
 379 
 380 bool SignatureStream::is_array() const {
 381   return _type == T_ARRAY;
 382 }
 383 
 384 Symbol* SignatureStream::as_symbol(TRAPS) {
 385   // Create a symbol from for string _begin _end
 386   int begin = _begin;
 387   int end   = _end;
 388 
 389   if ( ( _signature->byte_at(_begin) == 'L' || _signature->byte_at(_begin) == 'Q' )
 390       && _signature->byte_at(_end-1) == ';') {
 391     begin++;
 392     end--;



 393   }
 394 
 395   // Save names for cleaning up reference count at the end of
 396   // SignatureStream scope.
 397   Symbol* name = SymbolTable::new_symbol(_signature, begin, end, CHECK_NULL);
 398   _names->push(name);  // save new symbol for decrementing later
 399   return name;
 400 }
 401 
 402 Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
 403                                    FailureMode failure_mode, TRAPS) {
 404   if (!is_object())  return NULL;
 405   Symbol* name = as_symbol(CHECK_NULL);
 406   if (failure_mode == ReturnNull) {
 407     return SystemDictionary::resolve_or_null(name, class_loader, protection_domain, THREAD);
 408   } else {
 409     bool throw_error = (failure_mode == NCDFError);
 410     return SystemDictionary::resolve_or_fail(name, class_loader, protection_domain, throw_error, THREAD);
 411   }
 412 }




 369     default : ShouldNotReachHere();
 370   }
 371 }
 372 
 373 
 374 bool SignatureStream::is_object() const {
 375   return _type == T_OBJECT
 376       || _type == T_ARRAY
 377       || _type == T_VALUETYPE;
 378 }
 379 
 380 bool SignatureStream::is_array() const {
 381   return _type == T_ARRAY;
 382 }
 383 
 384 Symbol* SignatureStream::as_symbol(TRAPS) {
 385   // Create a symbol from for string _begin _end
 386   int begin = _begin;
 387   int end   = _end;
 388 
 389   if (_type == T_OBJECT || _type == T_VALUETYPE) {

 390     begin++;
 391     end--;
 392     if (begin == end) {
 393       return (_type == T_OBJECT) ? vmSymbols::java_lang_Object() : vmSymbols::java_lang____Value();
 394     }
 395   }
 396 
 397   // Save names for cleaning up reference count at the end of
 398   // SignatureStream scope.
 399   Symbol* name = SymbolTable::new_symbol(_signature, begin, end, CHECK_NULL);
 400   _names->push(name);  // save new symbol for decrementing later
 401   return name;
 402 }
 403 
 404 Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
 405                                    FailureMode failure_mode, TRAPS) {
 406   if (!is_object())  return NULL;
 407   Symbol* name = as_symbol(CHECK_NULL);
 408   if (failure_mode == ReturnNull) {
 409     return SystemDictionary::resolve_or_null(name, class_loader, protection_domain, THREAD);
 410   } else {
 411     bool throw_error = (failure_mode == NCDFError);
 412     return SystemDictionary::resolve_or_fail(name, class_loader, protection_domain, throw_error, THREAD);
 413   }
 414 }


< prev index next >