Author: Ronan Lamy <[email protected]>
Branch: unify-call-ops
Changeset: r71695:db7249733b48
Date: 2014-05-24 05:46 +0100
http://bitbucket.org/pypy/pypy/changeset/db7249733b48/

Log:    kill HighLevelOp.forced_opname

diff --git a/rpython/rtyper/lltypesystem/rpbc.py 
b/rpython/rtyper/lltypesystem/rpbc.py
--- a/rpython/rtyper/lltypesystem/rpbc.py
+++ b/rpython/rtyper/lltypesystem/rpbc.py
@@ -352,11 +352,6 @@
         v_func = r_class.getclsfield(v_cls, self.methodname, hop.llops)
 
         hop2 = self.add_instance_arg_to_hop(hop, call_args)
-        opname = 'simple_call'
-        if call_args:
-            opname = 'call_args'
-        hop2.forced_opname = opname
-
         hop2.v_s_insertfirstarg(v_func, s_func)   # insert 'function'
 
         if type(hop2.args_r[0]) is SmallFunctionSetPBCRepr and type(r_func) is 
FunctionsPBCRepr:
diff --git a/rpython/rtyper/module/r_os_stat.py 
b/rpython/rtyper/module/r_os_stat.py
--- a/rpython/rtyper/module/r_os_stat.py
+++ b/rpython/rtyper/module/r_os_stat.py
@@ -10,7 +10,9 @@
 from rpython.annotator import model as annmodel
 from rpython.rtyper.llannotation import lltype_to_annotation
 from rpython.flowspace.model import Constant
+from rpython.flowspace.operation import op
 from rpython.tool.pairtype import pairtype
+from rpython.rtyper.rtyper import HighLevelOp
 from rpython.rtyper.rmodel import Repr
 from rpython.rtyper.rint import IntegerRepr
 from rpython.rtyper.error import TyperError
@@ -34,12 +36,10 @@
 
     def redispatch_getfield(self, hop, index):
         rtyper = self.rtyper
-        s_index = rtyper.annotator.bookkeeper.immutablevalue(index)
-        hop2 = hop.copy()
-        hop2.forced_opname = 'getitem'
-        hop2.args_v = [hop2.args_v[0], Constant(index)]
-        hop2.args_s = [self.s_tuple, s_index]
-        hop2.args_r = [self.r_tuple, rtyper.getrepr(s_index)]
+        spaceop = op.getitem(hop.args_v[0], Constant(index))
+        spaceop.result = hop.spaceop.result
+        hop2 = HighLevelOp(rtyper, spaceop, hop.exceptionlinks[:], 
hop.llops[:])
+        hop2.setup()
         return hop2.dispatch()
 
     def rtype_getattr(self, hop):
@@ -86,11 +86,10 @@
     def redispatch_getfield(self, hop, index):
         rtyper = self.rtyper
         s_index = rtyper.annotator.bookkeeper.immutablevalue(index)
-        hop2 = hop.copy()
-        hop2.forced_opname = 'getitem'
-        hop2.args_v = [hop2.args_v[0], Constant(index)]
-        hop2.args_s = [self.s_tuple, s_index]
-        hop2.args_r = [self.r_tuple, rtyper.getrepr(s_index)]
+        spaceop = op.getitem(hop.args_v[0], Constant(index))
+        spaceop.result = hop.spaceop.result
+        hop2 = HighLevelOp(rtyper, spaceop, hop.exceptionlinks[:], 
hop.llops[:])
+        hop2.setup()
         return hop2.dispatch()
 
     def rtype_getattr(self, hop):
diff --git a/rpython/rtyper/rcontrollerentry.py 
b/rpython/rtyper/rcontrollerentry.py
--- a/rpython/rtyper/rcontrollerentry.py
+++ b/rpython/rtyper/rcontrollerentry.py
@@ -71,5 +71,5 @@
         s_new, r_new = r_controlled.s_real_obj, r_controlled.r_real_obj
         hop2.s_result, hop2.r_result = s_new, r_new
     hop2.v_s_insertfirstarg(c_meth, s_meth)
-    hop2.forced_opname = 'simple_call'
+    hop2.spaceop.opname = 'simple_call'
     return hop2.dispatch()
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -650,8 +650,6 @@
 
 
 class HighLevelOp(object):
-    forced_opname = None
-
     def __init__(self, rtyper, spaceop, exceptionlinks, llops):
         self.rtyper         = rtyper
         self.spaceop        = spaceop
@@ -679,12 +677,11 @@
             if type(value) is list:     # grunt
                 value = value[:]
             setattr(result, key, value)
-        result.forced_opname = self.forced_opname
         return result
 
     def dispatch(self):
         rtyper = self.rtyper
-        opname = self.forced_opname or self.spaceop.opname
+        opname = self.spaceop.opname
         translate_meth = getattr(rtyper, 'translate_op_' + opname,
                                  rtyper.default_translate_operation)
         return translate_meth(self)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to