Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/local/SLReadLocalVariableNode.java Wed Feb 05 15:50:36 2014 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/local/SLReadLocalVariableNode.java Wed Feb 05 08:02:15 2014 -0800 @@ -33,7 +33,6 @@ * variable changes its type, the frame access method throws an {@link FrameSlotTypeException}, * which causes not rewriting. The rewriting code is generated by the Truffle DSL. */ -@PolymorphicLimit(1) @NodeField(name = "slot", type = FrameSlot.class) public abstract class SLReadLocalVariableNode extends SLExpressionNode { @@ -53,13 +52,17 @@ return frame.getBoolean(getSlot()); } - @Specialization(rewriteOn = {FrameSlotTypeException.class}) + @Specialization(order = 1, rewriteOn = {FrameSlotTypeException.class}) protected Object readObject(VirtualFrame frame) throws FrameSlotTypeException { return frame.getObject(getSlot()); } - @Generic - protected Object readGeneric(VirtualFrame frame) { + /** + * This is the generic case that always succeeds. Since we already have another specialization + * with the same signature above, we need to order them explicitly with the order attribute. + */ + @Specialization(order = 2) + protected Object read(VirtualFrame frame) { return frame.getValue(getSlot()); } }