151 // Perform the field lookup. 152 fieldDescriptor field_desc; 153 Klass* canonical_holder = 154 loaded_decl_holder->find_field(name, signature, &field_desc); 155 if (canonical_holder == NULL) { 156 // Field lookup failed. Will be detected by will_link. 157 _holder = declared_holder; 158 _offset = -1; 159 _is_constant = false; 160 return; 161 } 162 163 // Access check based on declared_holder. canonical_holder should not be used 164 // to check access because it can erroneously succeed. If this check fails, 165 // propagate the declared holder to will_link() which in turn will bail out 166 // compilation for this field access. 167 if (!Reflection::verify_field_access(klass->get_Klass(), declared_holder->get_Klass(), canonical_holder, field_desc.access_flags(), true)) { 168 _holder = declared_holder; 169 _offset = -1; 170 _is_constant = false; 171 return; 172 } 173 174 assert(canonical_holder == field_desc.field_holder(), "just checking"); 175 initialize_from(&field_desc); 176 } 177 178 ciField::ciField(fieldDescriptor *fd) : 179 _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { 180 ASSERT_IN_VM; 181 182 // Get the field's name, signature, and type. 183 ciEnv* env = CURRENT_ENV; 184 _name = env->get_symbol(fd->name()); 185 _signature = env->get_symbol(fd->signature()); 186 187 BasicType field_type = fd->field_type(); 188 189 // If the field is a pointer type, get the klass of the 190 // field. | 151 // Perform the field lookup. 152 fieldDescriptor field_desc; 153 Klass* canonical_holder = 154 loaded_decl_holder->find_field(name, signature, &field_desc); 155 if (canonical_holder == NULL) { 156 // Field lookup failed. Will be detected by will_link. 157 _holder = declared_holder; 158 _offset = -1; 159 _is_constant = false; 160 return; 161 } 162 163 // Access check based on declared_holder. canonical_holder should not be used 164 // to check access because it can erroneously succeed. If this check fails, 165 // propagate the declared holder to will_link() which in turn will bail out 166 // compilation for this field access. 167 if (!Reflection::verify_field_access(klass->get_Klass(), declared_holder->get_Klass(), canonical_holder, field_desc.access_flags(), true)) { 168 _holder = declared_holder; 169 _offset = -1; 170 _is_constant = false; 171 // It's possible the access check failed due to a nestmate access check 172 // encountering an exception. We can't propagate the exception from here 173 // so we have to clear it. If the access check happens again in a different 174 // context then the exception will be thrown there. 175 Thread* THREAD = Thread::current(); 176 if (HAS_PENDING_EXCEPTION) { 177 CLEAR_PENDING_EXCEPTION; 178 } 179 return; 180 } 181 182 assert(canonical_holder == field_desc.field_holder(), "just checking"); 183 initialize_from(&field_desc); 184 } 185 186 ciField::ciField(fieldDescriptor *fd) : 187 _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { 188 ASSERT_IN_VM; 189 190 // Get the field's name, signature, and type. 191 ciEnv* env = CURRENT_ENV; 192 _name = env->get_symbol(fd->name()); 193 _signature = env->get_symbol(fd->signature()); 194 195 BasicType field_type = fd->field_type(); 196 197 // If the field is a pointer type, get the klass of the 198 // field. |