コード例 #1
0
ファイル: referents.py プロジェクト: Darriall/pypy
def get_objects(space):
    """Return a list of all app-level objects."""
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = do_get_objects()
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #2
0
def get_objects(space):
    """Return a list of all app-level objects."""
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = do_get_objects()
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #3
0
ファイル: storage.py プロジェクト: swipswaps/RSqueak
def get_instances_array_gc(interp, w_class=None):
    space = interp.space
    from rpython.rlib import rgc

    result_w = []
    roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
    pending = roots[:]
    while pending:
        gcref = pending.pop()
        if not rgc.get_gcflag_extra(gcref):
            rgc.toggle_gcflag_extra(gcref)
            w_obj = rgc.try_cast_gcref_to_instance(W_Object, gcref)

            if w_obj is not None and w_obj.has_class():
                w_cls = w_obj.getclass(space)
                if w_cls is not None:
                    # XXX: should not return SmallFloat64 on Spur64...
                    if ((not w_cls.is_same_object(space.w_SmallInteger)) and
                        (not (space.is_spur.is_set()
                              and w_cls.is_same_object(space.w_Character))) and
                        (w_class is None or w_cls.is_same_object(w_class))):
                        result_w.append(w_obj)
            pending.extend(rgc.get_rpy_referents(gcref))

    rgc.clear_gcflag_extra(roots)
    rgc.assert_no_more_gcflags()
    return result_w
コード例 #4
0
ファイル: storage.py プロジェクト: HPI-SWA-Lab/RSqueak
def get_instances_array_gc(interp, w_class=None):
    space = interp.space
    from rpython.rlib import rgc

    result_w = []
    roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
    pending = roots[:]
    while pending:
        gcref = pending.pop()
        if not rgc.get_gcflag_extra(gcref):
            rgc.toggle_gcflag_extra(gcref)
            w_obj = rgc.try_cast_gcref_to_instance(W_Object, gcref)

            if w_obj is not None and w_obj.has_class():
                w_cls = w_obj.getclass(space)
                if w_cls is not None:
                    # XXX: should not return SmallFloat64 on Spur64...
                    if ((not w_cls.is_same_object(space.w_SmallInteger)) and
                        (not (space.is_spur.is_set() and w_cls.is_same_object(space.w_Character))) and
                        (w_class is None or w_cls.is_same_object(w_class))):
                        result_w.append(w_obj)
            pending.extend(rgc.get_rpy_referents(gcref))

    rgc.clear_gcflag_extra(roots)
    rgc.assert_no_more_gcflags()
    return result_w
コード例 #5
0
ファイル: referents.py プロジェクト: cimarieta/usp
def get_referrers(space, args_w):
    """Return the list of objects that directly refer to any of objs."""
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = []
    for w_arg in args_w:
        result_w += do_get_referrers(w_arg)
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #6
0
def get_referrers(space, args_w):
    """Return the list of objects that directly refer to any of objs."""
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = []
    for w_arg in args_w:
        result_w += do_get_referrers(w_arg)
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #7
0
ファイル: referents.py プロジェクト: cimarieta/usp
def get_referents(space, args_w):
    """Return a list of objects directly referred to by any of the arguments.
    """
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = []
    for w_obj in args_w:
        gcref = rgc.cast_instance_to_gcref(w_obj)
        _list_w_obj_referents(gcref, result_w)
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #8
0
def get_referents(space, args_w):
    """Return a list of objects directly referred to by any of the arguments.
    """
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    result_w = []
    for w_obj in args_w:
        gcref = rgc.cast_instance_to_gcref(w_obj)
        _list_w_obj_referents(gcref, result_w)
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)
コード例 #9
0
ファイル: runtime.py プロジェクト: washort/typhon
def getMonteObjects():
    roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
    pending = roots[:]
    result_w = []
    while pending:
        gcref = pending.pop()
        if not rgc.get_gcflag_extra(gcref):
            rgc.toggle_gcflag_extra(gcref)
            w_obj = rgc.try_cast_gcref_to_instance(Object, gcref)
            if w_obj is not None:
                result_w.append(w_obj)
            pending.extend(rgc.get_rpy_referents(gcref))
    clear_gcflag_extra(roots)
    rgc.assert_no_more_gcflags()
    return result_w
コード例 #10
0
ファイル: runtime.py プロジェクト: dckc/typhon
def getMonteObjects():
    roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
    pending = roots[:]
    result_w = []
    while pending:
        gcref = pending.pop()
        if not rgc.get_gcflag_extra(gcref):
            rgc.toggle_gcflag_extra(gcref)
            w_obj = rgc.try_cast_gcref_to_instance(Object, gcref)
            if w_obj is not None:
                result_w.append(w_obj)
            pending.extend(rgc.get_rpy_referents(gcref))
    clear_gcflag_extra(roots)
    rgc.assert_no_more_gcflags()
    return result_w
コード例 #11
0
def get_referrers(space, args_w):
    """Return the list of objects that directly refer to any of objs."""
    if not rgc.has_gcflag_extra():
        raise missing_operation(space)
    # xxx uses a lot of memory to make the list of all W_Root objects,
    # but it's simpler this way and more correct than the previous
    # version of this code (issue #2612).  It is potentially very slow
    # because each of the n calls to _list_w_obj_referents() could take
    # O(n) time as well, in theory, but I hope in practice the whole
    # thing takes much less than O(n^2).  We could re-add an algorithm
    # that visits most objects only once, if needed...
    all_objects_w = rgc.do_get_objects(try_cast_gcref_to_w_root)
    result_w = []
    for w_obj in all_objects_w:
        refs_w = []
        gcref = rgc.cast_instance_to_gcref(w_obj)
        _list_w_obj_referents(gcref, refs_w)
        for w_arg in args_w:
            if w_arg in refs_w:
                result_w.append(w_obj)
    rgc.assert_no_more_gcflags()
    return space.newlist(result_w)