Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java @ 7530:5e3d1a68664e
applied mx eclipseformat to all Java files
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 23 Jan 2013 16:34:57 +0100 |
parents | dc3e86fd3be1 |
children | 1a2d258d481a |
comparison
equal
deleted
inserted
replaced
7529:4a11124a3563 | 7530:5e3d1a68664e |
---|---|
47 this.descriptor = descriptor; | 47 this.descriptor = descriptor; |
48 this.caller = caller; | 48 this.caller = caller; |
49 this.arguments = arguments; | 49 this.arguments = arguments; |
50 this.currentVersion = descriptor.getCurrentVersion(); | 50 this.currentVersion = descriptor.getCurrentVersion(); |
51 this.locals = new Object[descriptor.getSize()]; | 51 this.locals = new Object[descriptor.getSize()]; |
52 // The tags are only needed for assertion checking, so initialize the field only when assertions are enabled | 52 // The tags are only needed for assertion checking, so initialize the field only when |
53 // assertions are enabled | |
53 assert (this.tags = new Class[descriptor.getSize()]) != null; | 54 assert (this.tags = new Class[descriptor.getSize()]) != null; |
54 } | 55 } |
55 | 56 |
56 @Override | 57 @Override |
57 public Arguments getArguments() { | 58 public Arguments getArguments() { |
131 @Override | 132 @Override |
132 public void setDouble(FrameSlot slot, double value) { | 133 public void setDouble(FrameSlot slot, double value) { |
133 set(slot, Double.class, value); | 134 set(slot, Double.class, value); |
134 } | 135 } |
135 | 136 |
136 private Object get(FrameSlot slot, Class< ? > accessType, Object defaultValue) { | 137 private Object get(FrameSlot slot, Class<?> accessType, Object defaultValue) { |
137 Object value = locals[slot.getIndex()]; | 138 Object value = locals[slot.getIndex()]; |
138 assert verifyGet(slot, accessType, value); | 139 assert verifyGet(slot, accessType, value); |
139 if (value == null) { | 140 if (value == null) { |
140 return defaultValue; | 141 return defaultValue; |
141 } else { | 142 } else { |
142 return value; | 143 return value; |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
146 private boolean verifyGet(FrameSlot slot, Class< ? > accessType, Object value) { | 147 private boolean verifyGet(FrameSlot slot, Class<?> accessType, Object value) { |
147 assert descriptor.getSlots().get(slot.getIndex()) == slot; | 148 assert descriptor.getSlots().get(slot.getIndex()) == slot; |
148 Class< ? > tag = tags[slot.getIndex()]; | 149 Class<?> tag = tags[slot.getIndex()]; |
149 if (value == null) { | 150 if (value == null) { |
150 assert tag == null || tag == Object.class; | 151 assert tag == null || tag == Object.class; |
151 } else { | 152 } else { |
152 assert tag == accessType : "Local variable " + slot + " was written with set" + tag.getSimpleName() + ", but is read with get" + accessType.getSimpleName(); | 153 assert tag == accessType : "Local variable " + slot + " was written with set" + tag.getSimpleName() + ", but is read with get" + accessType.getSimpleName(); |
153 } | 154 } |
154 return true; | 155 return true; |
155 } | 156 } |
156 | 157 |
157 private void set(FrameSlot slot, Class< ? > accessType, Object value) { | 158 private void set(FrameSlot slot, Class<?> accessType, Object value) { |
158 assert verifySet(slot, accessType, value); | 159 assert verifySet(slot, accessType, value); |
159 locals[slot.getIndex()] = value; | 160 locals[slot.getIndex()] = value; |
160 } | 161 } |
161 | 162 |
162 private boolean verifySet(FrameSlot slot, Class< ? > accessType, Object value) { | 163 private boolean verifySet(FrameSlot slot, Class<?> accessType, Object value) { |
163 assert descriptor.getSlots().get(slot.getIndex()) == slot; | 164 assert descriptor.getSlots().get(slot.getIndex()) == slot; |
164 tags[slot.getIndex()] = accessType; | 165 tags[slot.getIndex()] = accessType; |
165 assert accessType.isAssignableFrom(slot.getType()) : "Local variable " + slot + ": " + accessType + " is not assignable from " + slot.getType(); | 166 assert accessType.isAssignableFrom(slot.getType()) : "Local variable " + slot + ": " + accessType + " is not assignable from " + slot.getType(); |
166 if (value == null) { | 167 if (value == null) { |
167 assert accessType == Object.class; | 168 assert accessType == Object.class; |