blob: f7c78ff1f12877ab57a605841e6eefaf05284e74 [file] [log] [blame]
Shih-wei Liao9407c602011-09-16 10:36:43 -07001public class StackWalk {
2 public StackWalk() {
3 }
4
5 int f() {
6 g(1);
7 g(2);
8 return 0;
9 }
10
11 void g(int num_calls) {
12 if (num_calls == 1) {
13 System.out.println("1st call");
14 } else if (num_calls == 2) {
15 System.out.println("2nd call");
16 }
17 System.out.println(shlemiel());
18 }
19
20 String shlemiel() {
21 String s0 = new String("0");
22 String s1 = new String("1");
23 String s2 = new String("2");
24 String s3 = new String("3");
25 String s4 = new String("4");
26 String s5 = new String("5");
27 String s6 = new String("6");
28 String s7 = new String("7");
29 String s8 = new String("8");
30 String s9 = new String("9");
31 String s10 = new String("10");
32 String s11 = new String("11");
33 String s12 = new String("12");
34 String s13 = new String("13");
35 String s14 = new String("14");
36 String s15 = new String("15");
37 String s16 = new String("16");
38 String s17 = new String("17");
39 String s18 = new String("18");
40 String s19 = new String("19");
41 String s20 = new String("20");
42 String s = new String();
43 s += s0;
44 s += s1;
45 s += s2;
46 s += s3;
47 s += s4;
48 s += s5;
49 s += s6;
50 s += s7;
51 s += s8;
52 s += s9;
53 s += s10;
54 s += s11;
55 s += s12;
56 s += s13;
57 s += s14;
58 s += s15;
59 s += s16;
60 s += s17;
61 s += s18;
62 s += s19;
63 s += s20;
64
65 s += s6;
66 s += s5;
67 s += s2;
68 s += s3;
69
70 s10 = s + s10;
71 s10 += s20;
72
73 s20 += s10;
74 s = s17 + s20;
75
76 s4 = s18 = s19;
77 s += s4;
78 s += s18;
79 refmap(0);
80 return s;
81 }
82
83 native int refmap(int x);
84
85 static {
86 System.loadLibrary("arttest");
87 }
88
89 public static void main(String[] args) {
90 StackWalk st = new StackWalk();
91 st.f();
92 }
93}