Skip to content
Permalink
Browse files

Merge a5b7b6b into 879e92b

  • Loading branch information
timfel committed Jul 21, 2013
2 parents 879e92b + a5b7b6b commit 49b1e6496e2b038312f23096c0b2c933e2e02ebf
Showing with 351 additions and 68 deletions.
  1. +17 −12 tests/jit/test_array.py
  2. +11 −0 tests/objects/test_arrayobject.py
  3. +6 −0 tests/objects/test_rangeobject.py
  4. +316 −55 topaz/objects/arrayobject.py
  5. +1 −1 topaz/objspace.py
@@ -8,39 +8,44 @@ def test_subscript_assign_simple(self, topaz, tmpdir):
10000.times { arr[0] = true }
""")
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_SELF')
debug_merge_point(0, 0, 'times at SEND')
setfield_gc(p28, 42, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>)
guard_not_invalidated(descr=<Guard0x100fe5d30>)
p72 = force_token()
i73 = int_lt(i69, i40)
guard_true(i73, descr=<Guard0x100fe5cb8>)
guard_not_invalidated(descr=<Guard0x101e2c548>)
p76 = force_token()
i77 = int_lt(i74, i40)
guard_true(i77, descr=<Guard0x101e2c4d0>)
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 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_CONST')
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 BUILD_ARRAY')
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(0, 0, 'times at DISCARD_TOP')
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 SEND')
p76 = force_token()
i77 = int_add(i69, 1)
p83 = force_token()
i84 = int_add(i74, 1)
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 JUMP')
debug_merge_point(0, 0, 'times at LOAD_DEREF')
setfield_gc(p28, 63, descr=<FieldS topaz.executioncontext.ExecutionContext.inst_last_instr 24>)
i78 = arraylen_gc(p51, descr=<ArrayP 8>)
i79 = arraylen_gc(p66, 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))
setarrayitem_gc(p82, 0, ConstPtr(ptr58), descr=<ArrayP 8>)
i85 = arraylen_gc(p51, descr=<ArrayP 8>)
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))
""")
@@ -203,6 +203,17 @@ def test_dup(self, space):
assert x == [1, 2, 3, 4]
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):
w_res = space.execute("return ['a', nil, 'b', nil, 'c'].compact")
assert self.unwrap(space, w_res) == ['a', 'b', 'c']
@@ -84,3 +84,9 @@ def test_each_returns_self(self, space):
return r.each {}.equal?(r)
""")
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.
You can’t perform that action at this time.