[pypy-svn] r22808 - in pypy/dist/pypy/jit: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Jan 28 20:09:10 CET 2006
Author: arigo
Date: Sat Jan 28 20:09:07 2006
New Revision: 22808
Modified:
pypy/dist/pypy/jit/hintcontainer.py
pypy/dist/pypy/jit/hintmodel.py
pypy/dist/pypy/jit/test/test_hint_annotation.py
Log:
(pedronis, arre around, arigo)
Some more operations here and there, and substructures.
Modified: pypy/dist/pypy/jit/hintcontainer.py
==============================================================================
--- pypy/dist/pypy/jit/hintcontainer.py (original)
+++ pypy/dist/pypy/jit/hintcontainer.py Sat Jan 28 20:09:07 2006
@@ -1,5 +1,6 @@
from pypy.annotation.listdef import ListItem
from pypy.jit import hintmodel
+from pypy.rpython.lltypesystem import lltype
class FieldValue(ListItem):
@@ -20,7 +21,13 @@
self.fields = {}
self.names = TYPE._names
for name in self.names:
- hs = hintmodel.SomeLLAbstractConstant(self.fieldtype(name), {})
+ FIELD_TYPE = self.fieldtype(name)
+ if isinstance(FIELD_TYPE, lltype.ContainerType):
+ assert isinstance(FIELD_TYPE, lltype.Struct) # for now
+ vstructdef = VirtualStructDef(bookkeeper, FIELD_TYPE)
+ hs = hintmodel.SomeLLAbstractContainer(vstructdef)
+ else:
+ hs = hintmodel.SomeLLAbstractConstant(FIELD_TYPE, {})
fv = self.fields[name] = FieldValue(bookkeeper, name, hs)
fv.itemof[self] = True
Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py (original)
+++ pypy/dist/pypy/jit/hintmodel.py Sat Jan 28 20:09:07 2006
@@ -3,7 +3,8 @@
from pypy.jit.hintbookkeeper import getbookkeeper
from pypy.rpython.lltypesystem import lltype
-UNARY_OPERATIONS = "same_as hint getfield setfield direct_call".split()
+UNARY_OPERATIONS = """same_as hint getfield setfield getsubstruct getarraysize
+ direct_call""".split()
BINARY_OPERATIONS = "int_add int_sub int_mul int_gt int_eq".split()
@@ -93,6 +94,18 @@
else:
return SomeLLAbstractVariable(FIELD_TYPE)
+ def getsubstruct(hs_c1, hs_fieldname):
+ S = hs_c1.concretetype.TO
+ SUB_TYPE = getattr(S, hs_fieldname.const)
+ origin = getbookkeeper().myorigin()
+ origin.merge(hs_c1.origins)
+ return SomeLLAbstractConstant(lltype.Ptr(SUB_TYPE), {origin: True})
+
+ def getarraysize(hs_c1):
+ origin = getbookkeeper().myorigin()
+ origin.merge(hs_c1.origins)
+ return SomeLLAbstractConstant(lltype.Signed, {origin: True})
+
def direct_call(hs_f1, *args_hs):
bookkeeper = getbookkeeper()
graph = hs_f1.const._obj.graph
@@ -110,6 +123,8 @@
def getfield(hs_s1, hs_fieldname):
return hs_s1.contentdef.read_field(hs_fieldname.const)
+ getsubstruct = getfield
+
class __extend__(pairtype(SomeLLAbstractValue, SomeLLAbstractValue)):
Modified: pypy/dist/pypy/jit/test/test_hint_annotation.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_hint_annotation.py (original)
+++ pypy/dist/pypy/jit/test/test_hint_annotation.py Sat Jan 28 20:09:07 2006
@@ -218,12 +218,3 @@
from pypy.jit import tl
hannotate(tl.interp, [str, int])
-
-
-
-
-
-
-
-
-
More information about the Pypy-commit
mailing list