This commit is contained in:
Christian Thalinger 2016-05-11 20:27:17 +00:00
commit 60360e8793
2 changed files with 7 additions and 5 deletions

View File

@ -28,7 +28,6 @@ import jdk.vm.ci.meta.ConstantPool;
import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaField;
import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.ResolvedJavaType;
@ -109,6 +108,4 @@ public interface HotSpotResolvedObjectType extends ResolvedJavaType {
HotSpotResolvedObjectType getEnclosingType(); HotSpotResolvedObjectType getEnclosingType();
ResolvedJavaMethod getClassInitializer(); ResolvedJavaMethod getClassInitializer();
ResolvedJavaField createField(String name, JavaType type, long offset, int modifiers);
} }

View File

@ -469,7 +469,7 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
return result; return result;
} }
public synchronized HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags) { synchronized HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags) {
HotSpotResolvedJavaField result = null; HotSpotResolvedJavaField result = null;
final int flags = rawFlags & ModifiersProvider.jvmFieldModifiers(); final int flags = rawFlags & ModifiersProvider.jvmFieldModifiers();
@ -489,7 +489,12 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
fieldCache.put(id, result); fieldCache.put(id, result);
} else { } else {
assert result.getName().equals(fieldName); assert result.getName().equals(fieldName);
// assert result.getType().equals(type); /*
* Comparing the types directly is too strict, because the type in the cache could be
* resolved while the incoming type is unresolved. The name comparison is sufficient
* because the type will always be resolved in the context of the holder.
*/
assert result.getType().getName().equals(type.getName());
assert result.offset() == offset; assert result.offset() == offset;
assert result.getModifiers() == flags; assert result.getModifiers() == flags;
} }