Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Shape.java @ 22548:6b76a24fffbd default tip
Use all variables: a, b, u,v and x, y
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Thu, 14 Jan 2016 14:20:57 +0100 |
parents | 47172a9b40ac |
children |
rev | line source |
---|---|
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
1 /* |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
4 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
10 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
15 * accompanied this code). |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
16 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
20 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
23 * questions. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
24 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.object; |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
26 |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22144
diff
changeset
|
27 import com.oracle.truffle.api.Assumption; |
22288
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
28 |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22144
diff
changeset
|
29 import java.util.EnumSet; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22144
diff
changeset
|
30 import java.util.List; |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
31 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
32 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
33 * Shape objects create a mapping of Property objects to Locations. Shapes are immutable; adding or |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
34 * deleting a property yields a new Shape which links to the old one. This allows inline caching to |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
35 * simply check the identity of an object's Shape to determine if the cache is valid. There is one |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
36 * exception to this immutability, the transition map, but that is used simply to assure that an |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
37 * identical series of property additions and deletions will yield the same Shape object. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
38 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
39 * @see DynamicObject |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
40 * @see Property |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
41 * @see Location |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
42 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
43 public abstract class Shape { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
44 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
45 * Get a property entry by key. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
46 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
47 * @param key the identifier to look up |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
48 * @return a Property object, or null if not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
49 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
50 public abstract Property getProperty(Object key); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
51 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
52 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
53 * Add a new property in the map, yielding a new or cached Shape object. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
54 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
55 * @param property the property to add |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
56 * @return the new Shape |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
57 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
58 public abstract Shape addProperty(Property property); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
59 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
60 /** |
22288
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
61 * Add or change property in the map, yielding a new or cached Shape object. |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
62 * |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
63 * @return the shape after defining the property |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
64 */ |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
65 public abstract Shape defineProperty(Object key, Object value, int flags); |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
66 |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
67 /** |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
68 * Add or change property in the map, yielding a new or cached Shape object. |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
69 * |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
70 * @return the shape after defining the property |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
71 */ |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
72 public abstract Shape defineProperty(Object key, Object value, int flags, LocationFactory locationFactory); |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
73 |
47172a9b40ac
Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents:
22157
diff
changeset
|
74 /** |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
75 * An {@link Iterable} over the shape's properties in insertion order. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
76 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
77 public abstract Iterable<Property> getProperties(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
78 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
79 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
80 * Get a list of properties that this Shape stores. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
81 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
82 * @return list of properties |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
83 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
84 public abstract List<Property> getPropertyList(Pred<Property> filter); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
85 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
86 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
87 * Get a list of all properties that this Shape stores. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
88 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
89 * @return list of properties |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
90 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
91 public abstract List<Property> getPropertyList(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
92 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
93 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
94 * Returns all (also hidden) property objects in this shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
95 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
96 * @param ascending desired order ({@code true} for insertion order, {@code false} for reverse |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
97 * insertion order) |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
98 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
99 public abstract List<Property> getPropertyListInternal(boolean ascending); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
100 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
101 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
102 * Get a filtered list of property keys in insertion order. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
103 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
104 public abstract List<Object> getKeyList(Pred<Property> filter); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
105 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
106 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
107 * Get a list of all property keys in insertion order. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
108 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
109 public abstract List<Object> getKeyList(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
110 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
111 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
112 * Get all property keys in insertion order. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
113 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
114 public abstract Iterable<Object> getKeys(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
115 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
116 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
117 * Get an assumption that the shape is valid. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
118 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
119 public abstract Assumption getValidAssumption(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
120 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
121 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
122 * Check whether this shape is valid. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
123 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
124 public abstract boolean isValid(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
125 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
126 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
127 * Get an assumption that the shape is a leaf. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
128 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
129 public abstract Assumption getLeafAssumption(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
130 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
131 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
132 * Check whether this shape is a leaf in the transition graph, i.e. transitionless. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
133 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
134 public abstract boolean isLeaf(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
135 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
136 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
137 * @return the parent shape or {@code null} if none. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
138 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
139 public abstract Shape getParent(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
140 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
141 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
142 * Check whether the shape has a property with the given key. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
143 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
144 public abstract boolean hasProperty(Object key); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
145 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
146 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
147 * Remove the given property from the shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
148 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
149 public abstract Shape removeProperty(Property property); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
150 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
151 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
152 * Replace a property in the shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
153 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
154 public abstract Shape replaceProperty(Property oldProperty, Property newProperty); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
155 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
156 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
157 * Get the last added property. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
158 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
159 public abstract Property getLastProperty(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
160 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
161 public abstract int getId(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
162 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
163 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
164 * Append the property, relocating it to the next allocated location. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
165 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
166 public abstract Shape append(Property oldProperty); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
167 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
168 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
169 * Obtain an {@link Allocator} instance for the purpose of allocating locations. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
170 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
171 public abstract Allocator allocator(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
172 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
173 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
174 * Get number of properties in this shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
175 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
176 public abstract int getPropertyCount(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
177 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
178 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
179 * Get the shape's operations. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
180 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
181 public abstract ObjectType getObjectType(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
182 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
183 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
184 * Get the root shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
185 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
186 public abstract Shape getRoot(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
187 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
188 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
189 * Check whether this shape is identical to the given shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
190 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
191 public abstract boolean check(DynamicObject subject); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
192 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
193 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
194 * Get the shape's layout. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
195 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
196 public abstract Layout getLayout(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
197 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
198 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
199 * Get the shape's custom data. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
200 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
201 public abstract Object getData(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
202 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
203 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
204 * Get the shape's shared data. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
205 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
206 public abstract Object getSharedData(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
207 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
208 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
209 * Query whether the shape has a transition with the given key. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
210 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
211 public abstract boolean hasTransitionWithKey(Object key); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
212 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
213 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
214 * Clone off a separate shape with new shared data. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
215 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
216 public abstract Shape createSeparateShape(Object sharedData); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
217 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
218 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
219 * Change the shape's type, yielding a new shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
220 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
221 public abstract Shape changeType(ObjectType newOps); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
222 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
223 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
224 * Reserve the primitive extension array field. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
225 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
226 public abstract Shape reservePrimitiveExtensionArray(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
227 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
228 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
229 * Create a new {@link DynamicObject} instance with this shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
230 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
231 public abstract DynamicObject newInstance(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
232 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
233 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
234 * Create a {@link DynamicObjectFactory} for creating instances of this shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
235 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
236 public abstract DynamicObjectFactory createFactory(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
237 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
238 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
239 * Get mutex object shared by related shapes, i.e. shapes with a common root. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
240 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
241 public abstract Object getMutex(); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
242 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
243 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
244 * Are these two shapes related, i.e. do they have the same root? |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
245 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
246 * @param other Shape to compare to |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
247 * @return true if one shape is an upcast of the other, or the Shapes are equal |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
248 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
249 public abstract boolean isRelated(Shape other); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
250 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
251 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
252 * Try to merge two related shapes to a more general shape that has the same properties and can |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
253 * store at least the values of both shapes. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
254 * |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
255 * @return this, other, or a new shape that is compatible with both shapes |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
256 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
257 public abstract Shape tryMerge(Shape other); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
258 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
259 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
260 * Utility class to allocate locations in an object layout. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
261 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
262 public abstract static class Allocator { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
263 protected abstract Location locationForValue(Object value, boolean useFinal, boolean nonNull); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
264 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
265 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
266 * Create a new location compatible with the given initial value. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
267 * |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
268 * @param value the initial value this location is going to be assigned |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
269 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
270 public final Location locationForValue(Object value) { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
271 return locationForValue(value, false, value != null); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
272 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
273 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
274 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
275 * Create a new location compatible with the given initial value. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
276 * |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
277 * @param value the initial value this location is going to be assigned |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
278 * @param modifiers additional restrictions and semantics |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
279 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
280 public final Location locationForValue(Object value, EnumSet<LocationModifier> modifiers) { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
281 assert value != null || !modifiers.contains(LocationModifier.NonNull); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
282 return locationForValue(value, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
283 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
284 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
285 protected abstract Location locationForType(Class<?> type, boolean useFinal, boolean nonNull); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
286 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
287 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
288 * Create a new location for a fixed type. It can only be assigned to values of this type. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
289 * |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
290 * @param type the Java type this location must be compatible with (may be primitive) |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
291 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
292 public final Location locationForType(Class<?> type) { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
293 return locationForType(type, false, false); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
294 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
295 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
296 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
297 * Create a new location for a fixed type. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
298 * |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
299 * @param type the Java type this location must be compatible with (may be primitive) |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
300 * @param modifiers additional restrictions and semantics |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
301 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
302 public final Location locationForType(Class<?> type, EnumSet<LocationModifier> modifiers) { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
303 return locationForType(type, modifiers.contains(LocationModifier.Final), modifiers.contains(LocationModifier.NonNull)); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
304 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
305 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
306 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
307 * Creates a new location from a constant value. The value is stored in the shape rather |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
308 * than in the object. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
309 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
310 public abstract Location constantLocation(Object value); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
311 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
312 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
313 * Creates a new declared location with a default value. A declared location only assumes a |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
314 * type after the first set (initialization). |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
315 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
316 public abstract Location declaredLocation(Object value); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
317 |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
318 /** |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
319 * Reserves space for the given location, so that it will not be available to subsequently |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
320 * allocated locations. |
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
321 */ |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
322 public abstract Allocator addLocation(Location location); |
22087
5d9e5f866821
add Shape.Allocator#copy()
Andreas Woess <andreas.woess@oracle.com>
parents:
21951
diff
changeset
|
323 |
5d9e5f866821
add Shape.Allocator#copy()
Andreas Woess <andreas.woess@oracle.com>
parents:
21951
diff
changeset
|
324 /** |
22144
657d37ff352e
add missing javadoc to shape methods
Andreas Woess <andreas.woess@oracle.com>
parents:
22143
diff
changeset
|
325 * Creates an copy of this allocator state. |
22087
5d9e5f866821
add Shape.Allocator#copy()
Andreas Woess <andreas.woess@oracle.com>
parents:
21951
diff
changeset
|
326 */ |
5d9e5f866821
add Shape.Allocator#copy()
Andreas Woess <andreas.woess@oracle.com>
parents:
21951
diff
changeset
|
327 public abstract Allocator copy(); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
328 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
329 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
330 /** |
22092
1a1aa12ab310
add some missing javadoc
Andreas Woess <andreas.woess@oracle.com>
parents:
22088
diff
changeset
|
331 * Represents a predicate (boolean-valued function) of one argument. |
1a1aa12ab310
add some missing javadoc
Andreas Woess <andreas.woess@oracle.com>
parents:
22088
diff
changeset
|
332 * |
1a1aa12ab310
add some missing javadoc
Andreas Woess <andreas.woess@oracle.com>
parents:
22088
diff
changeset
|
333 * For Java 7 compatibility (equivalent to Predicate). |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
334 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
335 * @param <T> the type of the input to the predicate |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
336 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
337 public interface Pred<T> { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
338 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
339 * Evaluates this predicate on the given argument. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
340 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
341 * @param t the input argument |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
342 * @return {@code true} if the input argument matches the predicate, otherwise {@code false} |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
343 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
344 boolean test(T t); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
345 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
346 } |