@@ -503,13 +503,6 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
503503 domain = Handle (current, accessing_klass->protection_domain ());
504504 }
505505
506- // setup up the proper type to return on OOM
507- ciKlass* fail_type;
508- if (sym->char_at (0 ) == JVM_SIGNATURE_ARRAY) {
509- fail_type = _unloaded_ciobjarrayklass;
510- } else {
511- fail_type = _unloaded_ciinstance_klass;
512- }
513506 Klass* found_klass;
514507 {
515508 ttyUnlocker ttyul; // release tty lock to avoid ordering problems
@@ -591,15 +584,14 @@ ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
591584 int index,
592585 bool & is_accessible,
593586 ciInstanceKlass* accessor) {
594- EXCEPTION_CONTEXT;
595587 Klass* klass = NULL ;
596588 Symbol* klass_name = NULL ;
597589
598590 if (cpool->tag_at (index).is_symbol ()) {
599591 klass_name = cpool->symbol_at (index);
600592 } else {
601593 // Check if it's resolved if it's not a symbol constant pool entry.
602- klass = ConstantPool::klass_at_if_loaded (cpool, index);
594+ klass = ConstantPool::klass_at_if_loaded (cpool, index);
603595 // Try to look it up by name.
604596 if (klass == NULL ) {
605597 klass_name = cpool->klass_name_at (index);
@@ -666,7 +658,6 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
666658 int pool_index, int cache_index,
667659 ciInstanceKlass* accessor) {
668660 bool ignore_will_link;
669- EXCEPTION_CONTEXT;
670661 int index = pool_index;
671662 if (cache_index >= 0 ) {
672663 assert (index < 0 , " only one kind of index at a time" );
@@ -677,12 +668,14 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
677668 return ciConstant (T_OBJECT, get_object (NULL ));
678669 }
679670 BasicType bt = T_OBJECT;
680- if (cpool->tag_at (index).is_dynamic_constant ())
671+ if (cpool->tag_at (index).is_dynamic_constant ()) {
681672 bt = Signature::basic_type (cpool->uncached_signature_ref_at (index));
682- if ( is_reference_type (bt)) {
683- } else {
673+ }
674+ if (! is_reference_type (bt)) {
684675 // we have to unbox the primitive value
685- if (!is_java_primitive (bt)) return ciConstant ();
676+ if (!is_java_primitive (bt)) {
677+ return ciConstant ();
678+ }
686679 jvalue value;
687680 BasicType bt2 = java_lang_boxing_object::get_value (obj, &value);
688681 assert (bt2 == bt, " " );
@@ -717,6 +710,7 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
717710 } else if (tag.is_double ()) {
718711 return ciConstant ((jdouble)cpool->double_at (index));
719712 } else if (tag.is_string ()) {
713+ EXCEPTION_CONTEXT;
720714 oop string = NULL ;
721715 assert (cache_index >= 0 , " should have a cache index" );
722716 string = cpool->string_at (index, cache_index, THREAD);
@@ -733,24 +727,18 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
733727 return ciConstant (T_OBJECT, constant);
734728 }
735729 } else if (tag.is_unresolved_klass_in_error ()) {
736- return ciConstant ();
730+ return ciConstant (T_OBJECT, get_unloaded_klass_mirror ( NULL ) );
737731 } else if (tag.is_klass () || tag.is_unresolved_klass ()) {
738- // 4881222: allow ldc to take a class type
739732 ciKlass* klass = get_klass_by_index_impl (cpool, index, ignore_will_link, accessor);
740- if (HAS_PENDING_EXCEPTION) {
741- CLEAR_PENDING_EXCEPTION;
742- record_out_of_memory_failure ();
743- return ciConstant ();
744- }
745733 assert (klass->is_instance_klass () || klass->is_array_klass (),
746734 " must be an instance or array klass " );
747735 return ciConstant (T_OBJECT, klass->java_mirror ());
748- } else if (tag.is_method_type ()) {
736+ } else if (tag.is_method_type () || tag. is_method_type_in_error () ) {
749737 // must execute Java code to link this CP entry into cache[i].f1
750738 ciSymbol* signature = get_symbol (cpool->method_type_signature_at (index));
751739 ciObject* ciobj = get_unloaded_method_type_constant (signature);
752740 return ciConstant (T_OBJECT, ciobj);
753- } else if (tag.is_method_handle ()) {
741+ } else if (tag.is_method_handle () || tag. is_method_handle_in_error () ) {
754742 // must execute Java code to link this CP entry into cache[i].f1
755743 int ref_kind = cpool->method_handle_ref_kind_at (index);
756744 int callee_index = cpool->method_handle_klass_index_at (index);
@@ -759,10 +747,10 @@ ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
759747 ciSymbol* signature = get_symbol (cpool->method_handle_signature_ref_at (index));
760748 ciObject* ciobj = get_unloaded_method_handle_constant (callee, name, signature, ref_kind);
761749 return ciConstant (T_OBJECT, ciobj);
762- } else if (tag.is_dynamic_constant ()) {
763- return ciConstant ();
750+ } else if (tag.is_dynamic_constant () || tag. is_dynamic_constant_in_error () ) {
751+ return ciConstant (); // not supported
764752 } else {
765- ShouldNotReachHere ( );
753+ assert ( false , " unknown tag: %d (%s) " , tag. value (), tag. internal_name () );
766754 return ciConstant ();
767755 }
768756}
0 commit comments