Read about our upcoming Code of Conduct on this issue

Commit c4dd053c authored by Armin Rigo's avatar Armin Rigo
Browse files

Test and fix

parent 2859ce70cad6
......@@ -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."""
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment