[pypy-svn] r69128 - in pypy/trunk/pypy/translator/c/gcc: . test/darwin

pedronis at codespeak.net pedronis at codespeak.net
Tue Nov 10 18:31:23 CET 2009


Author: pedronis
Date: Tue Nov 10 18:31:23 2009
New Revision: 69128

Added:
   pypy/trunk/pypy/translator/c/gcc/test/darwin/track_0f.s   (contents, props changed)
Modified:
   pypy/trunk/pypy/translator/c/gcc/trackgcroot.py
Log:
fix asmgcroot on Darwin



Added: pypy/trunk/pypy/translator/c/gcc/test/darwin/track_0f.s
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/translator/c/gcc/test/darwin/track_0f.s	Tue Nov 10 18:31:23 2009
@@ -0,0 +1,105 @@
+_pypy_debug_open:
+	subl	$92, %esp
+	movl	%ebx, 76(%esp)
+	call	L161
+"L00000000014$pb":
+L161:
+	popl	%ebx
+	movl	%ebp, 88(%esp)
+	movl	%esi, 80(%esp)
+	movl	%edi, 84(%esp)
+	leal	LC18-"L00000000014$pb"(%ebx), %eax
+	movl	%eax, (%esp)
+	call	L_getenv$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	testl	%eax, %eax
+	movl	%eax, %ebp
+	je	L147
+	cmpb	$0, (%eax)
+	jne	L158
+L147:
+	movl	_pypy_debug_file-"L00000000014$pb"(%ebx), %esi
+	testl	%esi, %esi
+	je	L159
+L154:
+	movb	$1, _debug_ready-"L00000000014$pb"(%ebx)
+	movl	80(%esp), %esi
+	movl	76(%esp), %ebx
+	movl	84(%esp), %edi
+	movl	88(%esp), %ebp
+	addl	$92, %esp
+	ret
+	.align 4,0x90
+L158:
+	movl	$58, 4(%esp)
+	movl	%eax, (%esp)
+	call	L_strchr$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	testl	%eax, %eax
+	movl	%eax, %edi
+	je	L160
+	movl	%eax, %esi
+	subl	%ebp, %esi
+	leal	1(%esi), %eax
+	movl	%eax, (%esp)
+	call	L_malloc$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	movl	%ebp, 4(%esp)
+	leal	1(%edi), %ebp
+	movl	%esi, 8(%esp)
+	movl	%eax, _debug_prefix-"L00000000014$pb"(%ebx)
+	movl	%eax, (%esp)
+	call	L_memcpy$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	movl	_debug_prefix-"L00000000014$pb"(%ebx), %eax
+	movb	$0, (%eax,%esi)
+L152:
+	leal	LC19-"L00000000014$pb"(%ebx), %eax
+	movl	$2, %ecx
+	cld
+	movl	%ebp, %esi
+	movl	%eax, %edi
+	repz
+	cmpsb
+	mov	$0, %eax
+	je	0f
+	movzbl	-1(%esi), %eax
+	movzbl	-1(%edi), %ecx
+	subl	%ecx,%eax
+0:
+	testl	%eax, %eax
+	je	L147
+	leal	LC20-"L00000000014$pb"(%ebx), %eax
+	movl	%eax, 4(%esp)
+	movl	%ebp, (%esp)
+	call	L_fopen$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	movl	%eax, _pypy_debug_file-"L00000000014$pb"(%ebx)
+	jmp	L147
+L160:
+	movb	$1, _debug_profile-"L00000000014$pb"(%ebx)
+	jmp	L152
+	.align 4,0x90
+L159:
+	movl	L___sF$non_lazy_ptr-"L00000000014$pb"(%ebx), %eax
+	movl	$2, (%esp)
+	addl	$176, %eax
+	movl	%eax, _pypy_debug_file-"L00000000014$pb"(%ebx)
+	call	L_isatty$stub
+        ;; expected {92(%esp) | 76(%esp), 80(%esp), 84(%esp), 88(%esp) | }
+	testl	%eax, %eax
+	je	L154
+	leal	LC21-"L00000000014$pb"(%ebx), %eax
+	movl	80(%esp), %esi
+	movl	%eax, _debug_start_colors_1-"L00000000014$pb"(%ebx)
+	leal	LC22-"L00000000014$pb"(%ebx), %eax
+	movl	84(%esp), %edi
+	movl	%eax, _debug_start_colors_2-"L00000000014$pb"(%ebx)
+	leal	LC23-"L00000000014$pb"(%ebx), %eax
+	movl	88(%esp), %ebp
+	movl	%eax, _debug_stop_colors-"L00000000014$pb"(%ebx)
+	movb	$1, _debug_ready-"L00000000014$pb"(%ebx)
+	movl	76(%esp), %ebx
+	addl	$92, %esp
+	ret
+	.align 4,0x90
\ No newline at end of file

