Author: hager <sven.ha...@uni-duesseldorf.de> Branch: ppc-jit-backend Changeset: r52124:aaf78782650f Date: 2012-02-06 10:26 +0100 http://bitbucket.org/pypy/pypy/changeset/aaf78782650f/
Log: kill more unused code diff --git a/pypy/jit/backend/ppc/ppcgen/autopath.py b/pypy/jit/backend/ppc/ppcgen/autopath.py deleted file mode 100644 --- a/pypy/jit/backend/ppc/ppcgen/autopath.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -self cloning, automatic path configuration - -copy this into any subdirectory of pypy from which scripts need -to be run, typically all of the test subdirs. -The idea is that any such script simply issues - - import autopath - -and this will make sure that the parent directory containing "pypy" -is in sys.path. - -If you modify the master "autopath.py" version (in pypy/tool/autopath.py) -you can directly run it which will copy itself on all autopath.py files -it finds under the pypy root directory. - -This module always provides these attributes: - - pypydir pypy root directory path - this_dir directory where this autopath.py resides - -""" - - -def __dirinfo(part): - """ return (partdir, this_dir) and insert parent of partdir - into sys.path. If the parent directories don't have the part - an EnvironmentError is raised.""" - - import sys, os - try: - head = this_dir = os.path.realpath(os.path.dirname(__file__)) - except NameError: - head = this_dir = os.path.realpath(os.path.dirname(sys.argv[0])) - - while head: - partdir = head - head, tail = os.path.split(head) - if tail == part: - break - else: - raise EnvironmentError, "'%s' missing in '%r'" % (partdir, this_dir) - - pypy_root = os.path.join(head, '') - try: - sys.path.remove(head) - except ValueError: - pass - sys.path.insert(0, head) - - munged = {} - for name, mod in sys.modules.items(): - if '.' in name: - continue - fn = getattr(mod, '__file__', None) - if not isinstance(fn, str): - continue - newname = os.path.splitext(os.path.basename(fn))[0] - if not newname.startswith(part + '.'): - continue - path = os.path.join(os.path.dirname(os.path.realpath(fn)), '') - if path.startswith(pypy_root) and newname != part: - modpaths = os.path.normpath(path[len(pypy_root):]).split(os.sep) - if newname != '__init__': - modpaths.append(newname) - modpath = '.'.join(modpaths) - if modpath not in sys.modules: - munged[modpath] = mod - - for name, mod in munged.iteritems(): - if name not in sys.modules: - sys.modules[name] = mod - if '.' in name: - prename = name[:name.rfind('.')] - postname = name[len(prename)+1:] - if prename not in sys.modules: - __import__(prename) - if not hasattr(sys.modules[prename], postname): - setattr(sys.modules[prename], postname, mod) - - return partdir, this_dir - -def __clone(): - """ clone master version of autopath.py into all subdirs """ - from os.path import join, walk - if not this_dir.endswith(join('pypy','tool')): - raise EnvironmentError("can only clone master version " - "'%s'" % join(pypydir, 'tool',_myname)) - - - def sync_walker(arg, dirname, fnames): - if _myname in fnames: - fn = join(dirname, _myname) - f = open(fn, 'rwb+') - try: - if f.read() == arg: - print "checkok", fn - else: - print "syncing", fn - f = open(fn, 'w') - f.write(arg) - finally: - f.close() - s = open(join(pypydir, 'tool', _myname), 'rb').read() - walk(pypydir, sync_walker, s) - -_myname = 'autopath.py' - -# set guaranteed attributes - -pypydir, this_dir = __dirinfo('pypy') - -if __name__ == '__main__': - __clone() diff --git a/pypy/jit/backend/ppc/ppcgen/pystructs.py b/pypy/jit/backend/ppc/ppcgen/pystructs.py deleted file mode 100644 --- a/pypy/jit/backend/ppc/ppcgen/pystructs.py +++ /dev/null @@ -1,22 +0,0 @@ -class PyVarObject(object): - ob_size = 8 - -class PyObject(object): - ob_refcnt = 0 - ob_type = 4 - -class PyTupleObject(object): - ob_item = 12 - -class PyTypeObject(object): - tp_name = 12 - tp_basicsize = 16 - tp_itemsize = 20 - tp_dealloc = 24 - -class PyFloatObject(object): - ob_fval = 8 - -class PyIntObject(object): - ob_ival = 8 - diff --git a/pypy/jit/backend/ppc/ppcgen/rassemblermaker.py b/pypy/jit/backend/ppc/ppcgen/rassemblermaker.py deleted file mode 100644 --- a/pypy/jit/backend/ppc/ppcgen/rassemblermaker.py +++ /dev/null @@ -1,63 +0,0 @@ -from pypy.tool.sourcetools import compile2 -from pypy.rlib.rarithmetic import r_uint -from pypy.jit.backend.ppc.ppcgen.form import IDesc, IDupDesc - -## "opcode": ( 0, 5), -## "rA": (11, 15, 'unsigned', regname._R), -## "rB": (16, 20, 'unsigned', regname._R), -## "Rc": (31, 31), -## "rD": ( 6, 10, 'unsigned', regname._R), -## "OE": (21, 21), -## "XO2": (22, 30), - -## XO = Form("rD", "rA", "rB", "OE", "XO2", "Rc") - -## add = XO(31, XO2=266, OE=0, Rc=0) - -## def add(rD, rA, rB): -## v = 0 -## v |= (31&(2**(5-0+1)-1)) << (32-5-1) -## ... -## return v - -def make_func(name, desc): - sig = [] - fieldvalues = [] - for field in desc.fields: - if field in desc.specializations: - fieldvalues.append((field, desc.specializations[field])) - else: - sig.append(field.name) - fieldvalues.append((field, field.name)) - if isinstance(desc, IDupDesc): - for destfield, srcfield in desc.dupfields.iteritems(): - fieldvalues.append((destfield, srcfield.name)) - body = ['v = r_uint(0)'] - assert 'v' not in sig # that wouldn't be funny - #body.append('print %r'%name + ', ' + ', '.join(["'%s:', %s"%(s, s) for s in sig])) - for field, value in fieldvalues: - if field.name == 'spr': - body.append('spr = (%s&31) << 5 | (%s >> 5 & 31)'%(value, value)) - value = 'spr' - body.append('v |= (%3s & r_uint(%#05x)) << %d'%(value, - field.mask, - (32 - field.right - 1))) - body.append('self.emit(v)') - src = 'def %s(self, %s):\n %s'%(name, ', '.join(sig), '\n '.join(body)) - d = {'r_uint':r_uint} - #print src - exec compile2(src) in d - return d[name] - -def make_rassembler(cls): - bases = [make_rassembler(b) for b in cls.__bases__] - ns = {} - for k, v in cls.__dict__.iteritems(): - if isinstance(v, IDesc): - v = make_func(k, v) - ns[k] = v - rcls = type('R' + cls.__name__, tuple(bases), ns) - def emit(self, value): - self.insts.append(value) - rcls.emit = emit - return rcls _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit