[pypy-svn] r77825 - pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt

antocuni at codespeak.net antocuni at codespeak.net
Tue Oct 12 13:35:23 CEST 2010


Author: antocuni
Date: Tue Oct 12 13:35:21 2010
New Revision: 77825

Modified:
   pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/fficall.py
Log:
simplify the logic, fix it when effectinfo is None, enable the optimization when translated


Modified: pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/fficall.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/fficall.py	(original)
+++ pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/fficall.py	Tue Oct 12 13:35:21 2010
@@ -61,19 +61,14 @@
     def __init__(self):
         self.func_infos = {}
 
-    def optimize_CALL(self, op):
-        if we_are_translated():
-            self.emit_operation(op)
-            return
-        #
+    def _get_oopspec(self, op):
         effectinfo = op.getdescr().get_extra_info()
-        oopspec = effectinfo.oopspecindex
-        if oopspec not in (EffectInfo.OS_LIBFFI_PREPARE,
-                           EffectInfo.OS_LIBFFI_PUSH_ARG,
-                           EffectInfo.OS_LIBFFI_CALL):
-            self.emit_operation(op) # normal case
-            return
-        #
+        if effectinfo is not None:
+            return effectinfo.oopspecindex
+        return EffectInfo.OS_NONE
+
+    def optimize_CALL(self, op):
+        oopspec = self._get_oopspec(op)
         try:
             if oopspec == EffectInfo.OS_LIBFFI_PREPARE:
                 self.do_prepare_call(op)
@@ -82,7 +77,10 @@
             elif oopspec == EffectInfo.OS_LIBFFI_CALL:
                 op = self.do_call(op)
                 self.emit_operation(op)
+            else:
+                raise NonConstantFuncVal # it's not a libffi call
         except NonConstantFuncVal:
+            # normal case
             self.emit_operation(op)
 
     def _get_funcval(self, op):



More information about the Pypy-commit mailing list