[pypy-commit] pypy heapcache-refactor: ll_arraycopy
arigo
pypy.commits at gmail.com
Thu Mar 17 10:44:45 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: heapcache-refactor
Changeset: r83110:f71e1a7f5bbb
Date: 2016-03-17 15:43 +0100
http://bitbucket.org/pypy/pypy/changeset/f71e1a7f5bbb/
Log: ll_arraycopy
diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -131,8 +131,6 @@
self.head_version += _HF_VERSION_INC
self.likely_virtual_version = self.head_version
#
- # maps boxes to HeapCacheValue
- self.values = {}
# heap cache
# maps descrs to CacheEntry
self.heap_cache = {}
@@ -145,9 +143,6 @@
# at its older value.
assert self.head_version < _HF_VERSION_MAX
self.head_version += _HF_VERSION_INC
- #
- for value in self.values.itervalues():
- value.reset_keep_likely_virtual()
self.heap_cache = {}
self.heap_array_cache = {}
@@ -218,15 +213,15 @@
def _escape_box(self, box):
if isinstance(box, RefFrontendOp):
remove_flags(box, HF_LIKELY_VIRTUAL | HF_IS_UNESCAPED)
- #
- value = self.getvalue(box, create=False)
- if not value:
- return
- deps = value.dependencies
- value.dependencies = None
- if deps is not None:
- for dep in deps:
- self._escape(dep)
+ deps = self._get_deps(box)
+ if deps is not None and len(deps) > 1:
+ # 'deps[0]' is abused to store the array length, keep it
+ if deps[0] is None:
+ box._heapc_deps = None
+ else:
+ box._heapc_deps = [deps[0]]
+ for i in range(1, len(deps)):
+ self._escape(deps[i])
def clear_caches(self, opnum, descr, argboxes):
if (opnum == rop.SETFIELD_GC or
@@ -279,7 +274,8 @@
self.reset_keep_likely_virtuals()
def _clear_caches_arraycopy(self, opnum, desrc, argboxes, effectinfo):
- seen_allocation_of_target = self.getvalue(argboxes[2]).seen_allocation
+ seen_allocation_of_target = self._check_flag(
+ argboxes[2], HF_SEEN_ALLOCATION)
if (
isinstance(argboxes[3], ConstInt) and
isinstance(argboxes[4], ConstInt) and
diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -664,7 +664,7 @@
self.position_and_flags |= FO_REPLACED_WITH_CONST
def __repr__(self):
- return '%s(%s)' % (self.__class__.__name__, self.position)
+ return '%s(0x%x)' % (self.__class__.__name__, self.position_and_flags)
class IntFrontendOp(IntOp, FrontendOp):
_attrs_ = ('position_and_flags', '_resint')
diff --git a/rpython/jit/metainterp/test/test_heapcache.py b/rpython/jit/metainterp/test/test_heapcache.py
--- a/rpython/jit/metainterp/test/test_heapcache.py
+++ b/rpython/jit/metainterp/test/test_heapcache.py
@@ -466,6 +466,13 @@
def test_ll_arraycopy(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ box3 = RefFrontendOp(3)
+ box4 = RefFrontendOp(4)
+ box5 = RefFrontendOp(5)
+ lengthbox1 = IntFrontendOp(11)
+ lengthbox2 = IntFrontendOp(12)
h.new_array(box1, lengthbox1)
h.setarrayitem(box1, index1, box2, descr1)
h.new_array(box2, lengthbox1)
@@ -494,6 +501,10 @@
def test_ll_arraycopy_differing_descrs(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ box3 = RefFrontendOp(3)
+ lengthbox2 = IntFrontendOp(12)
h.setarrayitem(box1, index1, box2, descr2)
assert h.getarrayitem(box1, index1, descr2) is box2
h.new_array(box2, lengthbox2)
@@ -506,6 +517,9 @@
def test_ll_arraycopy_differing_descrs_nonconst_index(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ box3 = RefFrontendOp(3)
h.setarrayitem(box1, index1, box2, descr2)
assert h.getarrayitem(box1, index1, descr2) is box2
h.invalidate_caches(
@@ -517,6 +531,9 @@
def test_ll_arraycopy_result_propogated(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ box3 = RefFrontendOp(3)
h.setarrayitem(box1, index1, box2, descr1)
h.invalidate_caches(
rop.CALL_N,
@@ -527,6 +544,11 @@
def test_ll_arraycopy_dest_new(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ box3 = RefFrontendOp(3)
+ box4 = RefFrontendOp(4)
+ lengthbox1 = IntFrontendOp(11)
h.new_array(box1, lengthbox1)
h.setarrayitem(box3, index1, box4, descr1)
h.invalidate_caches(
@@ -537,6 +559,10 @@
def test_ll_arraycopy_doesnt_escape_arrays(self):
h = HeapCache()
+ box1 = RefFrontendOp(1)
+ box2 = RefFrontendOp(2)
+ lengthbox1 = IntFrontendOp(11)
+ lengthbox2 = IntFrontendOp(12)
h.new_array(box1, lengthbox1)
h.new_array(box2, lengthbox2)
h.invalidate_caches(
More information about the pypy-commit
mailing list