399 }
400
401 Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
402 FailureMode failure_mode, TRAPS) {
403 if (!is_object()) return NULL;
404 Symbol* name = as_symbol(CHECK_NULL);
405 if (failure_mode == ReturnNull) {
406 return SystemDictionary::resolve_or_null(name, class_loader, protection_domain, THREAD);
407 } else {
408 bool throw_error = (failure_mode == NCDFError);
409 return SystemDictionary::resolve_or_fail(name, class_loader, protection_domain, throw_error, THREAD);
410 }
411 }
412
413 oop SignatureStream::as_java_mirror(Handle class_loader, Handle protection_domain,
414 FailureMode failure_mode, TRAPS) {
415 if (!is_object())
416 return Universe::java_mirror(type());
417 Klass* klass = as_klass(class_loader, protection_domain, failure_mode, CHECK_NULL);
418 if (klass == NULL) return NULL;
419 return _type == T_VALUETYPE ? ValueKlass::cast(InstanceKlass::cast(klass))->value_mirror() : klass->java_mirror();
420 }
421
422 Symbol* SignatureStream::as_symbol_or_null() {
423 // Create a symbol from for string _begin _end
424 ResourceMark rm;
425
426 int begin = _begin;
427 int end = _end;
428
429 if (_type == T_OBJECT || _type == T_VALUETYPE) {
430 begin++;
431 end--;
432 if (begin == end) {
433 return vmSymbols::java_lang_Object();
434 }
435 }
436
437 char* buffer = NEW_RESOURCE_ARRAY(char, end - begin);
438 for (int index = begin; index < end; index++) {
439 buffer[index - begin] = _signature->char_at(index);
|
399 }
400
401 Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
402 FailureMode failure_mode, TRAPS) {
403 if (!is_object()) return NULL;
404 Symbol* name = as_symbol(CHECK_NULL);
405 if (failure_mode == ReturnNull) {
406 return SystemDictionary::resolve_or_null(name, class_loader, protection_domain, THREAD);
407 } else {
408 bool throw_error = (failure_mode == NCDFError);
409 return SystemDictionary::resolve_or_fail(name, class_loader, protection_domain, throw_error, THREAD);
410 }
411 }
412
413 oop SignatureStream::as_java_mirror(Handle class_loader, Handle protection_domain,
414 FailureMode failure_mode, TRAPS) {
415 if (!is_object())
416 return Universe::java_mirror(type());
417 Klass* klass = as_klass(class_loader, protection_domain, failure_mode, CHECK_NULL);
418 if (klass == NULL) return NULL;
419 if (klass->is_value()) {
420 ValueKlass* vk = ValueKlass::cast(InstanceKlass::cast(klass));
421 return _type == T_VALUETYPE ? vk->value_mirror() : vk->nullable_mirror();
422 } else {
423 assert(_type != T_VALUETYPE, "must not be value type");
424 return klass->java_mirror();
425 }
426 }
427
428 Symbol* SignatureStream::as_symbol_or_null() {
429 // Create a symbol from for string _begin _end
430 ResourceMark rm;
431
432 int begin = _begin;
433 int end = _end;
434
435 if (_type == T_OBJECT || _type == T_VALUETYPE) {
436 begin++;
437 end--;
438 if (begin == end) {
439 return vmSymbols::java_lang_Object();
440 }
441 }
442
443 char* buffer = NEW_RESOURCE_ARRAY(char, end - begin);
444 for (int index = begin; index < end; index++) {
445 buffer[index - begin] = _signature->char_at(index);
|