Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
5d84eaa1
Commit
5d84eaa1
authored
Aug 16, 2017
by
Isaac Oscar Gariano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another swapstack test (I can't think of any more...)
parent
6c445fa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
tests/test_muc/test_swapstack.py
tests/test_muc/test_swapstack.py
+45
-0
No files found.
tests/test_muc/test_swapstack.py
View file @
5d84eaa1
...
@@ -102,3 +102,48 @@ def test_swapstack_throw():
...
@@ -102,3 +102,48 @@ def test_swapstack_throw():
}
}
"""
,
"test_swapstack_throw"
);
"""
,
"test_swapstack_throw"
);
assert
(
execute
(
"test_swapstack_throw"
,
[])
==
3
);
assert
(
execute
(
"test_swapstack_throw"
,
[])
==
3
);
def
test_swapstack_throw_back
():
compile_bundle
(
"""
.funcdef new_func <(stackref)->()>
{
entry(<stackref>s):
er = NEW <int<32>>
eri = GETIREF <int<32>> er
STORE <int<32>> eri <int<32>> 1
ev = REFCAST <ref<int<32>> ref<void>> er
r = SWAPSTACK s RET_WITH<int<32>> THROW_EXC ev EXC(nor_dest(r) exc_dest())
nor_dest(<int<32>> r):
CCALL #DEFAULT <exit_type exit_sig> exit(<int<32>>0)
RET
exc_dest()[exc_param]:
e = REFCAST <ref<void> ref<int<32>>> exc_param
evi = GETIREF <int<32>> e
ev = LOAD <int<32>> evi
CCALL #DEFAULT <exit_type exit_sig> exit(ev)
RET
}
.funcdef test_swapstack_throw_back <main_sig>
{
entry(<int<32>>argc <uptr<uptr<char>>>argv):
cs = COMMINST uvm.current_stack()
s = COMMINST uvm.new_stack<[(stackref)->()]>(new_func)
r = SWAPSTACK s RET_WITH<int<32>> PASS_VALUES<stackref>(cs) EXC(nor_dest(r) exc_dest(s))
RET r
nor_dest(<int<32>> r):
RET <int<32>>0
exc_dest(<stackref> s)[exc_param]:
e = REFCAST <ref<void> ref<int<32>>> exc_param
evi = GETIREF <int<32>> e
ev = LOAD <int<32>> evi
newv = ADD <int<32>> ev <int<32>> 2
STORE <int<32>> evi newv
// exc_param += 2
// Throw back to new_func
SWAPSTACK s KILL_OLD THROW_EXC exc_param
}
"""
,
"test_swapstack_throw_back"
);
assert
(
execute
(
"test_swapstack_throw"
,
[])
==
3
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment