[pypy-commit] pypy kill-typesystem: merge lltypesystem.rvirtualizable2 into rtyper.rvirtualizable2
rlamy
noreply at buildbot.pypy.org
Mon Jul 29 03:08:53 CEST 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: kill-typesystem
Changeset: r65765:48dff2fcd56e
Date: 2013-07-29 02:05 +0100
http://bitbucket.org/pypy/pypy/changeset/48dff2fcd56e/
Log: merge lltypesystem.rvirtualizable2 into rtyper.rvirtualizable2
diff --git a/rpython/rtyper/lltypesystem/rvirtualizable2.py b/rpython/rtyper/lltypesystem/rvirtualizable2.py
deleted file mode 100644
--- a/rpython/rtyper/lltypesystem/rvirtualizable2.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from rpython.rtyper.rmodel import inputconst
-from rpython.rtyper.lltypesystem import lltype, llmemory
-from rpython.rtyper.lltypesystem.rclass import InstanceRepr, OBJECTPTR
-from rpython.rtyper.rvirtualizable2 import AbstractVirtualizable2InstanceRepr
-
-
-class Virtualizable2InstanceRepr(AbstractVirtualizable2InstanceRepr, InstanceRepr):
-
- def _setup_repr_llfields(self):
- llfields = []
- if self.top_of_virtualizable_hierarchy:
- llfields.append(('vable_token', llmemory.GCREF))
- return llfields
diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
--- a/rpython/rtyper/rclass.py
+++ b/rpython/rtyper/rclass.py
@@ -1,9 +1,11 @@
import types
+from rpython.flowspace.model import Constant
from rpython.annotator import description, model as annmodel
from rpython.rtyper.error import TyperError
from rpython.rtyper.lltypesystem.lltype import Void
from rpython.rtyper.rmodel import Repr, getgcflavor, inputconst
+from rpython.rlib.objectmodel import UnboxedValue
class FieldListAccessor(object):
@@ -73,8 +75,7 @@
def buildinstancerepr(rtyper, classdef, gcflavor='gc'):
- from rpython.rlib.objectmodel import UnboxedValue
- from rpython.flowspace.model import Constant
+ from rpython.rtyper.rvirtualizable2 import Virtualizable2InstanceRepr
if classdef is None:
unboxed = []
@@ -91,8 +92,8 @@
if virtualizable2:
assert len(unboxed) == 0
assert gcflavor == 'gc'
- return rtyper.type_system.rvirtualizable2.Virtualizable2InstanceRepr(rtyper, classdef)
- elif usetagging and rtyper.type_system.name == 'lltypesystem':
+ return Virtualizable2InstanceRepr(rtyper, classdef)
+ elif usetagging:
# the UnboxedValue class and its parent classes need a
# special repr for their instances
if len(unboxed) != 1:
diff --git a/rpython/rtyper/rvirtualizable2.py b/rpython/rtyper/rvirtualizable2.py
--- a/rpython/rtyper/rvirtualizable2.py
+++ b/rpython/rtyper/rvirtualizable2.py
@@ -1,35 +1,40 @@
from rpython.rtyper.rmodel import inputconst, log
-from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.rclass import AbstractInstanceRepr, FieldListAccessor
+from rpython.rtyper.lltypesystem import lltype, llmemory
+from rpython.rtyper.rclass import FieldListAccessor
+from rpython.rtyper.lltypesystem.rclass import InstanceRepr
-class AbstractVirtualizable2InstanceRepr(AbstractInstanceRepr):
+class Virtualizable2InstanceRepr(InstanceRepr):
def _super(self):
- return super(AbstractVirtualizable2InstanceRepr, self)
+ return super(Virtualizable2InstanceRepr, self)
def __init__(self, rtyper, classdef):
self._super().__init__(rtyper, classdef)
classdesc = classdef.classdesc
if '_virtualizable2_' in classdesc.classdict:
basedesc = classdesc.basedesc
- assert basedesc is None or basedesc.lookup('_virtualizable2_') is None
+ assert basedesc is None or basedesc.lookup(
+ '_virtualizable2_') is None
self.top_of_virtualizable_hierarchy = True
self.accessor = FieldListAccessor()
else:
self.top_of_virtualizable_hierarchy = False
def _setup_repr_llfields(self):
- raise NotImplementedError
+ llfields = []
+ if self.top_of_virtualizable_hierarchy:
+ llfields.append(('vable_token', llmemory.GCREF))
+ return llfields
def _setup_repr(self):
if self.top_of_virtualizable_hierarchy:
hints = {'virtualizable2_accessor': self.accessor}
llfields = self._setup_repr_llfields()
if llfields:
- self._super()._setup_repr(llfields, hints = hints)
+ self._super()._setup_repr(llfields, hints=hints)
else:
- self._super()._setup_repr(hints = hints)
+ self._super()._setup_repr(hints=hints)
c_vfields = self.classdef.classdesc.classdict['_virtualizable2_']
self.my_redirected_fields = self._parse_field_list(c_vfields.value,
self.accessor)
@@ -40,7 +45,7 @@
self.my_redirected_fields = self.rbase.my_redirected_fields
def hook_access_field(self, vinst, cname, llops, flags):
- #if not flags.get('access_directly'):
+ # if not flags.get('access_directly'):
if self.my_redirected_fields.get(cname.value):
cflags = inputconst(lltype.Void, flags)
llops.genop('jit_force_virtualizable', [vinst, cname, cflags])
diff --git a/rpython/rtyper/typesystem.py b/rpython/rtyper/typesystem.py
--- a/rpython/rtyper/typesystem.py
+++ b/rpython/rtyper/typesystem.py
@@ -21,8 +21,7 @@
return None
if name in ('rclass', 'rpbc', 'rbuiltin', 'rtuple', 'rlist',
'rslice', 'rdict', 'rrange', 'rstr',
- 'll_str', 'rbuilder', 'rvirtualizable2', 'rbytearray',
- 'exceptiondata'):
+ 'll_str', 'rbuilder', 'rbytearray', 'exceptiondata'):
mod = load(name)
if mod is not None:
setattr(self, name, mod)
More information about the pypy-commit
mailing list