def compute_types(self): box2classes = {} # box --> [ootype.Class] self._collect_types(self.cliloop.operations, box2classes) for box, classes in box2classes.iteritems(): cls = classes[0] for cls2 in classes[1:]: if ootype.subclassof(cls, cls2): cls = cls2 else: assert ootype.subclassof(cls2, cls) self.box2type[box] = dotnet.class2type(cls)
def f(flag, n): res = True while n > -100: myjitdriver.can_enter_jit(n=n, flag=flag, res=res) myjitdriver.jit_merge_point(n=n, flag=flag, res=res) cls = getcls(flag) n -= 1 res = ootype.subclassof(cls, clsB) return res
def _auto_propagate(self, link, block): assert block.exitswitch is flowmodel.c_last_exception if not self.auto_propagate_exceptions: return False if not self._is_raise_block(link.target): return False llexc = link.llexitcase i = list(block.exits).index(link) next_links = block.exits[i+1:] for next_link in next_links: # if one of the next links catches a superclass of llexc, we # *have* to insert a catch block here, else the exception might be # caught by the wrong one if ootype.subclassof(llexc, next_link.llexitcase): return False # if all the checks were ok, it's safe to avoid the catch block and # let the exception propagate return True
def _auto_propagate(self, link, block): assert block.exitswitch is flowmodel.c_last_exception if not self.auto_propagate_exceptions: return False if not self._is_raise_block(link.target): return False llexc = link.llexitcase i = list(block.exits).index(link) next_links = block.exits[i + 1:] for next_link in next_links: # if one of the next links catches a superclass of llexc, we # *have* to insert a catch block here, else the exception might be # caught by the wrong one if ootype.subclassof(llexc, next_link.llexitcase): return False # if all the checks were ok, it's safe to avoid the catch block and # let the exception propagate return True
def ll_issubclass(class1, class2): # helper for exceptiondata.py return ootype.subclassof(class1, class2)
def ll_issubclass(meta1, meta2): class1 = meta1.class_ class2 = meta2.class_ return ootype.subclassof(class1, class2)
def ll_isinstance(inst, class_): c1 = ootype.classof(inst) return ootype.subclassof(c1, class_)
def subclassOf(self, cpu, clsbox1, clsbox2): cls1 = clsbox1.getref(ootype.Class) cls2 = clsbox2.getref(ootype.Class) return ootype.subclassof(cls1, cls2)
def op_subclassof(class1, class2): return ootype.subclassof(class1, class2)
def ll_isinstance(inst, meta): c1 = inst.meta.class_ c2 = meta.class_ return ootype.subclassof(c1, c2)