Ejemplo n.º 1
0
 def replace_force_virtual_with_call(self, graphs):
     # similar to rvirtualizable.replace_force_virtualizable_with_call().
     c_force_virtual_ptr = None
     c_is_virtual_ptr = None
     force_virtual_count = 0
     for graph in graphs:
         for block in graph.iterblocks():
             for op in block.operations:
                 if op.opname == 'jit_force_virtual':
                     # first compute c_funcptr, but only if there is any
                     # 'jit_force_virtual' around
                     if c_force_virtual_ptr is None:
                         c_force_virtual_ptr = self.get_force_virtual_fnptr(
                         )
                     #
                     op.opname = 'direct_call'
                     op.args = [c_force_virtual_ptr, op.args[0]]
                     force_virtual_count += 1
                 #
                 if op.opname == 'jit_is_virtual':
                     if c_is_virtual_ptr is None:
                         c_is_virtual_ptr = self.get_is_virtual_fnptr()
                     #
                     op.opname = 'direct_call'
                     op.args = [c_is_virtual_ptr, op.args[0]]
     #
     if c_force_virtual_ptr is not None:
         log("replaced %d 'jit_force_virtual' with %r" %
             (force_virtual_count, c_force_virtual_ptr.value))
Ejemplo n.º 2
0
 def replace_force_virtual_with_call(self, graphs):
     # similar to rvirtualizable2.replace_force_virtualizable_with_call().
     c_force_virtual_ptr = None
     c_is_virtual_ptr = None
     force_virtual_count = 0
     for graph in graphs:
         for block in graph.iterblocks():
             for op in block.operations:
                 if op.opname == 'jit_force_virtual':
                     # first compute c_funcptr, but only if there is any
                     # 'jit_force_virtual' around
                     if c_force_virtual_ptr is None:
                         c_force_virtual_ptr = self.get_force_virtual_fnptr()
                     #
                     op.opname = 'direct_call'
                     op.args = [c_force_virtual_ptr, op.args[0]]
                     force_virtual_count += 1
                 #
                 if op.opname == 'jit_is_virtual':
                     if c_is_virtual_ptr is None:
                         c_is_virtual_ptr = self.get_is_virtual_fnptr()
                     #
                     op.opname = 'direct_call'
                     op.args = [c_is_virtual_ptr, op.args[0]]
     #
     if c_force_virtual_ptr is not None:
         log("replaced %d 'jit_force_virtual' with %r" % (force_virtual_count,
                                                          c_force_virtual_ptr.value))
Ejemplo n.º 3
0
def replace_force_virtualizable_with_call(graphs, VTYPEPTR, funcptr):
    # funcptr should be a function pointer with a VTYPEPTR argument
    c_funcptr = inputconst(lltype.typeOf(funcptr), funcptr)
    count = 0
    for graph in graphs:
        for block in graph.iterblocks():
            if not block.operations:
                continue
            newoplist = []
            for i, op in enumerate(block.operations):
                if (op.opname == 'jit_force_virtualizable'
                        and op.args[0].concretetype == VTYPEPTR):
                    if op.args[-1].value.get('access_directly', False):
                        continue
                    op.opname = 'direct_call'
                    op.args = [c_funcptr, op.args[0]]
                    count += 1
                newoplist.append(op)
            block.operations = newoplist
    log("replaced %d 'jit_force_virtualizable' with %r" % (count, funcptr))
Ejemplo n.º 4
0
def replace_force_virtualizable_with_call(graphs, VTYPEPTR, funcptr):
    # funcptr should be a function pointer with a VTYPEPTR argument
    c_funcptr = inputconst(lltype.typeOf(funcptr), funcptr)
    count = 0
    for graph in graphs:
        for block in graph.iterblocks():
            if not block.operations:
                continue
            newoplist = []
            for i, op in enumerate(block.operations):
                if (op.opname == 'jit_force_virtualizable' and
                        op.args[0].concretetype == VTYPEPTR):
                    if op.args[-1].value.get('access_directly', False):
                        continue
                    op.opname = 'direct_call'
                    op.args = [c_funcptr, op.args[0]]
                    count += 1
                newoplist.append(op)
            block.operations = newoplist
    log("replaced %d 'jit_force_virtualizable' with %r" % (count, funcptr))