Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReadLocalNode.java @ 12752:71991b7a0f14
SL: Enhanced SimpleLanguage with support for if statements, function calls, function caching + inlining and builtins.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Nov 2013 21:34:44 +0100 |
parents | 269e6794e1ec |
children |
comparison
equal
deleted
inserted
replaced
12712:882a0aadfed6 | 12752:71991b7a0f14 |
---|---|
23 package com.oracle.truffle.sl.nodes; | 23 package com.oracle.truffle.sl.nodes; |
24 | 24 |
25 import com.oracle.truffle.api.dsl.*; | 25 import com.oracle.truffle.api.dsl.*; |
26 import com.oracle.truffle.api.frame.*; | 26 import com.oracle.truffle.api.frame.*; |
27 | 27 |
28 @PolymorphicLimit(1) | |
28 public abstract class ReadLocalNode extends FrameSlotNode { | 29 public abstract class ReadLocalNode extends FrameSlotNode { |
29 | 30 |
30 public ReadLocalNode(FrameSlot slot) { | 31 public ReadLocalNode(FrameSlot slot) { |
31 super(slot); | 32 super(slot); |
32 } | 33 } |
43 @Specialization(rewriteOn = {FrameSlotTypeException.class}) | 44 @Specialization(rewriteOn = {FrameSlotTypeException.class}) |
44 public boolean doBoolean(VirtualFrame frame) throws FrameSlotTypeException { | 45 public boolean doBoolean(VirtualFrame frame) throws FrameSlotTypeException { |
45 return frame.getBoolean(slot); | 46 return frame.getBoolean(slot); |
46 } | 47 } |
47 | 48 |
48 @Specialization | 49 @Specialization(rewriteOn = {FrameSlotTypeException.class}) |
49 public Object doObject(VirtualFrame frame) { | 50 public Object doObject(VirtualFrame frame) throws FrameSlotTypeException { |
50 try { | 51 return frame.getObject(slot); |
51 return frame.getObject(slot); | 52 } |
52 } catch (FrameSlotTypeException e) { | 53 |
53 throw new IllegalStateException(); | 54 @Generic |
54 } | 55 public Object doGeneric(VirtualFrame frame) { |
56 return frame.getValue(slot); | |
55 } | 57 } |
56 | 58 |
57 } | 59 } |