Mercurial > hg > graal-compiler
changeset 14085:af84c0b2e74f
Don't remove UnboxNode if the incoming type is wrong.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 06 Mar 2014 10:40:00 +0100 |
parents | 40fac3ef157d |
children | b6c6a18b2232 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Wed Mar 05 21:13:51 2014 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Mar 06 10:40:00 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,11 @@ public void virtualize(VirtualizerTool tool) { State state = tool.getObjectState(value); if (state != null && state.getState() == EscapeState.Virtual) { - tool.replaceWithValue(state.getEntry(0)); + ResolvedJavaType objectType = state.getVirtualObject().type(); + ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass()); + if (objectType == expectedType) { + tool.replaceWithValue(state.getEntry(0)); + } } } @@ -90,7 +94,10 @@ } } } else if (value instanceof BoxNode) { - return ((BoxNode) value).getValue(); + BoxNode box = (BoxNode) value; + if (boxingKind == box.getBoxingKind()) { + return box.getValue(); + } } if (usages().isEmpty()) { return null;