comparison truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLReadPropertyCacheNode.java @ 22519:47c371370539

SL read node: update shape before going to the uncached case.
author Benoit Daloze <benoit.daloze@jku.at>
date Fri, 18 Dec 2015 16:35:25 +0100
parents 72809fce725f
children
comparison
equal deleted inserted replaced
22518:72809fce725f 22519:47c371370539
38 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39 * SOFTWARE. 39 * SOFTWARE.
40 */ 40 */
41 package com.oracle.truffle.sl.nodes.access; 41 package com.oracle.truffle.sl.nodes.access;
42 42
43 import com.oracle.truffle.api.CompilerDirectives;
43 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; 44 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
44 import com.oracle.truffle.api.dsl.Cached; 45 import com.oracle.truffle.api.dsl.Cached;
45 import com.oracle.truffle.api.dsl.Specialization; 46 import com.oracle.truffle.api.dsl.Specialization;
46 import com.oracle.truffle.api.nodes.Node; 47 import com.oracle.truffle.api.nodes.Node;
47 import com.oracle.truffle.api.nodes.UnexpectedResultException; 48 import com.oracle.truffle.api.nodes.UnexpectedResultException;
100 } else { 101 } else {
101 return property.get(receiver, shape); 102 return property.get(receiver, shape);
102 } 103 }
103 } 104 }
104 105
106 @Specialization(guards = "updateShape(receiver)")
107 public Object updateShapeAndRead(DynamicObject receiver) {
108 return executeObject(receiver);
109 }
110
105 /* 111 /*
106 * The generic case is used if the number of shapes accessed overflows the limit. 112 * The generic case is used if the number of shapes accessed overflows the limit.
107 */ 113 */
108 @Specialization(contains = "doCachedObject") 114 @Specialization(contains = {"doCachedObject", "updateShapeAndRead"})
109 @TruffleBoundary 115 @TruffleBoundary
110 protected Object doGeneric(DynamicObject receiver) { 116 protected Object doGeneric(DynamicObject receiver) {
111 return receiver.get(receiver, SLNull.SINGLETON); 117 return receiver.get(receiver, SLNull.SINGLETON);
112 } 118 }
113 119
120 protected static boolean updateShape(DynamicObject object) {
121 CompilerDirectives.transferToInterpreter();
122 return object.updateShape();
123 }
124
114 } 125 }