示例#1
0
 def f(a, b):
     a *= 2
     while a > 10:
         llop.gc_push_roots(lltype.Void, b)
         a = g(a)
         llop.gc_pop_roots(lltype.Void, b)
     return b
示例#2
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, a)
     llop.gc_pop_roots(lltype.Void, a)
     while b > 0:  # 'a' remains interesting across the blocks of this loop
         b -= 5
     llop.gc_push_roots(lltype.Void, a)
     llop.gc_pop_roots(lltype.Void, a)
示例#3
0
 def f(a, b, c):
     llop.gc_push_roots(lltype.Void, c, a)
     llop.gc_pop_roots(lltype.Void, c, a)
     while b > 0:
         b -= 5
     llop.gc_push_roots(lltype.Void, a)
     llop.gc_pop_roots(lltype.Void, a)
示例#4
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, b)
     g(a)
     llop.gc_pop_roots(lltype.Void, b)
     llop.gc_push_roots(lltype.Void, b)
     g(a)
     llop.gc_pop_roots(lltype.Void, b)
     return b
示例#5
0
 def f(a, b, c):
     while b > 0:  # 'a', 'c'
         b -= 5
         llop.gc_push_roots(lltype.Void, a, c)  # 'a', 'c'
         g(a, c)
         llop.gc_pop_roots(lltype.Void, a, c)
     while b < 10:
         b += 2
     return c
示例#6
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, b)
     g(a)
     llop.gc_pop_roots(lltype.Void, b)
     while a > 10:
         a -= 2
     llop.gc_push_roots(lltype.Void, b)
     g(a)
     llop.gc_pop_roots(lltype.Void, b)
     return b
示例#7
0
 def f(a, b, c):
     llop.gc_push_roots(lltype.Void, a, c)  # 'a', 'c'
     llop.gc_pop_roots(lltype.Void, a, c)
     while b > 0:  # 'a' only; 'c' not in push_roots
         b -= 5
         llop.gc_push_roots(lltype.Void, a)  # 'a'
         d = g(a, c)
         llop.gc_pop_roots(lltype.Void, a)
         c = d
     return c
示例#8
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, b)
     g(b)
     llop.gc_pop_roots(lltype.Void, b)
     #...b forgotten here; the next push/pop is empty
     llop.gc_push_roots(lltype.Void)
     g(b)
     llop.gc_pop_roots(lltype.Void)
     while a > 100:
         a -= 3
     return a
示例#9
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, b)
     g(a)
     llop.gc_pop_roots(lltype.Void, b)
     while a > 10:
         a -= 2
     c = lltype.cast_opaque_ptr(PSTRUCT, b)
     llop.gc_push_roots(lltype.Void, c)
     g(a)
     llop.gc_pop_roots(lltype.Void, c)
     return c
示例#10
0
 def f(a, b):
     if a & 1:
         llop.gc_push_roots(lltype.Void, b)
         g(b)
         llop.gc_pop_roots(lltype.Void, b)
         a += 5
     else:
         llop.gc_push_roots(lltype.Void, b)
         g(b)
         llop.gc_pop_roots(lltype.Void, b)
         a += 6
     #...b forgotten here, even though it is pushed/popped above
     while a > 100:
         a -= 3
     return a
示例#11
0
 def f():
     llop.gc_push_roots(lltype.Void)
     x = g()
     llop.gc_pop_roots(lltype.Void)
     llop.gc_push_roots(lltype.Void, x)
     h(x)
     llop.gc_pop_roots(lltype.Void, x)
     llop.gc_push_roots(lltype.Void)
     h(x)
     llop.gc_pop_roots(lltype.Void)
     llop.gc_push_roots(lltype.Void)
     k()
     llop.gc_pop_roots(lltype.Void)
示例#12
0
 def f(a, b):
     while a > 10:
         b1 = lltype.cast_opaque_ptr(PSTRUCT, b)
         while a > 100:
             a -= 3
         b2 = lltype.cast_opaque_ptr(llmemory.GCREF, b1)
         llop.gc_push_roots(lltype.Void, b2)
         a = g(a)
         llop.gc_pop_roots(lltype.Void, b2)
         b3 = lltype.cast_opaque_ptr(PSTRUCT, b2)
         while a > 100:
             a -= 4
         b4 = lltype.cast_opaque_ptr(llmemory.GCREF, b3)
         llop.gc_push_roots(lltype.Void, b4)
         a = g(a)
         llop.gc_pop_roots(lltype.Void, b4)
         b5 = lltype.cast_opaque_ptr(PSTRUCT, b4)
         while a > 100:
             a -= 5
         b = lltype.cast_opaque_ptr(llmemory.GCREF, b5)
     return b
示例#13
0
 def f(w_tup):
     while True:
         llop.gc_push_roots(lltype.Void, w_tup)
         llop.gc_pop_roots(lltype.Void, w_tup)
示例#14
0
    def f(a, w_tup):
        llop.gc_push_roots(lltype.Void, w_tup)
        w_key = foo(a)
        llop.gc_pop_roots(lltype.Void, w_tup)

        llop.gc_push_roots(lltype.Void, w_key)
        w_iter = foo(a)
        llop.gc_pop_roots(lltype.Void, w_key)

        has_key = w_key is not None
        hasit = False
        w_maxit = None
        w_max_val = None

        while True:
            llop.gc_push_roots(lltype.Void, w_iter, w_key, w_maxit, w_max_val)
            w_item = call_next(w_iter)
            llop.gc_pop_roots(lltype.Void, w_iter, w_key, w_maxit, w_max_val)

            if has_key:
                llop.gc_push_roots(lltype.Void, w_iter, w_key, w_maxit,
                                   w_max_val, w_item)
                w_compare_with = fetch_compare(w_key, w_item)
                llop.gc_pop_roots(lltype.Void, w_iter, w_key, w_maxit,
                                  w_max_val, w_item)
            else:
                w_compare_with = w_item

            if hasit:
                llop.gc_push_roots(lltype.Void, w_iter, w_key, w_maxit,
                                   w_max_val, w_item, w_compare_with)
                w_bool = compare(w_compare_with, w_max_val)
                llop.gc_pop_roots(lltype.Void, w_iter, w_key, w_maxit,
                                  w_max_val, w_item, w_compare_with)

                llop.gc_push_roots(lltype.Void, w_iter, w_key, w_maxit,
                                   w_max_val, w_item, w_compare_with)
                condition = is_true(a, w_bool)
                llop.gc_pop_roots(lltype.Void, w_iter, w_key, w_maxit,
                                  w_max_val, w_item, w_compare_with)
            else:
                condition = True

            if condition:
                hasit = True
                w_maxit = w_item
                w_max_val = w_compare_with
示例#15
0
 def f(x, n):
     if n > 100:
         llop.gc_push_roots(lltype.Void, x)
         g(x)
         llop.gc_pop_roots(lltype.Void, x)
     return x
示例#16
0
 def f(x):
     llop.gc_push_roots(lltype.Void, x)
     if x > 100:  # slow-path
         foobar()
     llop.gc_pop_roots(lltype.Void, x)
     return x
示例#17
0
 def f(a, b):
     llop.gc_push_roots(lltype.Void, a)
     llop.gc_pop_roots(lltype.Void, a)