Skip to content

Commit 68a0634

Browse files
committed
Remove unneded indirect context
1 parent 1cb0488 commit 68a0634

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@
208208
import com.oracle.graal.python.nodes.util.CastToJavaStringNodeGen;
209209
import com.oracle.graal.python.nodes.util.SplitArgsNode;
210210
import com.oracle.graal.python.runtime.ExecutionContext.ForeignCallContext;
211-
import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext;
212211
import com.oracle.graal.python.runtime.PythonContext;
213212
import com.oracle.graal.python.runtime.PythonCore;
214213
import com.oracle.graal.python.runtime.exception.PException;
@@ -2879,18 +2878,12 @@ Object methodBuiltin(@SuppressWarnings("unused") Object cls, PBuiltinFunction fu
28792878
}
28802879

28812880
@Specialization
2882-
Object methodGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object cls, Object func, Object self,
2881+
Object methodGeneric(@SuppressWarnings("unused") Object cls, Object func, Object self,
28832882
@CachedLibrary(limit = "3") PythonObjectLibrary dataModelLibrary) {
2884-
PythonContext context = getContextRef().get();
2885-
Object state = IndirectCallContext.enter(frame, context, this);
2886-
try {
2887-
if (dataModelLibrary.isCallable(func)) {
2888-
return factory().createMethod(self, func);
2889-
} else {
2890-
throw raise(TypeError, ErrorMessages.FIRST_ARG_MUST_BE_CALLABLE);
2891-
}
2892-
} finally {
2893-
IndirectCallContext.exit(frame, context, state);
2883+
if (dataModelLibrary.isCallable(func)) {
2884+
return factory().createMethod(self, func);
2885+
} else {
2886+
throw raise(TypeError, ErrorMessages.FIRST_ARG_MUST_BE_CALLABLE);
28942887
}
28952888
}
28962889
}
@@ -3061,8 +3054,8 @@ Object initArgs(Object cls, Object[] args, @SuppressWarnings("unused") PKeyword[
30613054
@Builtin(name = "mappingproxy", constructsClass = PythonBuiltinClassType.PMappingproxy, isPublic = false, minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2)
30623055
@GenerateNodeFactory
30633056
public abstract static class MappingproxyNode extends PythonBuiltinNode {
3064-
@Specialization(guards = "isMapping(frame, obj, lib)", limit = "1")
3065-
Object doMapping(@SuppressWarnings("unused") VirtualFrame frame, Object klass, PythonObject obj,
3057+
@Specialization(guards = "isMapping(obj, lib)", limit = "1")
3058+
Object doMapping(Object klass, PythonObject obj,
30663059
@SuppressWarnings("unused") @CachedLibrary("obj") PythonObjectLibrary lib) {
30673060
return factory().createMappingproxy(klass, obj);
30683061
}
@@ -3073,23 +3066,17 @@ Object doMissing(Object klass, PNone none) {
30733066
throw raise(TypeError, ErrorMessages.MISSING_D_REQUIRED_S_ARGUMENT_S_POS, "mappingproxy()", "mapping", 1);
30743067
}
30753068

3076-
@Specialization(guards = {"!isMapping(frame, obj, lib)", "!isNoValue(obj)"}, limit = "1")
3077-
Object doInvalid(@SuppressWarnings("unused") VirtualFrame frame, @SuppressWarnings("unused") Object klass, Object obj,
3069+
@Specialization(guards = {"!isMapping(obj, lib)", "!isNoValue(obj)"}, limit = "1")
3070+
Object doInvalid(@SuppressWarnings("unused") Object klass, Object obj,
30783071
@SuppressWarnings("unused") @CachedLibrary("obj") PythonObjectLibrary lib) {
30793072
throw raise(TypeError, ErrorMessages.ARG_MUST_BE_S_NOT_P, "mappingproxy()", "mapping", obj);
30803073
}
30813074

3082-
protected boolean isMapping(VirtualFrame frame, Object o, PythonObjectLibrary library) {
3083-
PythonContext context = getContextRef().get();
3075+
protected boolean isMapping(Object o, PythonObjectLibrary library) {
30843076
if (o instanceof PList || o instanceof PTuple) {
30853077
return false;
30863078
}
3087-
Object state = IndirectCallContext.enter(frame, context, this);
3088-
try {
3089-
return library.isMapping(o);
3090-
} finally {
3091-
IndirectCallContext.exit(frame, context, state);
3092-
}
3079+
return library.isMapping(o);
30933080
}
30943081
}
30953082

0 commit comments

Comments
 (0)