Author: fijal
Branch: compress-numbering
Changeset: r80880:c73a5279a022
Date: 2015-11-24 12:26 +0200
http://bitbucket.org/pypy/pypy/changeset/c73a5279a022/
Log: small progress
diff --git a/rpython/jit/codewriter/jitcode.py
b/rpython/jit/codewriter/jitcode.py
--- a/rpython/jit/codewriter/jitcode.py
+++ b/rpython/jit/codewriter/jitcode.py
@@ -142,6 +142,7 @@
return ord(self.live_f[index])
def enumerate_vars(self, callback_i, callback_r, callback_f, spec):
+ xxx
index = 0
for i in range(self.get_register_count_i()):
callback_i(index, self.get_register_index_i(i))
diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py
--- a/rpython/jit/metainterp/resume.py
+++ b/rpython/jit/metainterp/resume.py
@@ -978,7 +978,8 @@
def _init(self, cpu, storage):
self.cpu = cpu
- self.cur_numb = storage.rd_numb
+ self.numb = storage.rd_numb
+ self.cur_index = 0
self.count = storage.rd_count
self.consts = storage.rd_consts
@@ -1061,23 +1062,29 @@
def _prepare_next_section(self, info):
# Use info.enumerate_vars(), normally dispatching to
# rpython.jit.codewriter.jitcode. Some tests give a different 'info'.
- info.enumerate_vars(self._callback_i,
- self._callback_r,
- self._callback_f,
- self.unique_id) # <-- annotation hack
- self.cur_numb = self.cur_numb.prev
+ self.cur_index = info.enumerate_vars(self._callback_i,
+ self._callback_r,
+ self._callback_f,
+ self.unique_id, # <-- annotation hack
+ self.cur_index)
def _callback_i(self, index, register_index):
- value = self.decode_int(self.cur_numb.nums[index])
+ item, index = resumecode.numb_next_item(self.numb, index)
+ value = self.decode_int(item)
self.write_an_int(register_index, value)
+ return index
def _callback_r(self, index, register_index):
- value = self.decode_ref(self.cur_numb.nums[index])
+ item, index = resumecode.numb_next_item(self.numb, index)
+ value = self.decode_ref(item)
self.write_a_ref(register_index, value)
+ return index
def _callback_f(self, index, register_index):
- value = self.decode_float(self.cur_numb.nums[index])
+ item, index = resumecode.numb_next_item(self.numb, index)
+ value = self.decode_float(item)
self.write_a_float(register_index, value)
+ return index
# ---------- when resuming for pyjitpl.py, make boxes ----------
@@ -1379,6 +1386,7 @@
#
# Now fill the blackhole interpreters with resume data.
curbh = firstbh
+ xxxx
numbering = storage.rd_numb.prev
while True:
jitcode_pos, pc = unpack_uint(numbering.packed_jitcode_pc)
diff --git a/rpython/jit/metainterp/resumecode.py
b/rpython/jit/metainterp/resumecode.py
--- a/rpython/jit/metainterp/resumecode.py
+++ b/rpython/jit/metainterp/resumecode.py
@@ -17,6 +17,7 @@
('prev_index', rffi.USHORT),
('code', lltype.Array(rffi.UCHAR)))
NUMBERINGP.TO.become(NUMBERING)
+NULL_NUMBER = lltype.nullptr(NUMBERING)
def create_numbering(lst, prev, prev_index):
count = 0
diff --git a/rpython/jit/metainterp/test/test_resume.py
b/rpython/jit/metainterp/test/test_resume.py
--- a/rpython/jit/metainterp/test/test_resume.py
+++ b/rpython/jit/metainterp/test/test_resume.py
@@ -11,7 +11,9 @@
VUniPlainInfo, VUniConcatInfo, VUniSliceInfo, Snapshot, FrameInfo,\
capture_resumedata, ResumeDataLoopMemo, UNASSIGNEDVIRTUAL, INT,\
annlowlevel, PENDINGFIELDSP, unpack_uint
-from rpython.jit.metainterp.resumecode import unpack_numbering
+from rpython.jit.metainterp.resumecode import unpack_numbering,\
+ create_numbering, NULL_NUMBER
+
from rpython.jit.metainterp.optimizeopt import info
from rpython.jit.metainterp.history import ConstInt, Const, AbstractDescr
from rpython.jit.metainterp.history import ConstPtr, ConstFloat
@@ -238,17 +240,18 @@
def get_current_position_info(self):
class MyInfo:
@staticmethod
- def enumerate_vars(callback_i, callback_r, callback_f, _):
+ def enumerate_vars(callback_i, callback_r, callback_f, _, index):
count_i = count_r = count_f = 0
- for index, ARG in enumerate(self.ARGS):
+ for ARG in self.ARGS:
if ARG == lltype.Signed:
- callback_i(index, count_i); count_i += 1
+ index = callback_i(index, count_i); count_i += 1
elif ARG == llmemory.GCREF:
- callback_r(index, count_r); count_r += 1
+ index = callback_r(index, count_r); count_r += 1
elif ARG == longlong.FLOATSTORAGE:
- callback_f(index, count_f); count_f += 1
+ index = callback_f(index, count_f); count_f += 1
else:
assert 0
+ return index
return MyInfo()
def setarg_i(self, index, value):
@@ -275,11 +278,8 @@
assert bh.written_f == expected_f
-def Numbering(prev, nums):
- numb = lltype.malloc(NUMBERING, len(nums))
- numb.prev = prev or lltype.nullptr(NUMBERING)
- for i in range(len(nums)):
- numb.nums[i] = nums[i]
+def Numbering(nums):
+ numb = create_numbering(nums, NULL_NUMBER, 0)
return numb
def test_simple_read():
@@ -287,13 +287,10 @@
c1, c2, c3 = [ConstInt(111), ConstInt(222), ConstInt(333)]
storage = Storage()
storage.rd_consts = [c1, c2, c3]
- numb = Numbering(None, [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)])
- numb = Numbering(numb, [tag(1, TAGCONST), tag(2, TAGCONST)])
- numb = Numbering(numb, [tag(0, TAGBOX),
- tag(0, TAGCONST),
- NULLREF,
- tag(0, TAGBOX),
- tag(1, TAGBOX)])
+ numb = Numbering([tag(0, TAGBOX), tag(0, TAGCONST),
+ NULLREF, tag(0, TAGBOX), tag(1, TAGBOX)] +
+ [tag(1, TAGCONST), tag(2, TAGCONST)] + [0, 0] +
+ [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)] + [0,
0])
storage.rd_numb = numb
storage.rd_count = 3
#
@@ -1072,8 +1069,10 @@
snapshot = Snapshot(None, [b1, ConstInt(1), b1, b2])
snapshot = Snapshot(snapshot, [ConstInt(2), ConstInt(3)])
snapshot = Snapshot(snapshot, [b1, b2, b3])
+ frameinfo = FrameInfo(FrameInfo(None, FakeJitCode("code1", 21), 22),
+ FakeJitCode("code2", 31), 32)
storage.rd_snapshot = snapshot
- storage.rd_frame_info_list = None
+ storage.rd_frame_info_list = frameinfo
return storage
def test_virtual_adder_int_constants():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit