ADT
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since d5f6a14 was ea593a3, checked in by Andrew Beach <ajbeach@…>, 4 years ago |
First draft of all the exception benchmarks. There is an issue with the Cforall linking.
|
-
Property mode
set to
100644
|
File size:
651 bytes
|
Rev | Line | |
---|
[ea593a3] | 1 | // Resume Across Empty Function
|
---|
| 2 | #include <exception.hfa>
|
---|
| 3 | #include <stdlib.hfa>
|
---|
| 4 |
|
---|
| 5 | EHM_EXCEPTION(empty_exception)();
|
---|
| 6 |
|
---|
| 7 | EHM_VIRTUAL_TABLE(empty_exception, empty_vt);
|
---|
| 8 |
|
---|
| 9 | void unwind_empty(unsigned int frames) {
|
---|
| 10 | if (frames) {
|
---|
| 11 |
|
---|
| 12 | unwind_empty(frames - 1);
|
---|
| 13 | } else {
|
---|
| 14 | throw (empty_exception){&empty_vt};
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | int main(int argc, char * argv[]) {
|
---|
| 19 | unsigned int times = 1;
|
---|
| 20 | unsigned int total_frames = 1;
|
---|
| 21 | if (2 < argc) {
|
---|
| 22 | times = strtol(argv[1], 0p, 10);
|
---|
| 23 | }
|
---|
| 24 | if (3 < argc) {
|
---|
| 25 | total_frames = strtol(argv[2], 0p, 10);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | for (int count = 0 ; count < times ; ++count) {
|
---|
| 29 | try {
|
---|
| 30 | unwind_empty(total_frames);
|
---|
| 31 | } catch (empty_exception *) {
|
---|
| 32 | // ...
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.