|
116 | 116 | import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile; |
117 | 117 | import com.oracle.graal.python.nodes.subscript.SliceLiteralNode; |
118 | 118 | import com.oracle.graal.python.nodes.truffle.PythonTypes; |
| 119 | +import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext; |
119 | 120 | import com.oracle.graal.python.runtime.PythonContext; |
120 | 121 | import com.oracle.graal.python.runtime.exception.PException; |
121 | 122 | import com.oracle.truffle.api.CompilerDirectives; |
@@ -1000,18 +1001,21 @@ static Object doSequence(VirtualFrame frame, Object obj, |
1000 | 1001 | } |
1001 | 1002 |
|
1002 | 1003 | @Specialization(guards = "isNativeObject(obj)") |
1003 | | - static Object doNative(VirtualFrame frame, Object obj, |
| 1004 | + Object doNative(VirtualFrame frame, Object obj, |
1004 | 1005 | @Cached ToSulongNode toSulongNode, |
1005 | 1006 | @Cached PCallCapiFunction callCapiFunction, |
1006 | 1007 | @Cached CheckPrimitiveFunctionResultNode checkFunctionResultNode, |
1007 | 1008 | @Cached TransformExceptionToNativeNode transformExceptionToNativeNode) { |
| 1009 | + Object state = IndirectCallContext.enter(frame, this); |
1008 | 1010 | try { |
1009 | 1011 | Object result = callCapiFunction.call(FUN_PY_TRUFFLE_PY_SEQUENCE_SIZE, toSulongNode.execute(obj)); |
1010 | 1012 | checkFunctionResultNode.execute(PythonContext.get(callCapiFunction), FUN_PY_TRUFFLE_PY_SEQUENCE_SIZE.getName(), result); |
1011 | 1013 | return result; |
1012 | 1014 | } catch (PException e) { |
1013 | 1015 | transformExceptionToNativeNode.execute(frame, e); |
1014 | 1016 | return -1; |
| 1017 | + } finally { |
| 1018 | + IndirectCallContext.exit(frame, this, state); |
1015 | 1019 | } |
1016 | 1020 | } |
1017 | 1021 |
|
@@ -1071,19 +1075,22 @@ static int doGenericUnboxed(VirtualFrame frame, Object obj, |
1071 | 1075 | } |
1072 | 1076 |
|
1073 | 1077 | @Specialization(guards = {"isNativeObject(obj)"}) |
1074 | | - static Object size(VirtualFrame frame, Object obj, |
| 1078 | + Object size(VirtualFrame frame, Object obj, |
1075 | 1079 | @Cached ToSulongNode toSulongNode, |
1076 | 1080 | @Cached AsPythonObjectNode asPythonObjectNode, |
1077 | 1081 | @Cached PCallCapiFunction callCapiFunction, |
1078 | 1082 | @Cached CheckPrimitiveFunctionResultNode checkFunctionResultNode, |
1079 | 1083 | @Cached TransformExceptionToNativeNode transformExceptionToNativeNode) { |
| 1084 | + Object state = IndirectCallContext.enter(frame, this); |
1080 | 1085 | try { |
1081 | 1086 | Object result = callCapiFunction.call(FUN_PY_TRUFFLE_PY_OBJECT_SIZE, toSulongNode.execute(obj)); |
1082 | 1087 | checkFunctionResultNode.execute(PythonContext.get(callCapiFunction), FUN_PY_TRUFFLE_PY_OBJECT_SIZE.getName(), result); |
1083 | 1088 | return result; |
1084 | 1089 | } catch (PException e) { |
1085 | 1090 | transformExceptionToNativeNode.execute(frame, e); |
1086 | 1091 | return -1; |
| 1092 | + } finally { |
| 1093 | + IndirectCallContext.exit(frame, this, state); |
1087 | 1094 | } |
1088 | 1095 | } |
1089 | 1096 | } |
|
0 commit comments