Armin Rigo committed 95ea89b

Kill HalfConcreteWrapper. Yay!

It was still (ab)used by the ootypesystem implementation of r_dict.
I think I fixed the cli and jvm backends too.

Comments (0)

Files changed (9)


 def wrap_callable(llinterpreter, fn, obj, method_name):
     if method_name is None:
-        # fn is a HalfConcreteWrapper wrapping a StaticMethod
+        # fn is a StaticMethod
         if obj is not None:
             self_arg = [obj]
             self_arg = []
-        func_graph = fn.concretize().value.graph
+        func_graph = fn.graph
         # obj is an instance, we want to call 'method_name' on it
         assert fn is None        


 from pypy.rpython.lltypesystem.lltype import \
      typeOf, Void, ForwardReference, Struct, Bool, Char, \
      Ptr, malloc, nullptr, Array, Signed, FuncType
-from pypy.rpython.rmodel import Repr, TyperError, inputconst, inputdesc, HalfConcreteWrapper
+from pypy.rpython.rmodel import Repr, TyperError, inputconst, inputdesc
 from pypy.rpython.rpbc import samesig,\
      commonbase, allattributenames, adjust_shape, \
      AbstractClassesPBCRepr, AbstractMethodsPBCRepr, OverriddenFunctionPBCRepr, \
 class __extend__(pairtype(SmallFunctionSetPBCRepr, FunctionsPBCRepr)):
     def convert_from_to((r_set, r_ptr), v, llops):
         if r_ptr.lowleveltype is Void:
-            wrapper = HalfConcreteWrapper(r_ptr.get_unique_llfn)
-            return inputconst(Void, wrapper)
+            return inputconst(Void, None)
             assert v.concretetype is Char
             v_int = llops.genop('cast_char_to_int', [v],


             r_func, nimplicitarg = r_func.get_r_implfunc()
             obj = None
-        callable = r_func.convert_const(fn)
+        callable = r_func.get_unique_llfn().value
         func_name, interp_fn = llinterp.wrap_callable(interp, callable, obj, None)
         return ootype.static_meth(TYPE, func_name, _callable=interp_fn)
 def _get_call_vars(hop, r_func, arg, params_annotation):
     if isinstance(r_func, AbstractFunctionsPBCRepr):
-        v_fn = hop.inputarg(r_func, arg=arg)
+        v_fn = r_func.get_unique_llfn()
         v_obj = hop.inputconst(ootype.Void, None)
         c_method_name = hop.inputconst(ootype.Void, None)
     elif isinstance(r_func, AbstractMethodsPBCRepr):
         c_method_name = hop.inputconst(ootype.Void, methodname)
     elif isinstance(r_func, MethodOfFrozenPBCRepr):
         r_impl, nimplicitarg = r_func.get_r_implfunc()
-        v_fn = hop.inputconst(r_impl, r_func.funcdesc.pyobj)
+        v_fn = r_impl.get_unique_llfn()
         v_obj = hop.inputarg(r_func, arg=arg)
         c_method_name = hop.inputconst(ootype.Void, None)


 from pypy.annotation import model as annmodel
 from pypy.rpython.lltypesystem import lltype
 from pypy.rpython.ootypesystem import ootype
-from pypy.rpython.rmodel import Repr, HalfConcreteWrapper
+from pypy.rpython.rmodel import Repr
 from pypy.rpython import rbuiltin
 from pypy.objspace.flow.model import Constant, Variable
 from pypy.rpython import extregistry


         return '%s_%s' % (prefix, name)
-class HalfConcreteWrapper:
-    # see rtyper.gendirectcall()
-    def __init__(self, callback):
-        self.concretize = callback   # should produce a concrete const
-    def _freeze_(self):
-        return True
 # __________ utilities __________
 PyObjPtr = Ptr(PyObject)


 from pypy.rpython.lltypesystem.lltype import \
      typeOf, Void, Bool, nullptr, frozendict, Ptr, Struct, malloc
 from pypy.rpython.error import TyperError
-from pypy.rpython.rmodel import Repr, inputconst, HalfConcreteWrapper, CanBeNull, \
+from pypy.rpython.rmodel import Repr, inputconst, CanBeNull, \
         mangle, inputdesc, warning, impossible_repr
 from pypy.rpython import rclass
 from pypy.rpython import robject
         except KeyError:
         if self.lowleveltype is Void:
-            result = HalfConcreteWrapper(self.get_unique_llfn)
+            result = None
             llfns = {}
             found_anything = False
         if isinstance(value, types.MethodType) and value.im_self is None:
             value = value.im_func   # unbound method -> bare function
         if self.lowleveltype is Void:
-            return HalfConcreteWrapper(self.get_unique_llfn)
+            return None
         if value is None:
             null = self.rtyper.type_system.null_callable(self.lowleveltype)
             return null
             if r_fpbc1.lowleveltype is Void:
                 return inputconst(r_fpbc2, r_fpbc1.s_pbc.const)
             if r_fpbc2.lowleveltype is Void:
-                wrapper = HalfConcreteWrapper(r_fpbc2.get_unique_llfn)
-                return inputconst(Void, wrapper)
+                return inputconst(Void, None)
             return NotImplemented
 class OverriddenFunctionPBCRepr(Repr):


 from pypy.translator.unsimplify import insert_empty_block
 from pypy.rpython.error import TyperError
 from pypy.rpython.rmodel import Repr, inputconst, BrokenReprTyperError
-from pypy.rpython.rmodel import warning, HalfConcreteWrapper
+from pypy.rpython.rmodel import warning
 from pypy.rpython.annlowlevel import annotate_lowlevel_helper, LowLevelAnnotatorPolicy
 from pypy.rpython.typesystem import LowLevelTypeSystem,\
                     raise TyperError("non-constant variable of type Void")
                 if not isinstance(s_value, annmodel.SomePBC):
                     raise TyperError("non-PBC Void argument: %r", (s_value,))
-                if isinstance(s_value.const, HalfConcreteWrapper):
-                    # Modify args_v so that 'v' gets the concrete value
-                    # returned by the wrapper
-                    wrapper = s_value.const
-                    v = wrapper.concretize()
-                    s_value = annmodel.lltype_to_annotation(v.concretetype)


             self._call_function(fn_args.graph, len(arglist))
             fn, obj, method_name = fn_args
-            # fn is a HalfConcreteWrapper
-            sm = fn.value.concretize().value
+            # fn is a Constant(StaticMethod)
             if method_name.value is None:
-                self._call_function(sm.graph, len(arglist))
+                self._call_function(fn.value.graph, len(arglist))
                 assert False, 'XXX'


             # Standalone function: find the delegate class and
             # instantiate it.
             assert method_name.value is None
-            smimpl = fn.value.concretize().value   # ootype._static_meth
+            smimpl = fn.value                      # ootype._static_meth
             db.record_delegate(smimpl._TYPE)       # _TYPE is a StaticMethod
             ty = db.record_delegate_standalone_func_impl(smimpl.graph)