Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/local/SLReadLocalVariableNode.java @ 13882:afd6fa5e8229
SL: Feedback from reviewers
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 05 Feb 2014 08:02:15 -0800 |
parents | 64c77f0577bb |
children | 89ac75425681 |
comparison
equal
deleted
inserted
replaced
13881:272a166a9574 | 13882:afd6fa5e8229 |
---|---|
31 * allows to store primitive values of all Java primitive types, and Object values. This means that | 31 * allows to store primitive values of all Java primitive types, and Object values. This means that |
32 * all SL types that are objects are handled by the {@link #readObject} method. When a local | 32 * all SL types that are objects are handled by the {@link #readObject} method. When a local |
33 * variable changes its type, the frame access method throws an {@link FrameSlotTypeException}, | 33 * variable changes its type, the frame access method throws an {@link FrameSlotTypeException}, |
34 * which causes not rewriting. The rewriting code is generated by the Truffle DSL. | 34 * which causes not rewriting. The rewriting code is generated by the Truffle DSL. |
35 */ | 35 */ |
36 @PolymorphicLimit(1) | |
37 @NodeField(name = "slot", type = FrameSlot.class) | 36 @NodeField(name = "slot", type = FrameSlot.class) |
38 public abstract class SLReadLocalVariableNode extends SLExpressionNode { | 37 public abstract class SLReadLocalVariableNode extends SLExpressionNode { |
39 | 38 |
40 /** | 39 /** |
41 * Returns the descriptor of the accessed local variable. The implementation of this method is | 40 * Returns the descriptor of the accessed local variable. The implementation of this method is |
51 @Specialization(rewriteOn = {FrameSlotTypeException.class}) | 50 @Specialization(rewriteOn = {FrameSlotTypeException.class}) |
52 protected boolean readBoolean(VirtualFrame frame) throws FrameSlotTypeException { | 51 protected boolean readBoolean(VirtualFrame frame) throws FrameSlotTypeException { |
53 return frame.getBoolean(getSlot()); | 52 return frame.getBoolean(getSlot()); |
54 } | 53 } |
55 | 54 |
56 @Specialization(rewriteOn = {FrameSlotTypeException.class}) | 55 @Specialization(order = 1, rewriteOn = {FrameSlotTypeException.class}) |
57 protected Object readObject(VirtualFrame frame) throws FrameSlotTypeException { | 56 protected Object readObject(VirtualFrame frame) throws FrameSlotTypeException { |
58 return frame.getObject(getSlot()); | 57 return frame.getObject(getSlot()); |
59 } | 58 } |
60 | 59 |
61 @Generic | 60 /** |
62 protected Object readGeneric(VirtualFrame frame) { | 61 * This is the generic case that always succeeds. Since we already have another specialization |
62 * with the same signature above, we need to order them explicitly with the order attribute. | |
63 */ | |
64 @Specialization(order = 2) | |
65 protected Object read(VirtualFrame frame) { | |
63 return frame.getValue(getSlot()); | 66 return frame.getValue(getSlot()); |
64 } | 67 } |
65 } | 68 } |