|
22 | 22 | */
|
23 | 23 | package com.oracle.truffle.espresso.nodes;
|
24 | 24 |
|
25 |
| -import com.oracle.truffle.api.CompilerDirectives; |
26 | 25 | import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
|
27 | 26 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
28 | 27 | import com.oracle.truffle.api.TruffleLanguage;
|
|
42 | 41 | final class SubstitutionScope implements TruffleObject {
|
43 | 42 | @CompilationFinal(dimensions = 1) private final Object[] args;
|
44 | 43 | private final Method method;
|
45 |
| - @CompilationFinal(dimensions = 1) private String[] paramNames; |
| 44 | + private String[] paramNames; |
46 | 45 |
|
47 | 46 | SubstitutionScope(Object[] arguments, Method.MethodVersion method) {
|
48 | 47 | this.args = arguments;
|
@@ -88,7 +87,6 @@ Object readMember(String member) throws UnknownIdentifierException {
|
88 | 87 | // so this branch should rarely be taken.
|
89 | 88 | String[] names = paramNames;
|
90 | 89 | if (names == null) {
|
91 |
| - CompilerDirectives.transferToInterpreterAndInvalidate(); |
92 | 90 | names = paramNames = fetchNames();
|
93 | 91 | }
|
94 | 92 | for (int i = 0; i < names.length; i++) {
|
@@ -140,19 +138,32 @@ Object getMembers(@SuppressWarnings("unused") boolean includeInternal) throws Un
|
140 | 138 | }
|
141 | 139 |
|
142 | 140 | @ExportMessage
|
143 |
| - boolean isMemberReadable(@SuppressWarnings("unused") String member) { |
| 141 | + @TruffleBoundary |
| 142 | + boolean isMemberReadable(String member) { |
144 | 143 | try {
|
145 | 144 | int index = Integer.parseInt(member);
|
146 | 145 | return 0 <= index && index < args.length;
|
147 | 146 | } catch (NumberFormatException e) {
|
| 147 | + // OK, see if we have parameter names as a fallback. |
| 148 | + // The main use case which is JDWP doesn't use anything but slots, |
| 149 | + // so this branch should rarely be taken. |
| 150 | + String[] names = paramNames; |
| 151 | + if (names == null) { |
| 152 | + names = paramNames = fetchNames(); |
| 153 | + } |
| 154 | + for (String name : names) { |
| 155 | + if (name.equals(member)) { |
| 156 | + return true; |
| 157 | + } |
| 158 | + } |
148 | 159 | return false;
|
149 | 160 | }
|
150 | 161 | }
|
151 | 162 |
|
152 | 163 | @ExportMessage
|
153 | 164 | @SuppressWarnings("static-method")
|
154 | 165 | Object toDisplayString(@SuppressWarnings("unused") boolean allowSideEffects) {
|
155 |
| - return "<intrinsified>"; |
| 166 | + return method.getNameAsString(); |
156 | 167 | }
|
157 | 168 |
|
158 | 169 | }
|
0 commit comments