|
64 | 64 | @GenerateUncached |
65 | 65 | public abstract class ToEspressoNode extends EspressoNode { |
66 | 66 |
|
| 67 | + public abstract Object execute(Object value, Klass targetType) throws UnsupportedTypeException; |
| 68 | + |
67 | 69 | public static final int LIMIT = 2; |
68 | 70 |
|
69 | 71 | // region Specialization predicates |
@@ -137,11 +139,6 @@ static boolean isBoxedPrimitive(Object obj) { |
137 | 139 | return obj instanceof Number || obj instanceof Character || obj instanceof Boolean; |
138 | 140 | } |
139 | 141 |
|
140 | | - static boolean isForeignException(Klass klass) { |
141 | | - Meta meta = klass.getMeta(); |
142 | | - return meta.polyglot != null /* polyglot enabled */ && meta.polyglot.ForeignException.equals(klass); |
143 | | - } |
144 | | - |
145 | 142 | static boolean isIntegerCompatible(Klass klass) { |
146 | 143 | return klass.isAssignableFrom(klass.getMeta().java_lang_Integer); |
147 | 144 | } |
@@ -188,8 +185,6 @@ static boolean isHostObject(EspressoContext context, Object value) { |
188 | 185 |
|
189 | 186 | // endregion Specialization predicates |
190 | 187 |
|
191 | | - public abstract Object execute(Object value, Klass targetType) throws UnsupportedTypeException; |
192 | | - |
193 | 188 | @Specialization(guards = "!isPrimitiveKlass(klass)") |
194 | 189 | Object doEspresso(StaticObject value, Klass klass, |
195 | 190 | @Cached BranchProfile exceptionProfile, |
@@ -545,6 +540,10 @@ Object doForeignClassProxy(Object value, ObjectKlass klass, |
545 | 540 | } |
546 | 541 | } else { |
547 | 542 | if (klass == meta.java_lang_Object) { |
| 543 | + // check if foreign exception |
| 544 | + if (interop.isException(value)) { |
| 545 | + return StaticObject.createForeignException(klass.getContext(), value, interop); |
| 546 | + } |
548 | 547 | // see if a generated proxy can be used for interface mapped types |
549 | 548 | ObjectKlass proxyKlass = lookupProxyKlassNode.execute(metaObject, metaName, klass); |
550 | 549 | if (proxyKlass != null) { |
|
0 commit comments