Mercurial > hg > graal-compiler
changeset 18677:8d8523ed37e3
OM: copy hidden properties, too
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Sat, 13 Dec 2014 03:23:40 +0100 |
parents | 1c12cf39281d |
children | e04d70a4d3ae |
files | graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java Sun Dec 14 18:10:05 2014 -0800 +++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java Sat Dec 13 03:23:40 2014 +0100 @@ -156,24 +156,25 @@ } public final void copyProperties(DynamicObject fromObject, Shape ancestor) { - Shape fromShape = fromObject.getShape(); - Shape toShape = getShape(); + ShapeImpl fromShape = (ShapeImpl) fromObject.getShape(); + ShapeImpl toShape = getShape(); assert toShape.isRelated(ancestor); assert toShape.isValid(); assert ancestor.isValid(); for (; toShape != ancestor; toShape = toShape.getParent()) { - Property toProperty = toShape.getLastProperty(); - // assumption: hidden properties won't change and don't need copying - if (!toProperty.isHidden()) { - assert fromShape.hasProperty(toProperty.getKey()); + Transition transitionFromParent = toShape.getTransitionFromParent(); + if (transitionFromParent instanceof Transition.AddPropertyTransition) { + Property toProperty = ((Transition.AddPropertyTransition) transitionFromParent).getProperty(); Property fromProperty = fromShape.getProperty(toProperty.getKey()); + // copy only if property has a location and it's not the same as the source location if (toProperty.getLocation() != null && !(toProperty.getLocation() instanceof ValueLocation) && !toProperty.getLocation().equals(fromProperty.getLocation())) { toProperty.setInternal(this, fromProperty.get(fromObject, false)); assert toShape.isValid(); } - if (fromShape.getLastProperty() == fromProperty) { + if (fromShape.getTransitionFromParent() instanceof Transition.AddPropertyTransition && + ((Transition.AddPropertyTransition) fromShape.getTransitionFromParent()).getProperty() == fromProperty) { // no property is looked up twice, so we can skip over to parent fromShape = fromShape.getParent(); }