Author: Ronan Lamy <[email protected]>
Branch: kill-ootype
Changeset: r65556:11b518ec7c25
Date: 2013-07-23 14:47 +0200
http://bitbucket.org/pypy/pypy/changeset/11b518ec7c25/
Log: Kill get_functype() since it is now trivial
diff --git a/rpython/jit/codewriter/call.py b/rpython/jit/codewriter/call.py
--- a/rpython/jit/codewriter/call.py
+++ b/rpython/jit/codewriter/call.py
@@ -8,7 +8,6 @@
from rpython.jit.codewriter.effectinfo import (VirtualizableAnalyzer,
QuasiImmutAnalyzer, RandomEffectsAnalyzer, effectinfo_from_writeanalyze,
EffectInfo, CallInfoCollection)
-from rpython.translator.simplify import get_functype
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.translator.backendopt.canraise import RaiseAnalyzer
from rpython.translator.backendopt.writeanalyze import ReadWriteAnalyzer
@@ -191,7 +190,7 @@
interp to really do the call corresponding to 'inline_call' ops.
"""
fnptr = self.rtyper.type_system.getcallable(graph)
- FUNC = get_functype(lltype.typeOf(fnptr))
+ FUNC = lltype.typeOf(fnptr).TO
assert self.rtyper.type_system.name == "lltypesystem"
fnaddr = llmemory.cast_ptr_to_adr(fnptr)
NON_VOID_ARGS = [ARG for ARG in FUNC.ARGS if ARG is not lltype.Void]
@@ -212,7 +211,7 @@
if x.concretetype is not lltype.Void]
RESULT = op.result.concretetype
# check the number and type of arguments
- FUNC = get_functype(op.args[0].concretetype)
+ FUNC = op.args[0].concretetype.TO
ARGS = FUNC.ARGS
assert NON_VOID_ARGS == [T for T in ARGS if T is not lltype.Void]
assert RESULT == FUNC.RESULT
diff --git a/rpython/jit/metainterp/warmspot.py
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -13,7 +13,6 @@
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib.debug import fatalerror
from rpython.rlib.rstackovf import StackOverflow
-from rpython.translator.simplify import get_functype
from rpython.translator.backendopt import removenoops
from rpython.translator.unsimplify import call_final_function
@@ -661,7 +660,7 @@
def helper_func(self, FUNCPTR, func):
if not self.cpu.translate_support_code:
return llhelper(FUNCPTR, func)
- FUNC = get_functype(FUNCPTR)
+ FUNC = FUNCPTR.TO
args_s = [annmodel.lltype_to_annotation(ARG) for ARG in FUNC.ARGS]
s_result = annmodel.lltype_to_annotation(FUNC.RESULT)
graph = self.annhelper.getgraph(func, args_s, s_result)
diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py
--- a/rpython/rtyper/annlowlevel.py
+++ b/rpython/rtyper/annlowlevel.py
@@ -13,7 +13,6 @@
from rpython.rtyper import extregistry
from rpython.rtyper.ootypesystem import ootype
from rpython.rtyper.rmodel import warning
-from rpython.translator.simplify import get_functype
class KeyComp(object):
@@ -283,8 +282,8 @@
for p, graph in self.delayedfuncs:
self.newgraphs[graph] = True
real_p = rtyper.getcallable(graph)
- REAL = get_functype(lltype.typeOf(real_p))
- FUNCTYPE = get_functype(lltype.typeOf(p))
+ REAL = lltype.typeOf(real_p).TO
+ FUNCTYPE = lltype.typeOf(p).TO
if isinstance(FUNCTYPE, (lltype.ForwardReference,
ootype.ForwardReference)):
FUNCTYPE.become(REAL)
assert FUNCTYPE == REAL
@@ -334,7 +333,7 @@
p = self.instance.llfnptr
TYPE = lltype.typeOf(p)
c_func = Constant(p, TYPE)
- FUNCTYPE = get_functype(TYPE)
+ FUNCTYPE = TYPE.TO
for r_arg, ARGTYPE in zip(args_r, FUNCTYPE.ARGS):
assert r_arg.lowleveltype == ARGTYPE
assert r_res.lowleveltype == FUNCTYPE.RESULT
diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -13,20 +13,12 @@
from rpython.translator import unsimplify
from rpython.translator.backendopt import ssa
from rpython.rtyper.lltypesystem import lloperation, lltype
-from rpython.rtyper.ootypesystem import ootype
-
-def get_functype(TYPE):
- if isinstance(TYPE, lltype.Ptr):
- return TYPE.TO
- elif isinstance(TYPE, (ootype.StaticMethod, ootype.ForwardReference)):
- return TYPE
- assert False
def get_graph(arg, translator):
if isinstance(arg, Variable):
return None
f = arg.value
- if not isinstance(f, lltype._ptr) and not isinstance(f, ootype._callable):
+ if not isinstance(f, lltype._ptr):
return None
funcobj = f._obj
try:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit