@@ -432,13 +432,6 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
432432 domain = Handle (current, accessing_klass->protection_domain ());
433433 }
434434
435- // setup up the proper type to return on OOM
436- ciKlass* fail_type;
437- if (sym->char_at (0 ) == JVM_SIGNATURE_ARRAY) {
438- fail_type = _unloaded_ciobjarrayklass;
439- } else {
440- fail_type = _unloaded_ciinstance_klass;
441- }
442435 Klass* found_klass;
443436 {
444437 ttyUnlocker ttyul; // release tty lock to avoid ordering problems
@@ -520,15 +513,14 @@ ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
520513 int index,
521514 bool & is_accessible,
522515 ciInstanceKlass* accessor) {
523- EXCEPTION_CONTEXT;
524516 Klass* klass = NULL ;
525517 Symbol* klass_name = NULL ;
526518
527519 if (cpool->tag_at (index).is_symbol ()) {
528520 klass_name = cpool->symbol_at (index);
529521 } else {
530522 // Check if it's resolved if it's not a symbol constant pool entry.
531- klass = ConstantPool::klass_at_if_loaded (cpool, index);
523+ klass = ConstantPool::klass_at_if_loaded (cpool, index);
532524 // Try to look it up by name.
533525 if (klass == NULL ) {
534526 klass_name = cpool->klass_name_at (index);
@@ -588,7 +580,6 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
588580 int pool_index, int cache_index,
589581 ciInstanceKlass* accessor) {
590582 bool ignore_will_link;
591- EXCEPTION_CONTEXT;
592583 int index = pool_index;
593584 if (cache_index >= 0 ) {
594585 assert (index < 0 , " only one kind of index at a time" );
@@ -599,12 +590,14 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
599590 return ciConstant (T_OBJECT, get_object (NULL ));
600591 }
601592 BasicType bt = T_OBJECT;
602- if (cpool->tag_at (index).is_dynamic_constant ())
593+ if (cpool->tag_at (index).is_dynamic_constant ()) {
603594 bt = Signature::basic_type (cpool->uncached_signature_ref_at (index));
604- if ( is_reference_type (bt)) {
605- } else {
595+ }
596+ if (! is_reference_type (bt)) {
606597 // we have to unbox the primitive value
607- if (!is_java_primitive (bt)) return ciConstant ();
598+ if (!is_java_primitive (bt)) {
599+ return ciConstant ();
600+ }
608601 jvalue value;
609602 BasicType bt2 = java_lang_boxing_object::get_value (obj, &value);
610603 assert (bt2 == bt, " " );
@@ -639,6 +632,7 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
639632 } else if (tag.is_double ()) {
640633 return ciConstant ((jdouble)cpool->double_at (index));
641634 } else if (tag.is_string ()) {
635+ EXCEPTION_CONTEXT;
642636 oop string = NULL ;
643637 assert (cache_index >= 0 , " should have a cache index" );
644638 string = cpool->string_at (index, cache_index, THREAD);
@@ -655,24 +649,18 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
655649 return ciConstant (T_OBJECT, constant);
656650 }
657651 } else if (tag.is_unresolved_klass_in_error ()) {
658- return ciConstant ();
652+ return ciConstant (T_OBJECT, get_unloaded_klass_mirror ( NULL ) );
659653 } else if (tag.is_klass () || tag.is_unresolved_klass ()) {
660- // 4881222: allow ldc to take a class type
661654 ciKlass* klass = get_klass_by_index_impl (cpool, index, ignore_will_link, accessor);
662- if (HAS_PENDING_EXCEPTION) {
663- CLEAR_PENDING_EXCEPTION;
664- record_out_of_memory_failure ();
665- return ciConstant ();
666- }
667655 assert (klass->is_instance_klass () || klass->is_array_klass (),
668656 " must be an instance or array klass " );
669657 return ciConstant (T_OBJECT, klass->java_mirror ());
670- } else if (tag.is_method_type ()) {
658+ } else if (tag.is_method_type () || tag. is_method_type_in_error () ) {
671659 // must execute Java code to link this CP entry into cache[i].f1
672660 ciSymbol* signature = get_symbol (cpool->method_type_signature_at (index));
673661 ciObject* ciobj = get_unloaded_method_type_constant (signature);
674662 return ciConstant (T_OBJECT, ciobj);
675- } else if (tag.is_method_handle ()) {
663+ } else if (tag.is_method_handle () || tag. is_method_handle_in_error () ) {
676664 // must execute Java code to link this CP entry into cache[i].f1
677665 int ref_kind = cpool->method_handle_ref_kind_at (index);
678666 int callee_index = cpool->method_handle_klass_index_at (index);
@@ -681,10 +669,10 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
681669 ciSymbol* signature = get_symbol (cpool->method_handle_signature_ref_at (index));
682670 ciObject* ciobj = get_unloaded_method_handle_constant (callee, name, signature, ref_kind);
683671 return ciConstant (T_OBJECT, ciobj);
684- } else if (tag.is_dynamic_constant ()) {
685- return ciConstant ();
672+ } else if (tag.is_dynamic_constant () || tag. is_dynamic_constant_in_error () ) {
673+ return ciConstant (); // not supported
686674 } else {
687- ShouldNotReachHere ( );
675+ assert ( false , " unknown tag: %d (%s) " , tag. value (), tag. internal_name () );
688676 return ciConstant ();
689677 }
690678}
0 commit comments