[pypy-svn] r34806 - in pypy/dist/pypy: annotation rpython
pedronis at codespeak.net
pedronis at codespeak.net
Mon Nov 20 20:04:47 CET 2006
Author: pedronis
Date: Mon Nov 20 20:04:38 2006
New Revision: 34806
Modified:
pypy/dist/pypy/annotation/builtin.py
pypy/dist/pypy/annotation/model.py
pypy/dist/pypy/rpython/annlowlevel.py
Log:
(arigo, pedronis)
move not_const to model.py; make it so that the result of hint is never a constant.
Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py (original)
+++ pypy/dist/pypy/annotation/builtin.py Mon Nov 20 20:04:38 2006
@@ -10,7 +10,7 @@
from pypy.annotation.model import SomePBC, SomeInstance, SomeDict
from pypy.annotation.model import SomeExternalObject
from pypy.annotation.model import annotation_to_lltype, lltype_to_annotation, ll_to_annotation
-from pypy.annotation.model import add_knowntypedata
+from pypy.annotation.model import add_knowntypedata, not_const
from pypy.annotation.model import s_ImpossibleValue
from pypy.annotation.bookkeeper import getbookkeeper
from pypy.annotation import description
@@ -299,7 +299,7 @@
return immutablevalue(None)
def robjmodel_hint(s, **kwds_s):
- return s
+ return not_const(s)
def llmemory_cast_ptr_to_adr(s):
return SomeAddress()
Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py (original)
+++ pypy/dist/pypy/annotation/model.py Mon Nov 20 20:04:38 2006
@@ -659,6 +659,18 @@
r[truth_v] = unionof(ktd1[truth_v], ktd2[truth_v])
return r
+def not_const(s_obj):
+ if s_obj.is_constant():
+ new_s_obj = SomeObject()
+ new_s_obj.__class__ = s_obj.__class__
+ dic = new_s_obj.__dict__ = s_obj.__dict__.copy()
+ if 'const' in dic:
+ del new_s_obj.const
+ else:
+ del new_s_obj.const_box
+ s_obj = new_s_obj
+ return s_obj
+
# ____________________________________________________________
# internal
Modified: pypy/dist/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/dist/pypy/rpython/annlowlevel.py (original)
+++ pypy/dist/pypy/rpython/annlowlevel.py Mon Nov 20 20:04:38 2006
@@ -10,16 +10,6 @@
from pypy.rpython import extfunctable, extregistry
from pypy.objspace.flow.model import Constant
-def not_const(s_obj): # xxx move it somewhere else
- if s_obj.is_constant():
- new_s_obj = annmodel.SomeObject()
- new_s_obj.__class__ = s_obj.__class__
- new_s_obj.__dict__ = s_obj.__dict__.copy()
- del new_s_obj.const
- s_obj = new_s_obj
- return s_obj
-
-
class KeyComp(object):
def __init__(self, val):
self.val = val
@@ -59,7 +49,7 @@
key.append(KeyComp(s_obj.const))
new_args_s.append(s_obj)
else:
- new_args_s.append(not_const(s_obj))
+ new_args_s.append(annmodel.not_const(s_obj))
try:
key.append(annmodel.annotation_to_lltype(s_obj))
except ValueError:
More information about the Pypy-commit
mailing list