[pypy-svn] r18100 - in pypy/dist/pypy/translator/llvm: . module
ericvrp at codespeak.net
ericvrp at codespeak.net
Mon Oct 3 13:36:04 CEST 2005
Author: ericvrp
Date: Mon Oct 3 13:36:03 2005
New Revision: 18100
Modified:
pypy/dist/pypy/translator/llvm/gc.py
pypy/dist/pypy/translator/llvm/module/support.py
Log:
settings GC_all_interior_pointers explicitily.
memset malloced data only when is_atomic.
Modified: pypy/dist/pypy/translator/llvm/gc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/gc.py (original)
+++ pypy/dist/pypy/translator/llvm/gc.py Mon Oct 3 13:36:03 2005
@@ -1,3 +1,9 @@
+import py
+from pypy.tool.ansi_print import ansi_log
+log = py.log.Producer("llvm")
+log.setconsumer("llvm", ansi_log)
+
+
class GcPolicy:
def __init__(self):
raise Exception, 'GcPolicy should not be used directly'
@@ -21,7 +27,7 @@
from os.path import exists
boehm_on_path = exists('/usr/lib/libgc.so') or exists('/usr/lib/libgc.a')
if gcpolicy == 'boehm' and not boehm_on_path:
- print 'warning: Boehm GC libary not found in /usr/lib, falling back on no gc'
+ log.gc.WARNING('warning: Boehm GC libary not found in /usr/lib, falling back on no gc')
gcpolicy = 'none'
if gcpolicy == 'boehm':
@@ -55,6 +61,7 @@
return '''
declare ccc sbyte* %GC_malloc(uint)
declare ccc sbyte* %GC_malloc_atomic(uint)
+%GC_all_interior_pointers = external global int
'''
def malloc(self, targetvar, type_, size, is_atomic, word, uword):
@@ -62,12 +69,17 @@
self.n_malloced += 1
cnt = '.%d' % self.n_malloced
atomic = is_atomic and '_atomic' or ''
- return '''
+ t = '''
%%malloc.Size%(cnt)s = getelementptr %(type_)s* null, %(uword)s %(s)s
%%malloc.SizeU%(cnt)s = cast %(type_)s* %%malloc.Size%(cnt)s to %(uword)s
%%malloc.Ptr%(cnt)s = call ccc sbyte* %%GC_malloc%(atomic)s(%(uword)s %%malloc.SizeU%(cnt)s)
%(targetvar)s = cast sbyte* %%malloc.Ptr%(cnt)s to %(type_)s*
- ''' % locals()
+''' % locals()
+ if is_atomic:
+ t += '''
+call ccc void %%llvm.memset(sbyte* %%malloc.Ptr%(cnt)s, ubyte 0, uint %%malloc.SizeU%(cnt)s, uint 0)
+''' % locals()
+ return t
def pyrex_code(self):
return '''
Modified: pypy/dist/pypy/translator/llvm/module/support.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/support.py (original)
+++ pypy/dist/pypy/translator/llvm/module/support.py Mon Oct 3 13:36:03 2005
@@ -259,6 +259,7 @@
extfunctions["%main_noargs"] = [(), """
int %main(int %argc, sbyte** %argv) {
+ store int 0, int* %GC_all_interior_pointers
%ret = call fastcc int %pypy_main_noargs()
ret int %ret
}
@@ -267,6 +268,7 @@
extfunctions["%main"] = [(), """
int %main(int %argc, sbyte** %argv) {
entry:
+ store int 0, int* %GC_all_interior_pointers
%pypy_argv = call fastcc %structtype.list* %pypy__RPyListOfString_New__Signed(int %argc)
br label %no_exit
More information about the Pypy-commit
mailing list