77 }
78
79 bool VerificationType::is_reference_assignable_from(
80 const VerificationType& from, ClassVerifier* context,
81 bool from_field_is_protected, TRAPS) const {
82 InstanceKlass* klass = context->current_class();
83 if (from.is_null()) {
84 // null is assignable to any reference
85 return true;
86 } else if (is_null()) {
87 return false;
88 } else if (name() == from.name()) {
89 return true;
90 } else if (is_object()) {
91 // We need check the class hierarchy to check assignability
92 if (name() == vmSymbols::java_lang_Object()) {
93 // any object or array is assignable to java.lang.Object
94 return true;
95 }
96
97 if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
98 if (SystemDictionaryShared::add_verification_constraint(klass,
99 name(), from.name(), from_field_is_protected, from.is_array(),
100 from.is_object())) {
101 // If add_verification_constraint() returns true, the resolution/check should be
102 // delayed until runtime.
103 return true;
104 }
105 }
106
107 return resolve_and_check_assignability(klass, name(), from.name(),
108 from_field_is_protected, from.is_array(), from.is_object(), THREAD);
109 } else if (is_array() && from.is_array()) {
110 VerificationType comp_this = get_component(context, CHECK_false);
111 VerificationType comp_from = from.get_component(context, CHECK_false);
112 if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
113 return comp_this.is_component_assignable_from(comp_from, context,
114 from_field_is_protected, THREAD);
115 }
116 }
117 return false;
|
77 }
78
79 bool VerificationType::is_reference_assignable_from(
80 const VerificationType& from, ClassVerifier* context,
81 bool from_field_is_protected, TRAPS) const {
82 InstanceKlass* klass = context->current_class();
83 if (from.is_null()) {
84 // null is assignable to any reference
85 return true;
86 } else if (is_null()) {
87 return false;
88 } else if (name() == from.name()) {
89 return true;
90 } else if (is_object()) {
91 // We need check the class hierarchy to check assignability
92 if (name() == vmSymbols::java_lang_Object()) {
93 // any object or array is assignable to java.lang.Object
94 return true;
95 }
96
97 if (Arguments::is_dumping_archive()) {
98 if (SystemDictionaryShared::add_verification_constraint(klass,
99 name(), from.name(), from_field_is_protected, from.is_array(),
100 from.is_object())) {
101 // If add_verification_constraint() returns true, the resolution/check should be
102 // delayed until runtime.
103 return true;
104 }
105 }
106
107 return resolve_and_check_assignability(klass, name(), from.name(),
108 from_field_is_protected, from.is_array(), from.is_object(), THREAD);
109 } else if (is_array() && from.is_array()) {
110 VerificationType comp_this = get_component(context, CHECK_false);
111 VerificationType comp_from = from.get_component(context, CHECK_false);
112 if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
113 return comp_this.is_component_assignable_from(comp_from, context,
114 from_field_is_protected, THREAD);
115 }
116 }
117 return false;
|