Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java @ 14991:64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 06 Apr 2014 17:46:24 +0200 |
parents | a08b8694f556 |
children | 5148aab962af |
comparison
equal
deleted
inserted
replaced
14989:a0dbb3628f2a | 14991:64dcb92ee75a |
---|---|
111 public E getNode() { | 111 public E getNode() { |
112 return node; | 112 return node; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 public static class TestArguments extends Arguments { | |
117 | |
118 private final Object[] values; | |
119 | |
120 public TestArguments(Object... values) { | |
121 this.values = values; | |
122 } | |
123 | |
124 public Object[] getValues() { | |
125 return values; | |
126 } | |
127 | |
128 public Object get(int index) { | |
129 return values[index]; | |
130 } | |
131 | |
132 } | |
133 | |
134 public static class ArgumentNode extends ValueNode { | 116 public static class ArgumentNode extends ValueNode { |
135 | 117 |
136 private int invocationCount; | 118 private int invocationCount; |
137 final int index; | 119 final int index; |
138 | 120 |
145 } | 127 } |
146 | 128 |
147 @Override | 129 @Override |
148 public Object execute(VirtualFrame frame) { | 130 public Object execute(VirtualFrame frame) { |
149 invocationCount++; | 131 invocationCount++; |
150 return frame.getArguments(TestArguments.class).get(index); | 132 return frame.getArguments()[index]; |
151 } | 133 } |
152 | 134 |
153 @Override | 135 @Override |
154 public int executeInt(VirtualFrame frame) throws UnexpectedResultException { | 136 public int executeInt(VirtualFrame frame) throws UnexpectedResultException { |
155 // avoid casts for some tests | 137 // avoid casts for some tests |
156 Object o = frame.getArguments(TestArguments.class).get(index); | 138 Object o = frame.getArguments()[index]; |
157 if (o instanceof Integer) { | 139 if (o instanceof Integer) { |
158 return (int) o; | 140 return (int) o; |
159 } | 141 } |
160 throw new UnexpectedResultException(o); | 142 throw new UnexpectedResultException(o); |
161 } | 143 } |