[pypy-svn] r78390 - in pypy/trunk/pypy/translator/c/gcc: . test test/darwin64
afa at codespeak.net
afa at codespeak.net
Thu Oct 28 12:11:51 CEST 2010
Author: afa
Date: Thu Oct 28 12:11:49 2010
New Revision: 78390
Added:
pypy/trunk/pypy/translator/c/gcc/test/darwin64/
pypy/trunk/pypy/translator/c/gcc/test/darwin64/track0.s
Modified:
pypy/trunk/pypy/translator/c/gcc/test/test_trackgcroot.py
pypy/trunk/pypy/translator/c/gcc/trackgcroot.py
Log:
Add trackgcroot support for 64bit darwin
Added: pypy/trunk/pypy/translator/c/gcc/test/darwin64/track0.s
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/translator/c/gcc/test/darwin64/track0.s Thu Oct 28 12:11:49 2010
@@ -0,0 +1,159 @@
+_PyObject_Realloc:
+LFB118:
+ movq %rbx, -32(%rsp)
+LCFI86:
+ movq %rbp, -24(%rsp)
+LCFI87:
+ movq %r12, -16(%rsp)
+LCFI88:
+ movq %r13, -8(%rsp)
+LCFI89:
+ subq $40, %rsp
+LCFI90:
+ movq %rdi, %rbx
+ testq %rdi, %rdi
+ je L384
+ movq %rdi, %rbp
+ andq $-4096, %rbp
+ movl 32(%rbp), %edx
+ movl _narenas(%rip), %eax
+ cmpl %eax, %edx
+ jae L360
+ movq _arenas(%rip), %rax
+ mov %edx, %edx
+ movq %rdi, %rcx
+ subq (%rax,%rdx,8), %rcx
+ cmpq $262143, %rcx
+ ja L360
+ movl 36(%rbp), %ecx
+ incl %ecx
+ leal 0(,%rcx,8), %r12d
+ mov %r12d, %eax
+ cmpq %rax, %rsi
+ ja L363
+ leaq 0(,%rsi,4), %rdx
+ sall $4, %ecx
+ leal (%rcx,%r12), %eax
+ mov %eax, %eax
+ cmpq %rax, %rdx
+ ja L365
+ movl %esi, %r12d
+L363:
+ movq %rsi, %rdi
+ call _PyObject_Malloc
+ ;; expected {40(%rsp) | 8(%rsp), 24(%rsp), 32(%rsp), %r14, %r15, 16(%rsp) | }
+ testq %rax, %rax
+ je L367
+ mov %r12d, %edx
+ movq %rbx, %rsi
+ movq %rax, %rdi
+ call _memcpy
+ ;; expected {40(%rsp) | 8(%rsp), 24(%rsp), 32(%rsp), %r14, %r15, 16(%rsp) | }
+ movl 32(%rbp), %edx
+ movl _narenas(%rip), %eax
+ cmpl %eax, %edx
+ jae L369
+ movq _arenas(%rip), %rax
+ mov %edx, %edx
+ movq %rbx, %rcx
+ subq (%rax,%rdx,8), %rcx
+ cmpq $262143, %rcx
+ jbe L385
+L369:
+ movq %rbx, %rdi
+ call _free
+ ;; expected {40(%rsp) | 8(%rsp), 24(%rsp), 32(%rsp), %r14, %r15, 16(%rsp) | }
+ movq %r13, %rbx
+ jmp L365
+ .align 4,0x90
+L360:
+ testq %rsi, %rsi
+ jne L386
+ movl $1, %esi
+ movq %rbx, %rdi
+ call _realloc
+ ;; expected {40(%rsp) | 8(%rsp), 24(%rsp), 32(%rsp), %r14, %r15, 16(%rsp) | }
+ testq %rax, %rax
+ cmovne %rax, %rbx
+L365:
+ movq %rbx, %rax
+ movq 8(%rsp), %rbx
+ movq 16(%rsp), %rbp
+ movq 24(%rsp), %r12
+ movq 32(%rsp), %r13
+ addq $40, %rsp
+ ret
+ .align 4,0x90
+L386:
+ movq %rbx, %rdi
+ movq 8(%rsp), %rbx
+ movq 16(%rsp), %rbp
+ movq 24(%rsp), %r12
+ movq 32(%rsp), %r13
+ addq $40, %rsp
+ jmp _realloc
+L384:
+ movq %rsi, %rdi
+ movq 8(%rsp), %rbx
+ movq 16(%rsp), %rbp
+ movq 24(%rsp), %r12
+ movq 32(%rsp), %r13
+ addq $40, %rsp
+ jmp _PyObject_Malloc
+L367:
+ movq %r13, %rbx
+ jmp L365
+L385:
+ movl (%rbp), %esi
+ testl %esi, %esi
+ je L387
+ movq 8(%rbp), %rax
+ movq %rax, (%rbx)
+ movq %rbx, 8(%rbp)
+ testq %rax, %rax
+ je L374
+ movl (%rbp), %eax
+ decl %eax
+ movl %eax, (%rbp)
+ testl %eax, %eax
+ jne L367
+ movq 16(%rbp), %rdx
+ movq 24(%rbp), %rax
+ movq %rax, 24(%rdx)
+ movq %rdx, 16(%rax)
+ movq _freepools(%rip), %rax
+ movq %rax, 16(%rbp)
+ movq %rbp, _freepools(%rip)
+ movq %r13, %rbx
+ jmp L365
+L374:
+ movl (%rbp), %eax
+ decl %eax
+ movl %eax, (%rbp)
+ testl %eax, %eax
+ je L388
+ movl 36(%rbp), %eax
+ addl %eax, %eax
+ mov %eax, %eax
+ leaq _usedpools(%rip), %rdx
+ movq (%rdx,%rax,8), %rax
+ movq 24(%rax), %rdx
+ movq %rax, 16(%rbp)
+ movq %rdx, 24(%rbp)
+ movq %rbp, 24(%rax)
+ movq %rbp, 16(%rdx)
+ movq %r13, %rbx
+ jmp L365
+L387:
+ leaq LC6(%rip), %rcx
+ movl $744, %edx
+ leaq LC7(%rip), %rsi
+ leaq ___func__.207211(%rip), %rdi
+ call ___assert_rtn
+L388:
+ leaq LC6(%rip), %rcx
+ movl $783, %edx
+ leaq LC7(%rip), %rsi
+ leaq ___func__.207211(%rip), %rdi
+ call ___assert_rtn
+LFE118:
Modified: pypy/trunk/pypy/translator/c/gcc/test/test_trackgcroot.py
==============================================================================
--- pypy/trunk/pypy/translator/c/gcc/test/test_trackgcroot.py (original)
+++ pypy/trunk/pypy/translator/c/gcc/test/test_trackgcroot.py Thu Oct 28 12:11:49 2010
@@ -109,7 +109,7 @@
def test_computegcmaptable():
tests = []
- for format in ('elf', 'darwin', 'msvc', 'elf64'):
+ for format in ('elf', 'elf64', 'darwin', 'darwin64', 'msvc'):
for path in this_dir.join(format).listdir("track*.s"):
n = path.purebasename[5:]
try:
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 Thu Oct 28 12:11:49 2010
@@ -1090,7 +1090,7 @@
ElfFunctionGcRootTracker64.init_regexp()
-class DarwinFunctionGcRootTracker(ElfFunctionGcRootTracker32):
+class DarwinFunctionGcRootTracker32(ElfFunctionGcRootTracker32):
format = 'darwin'
function_names_prefix = '_'
@@ -1102,7 +1102,19 @@
funcname = '_' + match.group(1)
FunctionGcRootTracker32.__init__(self, funcname, lines, filetag)
-class Mingw32FunctionGcRootTracker(DarwinFunctionGcRootTracker):
+class DarwinFunctionGcRootTracker64(ElfFunctionGcRootTracker64):
+ format = 'darwin64'
+ function_names_prefix = '_'
+
+ r_functionstart = re.compile(r"_(\w+):\s*$")
+ OFFSET_LABELS = 0
+
+ def __init__(self, lines, filetag=0):
+ match = self.r_functionstart.match(lines[0])
+ funcname = '_' + match.group(1)
+ FunctionGcRootTracker64.__init__(self, funcname, lines, filetag)
+
+class Mingw32FunctionGcRootTracker(DarwinFunctionGcRootTracker32):
format = 'mingw32'
function_names_prefix = '_'
@@ -1373,7 +1385,7 @@
class DarwinAssemblerParser(AssemblerParser):
format = "darwin"
- FunctionGcRootTracker = DarwinFunctionGcRootTracker
+ FunctionGcRootTracker = DarwinFunctionGcRootTracker32
r_textstart = re.compile(r"\t.text\s*$")
@@ -1419,6 +1431,10 @@
return super(DarwinAssemblerParser, self).process_function(
lines, entrypoint, filename)
+class DarwinAssemblerParser64(DarwinAssemblerParser):
+ format = "darwin64"
+ FunctionGcRootTracker = DarwinFunctionGcRootTracker64
+
class Mingw32AssemblerParser(DarwinAssemblerParser):
format = "mingw32"
FunctionGcRootTracker = Mingw32FunctionGcRootTracker
@@ -1542,6 +1558,7 @@
'elf': ElfAssemblerParser,
'elf64': ElfAssemblerParser64,
'darwin': DarwinAssemblerParser,
+ 'darwin64': DarwinAssemblerParser64,
'mingw32': Mingw32AssemblerParser,
'msvc': MsvcAssemblerParser,
}
@@ -1885,7 +1902,10 @@
shuffle = False
output_raw_table = False
if sys.platform == 'darwin':
- format = 'darwin'
+ if sys.maxint > 2147483647:
+ format = 'darwin64'
+ else:
+ format = 'darwin'
elif sys.platform == 'win32':
format = 'mingw32'
else:
More information about the Pypy-commit
mailing list