Author: Ronan Lamy <[email protected]>
Branch: annotator
Changeset: r68744:71ea2dd65784
Date: 2014-01-17 02:14 +0000
http://bitbucket.org/pypy/pypy/changeset/71ea2dd65784/

Log:    move appcall() out of FlowObjSpace

diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -576,6 +576,11 @@
     def getname_w(self, index):
         return Constant(self.pycode.names[index])
 
+    def appcall(self, func, *args_w):
+        """Call an app-level RPython function directly"""
+        w_func = const(func)
+        return op.simple_call(w_func, *args_w).eval(self)
+
     def BAD_OPCODE(self, _):
         raise FlowingError("This operation is not RPython")
 
@@ -781,10 +786,10 @@
     def PRINT_ITEM(self, oparg):
         w_item = self.popvalue()
         w_s = op.str(w_item).eval(self)
-        self.space.appcall(rpython_print_item, w_s)
+        self.appcall(rpython_print_item, w_s)
 
     def PRINT_NEWLINE(self, oparg):
-        self.space.appcall(rpython_print_newline)
+        self.appcall(rpython_print_newline)
 
     def JUMP_FORWARD(self, target):
         return target
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -45,11 +45,6 @@
         args = CallSpec(list(args_w))
         return self.call(w_func, args)
 
-    def appcall(self, func, *args_w):
-        """Call an app-level RPython function directly"""
-        w_func = const(func)
-        return op.simple_call(w_func, *args_w).eval(self.frame)
-
     def call(self, w_callable, args):
         if isinstance(w_callable, Constant):
             fn = w_callable.value
diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
--- a/rpython/flowspace/specialcase.py
+++ b/rpython/flowspace/specialcase.py
@@ -35,12 +35,12 @@
 def sc_isinstance(space, w_instance, w_type):
     if w_instance.foldable() and w_type.foldable():
         return const(isinstance(w_instance.value, w_type.value))
-    return space.appcall(isinstance, w_instance, w_type)
+    return space.frame.appcall(isinstance, w_instance, w_type)
 
 @register_flow_sc(getattr)
 def sc_getattr(space, w_obj, w_index, w_default=None):
     if w_default is not None:
-        return space.appcall(getattr, w_obj, w_index, w_default)
+        return space.frame.appcall(getattr, w_obj, w_index, w_default)
     else:
         from rpython.flowspace.operation import op
         return op.getattr(w_obj, w_index).eval(space.frame)
@@ -48,18 +48,18 @@
 @register_flow_sc(open)
 def sc_open(space, *args_w):
     from rpython.rlib.rfile import create_file
-    return space.appcall(create_file, *args_w)
+    return space.frame.appcall(create_file, *args_w)
 
 @register_flow_sc(os.tmpfile)
 def sc_os_tmpfile(space):
     from rpython.rlib.rfile import create_temp_rfile
-    return space.appcall(create_temp_rfile)
+    return space.frame.appcall(create_temp_rfile)
 
 @register_flow_sc(os.remove)
 def sc_os_remove(space, *args_w):
     # on top of PyPy only: 'os.remove != os.unlink'
     # (on CPython they are '==', but not identical either)
-    return space.appcall(os.unlink, *args_w)
+    return space.frame.appcall(os.unlink, *args_w)
 
 # _________________________________________________________________________
 # a simplified version of the basic printing routines, for RPython programs
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -521,7 +521,7 @@
     # show up in the flow graphs at all)
     if isinstance(w_value, Constant):
         return Constant(r_uint(w_value.value))
-    return space.appcall(r_uint, w_value)
+    return space.frame.appcall(r_uint, w_value)
 
 
 r_longlong = build_int('r_longlong', True, 64)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to