Mercurial > hg > truffle
changeset 4326:2b7474c492a9
Generate if(!=null){Deopt}else{...} In the unresolved case for instanceof instead of always deopting
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 24 Jan 2012 18:30:21 +0100 |
parents | e3374bccaa5f |
children | 982c986bb628 |
files | graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Mon Jan 23 08:26:45 2012 -0800 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Tue Jan 24 18:30:21 2012 +0100 @@ -712,11 +712,16 @@ private void genInstanceOf() { int cpi = stream().readCPI(); RiType type = lookupType(cpi, INSTANCEOF); - ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type instanceof RiResolvedType); ValueNode object = frameState.apop(); - if (typeInstruction != null) { - frameState.ipush(append(MaterializeNode.create(currentGraph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) type, object, false)), currentGraph))); + if (type instanceof RiResolvedType) { + ConstantNode hub = appendConstant(((RiResolvedType) type).getEncoding(RiType.Representation.ObjectHub)); + frameState.ipush(append(MaterializeNode.create(currentGraph.unique(new InstanceOfNode(hub, (RiResolvedType) type, object, false)), currentGraph))); } else { + PlaceholderNode trueSucc = currentGraph.add(new PlaceholderNode()); + DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile)); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new NullCheckNode(object, true)), trueSucc, deopt, 1)); + append(ifNode); + lastInstr = trueSucc; frameState.ipush(appendConstant(CiConstant.INT_0)); } }