[pypy-svn] r48899 - in pypy/dist/pypy: annotation jit/hintannotator rlib rpython rpython/lltypesystem rpython/module translator translator/backendopt translator/c translator/c/test translator/llvm translator/oosupport translator/stackless
xoraxax at codespeak.net
xoraxax at codespeak.net
Wed Nov 21 14:34:41 CET 2007
Author: xoraxax
Date: Wed Nov 21 14:34:39 2007
New Revision: 48899
Removed:
pypy/dist/pypy/rpython/extfunctable.py
Modified:
pypy/dist/pypy/annotation/builtin.py
pypy/dist/pypy/annotation/model.py
pypy/dist/pypy/annotation/unaryop.py
pypy/dist/pypy/jit/hintannotator/model.py
pypy/dist/pypy/rlib/rstack.py
pypy/dist/pypy/rpython/annlowlevel.py
pypy/dist/pypy/rpython/exceptiondata.py
pypy/dist/pypy/rpython/extfunc.py
pypy/dist/pypy/rpython/extfuncregistry.py
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/lltypesystem/exceptiondata.py
pypy/dist/pypy/rpython/lltypesystem/lltype.py
pypy/dist/pypy/rpython/module/support.py
pypy/dist/pypy/rpython/rbuiltin.py
pypy/dist/pypy/rpython/rexternalobj.py
pypy/dist/pypy/rpython/rspecialcase.py
pypy/dist/pypy/translator/backendopt/inline.py
pypy/dist/pypy/translator/backendopt/removenoops.py
pypy/dist/pypy/translator/backendopt/support.py
pypy/dist/pypy/translator/c/database.py
pypy/dist/pypy/translator/c/node.py
pypy/dist/pypy/translator/c/test/test_stackless.py
pypy/dist/pypy/translator/llvm/database.py
pypy/dist/pypy/translator/llvm/typedefnode.py
pypy/dist/pypy/translator/oosupport/function.py
pypy/dist/pypy/translator/oosupport/metavm.py
pypy/dist/pypy/translator/simplify.py
pypy/dist/pypy/translator/stackless/code.py
pypy/dist/pypy/translator/stackless/frame.py
Log:
(cfbolz, xoraxax): Remove extfunctable and suggested_primitive support. Refactored exttypeinfo-usage
of rstack to use a hint on the opaquetype. Ignored a weird hack in the extfunctable regarding ntpath.isabs
because there is str in str support in rpython now.
Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py (original)
+++ pypy/dist/pypy/annotation/builtin.py Wed Nov 21 14:34:39 2007
@@ -662,25 +662,3 @@
BUILTIN_ANALYZERS[llmemory.offsetof] = offsetof
-#_________________________________
-# external functions
-
-
-from pypy.rpython import extfunctable
-
-def update_exttables():
-
- # import annotation information for external functions
- # from the extfunctable.table into our own annotation specific table
- for func, extfuncinfo in extfunctable.table.iteritems():
- BUILTIN_ANALYZERS[func] = extfuncinfo.annotation
-
- # import annotation information for external types
- # from the extfunctable.typetable into our own annotation specific table
- for typ, exttypeinfo in extfunctable.typetable.iteritems():
- EXTERNAL_TYPE_ANALYZERS[typ] = exttypeinfo.get_annotations()
-
-# Note: calls to declare() may occur after builtin.py is first imported.
-# We must track future changes to the extfunctables.
-extfunctable.table_callbacks.append(update_exttables)
-update_exttables()
Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py (original)
+++ pypy/dist/pypy/annotation/model.py Wed Nov 21 14:34:39 2007
@@ -460,9 +460,7 @@
class SomeExternalObject(SomeObject):
"""Stands for an object of 'external' type. External types have a Repr
- controlled by pypy.rpython.extregistry; or they come from the (obsolete)
- table created by pypy.rpython.extfunctable.declaretype() and represent
- simple types with some methods that need direct back-end support."""
+ controlled by pypy.rpython.extregistry."""
def __init__(self, knowntype):
self.knowntype = knowntype
Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py (original)
+++ pypy/dist/pypy/annotation/unaryop.py Wed Nov 21 14:34:39 2007
@@ -634,21 +634,8 @@
return self.s_result
class __extend__(SomeExternalObject):
- # XXX kill with extfunctable.py
- def find_method(obj, name):
- "Look for a special-case implementation for the named method."
- type_analyser = builtin.EXTERNAL_TYPE_ANALYZERS[obj.knowntype]
- if name in type_analyser:
- analyser = type_analyser[name]
- return SomeBuiltin(analyser, obj, name)
- return SomeObject.find_method(obj, name)
-
def getattr(p, s_attr):
if s_attr.is_constant() and isinstance(s_attr.const, str):
- # XXX kill with extfunctable.py
- if p.knowntype in builtin.EXTERNAL_TYPE_ANALYZERS:
- return SomeObject.getattr(p, s_attr)
-
attr = s_attr.const
entry = extregistry.lookup_type(p.knowntype)
s_value = entry.get_field_annotation(p.knowntype, attr)
Modified: pypy/dist/pypy/jit/hintannotator/model.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/model.py (original)
+++ pypy/dist/pypy/jit/hintannotator/model.py Wed Nov 21 14:34:39 2007
@@ -437,9 +437,6 @@
*args_hs)
except NotImplementedError:
pass
- # don't try to annotate suggested_primitive graphs
- if getattr(getattr(fnobj, '_callable', None), 'suggested_primitive', False):
- return variableoftype(lltype.typeOf(fnobj).RESULT)
# normal call
if not hasattr(fnobj, 'graph'):
Modified: pypy/dist/pypy/rlib/rstack.py
==============================================================================
--- pypy/dist/pypy/rlib/rstack.py (original)
+++ pypy/dist/pypy/rlib/rstack.py Wed Nov 21 14:34:39 2007
@@ -78,8 +78,7 @@
frame_stack_top_controller = FrameStackTopController()
bound_switch_of_frame_stack_top_controller = BoundSwitchOfFrameStackTopController()
-OPAQUE_STATE_HEADER = lltype.GcOpaqueType("OPAQUE_STATE_HEADER")
-OPAQUE_STATE_HEADER._exttypeinfo = "Really bad hack - dont remove"
+OPAQUE_STATE_HEADER = lltype.GcOpaqueType("OPAQUE_STATE_HEADER", hints={"render_structure": True})
OPAQUE_STATE_HEADER_PTR = lltype.Ptr(OPAQUE_STATE_HEADER)
Modified: pypy/dist/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/dist/pypy/rpython/annlowlevel.py (original)
+++ pypy/dist/pypy/rpython/annlowlevel.py Wed Nov 21 14:34:39 2007
@@ -8,7 +8,7 @@
from pypy.annotation.policy import AnnotatorPolicy, Sig
from pypy.annotation.specialize import flatten_star_args
from pypy.rpython.lltypesystem import lltype
-from pypy.rpython import extfunctable, extregistry
+from pypy.rpython import extregistry
from pypy.objspace.flow.model import Constant
class KeyComp(object):
@@ -71,25 +71,6 @@
return LowLevelAnnotatorPolicy.lowlevelspecialize(funcdesc, args_s, {})
default_specialize = staticmethod(default_specialize)
- def override__init_opaque_object(pol, s_opaqueptr, s_value):
- assert isinstance(s_opaqueptr, annmodel.SomePtr)
- assert isinstance(s_opaqueptr.ll_ptrtype.TO, lltype.OpaqueType)
- assert isinstance(s_value, annmodel.SomeExternalObject)
- exttypeinfo = extfunctable.typetable[s_value.knowntype]
- assert s_opaqueptr.ll_ptrtype.TO._exttypeinfo == exttypeinfo
- return annmodel.SomeExternalObject(exttypeinfo.typ)
-
- def override__from_opaque_object(pol, s_opaqueptr):
- assert isinstance(s_opaqueptr, annmodel.SomePtr)
- assert isinstance(s_opaqueptr.ll_ptrtype.TO, lltype.OpaqueType)
- exttypeinfo = s_opaqueptr.ll_ptrtype.TO._exttypeinfo
- return annmodel.SomeExternalObject(exttypeinfo.typ)
-
- def override__to_opaque_object(pol, s_value):
- assert isinstance(s_value, annmodel.SomeExternalObject)
- exttypeinfo = extfunctable.typetable[s_value.knowntype]
- return annmodel.SomePtr(lltype.Ptr(exttypeinfo.get_lltype()))
-
def specialize__ts(pol, funcdesc, args_s, ref):
ts = pol.rtyper.type_system
ref = ref.split('.')
Modified: pypy/dist/pypy/rpython/exceptiondata.py
==============================================================================
--- pypy/dist/pypy/rpython/exceptiondata.py (original)
+++ pypy/dist/pypy/rpython/exceptiondata.py Wed Nov 21 14:34:39 2007
@@ -1,7 +1,26 @@
from pypy.rpython import rclass
-from pypy.rpython.extfunctable import standardexceptions
from pypy.annotation import model as annmodel
+
+# the exceptions that can be implicitely raised by some operations
+standardexceptions = {
+ TypeError : True,
+ OverflowError : True,
+ ValueError : True,
+ ZeroDivisionError: True,
+ MemoryError : True,
+ IOError : True,
+ OSError : True,
+ StopIteration : True,
+ KeyError : True,
+ IndexError : True,
+ AssertionError : True,
+ RuntimeError : True,
+ UnicodeDecodeError: True,
+ UnicodeEncodeError: True,
+ }
+
+
class AbstractExceptionData:
"""Public information for the code generators to help with exceptions."""
standardexceptions = standardexceptions
@@ -42,3 +61,5 @@
example = r_inst.get_reusable_prebuilt_instance()
example = self.cast_exception(self.lltype_of_exception_value, example)
return example
+
+
Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py (original)
+++ pypy/dist/pypy/rpython/extfunc.py Wed Nov 21 14:34:39 2007
@@ -271,8 +271,6 @@
def is_external(func):
if hasattr(func, 'value'):
func = func.value
- if getattr(func._callable, 'suggested_primitive', False):
- return True
if hasattr(func, '_external_name'):
return True
return False
Modified: pypy/dist/pypy/rpython/extfuncregistry.py
==============================================================================
--- pypy/dist/pypy/rpython/extfuncregistry.py (original)
+++ pypy/dist/pypy/rpython/extfuncregistry.py Wed Nov 21 14:34:39 2007
@@ -1,6 +1,4 @@
# this registry uses the new interface for external functions
-# all the above declarations in extfunctable should be moved here
-# at some point.
from extfunc import register_external
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Wed Nov 21 14:34:39 2007
@@ -615,8 +615,6 @@
def perform_call(self, f, ARGS, args):
fobj = self.llinterpreter.typer.type_system.deref(f)
has_callable = getattr(fobj, '_callable', None) is not None
- if has_callable and getattr(fobj._callable, 'suggested_primitive', False):
- return self.invoke_callable_with_pyexceptions(f, *args)
if hasattr(fobj, 'graph'):
graph = fobj.graph
else:
Modified: pypy/dist/pypy/rpython/lltypesystem/exceptiondata.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/exceptiondata.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/exceptiondata.py Wed Nov 21 14:34:39 2007
@@ -4,7 +4,6 @@
Array, malloc, Ptr, PyObject, pyobjectptr, \
FuncType, functionptr, Signed
from pypy.rpython.exceptiondata import AbstractExceptionData
-from pypy.rpython.extfunctable import standardexceptions
from pypy.annotation.classdef import FORCE_ATTRIBUTES_INTO_CLASSES
class ExceptionData(AbstractExceptionData):
Modified: pypy/dist/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lltype.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/lltype.py Wed Nov 21 14:34:39 2007
@@ -455,6 +455,8 @@
_gckind = 'raw'
def __init__(self, tag, hints={}):
+ """ if hints['render_structure'] is set, the type is internal and not considered
+ to come from somewhere else (it should be rendered as a structure) """
self.tag = tag
self.__name__ = tag
self.hints = frozendict(hints)
Modified: pypy/dist/pypy/rpython/module/support.py
==============================================================================
--- pypy/dist/pypy/rpython/module/support.py (original)
+++ pypy/dist/pypy/rpython/module/support.py Wed Nov 21 14:34:39 2007
@@ -1,6 +1,5 @@
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.ootypesystem import ootype
-from pypy.rpython import extfunctable
from pypy.rpython.lltypesystem.lltype import \
GcStruct, Signed, Array, Char, Ptr, malloc, GcArray
from pypy.rpython.rlist import ll_append
@@ -86,19 +85,4 @@
dstchars[i] = srcchars[i]
i += 1
-def init_opaque_object(opaqueptr, value):
- "NOT_RPYTHON"
- opaqueptr._obj.externalobj = value
-init_opaque_object._annspecialcase_ = "override:init_opaque_object"
-
-def from_opaque_object(opaqueptr):
- "NOT_RPYTHON"
- return opaqueptr._obj.externalobj
-from_opaque_object._annspecialcase_ = "override:from_opaque_object"
-
-def to_opaque_object(value):
- "NOT_RPYTHON"
- exttypeinfo = extfunctable.typetable[value.__class__]
- return lltype.opaqueptr(exttypeinfo.get_lltype(), 'opaque',
- externalobj=value)
-to_opaque_object._annspecialcase_ = "override:to_opaque_object"
+
Modified: pypy/dist/pypy/rpython/rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/rbuiltin.py (original)
+++ pypy/dist/pypy/rpython/rbuiltin.py Wed Nov 21 14:34:39 2007
@@ -515,53 +515,6 @@
BUILTIN_TYPER[objectmodel.hlinvoke] = rtype_hlinvoke
-from pypy.rpython import extfunctable
-
-def rnormalize(rtyper, r):
- # this replaces char_repr with string_repr, because so far we have
- # no external function expecting a char, but only external functions
- # that happily crash if passed a char instead of a string
- if r == rtyper.type_system.rstr.char_repr:
- r = rtyper.type_system.rstr.string_repr
- return r
-
-def make_rtype_extfunc(extfuncinfo):
- if extfuncinfo.ll_annotable:
- def rtype_extfunc(hop):
- ll_function = extfuncinfo.get_ll_function(hop.rtyper.type_system)
- vars = hop.inputargs(*[rnormalize(hop.rtyper, r)
- for r in hop.args_r])
- hop.exception_is_here()
- return hop.gendirectcall(ll_function, *vars)
- else:
- def rtype_extfunc(hop):
- ll_function = extfuncinfo.get_ll_function(hop.rtyper.type_system)
- resulttype = hop.r_result
- vars = hop.inputargs(*[rnormalize(hop.rtyper, r)
- for r in hop.args_r])
- hop.exception_is_here()
- return hop.llops.genexternalcall(ll_function.__name__, vars, resulttype=resulttype,
- _callable = ll_function)
-
- if extfuncinfo.func is not None:
- rtype_extfunc = sourcetools.func_with_new_name(rtype_extfunc,
- "rtype_extfunc_%s" % extfuncinfo.func.__name__)
- return rtype_extfunc
-
-
-def update_exttable():
- """import rtyping information for external functions
- from the extfunctable.table into our own specific table
- """
- for func, extfuncinfo in extfunctable.table.iteritems():
- if func not in BUILTIN_TYPER:
- BUILTIN_TYPER[func] = make_rtype_extfunc(extfuncinfo)
-
-# Note: calls to declare() may occur after rbuiltin.py is first imported.
-# We must track future changes to the extfunctable.
-extfunctable.table_callbacks.append(update_exttable)
-update_exttable()
-
# _________________________________________________________________
# memory addresses
Modified: pypy/dist/pypy/rpython/rexternalobj.py
==============================================================================
--- pypy/dist/pypy/rpython/rexternalobj.py (original)
+++ pypy/dist/pypy/rpython/rexternalobj.py Wed Nov 21 14:34:39 2007
@@ -2,9 +2,7 @@
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.rmodel import Repr, HalfConcreteWrapper
-from pypy.rpython.extfunctable import typetable
from pypy.rpython import rbuiltin
-from pypy.rpython.module.support import init_opaque_object
from pypy.objspace.flow.model import Constant, Variable
from pypy.rpython import extregistry
from pypy.annotation.signature import annotation
@@ -15,13 +13,9 @@
class __extend__(annmodel.SomeExternalObject):
def rtyper_makerepr(self, rtyper):
- # XXX kill with extfunctable.py
- if self.knowntype in typetable:
- return ExternalObjRepr(self.knowntype)
- else:
- # delegate to the get_repr() of the extregistrered Entry class
- entry = extregistry.lookup_type(self.knowntype)
- return entry.get_repr(rtyper, self)
+ # delegate to the get_repr() of the extregistrered Entry class
+ entry = extregistry.lookup_type(self.knowntype)
+ return entry.get_repr(rtyper, self)
def rtyper_makekey(self):
# grab all attributes of the SomeExternalObject for the key
@@ -31,41 +25,4 @@
if 'const_box' in attrs:
del attrs['const_box']
return self.__class__, attrs
-
-class ExternalObjRepr(Repr):
- """Repr for the (obsolecent) extfunctable.declaretype() case.
- If you use the extregistry instead you get to pick your own Repr.
- """
- def __init__(self, knowntype):
- self.exttypeinfo = typetable[knowntype]
- TYPE = self.exttypeinfo.get_lltype()
- self.lowleveltype = lltype.Ptr(TYPE)
- self.instance_cache = {}
- # The set of methods supported depends on 'knowntype', so we
- # cannot have rtype_method_xxx() methods directly on the
- # ExternalObjRepr class. But we can store them in 'self' now.
- for name, extfuncinfo in self.exttypeinfo.methods.items():
- methodname = 'rtype_method_' + name
- bltintyper = rbuiltin.make_rtype_extfunc(extfuncinfo)
- setattr(self, methodname, bltintyper)
-
- def convert_const(self, value):
- T = self.exttypeinfo.get_lltype()
- if value is None:
- return lltype.nullptr(T)
- if not isinstance(value, self.exttypeinfo.typ):
- raise TyperError("expected a %r: %r" % (self.exttypeinfo.typ,
- value))
- key = Constant(value)
- try:
- p = self.instance_cache[key]
- except KeyError:
- p = lltype.malloc(T)
- init_opaque_object(p.obj, value)
- self.instance_cache[key] = p
- return p
-
- def rtype_is_true(self, hop):
- vlist = hop.inputargs(self)
- return hop.genop('ptr_nonzero', vlist, resulttype=lltype.Bool)
Modified: pypy/dist/pypy/rpython/rspecialcase.py
==============================================================================
--- pypy/dist/pypy/rpython/rspecialcase.py (original)
+++ pypy/dist/pypy/rpython/rspecialcase.py Wed Nov 21 14:34:39 2007
@@ -30,18 +30,6 @@
v, = hop.inputargs(hop.args_r[0])
return v
-def rtype_override_init_opaque_object(hop):
- return hop.genop('init_opaque_object_should_never_be_seen_by_the_backend',
- [], resulttype=hop.r_result)
-
-def rtype_override_from_opaque_object(hop):
- return hop.genop('from_opaque_object_should_never_be_seen_by_the_backend',
- [], resulttype=hop.r_result)
-
-def rtype_override_to_opaque_object(hop):
- return hop.genop('to_opaque_object_should_never_be_seen_by_the_backend',
- [], resulttype=hop.r_result)
-
def rtype_override_yield_current_frame_to_caller(hop):
return hop.genop('yield_current_frame_to_caller', [],
resulttype=hop.r_result)
Modified: pypy/dist/pypy/translator/backendopt/inline.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/inline.py (original)
+++ pypy/dist/pypy/translator/backendopt/inline.py Wed Nov 21 14:34:39 2007
@@ -634,9 +634,6 @@
graph = getattr(funcobj, 'graph', None)
if graph is not None:
if getattr(getattr(funcobj, '_callable', None),
- 'suggested_primitive', False):
- continue
- if getattr(getattr(funcobj, '_callable', None),
'dont_inline', False):
continue
result.append((parentgraph, graph))
@@ -669,9 +666,6 @@
graph = getattr(funcobj, 'graph', None)
if graph is not None:
if getattr(getattr(funcobj, '_callable', None),
- 'suggested_primitive', False):
- continue
- if getattr(getattr(funcobj, '_callable', None),
'dont_inline', False):
continue
if candidate(graph):
Modified: pypy/dist/pypy/translator/backendopt/removenoops.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removenoops.py (original)
+++ pypy/dist/pypy/translator/backendopt/removenoops.py Wed Nov 21 14:34:39 2007
@@ -111,25 +111,4 @@
else:
used[op.args[0]] = True
-##def rename_extfunc_calls(translator):
-## from pypy.rpython.extfunctable import table as extfunctable
-## def visit(block):
-## if isinstance(block, Block):
-## for op in block.operations:
-## if op.opname != 'direct_call':
-## continue
-## functionref = op.args[0]
-## if not isinstance(functionref, Constant):
-## continue
-## _callable = functionref.value._obj._callable
-## for func, extfuncinfo in extfunctable.iteritems(): # precompute a dict?
-## if _callable is not extfuncinfo.ll_function or not extfuncinfo.backend_functiontemplate:
-## continue
-## language, functionname = extfuncinfo.backend_functiontemplate.split(':')
-## if language is 'C':
-## old_name = functionref.value._obj._name[:]
-## functionref.value._obj._name = functionname
-## #print 'rename_extfunc_calls: %s -> %s' % (old_name, functionref.value._obj._name)
-## break
-## for func, graph in translator.flowgraphs.iteritems():
-## traverse(visit, graph)
+
Modified: pypy/dist/pypy/translator/backendopt/support.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/support.py (original)
+++ pypy/dist/pypy/translator/backendopt/support.py Wed Nov 21 14:34:39 2007
@@ -108,8 +108,6 @@
return splitlink
def find_calls_from(translator, graph):
- if getattr(getattr(graph, "func", None), "suggested_primitive", False):
- return
for block in graph.iterblocks():
for op in block.operations:
if op.opname == "direct_call":
Modified: pypy/dist/pypy/translator/c/database.py
==============================================================================
--- pypy/dist/pypy/translator/c/database.py (original)
+++ pypy/dist/pypy/translator/c/database.py Wed Nov 21 14:34:39 2007
@@ -87,7 +87,7 @@
node = BareBoneArrayDefNode(self, T, varlength)
else:
node = ArrayDefNode(self, T, varlength)
- elif isinstance(T, OpaqueType) and hasattr(T, '_exttypeinfo'):
+ elif isinstance(T, OpaqueType) and T.hints.get("render_structure", False):
node = ExtTypeOpaqueDefNode(self, T)
elif T == WeakRef:
REALT = self.gcpolicy.get_real_weakref_type()
@@ -134,8 +134,7 @@
elif isinstance(T, OpaqueType):
if T == RuntimeTypeInfo:
return self.gcpolicy.rtti_type()
- elif hasattr(T, '_exttypeinfo'):
- # for external types (pypy.rpython.extfunctable.declaretype())
+ elif T.hints.get("render_structure", False):
node = self.gettypedefnode(T, varlength=varlength)
if who_asks is not None:
who_asks.dependencies[node] = True
Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py (original)
+++ pypy/dist/pypy/translator/c/node.py Wed Nov 21 14:34:39 2007
@@ -433,7 +433,7 @@
class ExtTypeOpaqueDefNode:
- "For OpaqueTypes created by pypy.rpython.extfunctable.ExtTypeInfo."
+ """For OpaqueTypes created with the hint render_structure."""
typetag = 'struct'
def __init__(self, db, T):
@@ -867,7 +867,7 @@
def opaquenode_factory(db, T, obj):
if T == RuntimeTypeInfo:
return db.gcpolicy.rtti_node_factory()(db, T, obj)
- if hasattr(T, '_exttypeinfo'):
+ if T.hints.get("render_structure", False):
return ExtType_OpaqueNode(db, T, obj)
raise Exception("don't know about %r" % (T,))
Modified: pypy/dist/pypy/translator/c/test/test_stackless.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_stackless.py (original)
+++ pypy/dist/pypy/translator/c/test/test_stackless.py Wed Nov 21 14:34:39 2007
@@ -17,9 +17,6 @@
def setup_class(cls):
import py
if cls.gcpolicy in (None, "ref"):
- # to re-enable this, remove the two characters 'gc' in the
- # declaregcptrtype(rstack.frame_stack_top,...) call in
- # rpython/extfunctable. Doing so breaks translator/stackless/.
import py
py.test.skip("stackless + refcounting doesn't work any more for now")
elif cls.gcpolicy == "boehm":
Modified: pypy/dist/pypy/translator/llvm/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/database.py (original)
+++ pypy/dist/pypy/translator/llvm/database.py Wed Nov 21 14:34:39 2007
@@ -72,9 +72,7 @@
def create_constant_node(self, type_, value):
node = None
if isinstance(type_, lltype.FuncType):
- if getattr(value._callable, "suggested_primitive", False):
- node = ExternalFuncNode(self, value, value._callable)
- elif hasattr(value, '_external_name'):
+ if hasattr(value, '_external_name'):
node = ExternalFuncNode(self, value, value._external_name)
elif getattr(value, 'external', None) == 'C':
node = ExternalFuncNode(self, value)
@@ -102,7 +100,7 @@
node = ArrayNode(self, value)
elif isinstance(type_, lltype.OpaqueType):
- if hasattr(type_, '_exttypeinfo'):
+ if type_.hints.get('render_structure', False):
node = ExtOpaqueNode(self, value)
else:
node = OpaqueNode(self, value)
Modified: pypy/dist/pypy/translator/llvm/typedefnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/typedefnode.py (original)
+++ pypy/dist/pypy/translator/llvm/typedefnode.py Wed Nov 21 14:34:39 2007
@@ -145,7 +145,7 @@
return ArrayTypeNode(db, TYPE)
elif isinstance(TYPE, lltype.OpaqueType):
- if hasattr(TYPE, '_exttypeinfo'):
+ if TYPE.hints.get("render_structure", False):
return ExtOpaqueTypeNode(db, TYPE)
else:
return OpaqueTypeNode(db, TYPE)
Modified: pypy/dist/pypy/translator/oosupport/function.py
==============================================================================
--- pypy/dist/pypy/translator/oosupport/function.py (original)
+++ pypy/dist/pypy/translator/oosupport/function.py Wed Nov 21 14:34:39 2007
@@ -109,9 +109,6 @@
if self.db.graph_name(self.graph) is not None and not self.is_method:
return # already rendered
- if getattr(self.graph.func, 'suggested_primitive', False):
- assert False, 'Cannot render a suggested_primitive'
-
self.ilasm = ilasm
self.generator = self._create_generator(self.ilasm)
graph = self.graph
Modified: pypy/dist/pypy/translator/oosupport/metavm.py
==============================================================================
--- pypy/dist/pypy/translator/oosupport/metavm.py (original)
+++ pypy/dist/pypy/translator/oosupport/metavm.py Wed Nov 21 14:34:39 2007
@@ -410,12 +410,6 @@
graph = callee.graph
except AttributeError:
return callee._name.rsplit('.', 1)
- else:
- if getattr(graph.func, 'suggested_primitive', False):
- _, module = graph.func.__module__.rsplit('.', 1)
- return module, graph.func.func_name
- else:
- return None
def render(self, generator, op):
callee = op.args[0].value
Modified: pypy/dist/pypy/translator/simplify.py
==============================================================================
--- pypy/dist/pypy/translator/simplify.py (original)
+++ pypy/dist/pypy/translator/simplify.py Wed Nov 21 14:34:39 2007
@@ -34,9 +34,6 @@
funcobj = get_funcobj(f)
try:
callable = funcobj._callable
- # external function calls don't have a real graph
- if getattr(callable, "suggested_primitive", False):
- return None
except (AttributeError, KeyError, AssertionError):
return None
try:
Modified: pypy/dist/pypy/translator/stackless/code.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/code.py (original)
+++ pypy/dist/pypy/translator/stackless/code.py Wed Nov 21 14:34:39 2007
@@ -1,7 +1,6 @@
from pypy.rpython.lltypesystem import lltype, llmemory, lloperation
from pypy.tool.sourcetools import func_with_new_name
from pypy.rlib import rarithmetic
-from pypy.rpython import extfunctable
from pypy.translator.stackless import frame
from pypy.translator.stackless.frame import STATE_HEADER, SAVED_REFERENCE, STORAGE_TYPES_AND_FIELDS
Modified: pypy/dist/pypy/translator/stackless/frame.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/frame.py (original)
+++ pypy/dist/pypy/translator/stackless/frame.py Wed Nov 21 14:34:39 2007
@@ -1,5 +1,4 @@
from pypy.rpython.lltypesystem import lltype, llmemory
-from pypy.rpython import extfunctable
from pypy.rpython.typesystem import getfunctionptr
from pypy.rpython.annlowlevel import annotate_lowlevel_helper
from pypy.objspace.flow.model import FunctionGraph
More information about the Pypy-commit
mailing list