Skip to content

Commit 81e8946

Browse files
committed
Merge pull request #5 from smarr/pr/object-mode-comments
Improved documentation of some object model classes
2 parents e54b20c + f846c77 commit 81e8946

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Layout.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,30 @@ public static Layout createLayout() {
6565

6666
public abstract Class<? extends DynamicObject> getType();
6767

68-
public abstract Shape createShape(ObjectType operations);
68+
/**
69+
* Create a root shape.
70+
*
71+
* @param objectType that describes the object instance with this shape.
72+
*/
73+
public abstract Shape createShape(ObjectType objectType);
6974

70-
public abstract Shape createShape(ObjectType operations, Object sharedData);
75+
/**
76+
* Create a root shape.
77+
*
78+
* @param objectType that describes the object instance with this shape.
79+
* @param sharedData for language-specific use
80+
*/
81+
public abstract Shape createShape(ObjectType objectType, Object sharedData);
7182

72-
public abstract Shape createShape(ObjectType operations, Object sharedData, int id);
83+
/**
84+
* Create a root shape.
85+
*
86+
* @param objectType that describes the object instance with this shape.
87+
* @param sharedData for language-specific use
88+
* @param id for language-specific use
89+
* @return
90+
*/
91+
public abstract Shape createShape(ObjectType objectType, Object sharedData, int id);
7392

7493
/**
7594
* Create an allocator for static property creation. Reserves all array extension slots.

truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Location.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public final void set(DynamicObject store, Object value) throws IncompatibleLoca
125125
protected abstract void setInternal(DynamicObject store, Object value) throws IncompatibleLocationException;
126126

127127
/**
128-
* Returns {@code true} if the location can be set to the value.
128+
* Returns {@code true} if the location can be set to the given value.
129129
*
130130
* @param store the receiver object
131131
* @param value the value in question
@@ -144,9 +144,10 @@ public boolean canSet(Object value) {
144144
}
145145

146146
/**
147-
* Returns {@code true} if the location is compatible with the value.
147+
* Returns {@code true} if the location is compatible with the type of the value.
148148
*
149-
* The value may still be rejected if {@link #canSet(DynamicObject, Object)} returns false.
149+
* The actual value may still be rejected if {@link #canSet(DynamicObject, Object)} returns
150+
* false.
150151
*
151152
* @param value the value in question
152153
*/

truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Property.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ protected Property() {
3434

3535
/**
3636
* Create a new property.
37+
*
38+
* @param flags, for language-specific use
3739
*/
3840
public static Property create(Object key, Location location, int flags) {
3941
return Layout.getFactory().createProperty(key, location, flags);
@@ -45,7 +47,7 @@ public static Property create(Object key, Location location, int flags) {
4547
public abstract Object getKey();
4648

4749
/**
48-
* Get property flags.
50+
* Get property flags, which are free for language-specific use.
4951
*/
5052
public abstract int getFlags();
5153

truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/BasicLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public DynamicObject newInstance(Shape shape) {
6262
}
6363

6464
@Override
65-
public Shape createShape(ObjectType operations, Object sharedData, int id) {
66-
return new ShapeBasic(this, sharedData, operations, id);
65+
public Shape createShape(ObjectType objectType, Object sharedData, int id) {
66+
return new ShapeBasic(this, sharedData, objectType, id);
6767
}
6868

6969
@Override

truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/ShapeBasic.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import com.oracle.truffle.object.Transition;
3030

3131
public final class ShapeBasic extends ShapeImpl {
32-
public ShapeBasic(Layout layout, Object sharedData, ObjectType operations, int id) {
33-
super(layout, operations, sharedData, id);
32+
public ShapeBasic(Layout layout, Object sharedData, ObjectType objectType, int id) {
33+
super(layout, objectType, sharedData, id);
3434
}
3535

3636
public ShapeBasic(Layout layout, Object sharedData, ShapeImpl parent, ObjectType objectType, PropertyMap propertyMap, Transition transition, Allocator allocator, int id) {

truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/LayoutImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ public Class<? extends DynamicObject> getType() {
6868
}
6969

7070
@Override
71-
public final Shape createShape(ObjectType operations, Object sharedData) {
72-
return createShape(operations, sharedData, 0);
71+
public final Shape createShape(ObjectType objectType, Object sharedData) {
72+
return createShape(objectType, sharedData, 0);
7373
}
7474

7575
@Override
76-
public final Shape createShape(ObjectType operations) {
77-
return createShape(operations, null);
76+
public final Shape createShape(ObjectType objectType) {
77+
return createShape(objectType, null);
7878
}
7979

8080
public boolean isAllowedIntToDouble() {

0 commit comments

Comments
 (0)