Author: Carl Friedrich Bolz <[email protected]>
Branch: getarrayitem-into-bridges
Changeset: r92040:8885e06c04d6
Date: 2017-08-02 16:26 +0200
http://bitbucket.org/pypy/pypy/changeset/8885e06c04d6/
Log: finish support for serializing knowledge about arrays
diff --git a/rpython/jit/metainterp/optimizeopt/heap.py
b/rpython/jit/metainterp/optimizeopt/heap.py
--- a/rpython/jit/metainterp/optimizeopt/heap.py
+++ b/rpython/jit/metainterp/optimizeopt/heap.py
@@ -116,7 +116,6 @@
return None
def force_lazy_set(self, optheap, descr, can_cache=True):
- import pdb; pdb.set_trace()
op = self._lazy_set
if op is not None:
# This is the way _lazy_set is usually reset to None.
@@ -578,7 +577,6 @@
cf.do_setfield(self, op)
def optimize_GETARRAYITEM_GC_I(self, op):
- import pdb; pdb.set_trace()
arrayinfo = self.ensure_ptr_info_arg0(op)
indexb = self.getintbound(op.getarg(1))
cf = None
@@ -641,7 +639,6 @@
optimize_GETARRAYITEM_GC_PURE_F = optimize_GETARRAYITEM_GC_PURE_I
def optimize_SETARRAYITEM_GC(self, op):
- import pdb; pdb.set_trace()
#opnum = OpHelpers.getarrayitem_pure_for_descr(op.getdescr())
#if self.has_pure_result(opnum, [op.getarg(0), op.getarg(1)],
# op.getdescr()):
@@ -716,7 +713,6 @@
if isinstance(box2, Const) or box2 in available_boxes:
result_getfield.append((box1, descr, box2))
result_array = []
- import pdb; pdb.set_trace()
for descr, indexdict in self.cached_arrayitems.iteritems():
for index, cf in indexdict.iteritems():
if cf._lazy_set:
@@ -731,7 +727,7 @@
return result_getfield, result_array
def deserialize_optheap(self, triples_struct, triples_array):
- for box1, descr, box2 in triples_struct[0]:
+ for box1, descr, box2 in triples_struct:
parent_descr = descr.get_parent_descr()
assert parent_descr.is_object()
structinfo = box1.get_forwarded()
@@ -742,15 +738,14 @@
cf = self.field_cache(descr)
structinfo.setfield(descr, box1, box2, optheap=self, cf=cf)
- import pdb; pdb.set_trace()
- for box1, index, descr, box2 in triples_array[0]:
- structinfo = box1.get_forwarded()
- if not isinstance(structinfo, info.AbstractVirtualPtrInfo):
- structinfo = info.ArrayPtrInfo(descr)
- box1.set_forwarded(structinfo)
+ for box1, index, descr, box2 in triples_array:
+ arrayinfo = box1.get_forwarded()
+ if not isinstance(arrayinfo, info.AbstractVirtualPtrInfo):
+ arrayinfo = info.ArrayPtrInfo(descr)
+ box1.set_forwarded(arrayinfo)
- cf = self.arrayitem_cache(index, descr)
- structinfo.setfield(descr, box1, box2, optheap=self, cf=cf)
+ cf = self.arrayitem_cache(descr, index)
+ arrayinfo.setitem(descr, index, box1, box2, optheap=self, cf=cf)
dispatch_opt = make_dispatcher_method(OptHeap, 'optimize_',
diff --git a/rpython/jit/metainterp/test/test_bridgeopt.py
b/rpython/jit/metainterp/test/test_bridgeopt.py
--- a/rpython/jit/metainterp/test/test_bridgeopt.py
+++ b/rpython/jit/metainterp/test/test_bridgeopt.py
@@ -211,6 +211,5 @@
assert res == f(6, 32, 16)
self.check_trace_count(3)
self.check_resops(guard_value=1)
- self.check_resops(getarrayitem_gc_r=4) # 3x a.x, 1x a.n
- self.check_resops(getfield_gc_r=1) # in main loop
+ self.check_resops(getarrayitem_gc_i=4)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit