371 } |
371 } |
372 |
372 |
373 if (found_klass != NULL) { |
373 if (found_klass != NULL) { |
374 // Found it. Build a CI handle. |
374 // Found it. Build a CI handle. |
375 return get_object(found_klass)->as_klass(); |
375 return get_object(found_klass)->as_klass(); |
376 } |
|
377 |
|
378 // If we fail to find an array klass, look again for its element type. |
|
379 // The element type may be available either locally or via constraints. |
|
380 // In either case, if we can find the element type in the system dictionary, |
|
381 // we must build an array type around it. The CI requires array klasses |
|
382 // to be loaded if their element klasses are loaded, except when memory |
|
383 // is exhausted. |
|
384 if (sym->byte_at(0) == '[' && |
|
385 (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) { |
|
386 // We have an unloaded array. |
|
387 // Build it on the fly if the element class exists. |
|
388 symbolOop elem_sym = oopFactory::new_symbol(sym->as_utf8()+1, |
|
389 sym->utf8_length()-1, |
|
390 KILL_COMPILE_ON_FATAL_(fail_type)); |
|
391 // Get element ciKlass recursively. |
|
392 ciKlass* elem_klass = |
|
393 get_klass_by_name_impl(accessing_klass, |
|
394 get_object(elem_sym)->as_symbol(), |
|
395 require_local); |
|
396 if (elem_klass != NULL && elem_klass->is_loaded()) { |
|
397 // Now make an array for it |
|
398 return ciObjArrayKlass::make_impl(elem_klass); |
|
399 } |
|
400 } |
376 } |
401 |
377 |
402 if (require_local) return NULL; |
378 if (require_local) return NULL; |
403 // Not yet loaded into the VM, or not governed by loader constraints. |
379 // Not yet loaded into the VM, or not governed by loader constraints. |
404 // Make a CI representative for it. |
380 // Make a CI representative for it. |