[pypy-svn] r71512 - pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc

afa at codespeak.net afa at codespeak.net
Fri Feb 26 10:54:20 CET 2010


Author: afa
Date: Fri Feb 26 10:54:19 2010
New Revision: 71512

Modified:
   pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/trackgcroot.py
Log:
Workaround a bug in the MASM assembler, this seems to fix the JIT on windows

(btw, the crash was inside Assembler386_make_boxes_from_latest_values)


Modified: pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/trackgcroot.py	Fri Feb 26 10:54:19 2010
@@ -880,10 +880,21 @@
                                             'visit_' + name + 'l')
 
     visit_int = FunctionGcRootTracker.visit_nop
-    visit_npad = FunctionGcRootTracker.visit_nop
     # probably not GC pointers
     visit_cdq  = FunctionGcRootTracker.visit_nop
 
+    def visit_npad(self, line):
+        # MASM has a nasty bug: it implements "npad 5" with "add eax, 0"
+        # which is a not no-op except because it clears flags.
+        # I've seen this instruction appear between "test" and "jne"...
+        # see http://www.masm32.com/board/index.php?topic=13122
+        match = self.r_unaryinsn.match(line)
+        arg = match.group(1)
+        if arg == "5":
+            # replace with "npad 3; npad 2"
+            self.lines[self.currentlineno] = "\tnpad\t3\n" "\tnpad\t2\n"
+        return []
+
     def extract_immediate(self, value):
         try:
             return int(value)



More information about the Pypy-commit mailing list