Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeric arrays #555

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
de7e032
Implemented numeric_arrays, tests pass, translation wont.
merryman Mar 21, 2013
d881ea0
still not translating
Mar 26, 2013
c4a648a
fixed faulty method extraction.
Mar 26, 2013
102aae6
Merge remote-tracking branch 'origin/master' into numeric_arrays
timfel Mar 26, 2013
376755f
nits
timfel Mar 26, 2013
a98d169
refactor numeric array strategy
timfel Mar 26, 2013
d0b6ec1
fix translation for sorters
timfel Mar 26, 2013
33710ce
move choosing strategy and creating storage into W_ArrayObject
timfel Mar 26, 2013
93940cd
fix UnionErrors when merging different prebuilt erase methods
timfel Mar 26, 2013
0750ca9
fix translation
timfel Mar 26, 2013
33f49c0
fix tests
timfel Mar 26, 2013
a3e72ce
refactor code to be closer to master, style nits
timfel Mar 26, 2013
b62eb84
add EmptyArrayStrategy and fix tests
timfel Mar 26, 2013
0ae04b4
revert to empty strategy on clear and fix tests
timfel Mar 26, 2013
435eb7a
add NotImplementedError rasing to default methods
timfel Mar 26, 2013
3455128
fix signature mismatch
timfel Mar 26, 2013
cfc4ccd
fix forgotten path
timfel Mar 26, 2013
cecc2a1
Merged master
flaper87 Jun 18, 2013
13e7793
Merge branch 'master' of https://github.com/topazproject/topaz into n…
flaper87 Jul 7, 2013
db63721
Merge branch 'master' into numeric_arrays
alex Jul 21, 2013
8beb090
start of some cleanups
alex Jul 21, 2013
c11c786
some type fixups
alex Jul 21, 2013
b237b93
start on some cleanup
alex Jul 21, 2013
6bca7e7
more cleanups
alex Jul 21, 2013
96655c3
fix
alex Jul 21, 2013
f5692fa
Merge branch 'master' into numeric_arrays
alex Jul 21, 2013
e22e6c5
stub out
alex Jul 21, 2013
86926dc
remove the last of items_w
alex Jul 21, 2013
bb57731
Merge branch 'master' into numeric_arrays
alex Jul 21, 2013
e609913
make sorting work, still need the optimized version
alex Jul 21, 2013
3c165ec
fix types
alex Jul 21, 2013
a7b63c4
EmptyArrayStorage.mul
alex Jul 21, 2013
6fd533a
EmptyArrayStorage.reverse
alex Jul 21, 2013
10ff4ae
EmptyArrayStorage.getslice
alex Jul 21, 2013
2e10283
EmptyArrayStrategy.delslice
alex Jul 21, 2013
38221a4
sort_by
alex Jul 21, 2013
0b66118
unroll this function
alex Jul 21, 2013
608e38d
unroll this
alex Jul 21, 2013
1d6dd9c
unroll
alex Jul 21, 2013
8fd9c78
try again
alex Jul 21, 2013
21bba2e
some changes
alex Jul 21, 2013
a5b7b6b
update JIT tests, they're a bit worse, not much we can do
alex Jul 21, 2013
92b1974
Updated for the latest RPython. YOU MUST UPGRADE TO THE LAST RPYTHON
alex Aug 6, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions tests/jit/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
""")
11 changes: 11 additions & 0 deletions tests/objects/test_arrayobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
6 changes: 6 additions & 0 deletions tests/objects/test_rangeobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
2 changes: 1 addition & 1 deletion topaz/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self):


class Frame(BaseFrame):
_virtualizable2_ = [
_virtualizable_ = [
"bytecode", "localsstack_w[*]", "stackpos", "w_self", "block",
"cells[*]", "lastblock", "lexical_scope", "last_instr", "parent_interp",
"top_parent_interp",
Expand Down
Loading