[pypy-svn] r68413 - pypy/branch/asmgcc-mingw32-2/pypy/translator/c/gcc

afa at codespeak.net afa at codespeak.net
Wed Oct 14 02:03:40 CEST 2009


Author: afa
Date: Wed Oct 14 02:03:40 2009
New Revision: 68413

Modified:
   pypy/branch/asmgcc-mingw32-2/pypy/translator/c/gcc/trackgcroot.py
Log:
This comment proves completely wrong: computed jumps are sometimes stored on the stack.
Let the backwards walk go to the start of the function, and stops there.


Modified: pypy/branch/asmgcc-mingw32-2/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/branch/asmgcc-mingw32-2/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/branch/asmgcc-mingw32-2/pypy/translator/c/gcc/trackgcroot.py	Wed Oct 14 02:03:40 2009
@@ -635,7 +635,7 @@
         source = match.group(1)
         target = match.group(2)
         if self.r_localvar.match(target):
-            return InsnSetLocal(target)
+            return InsnSetLocal(target, [source])
         elif target == '%esp':
             raise UnrecognizedOperation(line)
         else:
@@ -769,19 +769,10 @@
                 for loc in locs:
                     for s in insn.all_sources_of(loc):
                         # if the source looks like 8(%eax,%edx,4)
-                        # %eax is the real source, %edx is an offset
+                        # %eax is the real source, %edx is an offset.
                         match = r_jmp_source.match(s)
-                        if match:
-                            if r_localvar_esp.match(s):
-                                # obscure: skip the source if it seems
-                                # to be an argument passed to the
-                                # function.  XXX It's theorically
-                                # possible that the address is stored
-                                # on the stack; let's say this is
-                                # improbable for table-based switches.
-                                pass
-                            else:
-                                sources.append(match.group(1))
+                        if match and not r_localvar_esp.match(s):
+                            sources.append(match.group(1))
                         else:
                             sources.append(s)
                 for source in sources:
@@ -991,6 +982,9 @@
             self.arguments[localvar] = somenewvalue
         return self.arguments[localvar]
 
+    def all_sources_of(self, localvar):
+        return []
+
 class InsnSetLocal(Insn):
     _args_ = ['target', 'sources']
     _locals_ = ['target', 'sources']
@@ -1075,6 +1069,9 @@
             localvar, tag1, tag))
         return localvar
 
+    def all_sources_of(self, localvar):
+        return [localvar]
+
 class InsnGCROOT(Insn):
     _args_ = ['loc']
     _locals_ = ['loc']



More information about the Pypy-commit mailing list