Skip to content

Commit

Permalink
Merge a5b7b6b into 879e92b
Browse files Browse the repository at this point in the history
  • Loading branch information
timfel committed Jul 21, 2013
2 parents 879e92b + a5b7b6b commit 49b1e64
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 68 deletions.
29 changes: 17 additions & 12 deletions tests/jit/test_array.py
Expand Up @@ -8,39 +8,44 @@ def test_subscript_assign_simple(self, topaz, tmpdir):
10000.times { arr[0] = true } 10000.times { arr[0] = true }
""") """)
self.assert_matches(traces[0].loop, """ self.assert_matches(traces[0].loop, """
label(p0, p1, p3, p4, p5, p6, p7, p8, p10, p13, i69, p21, p24, p26, p28, i40, p37, p51, p66, descr=TargetToken(4310782200)) label(p0, p1, p3, p4, p5, p6, p7, p8, p10, p13, i74, p21, p24, p26, p28, i40, p37, p67, p56, p43, p42, p46, p53, p47, p45, p51, descr=TargetToken(4311183872))
debug_merge_point(0, 0, 'times at LOAD_DEREF') debug_merge_point(0, 0, 'times at LOAD_DEREF')
debug_merge_point(0, 0, 'times at LOAD_SELF') debug_merge_point(0, 0, 'times at LOAD_SELF')
debug_merge_point(0, 0, 'times at SEND') debug_merge_point(0, 0, 'times at SEND')
setfield_gc(p28, 42, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>) setfield_gc(p28, 42, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>)
guard_not_invalidated(descr=<Guard0x100fe5d30>) guard_not_invalidated(descr=<Guard0x101e2c548>)
p72 = force_token() p76 = force_token()
i73 = int_lt(i69, i40) i77 = int_lt(i74, i40)
guard_true(i73, descr=<Guard0x100fe5cb8>) guard_true(i77, descr=<Guard0x101e2c4d0>)
debug_merge_point(0, 0, 'times at JUMP_IF_FALSE') debug_merge_point(0, 0, 'times at JUMP_IF_FALSE')
debug_merge_point(0, 0, 'times at LOAD_DEREF') debug_merge_point(0, 0, 'times at LOAD_DEREF')
debug_merge_point(0, 0, 'times at YIELD') debug_merge_point(0, 0, 'times at YIELD')
p74 = force_token() p78 = force_token()
debug_merge_point(1, 1, 'block in <main> at LOAD_DEREF') debug_merge_point(1, 1, 'block in <main> at LOAD_DEREF')
debug_merge_point(1, 1, 'block in <main> at LOAD_CONST') debug_merge_point(1, 1, 'block in <main> at LOAD_CONST')
debug_merge_point(1, 1, 'block in <main> at BUILD_ARRAY') debug_merge_point(1, 1, 'block in <main> at BUILD_ARRAY')
debug_merge_point(1, 1, 'block in <main> at LOAD_CONST') debug_merge_point(1, 1, 'block in <main> at LOAD_CONST')
debug_merge_point(1, 1, 'block in <main> at BUILD_ARRAY') debug_merge_point(1, 1, 'block in <main> at BUILD_ARRAY')
debug_merge_point(1, 1, 'block in <main> at SEND_SPLAT') debug_merge_point(1, 1, 'block in <main> at SEND_SPLAT')
p75 = force_token() p79 = force_token()
i80 = getfield_gc(p67, descr=<FieldS list.length 8>)
i81 = int_ge(0, i80)
setfield_gc(p28, 20, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>)
guard_false(i81, descr=<Guard0x101e2c3e0>)
p82 = getfield_gc(p67, descr=<FieldP list.items 16>)
debug_merge_point(1, 1, 'block in <main> at RETURN') debug_merge_point(1, 1, 'block in <main> at RETURN')
debug_merge_point(0, 0, 'times at DISCARD_TOP') debug_merge_point(0, 0, 'times at DISCARD_TOP')
debug_merge_point(0, 0, 'times at LOAD_DEREF') debug_merge_point(0, 0, 'times at LOAD_DEREF')
debug_merge_point(0, 0, 'times at LOAD_CONST') debug_merge_point(0, 0, 'times at LOAD_CONST')
debug_merge_point(0, 0, 'times at SEND') debug_merge_point(0, 0, 'times at SEND')
p76 = force_token() p83 = force_token()
i77 = int_add(i69, 1) i84 = int_add(i74, 1)
debug_merge_point(0, 0, 'times at STORE_DEREF') debug_merge_point(0, 0, 'times at STORE_DEREF')
debug_merge_point(0, 0, 'times at DISCARD_TOP') debug_merge_point(0, 0, 'times at DISCARD_TOP')
debug_merge_point(0, 0, 'times at JUMP') debug_merge_point(0, 0, 'times at JUMP')
debug_merge_point(0, 0, 'times at LOAD_DEREF') debug_merge_point(0, 0, 'times at LOAD_DEREF')
setfield_gc(p28, 63, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>) setfield_gc(p28, 63, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>)
i78 = arraylen_gc(p51, descr=<ArrayP 8>) setarrayitem_gc(p82, 0, ConstPtr(ptr58), descr=<ArrayP 8>)
i79 = arraylen_gc(p66, descr=<ArrayP 8>) i85 = arraylen_gc(p51, descr=<ArrayP 8>)
jump(p0, p1, p3, p4, p5, p6, p7, p8, p10, p13, i77, p21, p24, p26, p28, i40, p37, p51, p66, descr=TargetToken(4310782200)) jump(p0, p1, p3, p4, p5, p6, p7, p8, p10, p13, i84, p21, p24, p26, p28, i40, p37, p67, p56, p43, p42, p46, p53, p47, p45, p51, descr=TargetToken(4311183872))
""") """)
11 changes: 11 additions & 0 deletions tests/objects/test_arrayobject.py
Expand Up @@ -203,6 +203,17 @@ def test_dup(self, space):
assert x == [1, 2, 3, 4] assert x == [1, 2, 3, 4]
assert y == [1, 2, 3] assert y == [1, 2, 3]


def test_dupf(self, space):
w_res = space.execute("""
x = [1.0, 2.0, 3.0]
y = x.dup
x << 4
return [x, y]
""")
x, y = self.unwrap(space, w_res)
assert x == [1.0, 2.0, 3.0, 4]
assert y == [1.0, 2.0, 3.0]

def test_compact(self, space): def test_compact(self, space):
w_res = space.execute("return ['a', nil, 'b', nil, 'c'].compact") w_res = space.execute("return ['a', nil, 'b', nil, 'c'].compact")
assert self.unwrap(space, w_res) == ['a', 'b', 'c'] assert self.unwrap(space, w_res) == ['a', 'b', 'c']
Expand Down
6 changes: 6 additions & 0 deletions tests/objects/test_rangeobject.py
Expand Up @@ -84,3 +84,9 @@ def test_each_returns_self(self, space):
return r.each {}.equal?(r) return r.each {}.equal?(r)
""") """)
assert w_res is space.w_true assert w_res is space.w_true

def test_array_conversion(self, space):
w_res = space.execute("""
return (1..4).to_a
""")
assert self.unwrap(space, w_res) == [1, 2, 3, 4]

0 comments on commit 49b1e64

Please sign in to comment.