[pypy-commit] pypy translation-cleanup: Don't intern co-names in flow space
rlamy
noreply at buildbot.pypy.org
Thu Sep 27 19:29:13 CEST 2012
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r57628:333edc09fec9
Date: 2012-09-27 03:11 +0100
http://bitbucket.org/pypy/pypy/changeset/333edc09fec9/
Log: Don't intern co-names in flow space
Interning is effectively meaningless there. + Copy PyCode.__init__
inot HostCode
diff --git a/pypy/objspace/flow/bytecode.py b/pypy/objspace/flow/bytecode.py
--- a/pypy/objspace/flow/bytecode.py
+++ b/pypy/objspace/flow/bytecode.py
@@ -1,7 +1,8 @@
"""
Bytecode handling classes and functions for use by the flow space.
"""
-from pypy.interpreter.pycode import PyCode, BytecodeCorruption
+from pypy.interpreter.pycode import (PyCode, BytecodeCorruption, cpython_magic,
+ cpython_code_signature)
from pypy.tool.stdlib_opcode import (host_bytecode_spec, EXTENDED_ARG,
HAVE_ARGUMENT)
from pypy.interpreter.astcompiler.consts import CO_GENERATOR
@@ -12,6 +13,33 @@
"""
opnames = host_bytecode_spec.method_names
+ def __init__(self, space, argcount, nlocals, stacksize, flags,
+ code, consts, names, varnames, filename,
+ name, firstlineno, lnotab, freevars, cellvars,
+ hidden_applevel=False, magic=cpython_magic):
+ """Initialize a new code object"""
+ self.space = space
+ self.co_name = name
+ assert nlocals >= 0
+ self.co_argcount = argcount
+ self.co_nlocals = nlocals
+ self.co_stacksize = stacksize
+ self.co_flags = flags
+ self.co_code = code
+ self.co_consts_w = consts
+ self.co_names_w = [space.wrap(aname) for aname in names]
+ self.co_varnames = varnames
+ self.co_freevars = freevars
+ self.co_cellvars = cellvars
+ self.co_filename = filename
+ self.co_name = name
+ self.co_firstlineno = firstlineno
+ self.co_lnotab = lnotab
+ self.hidden_applevel = hidden_applevel
+ self.magic = magic
+ self._signature = cpython_code_signature(self)
+ self._initialize()
+
def read(self, pos):
"""
Decode the instruction starting at position ``next_instr``.
More information about the pypy-commit
mailing list