-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.chasm
228 lines (228 loc) · 5.83 KB
/
example.chasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
(class 53 (final public super) chasm/Main null java/lang/Object ()
(source "Main.java" null)
(inner-class chasm/Server$Command chasm/Server Command (abstract interface public static))
(inner-class java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup (final public static))
(method (private) <init> "()V" null null
(code
(label L0)
(line 9 L0)
(aload 0)
(invokespecial java/lang/Object <init> "()V")
(label L1)
(line 10 L1)
(return)
(label L2)
(local this "Lchasm/Main;" null L0 L2 0)
(maxs 1 1)))
(method (public static) main "([Ljava/lang/String;)V" null (java/io/IOException)
(code
(label L0)
(line 13 L0)
(invokedynamic run "()Lchasm/Server$Command;"
(H invokestatic java/lang/invoke/LambdaMetafactory metafactory
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;" false)
((T "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V")
(H invokestatic chasm/Main run
"(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V" false)
(T "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V")))
(aload 0)
(invokestatic chasm/Server main "(Lchasm/Server$Command;[Ljava/lang/String;)V")
(label L1)
(line 14 L1)
(return)
(label L2)
(local args "[Ljava/lang/String;" null L0 L2 0)
(maxs 2 1)))
(method (private static) run "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V" null null
(code
(try-catch L0 L1 L2 "java/io/IOException")
(label L3)
(line 17 L3)
(iconst_0)
(istore 3)
(label L4)
(iconst_0)
(istore 4)
(label L5)
(line 18 L5)
(frame append (I I) ())
(iload 4)
(aload 1)
(arraylength)
(if_icmpge L6)
(label L7)
(line 19 L7)
(aload 1)
(iload 4)
(aaload)
(ldc "-f")
(invokevirtual java/lang/String equals "(Ljava/lang/Object;)Z")
(ifeq L8)
(label L9)
(line 20 L9)
(iload 3)
(iconst_1)
(ior)
(istore 3)
(goto L10)
(label L8)
(line 21 L8)
(frame same () ())
(aload 1)
(iload 4)
(aaload)
(ldc "-m")
(invokevirtual java/lang/String equals "(Ljava/lang/Object;)Z")
(ifeq L11)
(label L12)
(line 22 L12)
(iload 3)
(iconst_2)
(ior)
(istore 3)
(goto L10)
(label L11)
(line 23 L11)
(frame same () ())
(aload 1)
(iload 4)
(aaload)
(ldc "-va")
(invokevirtual java/lang/String equals "(Ljava/lang/Object;)Z")
(ifeq L13)
(label L14)
(line 24 L14)
(iload 3)
(iconst_4)
(ior)
(istore 3)
(goto L10)
(label L13)
(line 25 L13)
(frame same () ())
(aload 1)
(iload 4)
(aaload)
(ldc "-vn")
(invokevirtual java/lang/String equals "(Ljava/lang/Object;)Z")
(ifeq L15)
(label L16)
(line 26 L16)
(iload 3)
(bipush 8)
(ior)
(istore 3)
(goto L10)
(label L15)
(line 27 L15)
(frame same () ())
(aload 1)
(iload 4)
(aaload)
(ldc "-")
(invokevirtual java/lang/String startsWith "(Ljava/lang/String;)Z")
(ifeq L6)
(label L17)
(line 28 L17)
(new java/lang/IllegalArgumentException)
(dup)
(aload 1)
(iload 4)
(aaload)
(invokespecial java/lang/IllegalArgumentException <init> "(Ljava/lang/String;)V")
(athrow)
(label L10)
(line 31 L10)
(frame same () ())
(iinc 4 1)
(goto L5)
(label L6)
(line 34 L6)
(frame same () ())
(iload 4)
(iconst_1)
(iadd)
(aload 1)
(arraylength)
(if_icmpeq L0)
(iload 4)
(iconst_2)
(iadd)
(aload 1)
(arraylength)
(if_icmpeq L0)
(label L18)
(line 35 L18)
(new java/lang/IllegalArgumentException)
(dup)
(ldc "Usage: chasm [-f|-m|-va|-vn] input [output]")
(invokespecial java/lang/IllegalArgumentException <init> "(Ljava/lang/String;)V")
(athrow)
(label L0)
(line 38 L0)
(frame same () ())
(new chasm/Pipeline)
(dup)
(iload 3)
(aload 2)
(invokespecial chasm/Pipeline <init> "(ILjava/io/PrintStream;)V")
(aload 0)
(aload 1)
(iload 4)
(aaload)
(iconst_0)
(anewarray java/lang/String)
(invokestatic java/nio/file/Paths get "(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;")
(invokeinterface java/nio/file/Path resolve "(Ljava/nio/file/Path;)Ljava/nio/file/Path;")
(label L19)
(line 39 L19)
(aload 1)
(arraylength)
(iload 4)
(iconst_2)
(iadd)
(if_icmpne L20)
(aload 0)
(aload 1)
(iload 4)
(iconst_1)
(iadd)
(aaload)
(iconst_0)
(anewarray java/lang/String)
(invokestatic java/nio/file/Paths get "(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;")
(invokeinterface java/nio/file/Path resolve "(Ljava/nio/file/Path;)Ljava/nio/file/Path;")
(goto L21)
(label L20)
(frame full ("java/nio/file/Path" "[Ljava/lang/String;" "java/io/PrintStream" I I) ("chasm/Pipeline" "java/nio/file/Path"))
(aconst_null)
(label L21)
(line 38 L21)
(frame full ("java/nio/file/Path" "[Ljava/lang/String;" "java/io/PrintStream" I I) ("chasm/Pipeline" "java/nio/file/Path" "java/nio/file/Path"))
(invokevirtual chasm/Pipeline process "(Ljava/nio/file/Path;Ljava/nio/file/Path;)V")
(label L1)
(line 42 L1)
(goto L22)
(label L2)
(line 40 L2)
(frame same1 () ("java/io/IOException"))
(astore 5)
(label L23)
(line 41 L23)
(new java/lang/RuntimeException)
(dup)
(aload 5)
(invokespecial java/lang/RuntimeException <init> "(Ljava/lang/Throwable;)V")
(athrow)
(label L22)
(line 43 L22)
(frame same () ())
(return)
(label L24)
(local e "Ljava/io/IOException;" null L23 L22 5)
(local cwd "Ljava/nio/file/Path;" null L3 L24 0)
(local args "[Ljava/lang/String;" null L3 L24 1)
(local out "Ljava/io/PrintStream;" null L3 L24 2)
(local flags "I" null L4 L24 3)
(local i "I" null L5 L24 4)
(maxs 6 6))))