ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 55ad35c was
ea593a3,
checked in by Andrew Beach <ajbeach@…>, 3 years ago
|
First draft of all the exception benchmarks. There is an issue with the Cforall linking.
|
-
Property mode set to
100644
|
File size:
924 bytes
|
Line | |
---|
1 | // Throw Across Other Handler |
---|
2 | |
---|
3 | class EmptyException extends Exception {} |
---|
4 | |
---|
5 | class NotRaisedException extends Exception {} |
---|
6 | |
---|
7 | public class ThrowOther { |
---|
8 | static boolean should_throw = false; |
---|
9 | |
---|
10 | private static void unwind_other(int frames) |
---|
11 | throws EmptyException, NotRaisedException { |
---|
12 | if (0 < frames) { |
---|
13 | try { |
---|
14 | unwind_other(frames - 1); |
---|
15 | } catch (NotRaisedException e) { |
---|
16 | // ... |
---|
17 | } |
---|
18 | } else { |
---|
19 | if (should_throw) { |
---|
20 | throw new NotRaisedException(); |
---|
21 | } |
---|
22 | throw new EmptyException(); |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | public static void main(String[] args) { |
---|
27 | int times = 1; |
---|
28 | int total_frames = 1; |
---|
29 | if (0 < args.length) { |
---|
30 | times = Integer.parseInt(args[0]); |
---|
31 | } |
---|
32 | if (1 < args.length) { |
---|
33 | total_frames = Integer.parseInt(args[1]); |
---|
34 | } |
---|
35 | |
---|
36 | for (int count = 0 ; count < times ; ++count) { |
---|
37 | try { |
---|
38 | unwind_other(total_frames); |
---|
39 | } catch (EmptyException e) { |
---|
40 | // ... |
---|
41 | } catch (NotRaisedException e) { |
---|
42 | // ... |
---|
43 | } |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.