Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyCacheNode.java @ 18485:e3c95cbbb50c
Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Sun, 23 Nov 2014 16:07:23 -0800 |
parents | 997bc9764a9a |
children | f7bc60c3a8f6 |
rev | line source |
---|---|
18412
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
1 /* |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
4 * |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
8 * |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
14 * |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
18 * |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
21 * questions. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
22 */ |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
23 package com.oracle.truffle.sl.nodes.access; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
24 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
25 import com.oracle.truffle.api.*; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
26 import com.oracle.truffle.api.nodes.*; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.object.*; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
28 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
29 /** |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
30 * The node for accessing a property of an object. When executed, this node first evaluates the |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
31 * object expression on the left side of the dot operator and then reads the named property. |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
32 */ |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
33 public abstract class SLWritePropertyCacheNode extends Node { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
34 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
35 public static SLWritePropertyCacheNode create(String propertyName) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
36 return new SLUninitializedWritePropertyNode(propertyName); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
37 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
38 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
39 public abstract void executeObject(DynamicObject receiver, Object value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
40 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
41 public abstract void executeLong(DynamicObject receiver, long value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
42 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
43 public abstract void executeBoolean(DynamicObject receiver, boolean value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
44 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
45 protected abstract static class SLWritePropertyCacheChainNode extends SLWritePropertyCacheNode { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
46 protected final Shape oldShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
47 protected final Shape newShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
48 @Child protected SLWritePropertyCacheNode next; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
49 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
50 public SLWritePropertyCacheChainNode(Shape oldShape, Shape newShape, SLWritePropertyCacheNode next) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
51 this.oldShape = oldShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
52 this.newShape = newShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
53 this.next = next; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
54 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
55 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
56 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
57 public final void executeObject(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
58 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
59 // if this assumption fails, the object needs to be updated to a valid shape |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
60 oldShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
61 newShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
62 } catch (InvalidAssumptionException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
63 this.replace(next).executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
64 return; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
65 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
66 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
67 boolean condition = oldShape.check(receiver) && checkValue(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
68 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
69 if (condition) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
70 executeObjectUnchecked(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
71 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
72 next.executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
73 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
74 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
75 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
76 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
77 public final void executeLong(DynamicObject receiver, long value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
78 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
79 // if this assumption fails, the object needs to be updated to a valid shape |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
80 oldShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
81 newShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
82 } catch (InvalidAssumptionException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
83 this.replace(next).executeLong(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
84 return; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
85 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
86 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
87 boolean condition = oldShape.check(receiver) && checkValue(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
88 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
89 if (condition) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
90 executeLongUnchecked(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
91 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
92 next.executeLong(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
93 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
94 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
95 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
96 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
97 public final void executeBoolean(DynamicObject receiver, boolean value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
98 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
99 // if this assumption fails, the object needs to be updated to a valid shape |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
100 oldShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
101 newShape.getValidAssumption().check(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
102 } catch (InvalidAssumptionException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
103 this.replace(next).executeBoolean(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
104 return; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
105 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
106 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
107 boolean condition = oldShape.check(receiver) && checkValue(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
108 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
109 if (condition) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
110 executeBooleanUnchecked(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
111 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
112 next.executeBoolean(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
113 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
114 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
115 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
116 @SuppressWarnings("unused") |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
117 protected boolean checkValue(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
118 return true; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
119 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
120 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
121 protected abstract void executeObjectUnchecked(DynamicObject receiver, Object value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
122 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
123 protected void executeLongUnchecked(DynamicObject receiver, long value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
124 executeObjectUnchecked(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
125 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
126 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
127 protected void executeBooleanUnchecked(DynamicObject receiver, boolean value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
128 executeObjectUnchecked(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
129 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
130 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
131 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
132 protected static class SLWriteObjectPropertyNode extends SLWritePropertyCacheChainNode { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
133 private final Location location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
134 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
135 protected SLWriteObjectPropertyNode(Shape oldShape, Shape newShape, Location location, SLWritePropertyCacheNode next) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
136 super(oldShape, newShape, next); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
137 this.location = location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
138 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
139 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
140 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
141 protected void executeObjectUnchecked(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
142 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
143 if (oldShape == newShape) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
144 location.set(receiver, value, oldShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
145 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
146 location.set(receiver, value, oldShape, newShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
147 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
148 } catch (IncompatibleLocationException | FinalLocationException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
149 replace(next).executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
150 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
151 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
152 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
153 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
154 protected boolean checkValue(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
155 return location.canSet(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
156 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
157 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
158 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
159 protected static class SLWriteBooleanPropertyNode extends SLWritePropertyCacheChainNode { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
160 private final BooleanLocation location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
161 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
162 protected SLWriteBooleanPropertyNode(Shape oldShape, Shape newShape, BooleanLocation location, SLWritePropertyCacheNode next) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
163 super(oldShape, newShape, next); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
164 this.location = location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
165 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
166 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
167 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
168 protected void executeObjectUnchecked(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
169 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
170 if (oldShape == newShape) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
171 location.set(receiver, value, oldShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
172 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
173 location.set(receiver, value, oldShape, newShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
174 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
175 } catch (IncompatibleLocationException | FinalLocationException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
176 replace(next).executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
177 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
178 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
179 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
180 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
181 protected void executeBooleanUnchecked(DynamicObject receiver, boolean value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
182 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
183 if (oldShape == newShape) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
184 location.setBoolean(receiver, value, oldShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
185 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
186 location.setBoolean(receiver, value, oldShape, newShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
187 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
188 } catch (FinalLocationException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
189 replace(next).executeBoolean(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
190 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
191 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
192 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
193 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
194 protected boolean checkValue(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
195 return value instanceof Boolean; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
196 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
197 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
198 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
199 protected static class SLWriteLongPropertyNode extends SLWritePropertyCacheChainNode { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
200 private final LongLocation location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
201 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
202 protected SLWriteLongPropertyNode(Shape oldShape, Shape newShape, LongLocation location, SLWritePropertyCacheNode next) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
203 super(oldShape, newShape, next); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
204 this.location = location; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
205 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
206 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
207 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
208 protected void executeObjectUnchecked(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
209 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
210 if (oldShape == newShape) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
211 location.set(receiver, value, oldShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
212 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
213 location.set(receiver, value, oldShape, newShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
214 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
215 } catch (IncompatibleLocationException | FinalLocationException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
216 replace(next).executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
217 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
218 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
219 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
220 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
221 protected void executeLongUnchecked(DynamicObject receiver, long value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
222 try { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
223 if (oldShape == newShape) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
224 location.setLong(receiver, value, oldShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
225 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
226 location.setLong(receiver, value, oldShape, newShape); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
227 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
228 } catch (FinalLocationException e) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
229 replace(next).executeLong(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
230 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
231 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
232 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
233 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
234 protected boolean checkValue(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
235 return value instanceof Long; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
236 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
237 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
238 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
239 protected static class SLUninitializedWritePropertyNode extends SLWritePropertyCacheNode { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
240 protected final String propertyName; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
241 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
242 protected SLUninitializedWritePropertyNode(String propertyName) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
243 this.propertyName = propertyName; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
244 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
245 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
246 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
247 public void executeObject(DynamicObject receiver, Object value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
248 CompilerDirectives.transferToInterpreterAndInvalidate(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
249 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
250 if (receiver.updateShape()) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
251 // shape changed, retry cache again |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
252 getTopNode().executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
253 return; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
254 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
255 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
256 Shape oldShape = receiver.getShape(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
257 Shape newShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
258 Property property = oldShape.getProperty(propertyName); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
259 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
260 final SLWritePropertyCacheNode resolvedNode; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
261 if (property != null && property.getLocation().canSet(receiver, value)) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
262 newShape = oldShape; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
263 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
264 receiver.define(propertyName, value, 0); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
265 newShape = receiver.getShape(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
266 property = newShape.getProperty(propertyName); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
267 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
268 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
269 if (property.getLocation() instanceof LongLocation) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
270 resolvedNode = new SLWriteLongPropertyNode(oldShape, newShape, (LongLocation) property.getLocation(), this); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
271 } else if (property.getLocation() instanceof BooleanLocation) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
272 resolvedNode = new SLWriteBooleanPropertyNode(oldShape, newShape, (BooleanLocation) property.getLocation(), this); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
273 } else { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
274 resolvedNode = new SLWriteObjectPropertyNode(oldShape, newShape, property.getLocation(), this); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
275 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
276 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
277 this.replace(resolvedNode, "resolved '" + propertyName + "'").executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
278 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
279 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
280 private SLWritePropertyCacheNode getTopNode() { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
281 SLWritePropertyCacheNode top = this; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
282 while (top.getParent() instanceof SLWritePropertyCacheNode) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
283 top = (SLWritePropertyCacheNode) top.getParent(); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
284 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
285 return top; |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
286 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
287 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
288 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
289 public void executeLong(DynamicObject receiver, long value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
290 executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
291 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
292 |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
293 @Override |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
294 public void executeBoolean(DynamicObject receiver, boolean value) { |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
295 executeObject(receiver, value); |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
296 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
297 } |
997bc9764a9a
SL: use the truffle object storage model to represent SL objects
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
298 } |