[pypy-svn] r71583 - in pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc: . test test/darwin test/elf test/msvc
arigo at codespeak.net
arigo at codespeak.net
Mon Mar 1 09:31:47 CET 2010
Author: arigo
Date: Mon Mar 1 09:31:43 2010
New Revision: 71583
Added:
pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/darwin/track9.s
pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/elf/track9.s
pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/msvc/track9.s
Modified:
pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/test_trackgcroot.py
pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/trackgcroot.py
Log:
Add tests for GC_NOCOLLECT calls. Small fix to prevent any resume
data from being generated around such calls.
Added: pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/darwin/track9.s
==============================================================================
--- (empty file)
+++ pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/darwin/track9.s Mon Mar 1 09:31:43 2010
@@ -0,0 +1,18 @@
+_pypy_g_foo:
+L1506:
+ pushl %ebp
+ pushl %edi
+ pushl %esi
+ pushl %ebx
+ call L103
+"L00000000006$pb":
+L103:
+ popl %ebx
+ call _open
+ /* GC_NOCOLLECT open */
+ popl %ebx
+ popl %esi
+ popl %edi
+ popl %ebp
+ ret
+ .align 4,0x90
Added: pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/elf/track9.s
==============================================================================
--- (empty file)
+++ pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/elf/track9.s Mon Mar 1 09:31:43 2010
@@ -0,0 +1,23 @@
+ .type pypy_g_stuff, @function
+pypy_g_stuff:
+.LFB41:
+ .loc 2 1513 0
+ pushl %ebp
+.LCFI87:
+ movl %esp, %ebp
+.LCFI88:
+ subl $72, %esp
+.LCFI89:
+.L543:
+ .loc 2 1521 0
+ movl $420, 8(%esp)
+ movl $0, 4(%esp)
+ movl $pypy_g_array_16, (%esp)
+ call open
+ /* GC_NOCOLLECT open */
+.L542:
+ .loc 2 1588 0
+ leave
+ ret
+.LFE41:
+ .size pypy_g_stuff, .-pypy_g_stuff
Added: pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/msvc/track9.s
==============================================================================
--- (empty file)
+++ pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/msvc/track9.s Mon Mar 1 09:31:43 2010
@@ -0,0 +1,26 @@
+; Function compile flags: /Ogtpy
+; COMDAT _pypy_g_ll_join_strs__Signed_arrayPtr
+_TEXT SEGMENT
+_pypy_g_ll_join_strs__Signed_arrayPtr PROC ; COMDAT
+
+; 1457 : struct pypy_rpy_string0 *pypy_g_ll_join_strs__Signed_arrayPtr(long l_num_items_0, struct pypy_array0 *l_items_2) {
+
+ sub esp, 8
+ push ebx
+ push ebp
+ push esi
+
+; 1458 : pypy_asm_gc_nocollect(open);
+
+ call _open
+ pop esi
+ pop ebp
+$block4$40052:
+ pop ebx
+
+; 1535 : goto block1_back;
+; 1536 : }
+
+ add esp, 8
+ ret 0
+_pypy_g_ll_join_strs__Signed_arrayPtr ENDP
Modified: pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/test_trackgcroot.py
==============================================================================
--- pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/test_trackgcroot.py (original)
+++ pypy/branch/asmgcc-cantcollect/pypy/translator/c/gcc/test/test_trackgcroot.py Mon Mar 1 09:31:43 2010
@@ -169,6 +169,9 @@
assert len(seen) == len(tabledict), (
"computed table contains unexpected entries:\n%r" %
[key for key in tabledict if key not in seen])
- print lines
- print expectedlines
+ print '--------------- got ---------------'
+ print ''.join(lines)
+ print '------------- expected ------------'
+ print ''.join(expectedlines)
+ print '-----------------------------------'
assert lines == expectedlines
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 Mon Mar 1 09:31:43 2010
@@ -44,7 +44,7 @@
self.findlabels()
self.parse_instructions()
try:
- if not self.list_call_insns():
+ if not self.list_collecting_call_insns():
return []
self.find_noncollecting_calls()
self.findframesize()
@@ -64,11 +64,9 @@
See format_callshape() for more details about callshape_tuple.
"""
table = []
- for insn in self.list_call_insns():
+ for insn in self.list_collecting_call_insns():
if not hasattr(insn, 'framesize'):
continue # calls that never end up reaching a RET
- if insn.name in self.cannot_collect:
- continue
if self.is_stack_bottom:
retaddr = LOC_NOWHERE # end marker for asmgcroot.py
elif self.uses_frame_pointer:
@@ -193,8 +191,9 @@
raise UnrecognizedOperation(opname)
setattr(cls, 'visit_' + opname, cls.visit_nop)
- def list_call_insns(self):
- return [insn for insn in self.insns if isinstance(insn, InsnCall)]
+ def list_collecting_call_insns(self):
+ return [insn for insn in self.insns if isinstance(insn, InsnCall)
+ if insn.name not in self.cannot_collect]
def findframesize(self):
# the 'framesize' attached to an instruction is the number of bytes
@@ -306,7 +305,7 @@
# walk backwards, because inserting the global labels in self.lines
# is going to invalidate the lineno of all the InsnCall objects
# after the current one.
- for call in self.list_call_insns()[::-1]:
+ for call in self.list_collecting_call_insns()[::-1]:
if hasattr(call, 'framesize'):
self.create_global_label(call)
More information about the Pypy-commit
mailing list