def getfield(self, vinst, attr, llops, force_cast=False, flags={}):
     """Read the given attribute (or __class__ for the type) of 'vinst'."""
     if not flags.get("access_directly") and attr in self.fields:
         mangled_name, r = self.fields[attr]
         if mangled_name in self.my_redirected_fields:
             if force_cast:
                 vinst = llops.genop("cast_pointer", [vinst], resulttype=self)
             c_name = inputconst(lltype.Void, mangled_name)
             llops.genop("promote_virtualizable", [vinst, c_name])
             return llops.genop("getfield", [vinst, c_name], resulttype=r)
     return InstanceRepr.getfield(self, vinst, attr, llops, force_cast)
Beispiel #2
0
 def getfield(self, vinst, attr, llops, force_cast=False, flags={}):
     """Read the given attribute (or __class__ for the type) of 'vinst'."""
     if (attr in self.my_redirected_fields
         and not flags.get('access_directly')):
         mangled_name, r = self.fields[attr]
         if force_cast:
             vinst = llops.genop('cast_pointer', [vinst], resulttype=self)
         ll_getter = self.get_getter(mangled_name)
         return llops.gendirectcall(ll_getter, vinst)
     else:
         return InstanceRepr.getfield(self, vinst, attr, llops, force_cast)
Beispiel #3
0
 def getfield(self, vinst, attr, llops, force_cast=False, flags={}):
     """Read the given attribute (or __class__ for the type) of 'vinst'."""
     if (attr in self.my_redirected_fields
             and not flags.get('access_directly')):
         mangled_name, r = self.fields[attr]
         if force_cast:
             vinst = llops.genop('cast_pointer', [vinst], resulttype=self)
         ll_getter = self.get_getter(mangled_name)
         return llops.gendirectcall(ll_getter, vinst)
     else:
         return InstanceRepr.getfield(self, vinst, attr, llops, force_cast)