comparison truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/LayoutStrategy.java @ 22288:47172a9b40ac

Object model refactoring, add Shape#defineProperty
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 07 Oct 2015 19:15:14 +0200
parents dc83cc1f94f2
children cf203af4610c
comparison
equal deleted inserted replaced
22287:479028cce974 22288:47172a9b40ac
27 import com.oracle.truffle.api.object.Location; 27 import com.oracle.truffle.api.object.Location;
28 import com.oracle.truffle.api.object.Property; 28 import com.oracle.truffle.api.object.Property;
29 import com.oracle.truffle.api.object.Shape; 29 import com.oracle.truffle.api.object.Shape;
30 import com.oracle.truffle.object.ShapeImpl.BaseAllocator; 30 import com.oracle.truffle.object.ShapeImpl.BaseAllocator;
31 31
32 public interface LayoutStrategy { 32 public abstract class LayoutStrategy {
33 boolean updateShape(DynamicObject object); 33 public abstract boolean updateShape(DynamicObject object);
34 34
35 Shape returnCached(Shape newShape); 35 public abstract Shape ensureValid(Shape newShape);
36 36
37 Shape ensureSpace(Shape shape, Location location); 37 public abstract Shape ensureSpace(Shape shape, Location location);
38 38
39 boolean isAutoExtArray(); 39 public abstract boolean isAutoExtArray();
40 40
41 Property generalizeProperty(DynamicObject object, Property oldProperty, Object value); 41 public abstract BaseAllocator createAllocator(Layout shape);
42 42
43 Property generalizeProperty(DynamicObject object, Property oldProperty, Object value, Shape oldShape, Shape newShape); 43 public abstract BaseAllocator createAllocator(Shape shape);
44 44
45 BaseAllocator createAllocator(Layout shape); 45 protected abstract ShapeAndProperty generalizeProperty(Property oldProperty, Object value, Shape currentShape, Shape nextShape);
46 46
47 BaseAllocator createAllocator(Shape shape); 47 public static class ShapeAndProperty {
48 private final Shape shape;
49 private final Property property;
50
51 public ShapeAndProperty(Shape shape, Property property) {
52 this.shape = shape;
53 this.property = property;
54 }
55
56 public Shape getShape() {
57 return shape;
58 }
59
60 public Property getProperty() {
61 return property;
62 }
63 }
48 } 64 }