1. Pypy
  2. Untitled project
  3. pypy

Commits

Maciej Fijalkowski  committed 6dfdca1

support renaming

  • Participants
  • Parent commits 927621f
  • Branches jitframe-on-heap

Comments (0)

Files changed (3)

File pypy/jit/metainterp/resume.py

View file
     def write_a_float(self, index, float):
         self.blackholeinterp.setarg_f(index, float)
 
+def resume_renum(list_of_positions, storage):
+    num = storage.rd_numb
+    while num:
+        i = 0
+        while i < len(num.nums):
+            pos, flags = untag(num.nums[i])
+            if flags == TAGBOX:
+                num.nums[i] = tag(list_of_positions[pos], TAGBOX)
+            i += 1
+        num = num.prev
+
 # ____________________________________________________________
 
 def dump_storage(storage, liveboxes):

File pypy/jit/metainterp/test/test_fficall.py

View file
 
+import py
 import ctypes, math
 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.jit.metainterp.test.support import LLJitMixin
 
 class TestFfiCall(FfiCallTests, LLJitMixin):
     def test_jit_fii_vref(self):
+        py.test.skip("unsupported so far")
         from pypy.rlib import clibffi
         from pypy.rlib.jit_libffi import jit_ffi_prep_cif, jit_ffi_call
 

File pypy/jit/metainterp/test/test_resume.py

View file
     rd_consts = []
     rd_virtuals = None
     rd_pendingfields = None
+    rd_count = 0
 
 
 class FakeOptimizer(object):
         CONST_NULL = ConstPtr(gcrefnull)
     def __init__(self, values):
         self.values = values
-    def get_latest_value_count(self, deadframe):
-        assert deadframe == "deadframe"
-        return len(self.values)
     def get_latest_value_int(self, deadframe, index):
         assert deadframe == "deadframe"
         return self.values[index]
                             tag(0, TAGBOX),
                             tag(1, TAGBOX)])
     storage.rd_numb = numb
+    storage.rd_count = 3
     #
     cpu = MyCPU([42, gcref1, -66])
     metainterp = MyMetaInterp(cpu)
     assert snapshot.prev is fs[2].parent_resumedata_snapshot
     assert snapshot.boxes == fs[2]._env
 
+def test_renaming():
+    b1, b2, b3 = [BoxInt(), BoxPtr(), BoxInt()]
+    c1, c2, c3 = [ConstInt(1), ConstInt(2), ConstInt(3)]
+    fs = [FakeFrame("code0", 0, b1, c1, b2)]
+
+    storage = Storage()
+    capture_resumedata(fs, None, [], storage)
+    memo = ResumeDataLoopMemo(FakeMetaInterpStaticData())
+    modifier = ResumeDataVirtualAdder(storage, memo)
+    modifier.finish(FakeOptimizer({}))
+    resume_renum([10, 20], storage)
+    for num, x in zip(storage.rd_numb.prev.nums, [10, 20]):
+        pos, tag = untag(num)
+        if tag == TAGBOX:
+            assert pos == x
 
 class FakeMetaInterpStaticData:
     cpu = LLtypeMixin.cpu