Commits

Gregor Wegberg  committed b5b57f1

add first simple JIT test with a pinned object

  • Participants
  • Parent commits f7318fc
  • Branches gc-incminimark-pinning

Comments (0)

Files changed (1)

File rpython/jit/backend/llsupport/test/zrpy_gc_test.py

 
     def test_compile_framework_call_assembler(self):
         self.run('compile_framework_call_assembler')
+
+    def define_pinned_simple(cls):
+        from rpython.rlib.jit import promote
+        class H:
+            inst = None
+        helper = H()
+
+        @dont_look_inside
+        def get_y():
+            if not helper.inst:
+                helper.inst = X()
+                helper.inst.x = 101
+                assert rgc.pin(helper.inst)
+            else:
+                assert rgc._is_pinned(helper.inst)
+            return helper.inst
+
+        def fn(n, x, *args):
+            t = get_y()
+            promote(t)
+            t.x += 11
+            n -= 1
+            return (n, x) + args
+
+        return None, fn, None
+
+    def test_pinned_simple(self):
+        self.run('pinned_simple')
+