Mercurial > hg > graal-jvmci-8
diff graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2634:4dd0573f510b
FrameState fixes.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 11 May 2011 10:52:37 +0200 |
parents | 721a45190d6d |
children | 8e96b2b3a866 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Tue May 10 18:12:26 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 11 10:52:37 2011 +0200 @@ -344,7 +344,8 @@ // this is a load of class constant which might be unresolved RiType riType = (RiType) con; if (!riType.isResolved() || C1XOptions.TestPatching) { - frameState.push(CiKind.Object, append(new ResolveClass(riType, RiType.Representation.JavaClass, graph))); + ResolveClass rc = new ResolveClass(riType, RiType.Representation.JavaClass, graph, frameState.create(bci())); + frameState.push(CiKind.Object, append(rc)); } else { frameState.push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph))); } @@ -585,27 +586,42 @@ void genNewInstance(int cpi) { RiType type = constantPool().lookupType(cpi, NEW); + FrameState stateBefore = null; + if (!type.isResolved()) { + stateBefore = frameState.create(bci()); + } NewInstance n = new NewInstance(type, cpi, constantPool(), graph); if (memoryMap != null) { memoryMap.newInstance(n); } + n.setStateBefore(stateBefore); frameState.apush(append(n)); } void genNewTypeArray(int typeCode) { CiKind kind = CiKind.fromArrayTypeCode(typeCode); RiType elementType = compilation.runtime.asRiType(kind); - frameState.apush(append(new NewTypeArray(frameState.ipop(), elementType, graph))); + NewTypeArray nta = new NewTypeArray(frameState.ipop(), elementType, graph); + frameState.apush(append(nta)); } void genNewObjectArray(int cpi) { RiType type = constantPool().lookupType(cpi, ANEWARRAY); + FrameState stateBefore = null; + if (!type.isResolved()) { + stateBefore = frameState.create(bci()); + } NewArray n = new NewObjectArray(type, frameState.ipop(), graph); frameState.apush(append(n)); + n.setStateBefore(stateBefore); } void genNewMultiArray(int cpi) { RiType type = constantPool().lookupType(cpi, MULTIANEWARRAY); + FrameState stateBefore = null; + if (!type.isResolved()) { + stateBefore = frameState.create(bci()); + } int rank = stream().readUByte(bci() + 3); Value[] dims = new Value[rank]; for (int i = rank - 1; i >= 0; i--) { @@ -613,26 +629,41 @@ } NewArray n = new NewMultiArray(type, dims, cpi, constantPool(), graph); frameState.apush(append(n)); + n.setStateBefore(stateBefore); } void genGetField(int cpi, RiField field) { // Must copy the state here, because the field holder must still be on the stack. + FrameState stateBefore = null; + if (!field.isResolved()) { + stateBefore = frameState.create(bci()); + } LoadField load = new LoadField(frameState.apop(), field, graph); appendOptimizedLoadField(field.kind(), load); + load.setStateBefore(stateBefore); } void genPutField(int cpi, RiField field) { // Must copy the state here, because the field holder must still be on the stack. + FrameState stateBefore = null; + if (!field.isResolved()) { + stateBefore = frameState.create(bci()); + } Value value = frameState.pop(field.kind().stackKind()); - appendOptimizedStoreField(new StoreField(frameState.apop(), field, value, graph)); + StoreField store = new StoreField(frameState.apop(), field, value, graph); + appendOptimizedStoreField(store); + store.setStateBefore(stateBefore); } void genGetStatic(int cpi, RiField field) { RiType holder = field.holder(); boolean isInitialized = !C1XOptions.TestPatching && field.isResolved(); CiConstant constantValue = null; + FrameState stateBefore = null; if (isInitialized) { constantValue = field.constantValue(null); + } else { + stateBefore = frameState.create(bci()); } if (constantValue != null) { frameState.push(constantValue.kind.stackKind(), appendConstant(constantValue)); @@ -640,15 +671,21 @@ Value container = genResolveClass(RiType.Representation.StaticFields, holder, field.isResolved(), cpi); LoadField load = new LoadField(container, field, graph); appendOptimizedLoadField(field.kind(), load); + load.setStateBefore(stateBefore); } } void genPutStatic(int cpi, RiField field) { RiType holder = field.holder(); + FrameState stateBefore = null; + if (!field.isResolved()) { + stateBefore = frameState.create(bci()); + } Value container = genResolveClass(RiType.Representation.StaticFields, holder, field.isResolved(), cpi); Value value = frameState.pop(field.kind().stackKind()); StoreField store = new StoreField(container, field, value, graph); appendOptimizedStoreField(store); + store.setStateBefore(stateBefore); } private Value genResolveClass(RiType.Representation representation, RiType holder, boolean initialized, int cpi) { @@ -656,7 +693,7 @@ if (initialized) { holderInstr = appendConstant(holder.getEncoding(representation)); } else { - ResolveClass rc = new ResolveClass(holder, representation, graph); + ResolveClass rc = new ResolveClass(holder, representation, graph, frameState.create(bci())); holderInstr = append(rc); } return holderInstr;