[pypy-svn] r46354 - in pypy/dist/pypy/rpython: lltypesystem module
arigo at codespeak.net
arigo at codespeak.net
Wed Sep 5 19:14:58 CEST 2007
Author: arigo
Date: Wed Sep 5 19:14:57 2007
New Revision: 46354
Modified:
pypy/dist/pypy/rpython/lltypesystem/rffi.py
pypy/dist/pypy/rpython/module/ll_time.py
Log:
MarkSweepGC.collect() -> time.time() -> wrapper from rffi
The latter takes a *arg, which needs to be GC-allocated -> boom
Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py Wed Sep 5 19:14:57 2007
@@ -28,7 +28,7 @@
def llexternal(name, args, result, _callable=None, sources=[], includes=[],
libraries=[], include_dirs=[], sandboxsafe=False,
- canraise=False, stringpolicy='noauto'):
+ canraise=False, stringpolicy='noauto', _nowrapper=False):
""" String policies:
autocast - automatically cast to ll_string, but don't delete it
fullauto - automatically cast + delete is afterwards
@@ -52,6 +52,9 @@
if isinstance(_callable, ll2ctypes.LL2CtypesCallable):
_callable.funcptr = funcptr
+ if _nowrapper:
+ return funcptr
+
unrolling_arg_tps = unrolling_iterable(enumerate(args))
def wrapper(*args):
# XXX the next line is a workaround for the annotation bug
Modified: pypy/dist/pypy/rpython/module/ll_time.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_time.py (original)
+++ pypy/dist/pypy/rpython/module/ll_time.py Wed Sep 5 19:14:57 2007
@@ -47,25 +47,33 @@
@registering(time.time)
def register_time_time(self):
+ # Note: time.time() is used by the framework GC during collect(),
+ # which means that we have to be very careful about not allocating
+ # GC memory here. This is the reason for the _nowrapper=True.
+
# AWFUL
if self.HAVE_GETTIMEOFDAY:
if self.GETTIMEOFDAY_NO_TZ:
c_gettimeofday = self.llexternal('gettimeofday',
- [self.TIMEVALP], rffi.INT)
+ [self.TIMEVALP], rffi.INT,
+ _nowrapper=True)
else:
c_gettimeofday = self.llexternal('gettimeofday',
- [self.TIMEVALP, rffi.VOIDP], rffi.INT)
+ [self.TIMEVALP, rffi.VOIDP], rffi.INT,
+ _nowrapper=True)
else:
c_gettimeofday = None
if self.HAVE_FTIME:
self.configure(CConfigForFTime)
c_ftime = self.llexternal('ftime', [lltype.Ptr(self.TIMEB)],
- lltype.Void)
+ lltype.Void,
+ _nowrapper=True)
else:
c_ftime = None # to not confuse the flow space
- c_time = self.llexternal('time', [rffi.VOIDP], self.TIME_T)
+ c_time = self.llexternal('time', [rffi.VOIDP], self.TIME_T,
+ _nowrapper=True)
def time_time_llimpl():
void = lltype.nullptr(rffi.VOIDP.TO)
More information about the Pypy-commit
mailing list