[pypy-commit] pypy gc-incminimark-pinning: Merged release-2.3.x into gc-incminimark-pinning

groggi noreply at buildbot.pypy.org
Mon Jun 2 17:24:01 CEST 2014


Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning
Changeset: r71821:7c48f4e1f802
Date: 2014-05-14 14:57 +0200
http://bitbucket.org/pypy/pypy/changeset/7c48f4e1f802/

Log:	Merged release-2.3.x into gc-incminimark-pinning

diff --git a/pypy/module/struct/__init__.py b/pypy/module/struct/__init__.py
--- a/pypy/module/struct/__init__.py
+++ b/pypy/module/struct/__init__.py
@@ -45,6 +45,8 @@
 
 The variable struct.error is an exception raised on errors."""
 
+    applevel_name = "_struct"
+
     interpleveldefs = {
         'error': 'interp_struct.get_error(space)',
 
@@ -55,6 +57,7 @@
         'unpack_from': 'interp_struct.unpack_from',
 
         'Struct': 'interp_struct.W_Struct',
+        '_clearcache': 'interp_struct.clearcache',
     }
 
     appleveldefs = {
diff --git a/pypy/module/struct/interp_struct.py b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -138,3 +138,6 @@
     pack_into=interp2app(W_Struct.descr_pack_into),
     unpack_from=interp2app(W_Struct.descr_unpack_from),
 )
+
+def clearcache(space):
+    """No-op on PyPy"""
diff --git a/rpython/translator/c/gcc/instruction.py b/rpython/translator/c/gcc/instruction.py
--- a/rpython/translator/c/gcc/instruction.py
+++ b/rpython/translator/c/gcc/instruction.py
@@ -184,6 +184,9 @@
     def __init__(self):
         self.delta = -7.25     # use this non-integer value as a marker
 
+class InsnPushed(InsnStackAdjust):
+    pass
+
 class InsnStop(Insn):
     _args_ = ['reason']
     def __init__(self, reason='?'):
diff --git a/rpython/translator/c/gcc/test/elf64/track_random_rsp_rbp.s b/rpython/translator/c/gcc/test/elf64/track_random_rsp_rbp.s
new file mode 100644
--- /dev/null
+++ b/rpython/translator/c/gcc/test/elf64/track_random_rsp_rbp.s
@@ -0,0 +1,158 @@
+	.type	seterror.part.1, @function
+seterror.part.1:
+.LFB77:
+	.cfi_startproc
+	pushq	%r14
+	.cfi_def_cfa_offset 16
+	.cfi_offset 14, -16
+	pushq	%r13
+	.cfi_def_cfa_offset 24
+	.cfi_offset 13, -24
+	pushq	%r12
+	.cfi_def_cfa_offset 32
+	.cfi_offset 12, -32
+	pushq	%rbp
+	.cfi_def_cfa_offset 40
+	.cfi_offset 6, -40
+	pushq	%rbx
+	.cfi_def_cfa_offset 48
+	.cfi_offset 3, -48
+	subq	$512, %rsp
+	.cfi_def_cfa_offset 560
+	testq	%r8, %r8
+	je	.L30
+.L11:
+	movq	PyPyExc_TypeError at GOTPCREL(%rip), %rax
+	movq	%r8, %rsi
+	movq	(%rax), %rdi
+	call	PyPyErr_SetString at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	addq	$512, %rsp
+	.cfi_remember_state
+	.cfi_def_cfa_offset 48
+	popq	%rbx
+	.cfi_def_cfa_offset 40
+	popq	%rbp
+	.cfi_def_cfa_offset 32
+	popq	%r12
+	.cfi_def_cfa_offset 24
+	popq	%r13
+	.cfi_def_cfa_offset 16
+	popq	%r14
+	.cfi_def_cfa_offset 8
+	ret
+	.p2align 4,,10
+	.p2align 3
+.L30:
+	.cfi_restore_state
+	testq	%rcx, %rcx
+	movq	%rsi, %r12
+	movl	%edi, %r14d
+	movq	%rdx, %r13
+	movq	%rsp, %rbp
+	movl	$512, %esi
+	movq	%rsp, %rbx
+	je	.L13
+	leaq	.LC6(%rip), %rdx
+	movl	$512, %esi
+	movq	%rsp, %rdi
+	xorl	%eax, %eax
+	movq	%rsp, %rbx
+	call	PyPyOS_snprintf at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+.L14:
+	movl	(%rbx), %eax
+	addq	$4, %rbx
+	leal	-16843009(%rax), %esi
+	notl	%eax
+	andl	%eax, %esi
+	andl	$-2139062144, %esi
+	je	.L14
+	movl	%esi, %eax
+	shrl	$16, %eax
+	testl	$32896, %esi
+	cmove	%eax, %esi
+	leaq	2(%rbx), %rax
+	cmove	%rax, %rbx
+	addb	%sil, %sil
+	movq	%rbp, %rsi
+	sbbq	$3, %rbx
+	subq	%rbx, %rsi
+	addq	$512, %rsi
+.L13:
+	testl	%r14d, %r14d
+	je	.L16
+	leaq	.LC7(%rip), %rdx
+	movq	%rbx, %rdi
+	movl	%r14d, %ecx
+	xorl	%eax, %eax
+	call	PyPyOS_snprintf at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	movq	%rbx, %rdi
+	call	strlen at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	addq	%rax, %rbx
+	movl	0(%r13), %eax
+	testl	%eax, %eax
+	jle	.L18
+	movq	%rbx, %rdx
+	subq	%rbp, %rdx
+	cmpl	$219, %edx
+	jg	.L18
+	addq	$4, %r13
+	xorl	%r14d, %r14d
+	.p2align 4,,10
+	.p2align 3
+.L21:
+	movq	%rbp, %rsi
+	leal	-1(%rax), %ecx
+	leaq	.LC8(%rip), %rdx
+	subq	%rbx, %rsi
+	movq	%rbx, %rdi
+	xorl	%eax, %eax
+	addq	$512, %rsi
+	addl	$1, %r14d
+	call	PyPyOS_snprintf at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	movq	%rbx, %rdi
+	call	strlen at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	addq	%rax, %rbx
+	movl	0(%r13), %eax
+	testl	%eax, %eax
+	jle	.L18
+	cmpl	$32, %r14d
+	je	.L18
+	movq	%rbx, %rdx
+	addq	$4, %r13
+	subq	%rbp, %rdx
+	cmpl	$219, %edx
+	jle	.L21
+	jmp	.L18
+	.p2align 4,,10
+	.p2align 3
+.L16:
+	leaq	.LC9(%rip), %rdx
+	movq	%rbx, %rdi
+	xorl	%eax, %eax
+	call	PyPyOS_snprintf at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	movq	%rbx, %rdi
+	call	strlen at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	addq	%rax, %rbx
+.L18:
+	movq	%rbp, %rsi
+	leaq	.LC10(%rip), %rdx
+	movq	%r12, %rcx
+	subq	%rbx, %rsi
+	movq	%rbx, %rdi
+	xorl	%eax, %eax
+	addq	$512, %rsi
+	call	PyPyOS_snprintf at PLT
+	;; expected {552(%rsp) | 512(%rsp), 528(%rsp), 536(%rsp), 544(%rsp), %r15, 520(%rsp) | }
+	movq	%rbp, %r8
+	jmp	.L11
+	.cfi_endproc
+.LFE77:
+	.size	seterror.part.1, .-seterror.part.1
diff --git a/rpython/translator/c/gcc/test/test_trackgcroot.py b/rpython/translator/c/gcc/test/test_trackgcroot.py
--- a/rpython/translator/c/gcc/test/test_trackgcroot.py
+++ b/rpython/translator/c/gcc/test/test_trackgcroot.py
@@ -130,7 +130,7 @@
     elif format == 'darwin' or format == 'darwin64':
         py.test.skip("disabled on OS/X's terribly old gcc")
     else:
-        r_globallabel = re.compile(r"([\w]+)=[.]+")
+        r_globallabel = re.compile(r"([\w.]+)=[.]+")
     print
     print path.dirpath().basename + '/' + path.basename
     lines = path.readlines()
diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py
--- a/rpython/translator/c/gcc/trackgcroot.py
+++ b/rpython/translator/c/gcc/trackgcroot.py
@@ -8,7 +8,7 @@
 from rpython.translator.c.gcc.instruction import InsnSetLocal, InsnCopyLocal
 from rpython.translator.c.gcc.instruction import InsnPrologue, InsnEpilogue
 from rpython.translator.c.gcc.instruction import InsnGCROOT, InsnCondJump
-from rpython.translator.c.gcc.instruction import InsnStackAdjust
+from rpython.translator.c.gcc.instruction import InsnStackAdjust, InsnPushed
 from rpython.translator.c.gcc.instruction import InsnCannotFollowEsp
 from rpython.translator.c.gcc.instruction import LocalVar, somenewvalue
 from rpython.translator.c.gcc.instruction import frameloc_esp, frameloc_ebp
@@ -665,14 +665,22 @@
         match = self.r_unaryinsn.match(line)
         source = match.group(1)
         return self.insns_for_copy(source, self.TOP_OF_STACK_MINUS_WORD) + \
-               [InsnStackAdjust(-self.WORD)]
+               [InsnPushed(-self.WORD)]
 
     def _visit_pop(self, target):
         return [InsnStackAdjust(+self.WORD)] + \
                self.insns_for_copy(self.TOP_OF_STACK_MINUS_WORD, target)
 
     def _visit_prologue(self):
-        # for the prologue of functions that use %ebp as frame pointer
+        # For the prologue of functions that use %ebp as frame pointer.
+        # First, find the latest InsnStackAdjust; if it's not a PUSH,
+        # then consider that this 'mov %rsp, %rbp' is actually unrelated
+        i = -1
+        while not isinstance(self.insns[i], InsnStackAdjust):
+            i -= 1
+        if not isinstance(self.insns[i], InsnPushed):
+            return []
+        #
         self.uses_frame_pointer = True
         self.r_localvar = self.r_localvarfp
         return [InsnPrologue(self.WORD)]


More information about the pypy-commit mailing list