Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
def ll_issubclass(class1, class2):
    # helper for exceptiondata.py
    return ootype.subclassof(class1, class2)
Ejemplo n.º 7
0
def ll_issubclass(meta1, meta2):
    class1 = meta1.class_
    class2 = meta2.class_
    return ootype.subclassof(class1, class2)
Ejemplo n.º 8
0
def ll_isinstance(inst, class_):
    c1 = ootype.classof(inst)
    return ootype.subclassof(c1, class_)
Ejemplo n.º 9
0
def ll_isinstance(inst, class_):
    c1 = ootype.classof(inst)
    return ootype.subclassof(c1, class_)
Ejemplo n.º 10
0
def ll_issubclass(class1, class2):
    # helper for exceptiondata.py
    return ootype.subclassof(class1, class2)
Ejemplo n.º 11
0
 def subclassOf(self, cpu, clsbox1, clsbox2):
     cls1 = clsbox1.getref(ootype.Class)
     cls2 = clsbox2.getref(ootype.Class)
     return ootype.subclassof(cls1, cls2)
Ejemplo n.º 12
0
def op_subclassof(class1, class2):
    return ootype.subclassof(class1, class2)
Ejemplo n.º 13
0
def ll_isinstance(inst, meta):
    c1 = inst.meta.class_
    c2 = meta.class_
    return ootype.subclassof(c1, c2)
Ejemplo n.º 14
0
def ll_issubclass(meta1, meta2):
    class1 = meta1.class_
    class2 = meta2.class_
    return ootype.subclassof(class1, class2)
Ejemplo n.º 15
0
def op_subclassof(class1, class2):
    return ootype.subclassof(class1, class2)