|
14 | 14 | import com.oracle.truffle.api.Truffle;
|
15 | 15 | import com.oracle.truffle.api.dsl.Cached;
|
16 | 16 | import com.oracle.truffle.api.dsl.CreateCast;
|
| 17 | +import com.oracle.truffle.api.dsl.Fallback; |
17 | 18 | import com.oracle.truffle.api.dsl.NodeChild;
|
18 | 19 | import com.oracle.truffle.api.dsl.NodeChildren;
|
19 | 20 | import com.oracle.truffle.api.dsl.Specialization;
|
@@ -1316,7 +1317,7 @@ protected WrapNode createWrapNode() {
|
1316 | 1317 | public abstract static class UnwrapValueNode extends CoreMethodArrayArgumentsNode {
|
1317 | 1318 |
|
1318 | 1319 | @Specialization
|
1319 |
| - public Object unwrap(Object value, |
| 1320 | + public Object unwrap(TruffleObject value, |
1320 | 1321 | @Cached("create()") BranchProfile exceptionProfile,
|
1321 | 1322 | @Cached("createUnwrapNode()") UnwrapNode unwrapNode) {
|
1322 | 1323 | Object object = unwrapNode.execute(value);
|
@@ -1359,7 +1360,7 @@ protected void setThreadLocal() {
|
1359 | 1360 | public abstract static class AddToMarkList extends CoreMethodArrayArgumentsNode {
|
1360 | 1361 |
|
1361 | 1362 | @Specialization
|
1362 |
| - public DynamicObject addToMarkList(VirtualFrame frmae, Object markedObject, |
| 1363 | + public DynamicObject addToMarkList(VirtualFrame frmae, TruffleObject markedObject, |
1363 | 1364 | @Cached("create()") BranchProfile exceptionProfile,
|
1364 | 1365 | @Cached("create()") BranchProfile noExceptionProfile,
|
1365 | 1366 | @Cached("create()") UnwrapNode.ToWrapperNode toWrapperNode) {
|
@@ -1388,21 +1389,21 @@ protected UnwrapNode createUnwrapNode() {
|
1388 | 1389 | public abstract static class GCGuardNode extends CoreMethodArrayArgumentsNode {
|
1389 | 1390 |
|
1390 | 1391 | @Specialization
|
1391 |
| - public DynamicObject addToMarkList(VirtualFrame frmae, Object guardedObject, |
1392 |
| - @Cached("create()") BranchProfile exceptionProfile, |
| 1392 | + public DynamicObject addToMarkList(VirtualFrame frmae, TruffleObject guardedObject, |
| 1393 | + @Cached("create()") BranchProfile noExceptionProfile, |
1393 | 1394 | @Cached("create()") UnwrapNode.ToWrapperNode toWrapperNode) {
|
1394 | 1395 | ValueWrapper wrappedValue = toWrapperNode.execute(guardedObject);
|
1395 |
| - if (wrappedValue == null) { |
1396 |
| - exceptionProfile.enter(); |
1397 |
| - throw new RaiseException(getContext(), coreExceptions().runtimeError(exceptionMessage(guardedObject), this)); |
| 1396 | + if (wrappedValue != null) { |
| 1397 | + noExceptionProfile.enter(); |
| 1398 | + getContext().getMarkingService().keepObject(guardedObject); |
1398 | 1399 | }
|
1399 |
| - getContext().getMarkingService().keepObject(guardedObject); |
1400 | 1400 | return nil();
|
1401 | 1401 | }
|
1402 | 1402 |
|
1403 |
| - @TruffleBoundary |
1404 |
| - private String exceptionMessage(Object value) { |
1405 |
| - return String.format("native handle not found (%s) to guard it", value); |
| 1403 | + @Fallback |
| 1404 | + public DynamicObject addToMarkList(VirtualFrame frmae, Object guardedObject) { |
| 1405 | + // Do nothing for unexpected objects, no matter how unexpected. |
| 1406 | + return nil(); |
1406 | 1407 | }
|
1407 | 1408 |
|
1408 | 1409 | protected UnwrapNode createUnwrapNode() {
|
|
0 commit comments