comparison graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java @ 19611:7d5a0223dc44

Truffle: minor ShapeImpl cleanup
author Andreas Woess <andreas.woess@oracle.com>
date Fri, 27 Feb 2015 13:55:56 +0100
parents 068256ee3b90
children b53f87e24a7b
comparison
equal deleted inserted replaced
19610:2625f0dc7b48 19611:7d5a0223dc44
351 * 351 *
352 * @see #addProperty(Property) 352 * @see #addProperty(Property)
353 */ 353 */
354 private ShapeImpl addPropertyInternal(Property prop) { 354 private ShapeImpl addPropertyInternal(Property prop) {
355 CompilerAsserts.neverPartOfCompilation(); 355 CompilerAsserts.neverPartOfCompilation();
356 assert prop.isShadow() || !(this.hasProperty(prop.getKey())) : "duplicate property"; 356 assert prop.isShadow() || !(this.hasProperty(prop.getKey())) : "duplicate property " + prop.getKey();
357 assert !getPropertyListInternal(false).contains(prop); 357 assert !getPropertyListInternal(false).contains(prop);
358 // invalidatePropertyAssumption(prop.getName());
359 358
360 AddPropertyTransition addTransition = new AddPropertyTransition(prop); 359 AddPropertyTransition addTransition = new AddPropertyTransition(prop);
361 ShapeImpl cachedShape = queryTransition(addTransition); 360 ShapeImpl cachedShape = queryTransition(addTransition);
362 if (cachedShape != null) { 361 if (cachedShape != null) {
363 return cachedShape; 362 return cachedShape;
651 for (ListIterator<Transition> iterator = transitionList.listIterator(transitionList.size()); iterator.hasPrevious();) { 650 for (ListIterator<Transition> iterator = transitionList.listIterator(transitionList.size()); iterator.hasPrevious();) {
652 Transition previous = iterator.previous(); 651 Transition previous = iterator.previous();
653 newShape = newShape.applyTransition(previous, true); 652 newShape = newShape.applyTransition(previous, true);
654 } 653 }
655 654
656 getTransitionMapForWrite().put(transition, newShape); 655 addIndirectTransition(transition, newShape);
657 return newShape; 656 return newShape;
658 } else { 657 } else {
659 return null; 658 return null;
660 } 659 }
661 } 660 }
897 } 896 }
898 897
899 private Property[] createPropertiesArray() { 898 private Property[] createPropertiesArray() {
900 propertyListAllocCount.inc(); 899 propertyListAllocCount.inc();
901 Property[] propertiesArray = new Property[getPropertyCount()]; 900 Property[] propertiesArray = new Property[getPropertyCount()];
902 List<Property> ownProperties = getPropertyList(ALL); 901 List<Property> ownProperties = getPropertyList();
903 assert ownProperties.size() == getPropertyCount(); 902 assert ownProperties.size() == getPropertyCount();
904 for (int i = 0; i < getPropertyCount(); i++) { 903 for (int i = 0; i < getPropertyCount(); i++) {
905 propertiesArray[i] = ownProperties.get(i); 904 propertiesArray[i] = ownProperties.get(i);
906 } 905 }
907 return propertiesArray; 906 return propertiesArray;
1097 } 1096 }
1098 1097
1099 /** 1098 /**
1100 * Match all filter. 1099 * Match all filter.
1101 */ 1100 */
1102 public static final Pred<Property> ALL = new Pred<Property>() { 1101 private static final Pred<Property> ALL = new Pred<Property>() {
1103 public boolean test(Property t) { 1102 public boolean test(Property t) {
1104 return true; 1103 return true;
1105 } 1104 }
1106 }; 1105 };
1107 1106