Modified: pypy/trunk/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/trunk/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/trunk/pypy/translator/c/gcc/trackgcroot.py	Tue Nov 10 18:31:23 2009
@@ -23,14 +23,19 @@
 r_sectionstart         = re.compile(r"\t\.("+'|'.join(OTHERSECTIONS)+").*$")
 r_functionstart_darwin = re.compile(r"_(\w+):\s*$")
 
-OFFSET_LABELS   = 2**30
+if sys.platform != 'darwin':
+    OFFSET_LABELS = 2**30
+else:
+    OFFSET_LABELS =  0
 
 # inside functions
 r_label         = re.compile(LABEL+"[:]\s*$")
+r_rel_label     = re.compile(r"(\d+):\s*$")
 r_globl         = re.compile(r"\t[.]globl\t"+LABEL+"\s*$")
 r_globllabel    = re.compile(LABEL+r"=[.][+]%d\s*$"%OFFSET_LABELS)
 r_insn          = re.compile(r"\t([a-z]\w*)\s")
 r_jump          = re.compile(r"\tj\w+\s+"+LABEL+"\s*$")
+r_jump_rel_label = re.compile(r"\tj\w+\s+"+"(\d+)f"+"\s*$")
 OPERAND         =           r'(?:[-\w$%+.:@"]+(?:[(][\w%,]+[)])?|[(][\w%,]+[)])'
 r_unaryinsn     = re.compile(r"\t[a-z]\w*\s+("+OPERAND+")\s*$")
 r_unaryinsn_star= re.compile(r"\t[a-z]\w*\s+([*]"+OPERAND+")\s*$")
@@ -358,9 +363,16 @@
         self.labels = {}      # {name: Label()}
         for lineno, line in enumerate(self.lines):
             match = r_label.match(line)
+            label = None
             if match:
                 label = match.group(1)
-                assert label not in self.labels, "duplicate label"
+            else:
+                # labels used by: j* NNNf
+                match = r_rel_label.match(line)
+                if match:
+                    label = "rel %d" % lineno
+            if label:
+                assert label not in self.labels, "duplicate label: %s" % label
                 self.labels[label] = Label(label, lineno)
 
     def append_instruction(self, insn):
@@ -721,6 +733,8 @@
                           # gcc -fno-unit-at-a-time.
         return self.insns_for_copy(source, target)
 
+    visit_mov = visit_movl
+
     def visit_pushl(self, line):
         match = r_unaryinsn.match(line)
         source = match.group(1)
@@ -825,8 +839,20 @@
     def conditional_jump(self, line):
         match = r_jump.match(line)
         if not match:
-            raise UnrecognizedOperation(line)
-        label = match.group(1)
+            match = r_jump_rel_label.match(line)
+            if not match:
+                raise UnrecognizedOperation(line)
+            # j* NNNf
+            label = match.group(1)
+            label += ":"
+            i = self.currentlineno + 1
+            while True:
+                if self.lines[i].startswith(label):
+                    label = "rel %d" % i
+                    break
+                i += 1
+        else:
+            label = match.group(1)
         self.register_jump_to(label)
         return []
 



More information about the Pypy-commit mailing list