source: doc/theses/andrew_beach_MMath/code/ThrowFinally.java @ ea593a3

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since ea593a3 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: 647 bytes
Line 
1// Throw Across Finally
2
3class EmptyException extends Exception {}
4
5public class ThrowFinally {
6        private static void unwind_finally(int frames)
7                        throws EmptyException {
8                if (0 < frames) {
9                        unwind_finally(frames - 1);
10                } else {
11                        throw new EmptyException();
12                }
13        }
14
15        public static void main(String[] args) {
16                int times = 1;
17                int total_frames = 1;
18                if (0 < args.length) {
19                        times = Integer.parseInt(args[0]);
20                }
21                if (1 < args.length) {
22                        total_frames = Integer.parseInt(args[1]);
23                }
24
25                for (int count = 0 ; count < times ; ++count) {
26                        try {
27                                unwind_finally(total_frames);
28                        } catch (EmptyException e) {
29                                // ...
30                        }
31                }
32        }
33}
Note: See TracBrowser for help on using the repository browser.