[pypy-svn] pypy out-of-line-guards: Directly take jit_invariant data from readwrite_analyzer and don't analyze

fijal commits-noreply at bitbucket.org
Sun Jan 2 19:39:19 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40331:7f28490ac678
Date: 2011-01-02 20:38 +0200
http://bitbucket.org/pypy/pypy/changeset/7f28490ac678/

Log:	Directly take jit_invariant data from readwrite_analyzer and don't
	analyze it again

diff --git a/pypy/jit/codewriter/call.py b/pypy/jit/codewriter/call.py
--- a/pypy/jit/codewriter/call.py
+++ b/pypy/jit/codewriter/call.py
@@ -6,14 +6,12 @@
 from pypy.jit.codewriter import support
 from pypy.jit.codewriter.jitcode import JitCode
 from pypy.jit.codewriter.effectinfo import VirtualizableAnalyzer
-from pypy.jit.codewriter.effectinfo import JitInvariantAnalyzer
 from pypy.jit.codewriter.effectinfo import effectinfo_from_writeanalyze
 from pypy.jit.codewriter.effectinfo import EffectInfo, CallInfoCollection
 from pypy.translator.simplify import get_funcobj, get_functype
 from pypy.rpython.lltypesystem import lltype, llmemory
 from pypy.translator.backendopt.canraise import RaiseAnalyzer
-from pypy.translator.backendopt.writeanalyze import ReadWriteAnalyzer
-
+from pypy.translator.backendopt.writeanalyze import ReadWriteAnalyzer, top_set
 
 class CallControl(object):
     virtualref_info = None     # optionally set from outside
@@ -31,7 +29,6 @@
             self.raise_analyzer = RaiseAnalyzer(translator)
             self.readwrite_analyzer = ReadWriteAnalyzer(translator)
             self.virtualizable_analyzer = VirtualizableAnalyzer(translator)
-            self.jit_invariant_analyzer = JitInvariantAnalyzer(translator)
         #
         for index, jd in enumerate(jitdrivers_sd):
             jd.index = index
@@ -218,9 +215,7 @@
                 assert not NON_VOID_ARGS, ("arguments not supported for "
                                            "loop-invariant function!")
         # build the extraeffect
-        if self.jit_invariant_analyzer.analyze(op):
-            extraeffect = EffectInfo.EF_FORCES_JIT_INVARIANT
-        elif self.virtualizable_analyzer.analyze(op):
+        if self.virtualizable_analyzer.analyze(op):
             extraeffect = EffectInfo.EF_FORCES_VIRTUAL_OR_VIRTUALIZABLE
         elif loopinvariant:
             extraeffect = EffectInfo.EF_LOOPINVARIANT
@@ -232,9 +227,18 @@
         else:
             extraeffect = EffectInfo.EF_CANNOT_RAISE
         #
+        readwrite_res = self.readwrite_analyzer.analyze(op)
+        if readwrite_res is top_set:
+            extraeffect = EffectInfo.EF_FORCES_JIT_INVARIANT
+        else:
+            for effect, struct, name in readwrite_res:
+                if (effect == 'struct' and
+                    (name in struct.TO._hints.get('jit_invariant_fields', []))):
+                    extraeffect = EffectInfo.EF_FORCES_JIT_INVARIANT
+                    break
+
         effectinfo = effectinfo_from_writeanalyze(
-            self.readwrite_analyzer.analyze(op), self.cpu, extraeffect,
-            oopspecindex)
+            readwrite_res, self.cpu, extraeffect, oopspecindex)
         #
         if pure or loopinvariant:
             assert effectinfo is not None

diff --git a/pypy/jit/codewriter/effectinfo.py b/pypy/jit/codewriter/effectinfo.py
--- a/pypy/jit/codewriter/effectinfo.py
+++ b/pypy/jit/codewriter/effectinfo.py
@@ -143,10 +143,6 @@
         return op.opname in ('jit_force_virtualizable',
                              'jit_force_virtual')
 
-class JitInvariantAnalyzer(BoolGraphAnalyzer):
-    def analyze_simple_operation(self, op):
-        return op.opname == 'jit_invariant_setfield'
-
 # ____________________________________________________________
 
 class CallInfoCollection(object):


More information about the Pypy-commit mailing list