Author: Ronan Lamy <[email protected]>
Branch: type_system-cleanup
Changeset: r80065:df52cada2be9
Date: 2015-10-08 20:35 +0100
http://bitbucket.org/pypy/pypy/changeset/df52cada2be9/
Log: Kill LowLevelTypeSystem.deref
diff --git a/rpython/jit/metainterp/test/test_virtualizable.py
b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -1114,10 +1114,8 @@
if getattr(graph, 'func', None) is f]
init_graph = t._graphof(Frame.__init__.im_func)
- deref = t.rtyper.type_system.deref
-
def direct_calls(graph):
- return [deref(op.args[0].value)._callable.func_name
+ return [op.args[0].value._obj._callable.func_name
for block, op in graph.iterblockops()
if op.opname == 'direct_call']
diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py
--- a/rpython/rtyper/llinterp.py
+++ b/rpython/rtyper/llinterp.py
@@ -466,7 +466,7 @@
raise LLException(etype, evalue, *extraargs)
def invoke_callable_with_pyexceptions(self, fptr, *args):
- obj = self.llinterpreter.typer.type_system.deref(fptr)
+ obj = fptr._obj
try:
return obj._callable(*args)
except LLException, e:
@@ -644,7 +644,7 @@
array[index] = item
def perform_call(self, f, ARGS, args):
- fobj = self.llinterpreter.typer.type_system.deref(f)
+ fobj = f._obj
has_callable = getattr(fobj, '_callable', None) is not None
if hasattr(fobj, 'graph'):
graph = fobj.graph
@@ -669,7 +669,7 @@
graphs = args[-1]
args = args[:-1]
if graphs is not None:
- obj = self.llinterpreter.typer.type_system.deref(f)
+ obj = f._obj
if hasattr(obj, 'graph'):
assert obj.graph in graphs
else:
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -874,7 +874,7 @@
# build the 'direct_call' operation
f = self.rtyper.getcallable(graph)
c = inputconst(typeOf(f), f)
- fobj = self.rtyper.type_system.deref(f)
+ fobj = f._obj
return self.genop('direct_call', [c]+newargs_v,
resulttype = typeOf(fobj).RESULT)
diff --git a/rpython/rtyper/test/test_rvirtualizable.py
b/rpython/rtyper/test/test_rvirtualizable.py
--- a/rpython/rtyper/test/test_rvirtualizable.py
+++ b/rpython/rtyper/test/test_rvirtualizable.py
@@ -337,7 +337,6 @@
g(a)
t, typer, graph = self.gengraph(f, [])
- deref = typer.type_system.deref
desc = typer.annotator.bookkeeper.getdesc(g)
g_graphs = desc._cache.items()
@@ -354,7 +353,7 @@
def get_direct_call_graph(graph):
for block, op in graph.iterblockops():
if op.opname == 'direct_call':
- return deref(op.args[0].value).graph
+ return op.args[0].value._obj.graph
return None
assert get_direct_call_graph(f_graph) is g_graph_directly
diff --git a/rpython/rtyper/typesystem.py b/rpython/rtyper/typesystem.py
--- a/rpython/rtyper/typesystem.py
+++ b/rpython/rtyper/typesystem.py
@@ -8,10 +8,6 @@
class LowLevelTypeSystem(object):
name = "lltypesystem"
- def deref(self, obj):
- assert isinstance(lltype.typeOf(obj), lltype.Ptr)
- return obj._obj
-
def check_null(self, repr, hop):
# None is a nullptr, which is false; everything else is true.
vlist = hop.inputargs(repr)
@@ -71,8 +67,7 @@
# _callable is normally graph.func, but can be overridden:
# see fakeimpl in extfunc.py
_callable = fnobjattrs.pop('_callable', graph.func)
- return lltype.functionptr(FT, name, graph = graph,
- _callable = _callable, **fnobjattrs)
+ return lltype.functionptr(FT, name, graph=graph,
+ _callable=_callable, **fnobjattrs)
else:
- return lltype.functionptr(FT, name, graph = graph)
-
+ return lltype.functionptr(FT, name, graph=graph)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit