source: doc/theses/andrew_beach_MMath/code/ThrowEmpty.java@ b7763da

ADT ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since b7763da 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: 635 bytes
Line 
1// Throw Across Empty Function
2
3class EmptyException extends Exception {}
4
5public class ThrowEmpty {
6 static void unwind_empty(int frames) throws EmptyException {
7 if (0 < frames) {
8 unwind_empty(frames - 1);
9 } else {
10 throw new EmptyException();
11 }
12 }
13
14 public static void main(String[] args) {
15 int times = 1;
16 int total_frames = 1;
17 if (0 < args.length) {
18 times = Integer.parseInt(args[0]);
19 }
20 if (1 < args.length) {
21 total_frames = Integer.parseInt(args[1]);
22 }
23
24 for (int count = 0 ; count < times ; ++count) {
25 try {
26 unwind_empty(total_frames);
27 } catch (EmptyException e) {
28 // ...
29 }
30 }
31 }
32}
Note: See TracBrowser for help on using the repository browser.