[pypy-svn] r14413 - pypy/dist/pypy/rpython
tismer at codespeak.net
tismer at codespeak.net
Thu Jul 7 22:23:20 CEST 2005
Author: tismer
Date: Thu Jul 7 22:23:19 2005
New Revision: 14413
Modified:
pypy/dist/pypy/rpython/rtyper.py
Log:
added block shuffling to the rtyper.
Instructions:
set the environment variable 'RTYPERSEED' to a number.
Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py (original)
+++ pypy/dist/pypy/rpython/rtyper.py Thu Jul 7 22:23:19 2005
@@ -12,7 +12,7 @@
"""
from __future__ import generators
-import sys
+import sys, os
import py
from pypy.annotation.pairtype import pair
from pypy.annotation import model as annmodel
@@ -50,6 +50,14 @@
r = self.getrepr(s_primitive)
self.primitive_to_repr[r.lowleveltype] = r
self.exceptiondata = ExceptionData(self)
+ try:
+ self.seed = int(os.getenv('RTYPERSEED'))
+ s = 'Using %d as seed for block shuffling' % self.seed
+ print '*' * len(s)
+ print s
+ print '*' * len(s)
+ except:
+ self.seed = 0
def getexceptiondata(self):
return self.exceptiondata # built at the end of specialize()
@@ -99,6 +107,11 @@
if block not in self.already_seen]
if not pending:
break
+ # shuffle blocks a bit
+ if self.seed:
+ import random
+ r = random.Random(self.seed)
+ r.shuffle(pending)
# specialize all blocks in the 'pending' list
for block in pending:
self.specialize_block(block)
More information about the Pypy-commit
mailing list