Mercurial > hg > truffle
changeset 18735:e04e41c3cb6e
Handle null in readKlassPointer
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 19 Dec 2014 12:09:14 -0800 |
parents | 61b6c57421c2 |
children | a61d63bd1e56 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java Fri Dec 19 12:44:00 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java Fri Dec 19 12:09:14 2014 -0800 @@ -182,6 +182,9 @@ @Override public Constant readKlassPointerConstant(Constant base, long displacement) { long klass = readRawValue(base, displacement, runtime.getTarget().wordSize * 8); + if (klass == 0) { + return JavaConstant.NULL_POINTER; + } HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass); return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime.getTarget().wordKind, klass, metaKlass, false); } @@ -190,6 +193,9 @@ public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) { int compressed = (int) readRawValue(base, displacement, 32); long klass = encoding.uncompress(compressed); + if (klass == 0) { + return JavaConstant.NULL_POINTER; + } HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass); return HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, compressed, metaKlass, true); }