diff options
author | Armin Rigo <arigo@tunes.org> | 2014-06-05 19:12:27 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2014-06-05 19:12:27 +0200 |
commit | 7154ecaa8d8fd1b0b850aa494cdd2727489f56d2 (patch) | |
tree | 1411694662e95bd57d4ef22a3ab9ca24acbbca63 | |
parent | Test and fix. It's relatively hard to hit the case on PyPy, but (diff) | |
download | pypy-7154ecaa8d8fd1b0b850aa494cdd2727489f56d2.tar.gz pypy-7154ecaa8d8fd1b0b850aa494cdd2727489f56d2.tar.bz2 pypy-7154ecaa8d8fd1b0b850aa494cdd2727489f56d2.zip |
Test and fix
-rw-r--r-- | rpython/jit/backend/llsupport/rewrite.py | 7 | ||||
-rw-r--r-- | rpython/jit/backend/llsupport/test/test_rewrite.py | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py index 5334cdc894..aa2ae71ddc 100644 --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -232,8 +232,8 @@ class GcRewriterAssembler(object): self.emitting_an_operation_that_can_collect() op = ResOperation(rop.CALL_MALLOC_GC, args, v_result, descr) self.newops.append(op) - # mark 'v_result' as freshly malloced, so not needing a write barrier - self.write_barrier_applied[v_result] = None + # In general, don't add v_result to write_barrier_applied: + # v_result might be a large young array. def gen_malloc_fixedsize(self, size, typeid, v_result): """Generate a CALL_MALLOC_GC(malloc_fixedsize_fn, ...). @@ -251,6 +251,9 @@ class GcRewriterAssembler(object): args = [ConstInt(addr), ConstInt(size)] descr = self.gc_ll_descr.malloc_fixedsize_descr self._gen_call_malloc_gc(args, v_result, descr) + # mark 'v_result' as freshly malloced, so not needing a write barrier + # (this is always true because it's a fixed-size object) + self.write_barrier_applied[v_result] = None def gen_boehm_malloc_array(self, arraydescr, v_num_elem, v_result): """Generate a CALL_MALLOC_GC(malloc_array_fn, ...) for Boehm.""" diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py index bfb6fc630b..813735c63d 100644 --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -435,16 +435,19 @@ class TestFramework(RewriteTests): nonstd_descr.itemsize = 8 nonstd_descr_gcref = 123 self.check_rewrite(""" - [i0] + [i0, p1] p0 = new_array(i0, descr=nonstd_descr) + setarrayitem_gc(p0, i0, p1) jump(i0) """, """ - [i0] + [i0, p1] p0 = call_malloc_gc(ConstClass(malloc_array_nonstandard), \ 64, 8, \ %(nonstd_descr.lendescr.offset)d, \ 6464, i0, \ descr=malloc_array_nonstandard_descr) + cond_call_gc_wb_array(p0, i0, descr=wbdescr) + setarrayitem_gc(p0, i0, p1) jump(i0) """, nonstd_descr=nonstd_descr) |