[pypy-svn] r20573 - in pypy/dist/pypy: annotation objspace/std translator/goal
arigo at codespeak.net
arigo at codespeak.net
Fri Dec 2 14:51:57 CET 2005
Author: arigo
Date: Fri Dec 2 14:51:56 2005
New Revision: 20573
Added:
pypy/dist/pypy/translator/goal/targetmultiplespaces.py
- copied unchanged from r19545, pypy/dist/pypy/translator/goal/targetmultiplespaces.py
Modified:
pypy/dist/pypy/annotation/builtin.py
pypy/dist/pypy/objspace/std/objspace.py
Log:
(mwh, pedronis, arre, arigo)
Reintroduced the two-spaces PyPy target. With a few tweaks
in the source of PyPy, this can now compile!
Three weeks of refactoring...
Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py (original)
+++ pypy/dist/pypy/annotation/builtin.py Fri Dec 2 14:51:56 2005
@@ -11,7 +11,9 @@
from pypy.annotation.model import SomeExternalObject
from pypy.annotation.model import annotation_to_lltype, lltype_to_annotation
from pypy.annotation.model import add_knowntypedata
+from pypy.annotation.model import s_ImpossibleValue
from pypy.annotation.bookkeeper import getbookkeeper
+from pypy.annotation import description
from pypy.objspace.flow.model import Constant
import pypy.rpython.rarithmetic
import pypy.rpython.objectmodel
@@ -169,6 +171,14 @@
r = SomeBool()
if s_obj.is_constant():
r.const = hasattr(s_obj.const, s_attr.const)
+ elif (isinstance(s_obj, SomePBC)
+ and s_obj.getKind() is description.FrozenDesc):
+ answers = {}
+ for d in s_obj.descriptions:
+ answer = (d.s_read_attribute(s_attr.const) != s_ImpossibleValue)
+ answers[answer] = True
+ if len(answers) == 1:
+ r.const, = answers
return r
##def builtin_callable(s_obj):
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Fri Dec 2 14:51:56 2005
@@ -5,6 +5,7 @@
from pypy.rpython.objectmodel import instantiate
from pypy.interpreter.gateway import PyPyCacheDir
from pypy.tool.cache import Cache
+from pypy.tool.sourcetools import func_with_new_name
from pypy.objspace.std.model import W_Object, UnwrapError
from pypy.objspace.std.model import W_ANY, StdObjSpaceMultiMethod, StdTypeModel
from pypy.objspace.std.multimethod import FailedToImplement
@@ -52,7 +53,11 @@
mm)
# e.g. add(space, w_x, w_y)
- boundmethod = func.__get__(self) # bind the 'space' argument
+ def make_boundmethod(func=func):
+ def boundmethod(*args):
+ return func(self, *args)
+ return func_with_new_name(boundmethod, 'boundmethod_'+name)
+ boundmethod = make_boundmethod()
setattr(self, name, boundmethod) # store into 'space' instance
# hack to avoid imports in the time-critical functions below
More information about the Pypy-commit
mailing list