ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change
on this file since 24ebddac was
f79ee0d,
checked in by Peter A. Buhr <pabuhr@…>, 3 years ago
|
update exception benchmarks
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[f79ee0d] | 1 | // Resume Across Fixup |
---|
| 2 | #include <clock.hfa> |
---|
| 3 | #include <fstream.hfa> |
---|
| 4 | #include <stdlib.hfa> // strto |
---|
| 5 | |
---|
| 6 | unsigned int frames; // use global because of gcc thunk problem |
---|
| 7 | |
---|
| 8 | void nounwind_fixup(unsigned int dummy, void (*raised_rtn)(int &), void (*not_raised_rtn)(int &)) { |
---|
| 9 | void not_raised(int & fixup) { |
---|
| 10 | fixup = frames + 42; // use local scope => lexical link |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | if (frames) { |
---|
| 14 | frames -= 1; |
---|
| 15 | nounwind_fixup(42, raised_rtn, not_raised); |
---|
| 16 | } else { |
---|
| 17 | int fixup = dummy; |
---|
| 18 | raised_rtn(fixup); |
---|
| 19 | } |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | int main(int argc, char * argv[]) { |
---|
| 23 | unsigned int times = 1; |
---|
| 24 | unsigned int total_frames = 1; |
---|
| 25 | if (1 < argc) { |
---|
| 26 | times = strto(argv[1], 0p, 10); |
---|
| 27 | } |
---|
| 28 | if (2 < argc) { |
---|
| 29 | total_frames = strto(argv[2], 0p, 10); |
---|
| 30 | } |
---|
| 31 | frames = total_frames; |
---|
| 32 | |
---|
| 33 | void raised(int & fixup) { |
---|
| 34 | fixup = total_frames + 42; // use local scope => lexical link |
---|
| 35 | } |
---|
| 36 | void not_raised(int & fixup) { |
---|
| 37 | fixup = total_frames + 42; // use local scope => lexical link |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | Time start_time = timeHiRes(); |
---|
| 41 | for (int count = 0 ; count < times ; ++count) { |
---|
| 42 | nounwind_fixup(42, raised, not_raised); |
---|
| 43 | } |
---|
| 44 | Time end_time = timeHiRes(); |
---|
| 45 | sout | "Run-Time (s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.); |
---|
| 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.