1 | $use Access Apply Arithm Box Class Compare Convert File JavaMangle List StdIO Table Java; |
---|
2 | |
---|
3 | $use "org.refal.plus.compiler.rfpc"; |
---|
4 | $use "org.refal.plus.compiler.rfp_helper"; |
---|
5 | $use "org.refal.plus.compiler.rfp_vars"; |
---|
6 | $use "org.refal.plus.compiler.NativeJava"; |
---|
7 | |
---|
8 | //$use "org.refal.plus.wrappers.org.objectweb.asm.AnnotationVisitor"; |
---|
9 | //$use "org.refal.plus.wrappers.org.objectweb.asm.ClassWriter"; |
---|
10 | //$use "org.refal.plus.wrappers.org.objectweb.asm.FieldVisitor"; |
---|
11 | //$use "org.refal.plus.wrappers.org.objectweb.asm.Label"; |
---|
12 | //$use "org.refal.plus.wrappers.org.objectweb.asm.MethodVisitor"; |
---|
13 | //$use "org.refal.plus.wrappers.org.objectweb.asm.Opcodes"; |
---|
14 | |
---|
15 | // Begin NATIVE |
---|
16 | $func Integer s = s; |
---|
17 | $native Integer = "java.lang.Integer (int)"; |
---|
18 | |
---|
19 | $func "IIAVvisit" s s s = ; |
---|
20 | $native "IIAVvisit" = "void org.objectweb.asm.AnnotationVisitor.visit (java.lang.String, java.lang.Object)"; |
---|
21 | |
---|
22 | $func "IIAVvisitEnd" s = ; |
---|
23 | $native "IIAVvisitEnd" = "void org.objectweb.asm.AnnotationVisitor.visitEnd ()"; |
---|
24 | |
---|
25 | $func "ClassWriter" s = s; |
---|
26 | $native "ClassWriter" = "org.objectweb.asm.ClassWriter (int)"; |
---|
27 | |
---|
28 | $func "CWvisit" s s s s s s (e) = ; |
---|
29 | $native "CWvisit" = "void org.objectweb.asm.ClassWriter.visit (int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])"; |
---|
30 | |
---|
31 | $func "CWvisitSource" s s s = ; |
---|
32 | $native "CWvisitSource" = "void org.objectweb.asm.ClassWriter.visitSource (java.lang.String, java.lang.String)"; |
---|
33 | |
---|
34 | //$func "CWvisitOuterClass" s s s s = ; |
---|
35 | //$native "CWvisitOuterClass" = "void org.objectweb.asm.ClassWriter.visitOuterClass (java.lang.String, java.lang.String, java.lang.String)"; |
---|
36 | // |
---|
37 | //$func "CWvisitInnerClass" s s s s s = ; |
---|
38 | //$native "CWvisitInnerClass" = "void org.objectweb.asm.ClassWriter.visitInnerClass (java.lang.String, java.lang.String, java.lang.String, int)"; |
---|
39 | |
---|
40 | $func "CWvisitField" s s s s s s = s; |
---|
41 | $native "CWvisitField" = "org.objectweb.asm.FieldVisitor org.objectweb.asm.ClassWriter.visitField (int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)"; |
---|
42 | |
---|
43 | $func "CWvisitMethod" s s s s s (e) = s; |
---|
44 | $native "CWvisitMethod" = "org.objectweb.asm.MethodVisitor org.objectweb.asm.ClassWriter.visitMethod (int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])"; |
---|
45 | |
---|
46 | $func "CWvisitEnd" s = ; |
---|
47 | $native "CWvisitEnd" = "void org.objectweb.asm.ClassWriter.visitEnd ()"; |
---|
48 | |
---|
49 | $func "CWtoByteArray" s = s; |
---|
50 | $native "CWtoByteArray" = "byte[] org.objectweb.asm.ClassWriter.toByteArray ()"; |
---|
51 | |
---|
52 | $func IIFVvisitAnnotation s s s = s; |
---|
53 | $native IIFVvisitAnnotation = "org.objectweb.asm.AnnotationVisitor org.objectweb.asm.FieldVisitor.visitAnnotation (java.lang.String, boolean)"; |
---|
54 | |
---|
55 | $func IIFVvisitEnd s = ; |
---|
56 | $native IIFVvisitEnd = "void org.objectweb.asm.FieldVisitor.visitEnd ()"; |
---|
57 | |
---|
58 | $func "Label" = s; |
---|
59 | $native "Label" = "org.objectweb.asm.Label ()"; |
---|
60 | |
---|
61 | $func "IIMVvisitAnnotation" s s s = s; |
---|
62 | $native "IIMVvisitAnnotation" = "org.objectweb.asm.AnnotationVisitor org.objectweb.asm.MethodVisitor.visitAnnotation (java.lang.String, boolean)"; |
---|
63 | |
---|
64 | $func "IIMVvisitCode" s = ; |
---|
65 | $native "IIMVvisitCode" = "void org.objectweb.asm.MethodVisitor.visitCode ()"; |
---|
66 | |
---|
67 | $func "IIMVvisitFrame" s s s (e) s (e) = ; |
---|
68 | $native "IIMVvisitFrame" = "void org.objectweb.asm.MethodVisitor.visitFrame (int, int, java.lang.Object[], int, java.lang.Object[])"; |
---|
69 | |
---|
70 | $func "IIMVvisitInsn" s s = ; |
---|
71 | $native "IIMVvisitInsn" = "void org.objectweb.asm.MethodVisitor.visitInsn (int)"; |
---|
72 | |
---|
73 | $func "IIMVvisitIntInsn" s s s = ; |
---|
74 | $native "IIMVvisitIntInsn" = "void org.objectweb.asm.MethodVisitor.visitIntInsn (int, int)"; |
---|
75 | |
---|
76 | $func "IIMVvisitVarInsn" s s s = ; |
---|
77 | $native "IIMVvisitVarInsn" = "void org.objectweb.asm.MethodVisitor.visitVarInsn (int, int)"; |
---|
78 | |
---|
79 | $func "IIMVvisitTypeInsn" s s s = ; |
---|
80 | $native "IIMVvisitTypeInsn" = "void org.objectweb.asm.MethodVisitor.visitTypeInsn (int, java.lang.String)"; |
---|
81 | |
---|
82 | $func "IIMVvisitFieldInsn" s s s s s = ; |
---|
83 | $native "IIMVvisitFieldInsn" = "void org.objectweb.asm.MethodVisitor.visitFieldInsn (int, java.lang.String, java.lang.String, java.lang.String)"; |
---|
84 | |
---|
85 | $func "IIMVvisitMethodInsn" s s s s s = ; |
---|
86 | $native "IIMVvisitMethodInsn" = "void org.objectweb.asm.MethodVisitor.visitMethodInsn (int, java.lang.String, java.lang.String, java.lang.String)"; |
---|
87 | |
---|
88 | $func "IIMVvisitJumpInsn" s s s = ; |
---|
89 | $native "IIMVvisitJumpInsn" = "void org.objectweb.asm.MethodVisitor.visitJumpInsn (int, org.objectweb.asm.Label)"; |
---|
90 | |
---|
91 | $func "IIMVvisitLabel" s s = ; |
---|
92 | $native "IIMVvisitLabel" = "void org.objectweb.asm.MethodVisitor.visitLabel (org.objectweb.asm.Label)"; |
---|
93 | |
---|
94 | $func "IIMVvisitLdcInsn" s s = ; |
---|
95 | $native "IIMVvisitLdcInsn" = "void org.objectweb.asm.MethodVisitor.visitLdcInsn (java.lang.Object)"; |
---|
96 | |
---|
97 | $func "IIMVvisitIincInsn" s s s = ; |
---|
98 | $native "IIMVvisitIincInsn" = "void org.objectweb.asm.MethodVisitor.visitIincInsn (int, int)"; |
---|
99 | |
---|
100 | $func "IIMVvisitTryCatchBlock" s s s s s = ; |
---|
101 | $native "IIMVvisitTryCatchBlock" = "void org.objectweb.asm.MethodVisitor.visitTryCatchBlock (org.objectweb.asm.Label, org.objectweb.asm.Label, org.objectweb.asm.Label, java.lang.String)"; |
---|
102 | |
---|
103 | $func "IIMVvisitLocalVariable" s s s s s s s = ; |
---|
104 | $native "IIMVvisitLocalVariable" = "void org.objectweb.asm.MethodVisitor.visitLocalVariable (java.lang.String, java.lang.String, java.lang.String, org.objectweb.asm.Label, org.objectweb.asm.Label, int)"; |
---|
105 | |
---|
106 | $func "IIMVvisitLineNumber" s s s = ; |
---|
107 | $native "IIMVvisitLineNumber" = "void org.objectweb.asm.MethodVisitor.visitLineNumber (int, org.objectweb.asm.Label)"; |
---|
108 | |
---|
109 | $func "IIMVvisitMaxs" s s s = ; |
---|
110 | $native "IIMVvisitMaxs" = "void org.objectweb.asm.MethodVisitor.visitMaxs (int, int)"; |
---|
111 | |
---|
112 | $func "IIMVvisitEnd" s = ; |
---|
113 | $native "IIMVvisitEnd" = "void org.objectweb.asm.MethodVisitor.visitEnd ()"; |
---|
114 | |
---|
115 | |
---|
116 | $func COMPUTE_MAXS = s; |
---|
117 | $native COMPUTE_MAXS = "static int org.objectweb.asm.ClassWriter.COMPUTE_MAXS"; |
---|
118 | |
---|
119 | $func V1_5 = s; |
---|
120 | $native V1_5 = "static int org.objectweb.asm.Opcodes.V1_5"; |
---|
121 | |
---|
122 | $func ACC_PUBLIC = s; |
---|
123 | $native ACC_PUBLIC = "static int org.objectweb.asm.Opcodes.ACC_PUBLIC"; |
---|
124 | |
---|
125 | $func ACC_PRIVATE = s; |
---|
126 | $native ACC_PRIVATE = "static int org.objectweb.asm.Opcodes.ACC_PRIVATE"; |
---|
127 | |
---|
128 | $func ACC_PROTECTED = s; |
---|
129 | $native ACC_PROTECTED = "static int org.objectweb.asm.Opcodes.ACC_PROTECTED"; |
---|
130 | |
---|
131 | $func ACC_STATIC = s; |
---|
132 | $native ACC_STATIC = "static int org.objectweb.asm.Opcodes.ACC_STATIC"; |
---|
133 | |
---|
134 | $func ACC_FINAL = s; |
---|
135 | $native ACC_FINAL = "static int org.objectweb.asm.Opcodes.ACC_FINAL"; |
---|
136 | |
---|
137 | $func ACC_SUPER = s; |
---|
138 | $native ACC_SUPER = "static int org.objectweb.asm.Opcodes.ACC_SUPER"; |
---|
139 | |
---|
140 | $func ACC_SYNCHRONIZED = s; |
---|
141 | $native ACC_SYNCHRONIZED = "static int org.objectweb.asm.Opcodes.ACC_SYNCHRONIZED"; |
---|
142 | |
---|
143 | $func ACC_VOLATILE = s; |
---|
144 | $native ACC_VOLATILE = "static int org.objectweb.asm.Opcodes.ACC_VOLATILE"; |
---|
145 | |
---|
146 | $func ACC_BRIDGE = s; |
---|
147 | $native ACC_BRIDGE = "static int org.objectweb.asm.Opcodes.ACC_BRIDGE"; |
---|
148 | |
---|
149 | $func ACC_VARARGS = s; |
---|
150 | $native ACC_VARARGS = "static int org.objectweb.asm.Opcodes.ACC_VARARGS"; |
---|
151 | |
---|
152 | $func ACC_TRANSIENT = s; |
---|
153 | $native ACC_TRANSIENT = "static int org.objectweb.asm.Opcodes.ACC_TRANSIENT"; |
---|
154 | |
---|
155 | $func ACC_NATIVE = s; |
---|
156 | $native ACC_NATIVE = "static int org.objectweb.asm.Opcodes.ACC_NATIVE"; |
---|
157 | |
---|
158 | $func ACC_INTERFACE = s; |
---|
159 | $native ACC_INTERFACE = "static int org.objectweb.asm.Opcodes.ACC_INTERFACE"; |
---|
160 | |
---|
161 | $func ACC_ABSTRACT = s; |
---|
162 | $native ACC_ABSTRACT = "static int org.objectweb.asm.Opcodes.ACC_ABSTRACT"; |
---|
163 | |
---|
164 | $func ACC_STRICT = s; |
---|
165 | $native ACC_STRICT = "static int org.objectweb.asm.Opcodes.ACC_STRICT"; |
---|
166 | |
---|
167 | $func ACC_SYNTHETIC = s; |
---|
168 | $native ACC_SYNTHETIC = "static int org.objectweb.asm.Opcodes.ACC_SYNTHETIC"; |
---|
169 | |
---|
170 | $func ACC_ANNOTATION = s; |
---|
171 | $native ACC_ANNOTATION = "static int org.objectweb.asm.Opcodes.ACC_ANNOTATION"; |
---|
172 | |
---|
173 | $func ACC_ENUM = s; |
---|
174 | $native ACC_ENUM = "static int org.objectweb.asm.Opcodes.ACC_ENUM"; |
---|
175 | |
---|
176 | $func ACC_DEPRECATED = s; |
---|
177 | $native ACC_DEPRECATED = "static int org.objectweb.asm.Opcodes.ACC_DEPRECATED"; |
---|
178 | |
---|
179 | $func T_BOOLEAN = s; |
---|
180 | $native T_BOOLEAN = "static int org.objectweb.asm.Opcodes.T_BOOLEAN"; |
---|
181 | |
---|
182 | $func T_CHAR = s; |
---|
183 | $native T_CHAR = "static int org.objectweb.asm.Opcodes.T_CHAR"; |
---|
184 | |
---|
185 | $func T_FLOAT = s; |
---|
186 | $native T_FLOAT = "static int org.objectweb.asm.Opcodes.T_FLOAT"; |
---|
187 | |
---|
188 | $func T_DOUBLE = s; |
---|
189 | $native T_DOUBLE = "static int org.objectweb.asm.Opcodes.T_DOUBLE"; |
---|
190 | |
---|
191 | $func T_BYTE = s; |
---|
192 | $native T_BYTE = "static int org.objectweb.asm.Opcodes.T_BYTE"; |
---|
193 | |
---|
194 | $func T_SHORT = s; |
---|
195 | $native T_SHORT = "static int org.objectweb.asm.Opcodes.T_SHORT"; |
---|
196 | |
---|
197 | $func T_INT = s; |
---|
198 | $native T_INT = "static int org.objectweb.asm.Opcodes.T_INT"; |
---|
199 | |
---|
200 | $func T_LONG = s; |
---|
201 | $native T_LONG = "static int org.objectweb.asm.Opcodes.T_LONG"; |
---|
202 | |
---|
203 | $func F_NEW = s; |
---|
204 | $native F_NEW = "static int org.objectweb.asm.Opcodes.F_NEW"; |
---|
205 | |
---|
206 | $func F_FULL = s; |
---|
207 | $native F_FULL = "static int org.objectweb.asm.Opcodes.F_FULL"; |
---|
208 | |
---|
209 | $func F_APPEND = s; |
---|
210 | $native F_APPEND = "static int org.objectweb.asm.Opcodes.F_APPEND"; |
---|
211 | |
---|
212 | $func F_CHOP = s; |
---|
213 | $native F_CHOP = "static int org.objectweb.asm.Opcodes.F_CHOP"; |
---|
214 | |
---|
215 | $func F_SAME = s; |
---|
216 | $native F_SAME = "static int org.objectweb.asm.Opcodes.F_SAME"; |
---|
217 | |
---|
218 | $func F_SAME1 = s; |
---|
219 | $native F_SAME1 = "static int org.objectweb.asm.Opcodes.F_SAME1"; |
---|
220 | |
---|
221 | $func NOP = s; |
---|
222 | $native NOP = "static int org.objectweb.asm.Opcodes.NOP"; |
---|
223 | |
---|
224 | $func ACONST_NULL = s; |
---|
225 | $native ACONST_NULL = "static int org.objectweb.asm.Opcodes.ACONST_NULL"; |
---|
226 | |
---|
227 | $func ICONST_M1 = s; |
---|
228 | $native ICONST_M1 = "static int org.objectweb.asm.Opcodes.ICONST_M1"; |
---|
229 | |
---|
230 | $func ICONST_0 = s; |
---|
231 | $native ICONST_0 = "static int org.objectweb.asm.Opcodes.ICONST_0"; |
---|
232 | |
---|
233 | $func ICONST_1 = s; |
---|
234 | $native ICONST_1 = "static int org.objectweb.asm.Opcodes.ICONST_1"; |
---|
235 | |
---|
236 | $func ICONST_2 = s; |
---|
237 | $native ICONST_2 = "static int org.objectweb.asm.Opcodes.ICONST_2"; |
---|
238 | |
---|
239 | $func ICONST_3 = s; |
---|
240 | $native ICONST_3 = "static int org.objectweb.asm.Opcodes.ICONST_3"; |
---|
241 | |
---|
242 | $func ICONST_4 = s; |
---|
243 | $native ICONST_4 = "static int org.objectweb.asm.Opcodes.ICONST_4"; |
---|
244 | |
---|
245 | $func ICONST_5 = s; |
---|
246 | $native ICONST_5 = "static int org.objectweb.asm.Opcodes.ICONST_5"; |
---|
247 | |
---|
248 | $func LCONST_0 = s; |
---|
249 | $native LCONST_0 = "static int org.objectweb.asm.Opcodes.LCONST_0"; |
---|
250 | |
---|
251 | $func LCONST_1 = s; |
---|
252 | $native LCONST_1 = "static int org.objectweb.asm.Opcodes.LCONST_1"; |
---|
253 | |
---|
254 | $func FCONST_0 = s; |
---|
255 | $native FCONST_0 = "static int org.objectweb.asm.Opcodes.FCONST_0"; |
---|
256 | |
---|
257 | $func FCONST_1 = s; |
---|
258 | $native FCONST_1 = "static int org.objectweb.asm.Opcodes.FCONST_1"; |
---|
259 | |
---|
260 | $func FCONST_2 = s; |
---|
261 | $native FCONST_2 = "static int org.objectweb.asm.Opcodes.FCONST_2"; |
---|
262 | |
---|
263 | $func DCONST_0 = s; |
---|
264 | $native DCONST_0 = "static int org.objectweb.asm.Opcodes.DCONST_0"; |
---|
265 | |
---|
266 | $func DCONST_1 = s; |
---|
267 | $native DCONST_1 = "static int org.objectweb.asm.Opcodes.DCONST_1"; |
---|
268 | |
---|
269 | $func BIPUSH = s; |
---|
270 | $native BIPUSH = "static int org.objectweb.asm.Opcodes.BIPUSH"; |
---|
271 | |
---|
272 | $func SIPUSH = s; |
---|
273 | $native SIPUSH = "static int org.objectweb.asm.Opcodes.SIPUSH"; |
---|
274 | |
---|
275 | $func LDC = s; |
---|
276 | $native LDC = "static int org.objectweb.asm.Opcodes.LDC"; |
---|
277 | |
---|
278 | $func ILOAD = s; |
---|
279 | $native ILOAD = "static int org.objectweb.asm.Opcodes.ILOAD"; |
---|
280 | |
---|
281 | $func LLOAD = s; |
---|
282 | $native LLOAD = "static int org.objectweb.asm.Opcodes.LLOAD"; |
---|
283 | |
---|
284 | $func FLOAD = s; |
---|
285 | $native FLOAD = "static int org.objectweb.asm.Opcodes.FLOAD"; |
---|
286 | |
---|
287 | $func DLOAD = s; |
---|
288 | $native DLOAD = "static int org.objectweb.asm.Opcodes.DLOAD"; |
---|
289 | |
---|
290 | $func ALOAD = s; |
---|
291 | $native ALOAD = "static int org.objectweb.asm.Opcodes.ALOAD"; |
---|
292 | |
---|
293 | $func IALOAD = s; |
---|
294 | $native IALOAD = "static int org.objectweb.asm.Opcodes.IALOAD"; |
---|
295 | |
---|
296 | $func LALOAD = s; |
---|
297 | $native LALOAD = "static int org.objectweb.asm.Opcodes.LALOAD"; |
---|
298 | |
---|
299 | $func FALOAD = s; |
---|
300 | $native FALOAD = "static int org.objectweb.asm.Opcodes.FALOAD"; |
---|
301 | |
---|
302 | $func DALOAD = s; |
---|
303 | $native DALOAD = "static int org.objectweb.asm.Opcodes.DALOAD"; |
---|
304 | |
---|
305 | $func AALOAD = s; |
---|
306 | $native AALOAD = "static int org.objectweb.asm.Opcodes.AALOAD"; |
---|
307 | |
---|
308 | $func BALOAD = s; |
---|
309 | $native BALOAD = "static int org.objectweb.asm.Opcodes.BALOAD"; |
---|
310 | |
---|
311 | $func CALOAD = s; |
---|
312 | $native CALOAD = "static int org.objectweb.asm.Opcodes.CALOAD"; |
---|
313 | |
---|
314 | $func SALOAD = s; |
---|
315 | $native SALOAD = "static int org.objectweb.asm.Opcodes.SALOAD"; |
---|
316 | |
---|
317 | $func ISTORE = s; |
---|
318 | $native ISTORE = "static int org.objectweb.asm.Opcodes.ISTORE"; |
---|
319 | |
---|
320 | $func LSTORE = s; |
---|
321 | $native LSTORE = "static int org.objectweb.asm.Opcodes.LSTORE"; |
---|
322 | |
---|
323 | $func FSTORE = s; |
---|
324 | $native FSTORE = "static int org.objectweb.asm.Opcodes.FSTORE"; |
---|
325 | |
---|
326 | $func DSTORE = s; |
---|
327 | $native DSTORE = "static int org.objectweb.asm.Opcodes.DSTORE"; |
---|
328 | |
---|
329 | $func ASTORE = s; |
---|
330 | $native ASTORE = "static int org.objectweb.asm.Opcodes.ASTORE"; |
---|
331 | |
---|
332 | $func IASTORE = s; |
---|
333 | $native IASTORE = "static int org.objectweb.asm.Opcodes.IASTORE"; |
---|
334 | |
---|
335 | $func LASTORE = s; |
---|
336 | $native LASTORE = "static int org.objectweb.asm.Opcodes.LASTORE"; |
---|
337 | |
---|
338 | $func FASTORE = s; |
---|
339 | $native FASTORE = "static int org.objectweb.asm.Opcodes.FASTORE"; |
---|
340 | |
---|
341 | $func DASTORE = s; |
---|
342 | $native DASTORE = "static int org.objectweb.asm.Opcodes.DASTORE"; |
---|
343 | |
---|
344 | $func AASTORE = s; |
---|
345 | $native AASTORE = "static int org.objectweb.asm.Opcodes.AASTORE"; |
---|
346 | |
---|
347 | $func BASTORE = s; |
---|
348 | $native BASTORE = "static int org.objectweb.asm.Opcodes.BASTORE"; |
---|
349 | |
---|
350 | $func CASTORE = s; |
---|
351 | $native CASTORE = "static int org.objectweb.asm.Opcodes.CASTORE"; |
---|
352 | |
---|
353 | $func SASTORE = s; |
---|
354 | $native SASTORE = "static int org.objectweb.asm.Opcodes.SASTORE"; |
---|
355 | |
---|
356 | $func POP = s; |
---|
357 | $native POP = "static int org.objectweb.asm.Opcodes.POP"; |
---|
358 | |
---|
359 | $func POP2 = s; |
---|
360 | $native POP2 = "static int org.objectweb.asm.Opcodes.POP2"; |
---|
361 | |
---|
362 | $func DUP = s; |
---|
363 | $native DUP = "static int org.objectweb.asm.Opcodes.DUP"; |
---|
364 | |
---|
365 | $func DUP_X1 = s; |
---|
366 | $native DUP_X1 = "static int org.objectweb.asm.Opcodes.DUP_X1"; |
---|
367 | |
---|
368 | $func DUP_X2 = s; |
---|
369 | $native DUP_X2 = "static int org.objectweb.asm.Opcodes.DUP_X2"; |
---|
370 | |
---|
371 | $func DUP2 = s; |
---|
372 | $native DUP2 = "static int org.objectweb.asm.Opcodes.DUP2"; |
---|
373 | |
---|
374 | $func DUP2_X1 = s; |
---|
375 | $native DUP2_X1 = "static int org.objectweb.asm.Opcodes.DUP2_X1"; |
---|
376 | |
---|
377 | $func DUP2_X2 = s; |
---|
378 | $native DUP2_X2 = "static int org.objectweb.asm.Opcodes.DUP2_X2"; |
---|
379 | |
---|
380 | $func SWAP = s; |
---|
381 | $native SWAP = "static int org.objectweb.asm.Opcodes.SWAP"; |
---|
382 | |
---|
383 | $func IADD = s; |
---|
384 | $native IADD = "static int org.objectweb.asm.Opcodes.IADD"; |
---|
385 | |
---|
386 | $func LADD = s; |
---|
387 | $native LADD = "static int org.objectweb.asm.Opcodes.LADD"; |
---|
388 | |
---|
389 | $func FADD = s; |
---|
390 | $native FADD = "static int org.objectweb.asm.Opcodes.FADD"; |
---|
391 | |
---|
392 | $func DADD = s; |
---|
393 | $native DADD = "static int org.objectweb.asm.Opcodes.DADD"; |
---|
394 | |
---|
395 | $func ISUB = s; |
---|
396 | $native ISUB = "static int org.objectweb.asm.Opcodes.ISUB"; |
---|
397 | |
---|
398 | $func LSUB = s; |
---|
399 | $native LSUB = "static int org.objectweb.asm.Opcodes.LSUB"; |
---|
400 | |
---|
401 | $func FSUB = s; |
---|
402 | $native FSUB = "static int org.objectweb.asm.Opcodes.FSUB"; |
---|
403 | |
---|
404 | $func DSUB = s; |
---|
405 | $native DSUB = "static int org.objectweb.asm.Opcodes.DSUB"; |
---|
406 | |
---|
407 | $func IMUL = s; |
---|
408 | $native IMUL = "static int org.objectweb.asm.Opcodes.IMUL"; |
---|
409 | |
---|
410 | $func LMUL = s; |
---|
411 | $native LMUL = "static int org.objectweb.asm.Opcodes.LMUL"; |
---|
412 | |
---|
413 | $func FMUL = s; |
---|
414 | $native FMUL = "static int org.objectweb.asm.Opcodes.FMUL"; |
---|
415 | |
---|
416 | $func DMUL = s; |
---|
417 | $native DMUL = "static int org.objectweb.asm.Opcodes.DMUL"; |
---|
418 | |
---|
419 | $func IDIV = s; |
---|
420 | $native IDIV = "static int org.objectweb.asm.Opcodes.IDIV"; |
---|
421 | |
---|
422 | $func LDIV = s; |
---|
423 | $native LDIV = "static int org.objectweb.asm.Opcodes.LDIV"; |
---|
424 | |
---|
425 | $func FDIV = s; |
---|
426 | $native FDIV = "static int org.objectweb.asm.Opcodes.FDIV"; |
---|
427 | |
---|
428 | $func DDIV = s; |
---|
429 | $native DDIV = "static int org.objectweb.asm.Opcodes.DDIV"; |
---|
430 | |
---|
431 | $func IREM = s; |
---|
432 | $native IREM = "static int org.objectweb.asm.Opcodes.IREM"; |
---|
433 | |
---|
434 | $func LREM = s; |
---|
435 | $native LREM = "static int org.objectweb.asm.Opcodes.LREM"; |
---|
436 | |
---|
437 | $func FREM = s; |
---|
438 | $native FREM = "static int org.objectweb.asm.Opcodes.FREM"; |
---|
439 | |
---|
440 | $func DREM = s; |
---|
441 | $native DREM = "static int org.objectweb.asm.Opcodes.DREM"; |
---|
442 | |
---|
443 | $func INEG = s; |
---|
444 | $native INEG = "static int org.objectweb.asm.Opcodes.INEG"; |
---|
445 | |
---|
446 | $func LNEG = s; |
---|
447 | $native LNEG = "static int org.objectweb.asm.Opcodes.LNEG"; |
---|
448 | |
---|
449 | $func FNEG = s; |
---|
450 | $native FNEG = "static int org.objectweb.asm.Opcodes.FNEG"; |
---|
451 | |
---|
452 | $func DNEG = s; |
---|
453 | $native DNEG = "static int org.objectweb.asm.Opcodes.DNEG"; |
---|
454 | |
---|
455 | $func ISHL = s; |
---|
456 | $native ISHL = "static int org.objectweb.asm.Opcodes.ISHL"; |
---|
457 | |
---|
458 | $func LSHL = s; |
---|
459 | $native LSHL = "static int org.objectweb.asm.Opcodes.LSHL"; |
---|
460 | |
---|
461 | $func ISHR = s; |
---|
462 | $native ISHR = "static int org.objectweb.asm.Opcodes.ISHR"; |
---|
463 | |
---|
464 | $func LSHR = s; |
---|
465 | $native LSHR = "static int org.objectweb.asm.Opcodes.LSHR"; |
---|
466 | |
---|
467 | $func IUSHR = s; |
---|
468 | $native IUSHR = "static int org.objectweb.asm.Opcodes.IUSHR"; |
---|
469 | |
---|
470 | $func LUSHR = s; |
---|
471 | $native LUSHR = "static int org.objectweb.asm.Opcodes.LUSHR"; |
---|
472 | |
---|
473 | $func IAND = s; |
---|
474 | $native IAND = "static int org.objectweb.asm.Opcodes.IAND"; |
---|
475 | |
---|
476 | $func LAND = s; |
---|
477 | $native LAND = "static int org.objectweb.asm.Opcodes.LAND"; |
---|
478 | |
---|
479 | $func IOR = s; |
---|
480 | $native IOR = "static int org.objectweb.asm.Opcodes.IOR"; |
---|
481 | |
---|
482 | $func LOR = s; |
---|
483 | $native LOR = "static int org.objectweb.asm.Opcodes.LOR"; |
---|
484 | |
---|
485 | $func IXOR = s; |
---|
486 | $native IXOR = "static int org.objectweb.asm.Opcodes.IXOR"; |
---|
487 | |
---|
488 | $func LXOR = s; |
---|
489 | $native LXOR = "static int org.objectweb.asm.Opcodes.LXOR"; |
---|
490 | |
---|
491 | $func IINC = s; |
---|
492 | $native IINC = "static int org.objectweb.asm.Opcodes.IINC"; |
---|
493 | |
---|
494 | $func I2L = s; |
---|
495 | $native I2L = "static int org.objectweb.asm.Opcodes.I2L"; |
---|
496 | |
---|
497 | $func I2F = s; |
---|
498 | $native I2F = "static int org.objectweb.asm.Opcodes.I2F"; |
---|
499 | |
---|
500 | $func I2D = s; |
---|
501 | $native I2D = "static int org.objectweb.asm.Opcodes.I2D"; |
---|
502 | |
---|
503 | $func L2I = s; |
---|
504 | $native L2I = "static int org.objectweb.asm.Opcodes.L2I"; |
---|
505 | |
---|
506 | $func L2F = s; |
---|
507 | $native L2F = "static int org.objectweb.asm.Opcodes.L2F"; |
---|
508 | |
---|
509 | $func L2D = s; |
---|
510 | $native L2D = "static int org.objectweb.asm.Opcodes.L2D"; |
---|
511 | |
---|
512 | $func F2I = s; |
---|
513 | $native F2I = "static int org.objectweb.asm.Opcodes.F2I"; |
---|
514 | |
---|
515 | $func F2L = s; |
---|
516 | $native F2L = "static int org.objectweb.asm.Opcodes.F2L"; |
---|
517 | |
---|
518 | $func F2D = s; |
---|
519 | $native F2D = "static int org.objectweb.asm.Opcodes.F2D"; |
---|
520 | |
---|
521 | $func D2I = s; |
---|
522 | $native D2I = "static int org.objectweb.asm.Opcodes.D2I"; |
---|
523 | |
---|
524 | $func D2L = s; |
---|
525 | $native D2L = "static int org.objectweb.asm.Opcodes.D2L"; |
---|
526 | |
---|
527 | $func D2F = s; |
---|
528 | $native D2F = "static int org.objectweb.asm.Opcodes.D2F"; |
---|
529 | |
---|
530 | $func I2B = s; |
---|
531 | $native I2B = "static int org.objectweb.asm.Opcodes.I2B"; |
---|
532 | |
---|
533 | $func I2C = s; |
---|
534 | $native I2C = "static int org.objectweb.asm.Opcodes.I2C"; |
---|
535 | |
---|
536 | $func I2S = s; |
---|
537 | $native I2S = "static int org.objectweb.asm.Opcodes.I2S"; |
---|
538 | |
---|
539 | $func LCMP = s; |
---|
540 | $native LCMP = "static int org.objectweb.asm.Opcodes.LCMP"; |
---|
541 | |
---|
542 | $func FCMPL = s; |
---|
543 | $native FCMPL = "static int org.objectweb.asm.Opcodes.FCMPL"; |
---|
544 | |
---|
545 | $func FCMPG = s; |
---|
546 | $native FCMPG = "static int org.objectweb.asm.Opcodes.FCMPG"; |
---|
547 | |
---|
548 | $func DCMPL = s; |
---|
549 | $native DCMPL = "static int org.objectweb.asm.Opcodes.DCMPL"; |
---|
550 | |
---|
551 | $func DCMPG = s; |
---|
552 | $native DCMPG = "static int org.objectweb.asm.Opcodes.DCMPG"; |
---|
553 | |
---|
554 | $func IFEQ = s; |
---|
555 | $native IFEQ = "static int org.objectweb.asm.Opcodes.IFEQ"; |
---|
556 | |
---|
557 | $func IFNE = s; |
---|
558 | $native IFNE = "static int org.objectweb.asm.Opcodes.IFNE"; |
---|
559 | |
---|
560 | $func IFLT = s; |
---|
561 | $native IFLT = "static int org.objectweb.asm.Opcodes.IFLT"; |
---|
562 | |
---|
563 | $func IFGE = s; |
---|
564 | $native IFGE = "static int org.objectweb.asm.Opcodes.IFGE"; |
---|
565 | |
---|
566 | $func IFGT = s; |
---|
567 | $native IFGT = "static int org.objectweb.asm.Opcodes.IFGT"; |
---|
568 | |
---|
569 | $func IFLE = s; |
---|
570 | $native IFLE = "static int org.objectweb.asm.Opcodes.IFLE"; |
---|
571 | |
---|
572 | $func IF_ICMPEQ = s; |
---|
573 | $native IF_ICMPEQ = "static int org.objectweb.asm.Opcodes.IF_ICMPEQ"; |
---|
574 | |
---|
575 | $func IF_ICMPNE = s; |
---|
576 | $native IF_ICMPNE = "static int org.objectweb.asm.Opcodes.IF_ICMPNE"; |
---|
577 | |
---|
578 | $func IF_ICMPLT = s; |
---|
579 | $native IF_ICMPLT = "static int org.objectweb.asm.Opcodes.IF_ICMPLT"; |
---|
580 | |
---|
581 | $func IF_ICMPGE = s; |
---|
582 | $native IF_ICMPGE = "static int org.objectweb.asm.Opcodes.IF_ICMPGE"; |
---|
583 | |
---|
584 | $func IF_ICMPGT = s; |
---|
585 | $native IF_ICMPGT = "static int org.objectweb.asm.Opcodes.IF_ICMPGT"; |
---|
586 | |
---|
587 | $func IF_ICMPLE = s; |
---|
588 | $native IF_ICMPLE = "static int org.objectweb.asm.Opcodes.IF_ICMPLE"; |
---|
589 | |
---|
590 | $func IF_ACMPEQ = s; |
---|
591 | $native IF_ACMPEQ = "static int org.objectweb.asm.Opcodes.IF_ACMPEQ"; |
---|
592 | |
---|
593 | $func IF_ACMPNE = s; |
---|
594 | $native IF_ACMPNE = "static int org.objectweb.asm.Opcodes.IF_ACMPNE"; |
---|
595 | |
---|
596 | $func GOTO = s; |
---|
597 | $native GOTO = "static int org.objectweb.asm.Opcodes.GOTO"; |
---|
598 | |
---|
599 | $func JSR = s; |
---|
600 | $native JSR = "static int org.objectweb.asm.Opcodes.JSR"; |
---|
601 | |
---|
602 | $func RET = s; |
---|
603 | $native RET = "static int org.objectweb.asm.Opcodes.RET"; |
---|
604 | |
---|
605 | $func TABLESWITCH = s; |
---|
606 | $native TABLESWITCH = "static int org.objectweb.asm.Opcodes.TABLESWITCH"; |
---|
607 | |
---|
608 | $func LOOKUPSWITCH = s; |
---|
609 | $native LOOKUPSWITCH = "static int org.objectweb.asm.Opcodes.LOOKUPSWITCH"; |
---|
610 | |
---|
611 | $func IRETURN = s; |
---|
612 | $native IRETURN = "static int org.objectweb.asm.Opcodes.IRETURN"; |
---|
613 | |
---|
614 | $func LRETURN = s; |
---|
615 | $native LRETURN = "static int org.objectweb.asm.Opcodes.LRETURN"; |
---|
616 | |
---|
617 | $func FRETURN = s; |
---|
618 | $native FRETURN = "static int org.objectweb.asm.Opcodes.FRETURN"; |
---|
619 | |
---|
620 | $func DRETURN = s; |
---|
621 | $native DRETURN = "static int org.objectweb.asm.Opcodes.DRETURN"; |
---|
622 | |
---|
623 | $func ARETURN = s; |
---|
624 | $native ARETURN = "static int org.objectweb.asm.Opcodes.ARETURN"; |
---|
625 | |
---|
626 | $func RETURN = s; |
---|
627 | $native RETURN = "static int org.objectweb.asm.Opcodes.RETURN"; |
---|
628 | |
---|
629 | $func GETSTATIC = s; |
---|
630 | $native GETSTATIC = "static int org.objectweb.asm.Opcodes.GETSTATIC"; |
---|
631 | |
---|
632 | $func PUTSTATIC = s; |
---|
633 | $native PUTSTATIC = "static int org.objectweb.asm.Opcodes.PUTSTATIC"; |
---|
634 | |
---|
635 | $func GETFIELD = s; |
---|
636 | $native GETFIELD = "static int org.objectweb.asm.Opcodes.GETFIELD"; |
---|
637 | |
---|
638 | $func PUTFIELD = s; |
---|
639 | $native PUTFIELD = "static int org.objectweb.asm.Opcodes.PUTFIELD"; |
---|
640 | |
---|
641 | $func INVOKEVIRTUAL = s; |
---|
642 | $native INVOKEVIRTUAL = "static int org.objectweb.asm.Opcodes.INVOKEVIRTUAL"; |
---|
643 | |
---|
644 | $func INVOKESPECIAL = s; |
---|
645 | $native INVOKESPECIAL = "static int org.objectweb.asm.Opcodes.INVOKESPECIAL"; |
---|
646 | |
---|
647 | $func INVOKESTATIC = s; |
---|
648 | $native INVOKESTATIC = "static int org.objectweb.asm.Opcodes.INVOKESTATIC"; |
---|
649 | |
---|
650 | $func INVOKEINTERFACE = s; |
---|
651 | $native INVOKEINTERFACE = "static int org.objectweb.asm.Opcodes.INVOKEINTERFACE"; |
---|
652 | |
---|
653 | $func NEW = s; |
---|
654 | $native NEW = "static int org.objectweb.asm.Opcodes.NEW"; |
---|
655 | |
---|
656 | $func NEWARRAY = s; |
---|
657 | $native NEWARRAY = "static int org.objectweb.asm.Opcodes.NEWARRAY"; |
---|
658 | |
---|
659 | $func ANEWARRAY = s; |
---|
660 | $native ANEWARRAY = "static int org.objectweb.asm.Opcodes.ANEWARRAY"; |
---|
661 | |
---|
662 | $func ARRAYLENGTH = s; |
---|
663 | $native ARRAYLENGTH = "static int org.objectweb.asm.Opcodes.ARRAYLENGTH"; |
---|
664 | |
---|
665 | $func ATHROW = s; |
---|
666 | $native ATHROW = "static int org.objectweb.asm.Opcodes.ATHROW"; |
---|
667 | |
---|
668 | $func CHECKCAST = s; |
---|
669 | $native CHECKCAST = "static int org.objectweb.asm.Opcodes.CHECKCAST"; |
---|
670 | |
---|
671 | $func INSTANCEOF = s; |
---|
672 | $native INSTANCEOF = "static int org.objectweb.asm.Opcodes.INSTANCEOF"; |
---|
673 | |
---|
674 | $func MONITORENTER = s; |
---|
675 | $native MONITORENTER = "static int org.objectweb.asm.Opcodes.MONITORENTER"; |
---|
676 | |
---|
677 | $func MONITOREXIT = s; |
---|
678 | $native MONITOREXIT = "static int org.objectweb.asm.Opcodes.MONITOREXIT"; |
---|
679 | |
---|
680 | $func MULTIANEWARRAY = s; |
---|
681 | $native MULTIANEWARRAY = "static int org.objectweb.asm.Opcodes.MULTIANEWARRAY"; |
---|
682 | |
---|
683 | $func IFNULL = s; |
---|
684 | $native IFNULL = "static int org.objectweb.asm.Opcodes.IFNULL"; |
---|
685 | |
---|
686 | $func IFNONNULL = s; |
---|
687 | $native IFNONNULL = "static int org.objectweb.asm.Opcodes.IFNONNULL"; |
---|
688 | |
---|
689 | |
---|
690 | // End NATIVE |
---|
691 | |
---|
692 | $box Module_Name; |
---|
693 | $box Refal_Module_Name; |
---|
694 | $box Class_Name; |
---|
695 | |
---|
696 | $box Entry; |
---|
697 | $box EntryName; |
---|
698 | |
---|
699 | $box FuncName; |
---|
700 | |
---|
701 | $func Module_To_JBC e.module = ; |
---|
702 | |
---|
703 | $func Module_Item_To_JBC t.item = ; |
---|
704 | |
---|
705 | $func Body_To_JBC e.body = ; |
---|
706 | |
---|
707 | $func Body_Item_To_JBC t.item = ; |
---|
708 | |
---|
709 | $func Expr_Ref_To_JBC e.ASAIL_Expr_Ref = ; |
---|
710 | |
---|
711 | $func Expr_Int_To_JBC e.ASAIL_Expr_Int = ; |
---|
712 | |
---|
713 | $func Step_To_JBC e.step_operators = ; |
---|
714 | |
---|
715 | $func Const_Expr_To_JBC e.ASAIL_const_expr = ; |
---|
716 | |
---|
717 | $func Var_To_JBC t.var = ; |
---|
718 | |
---|
719 | $func Cond_To_JBC t.cond = s.if; |
---|
720 | |
---|
721 | $func Infix_To_JBC s.func_for_converting_args_to_java s.op e.args = ; |
---|
722 | |
---|
723 | $func Access_Mode s.linkage = s.jbc_access_mode; |
---|
724 | $func WrapGen s.linkage s.tag t.qname (e.in) (e.out) e.native = ; |
---|
725 | |
---|
726 | $box Objects; |
---|
727 | $box Constants; |
---|
728 | $box Func_Refs; |
---|
729 | |
---|
730 | $func GetJBCName t.name = s.jbcName; |
---|
731 | |
---|
732 | GetJBCName { |
---|
733 | s.name = s.name; |
---|
734 | t.name = <ToWord <Rfp2Java t.name>>; |
---|
735 | }; |
---|
736 | |
---|
737 | $func GetJBCQName e.moduleName t.name = s.jbcModuleName s.jbcName; |
---|
738 | |
---|
739 | GetJBCQName e.moduleName t.name = |
---|
740 | <ToWord <Intersperse ('/') e.moduleName>> <GetJBCName t.name>; |
---|
741 | |
---|
742 | $box MVbox; |
---|
743 | $func MV = s; |
---|
744 | MV, <Get &MVbox> : s.mv = s.mv; |
---|
745 | |
---|
746 | $box CWbox; |
---|
747 | $func CW = s; |
---|
748 | CW, <Get &CWbox> : s.cv = s.cv; |
---|
749 | |
---|
750 | RFP_ASAIL_To_JBC (MODULE (e.moduleName) e.module) = |
---|
751 | <Store &Objects>, |
---|
752 | <Store &Constants>, |
---|
753 | <Store &Func_Refs>, |
---|
754 | { |
---|
755 | <Store &Entry <Lookup &RFP_Options ENTRIES>>; |
---|
756 | <Store &Entry (e.moduleName Main)>; |
---|
757 | }, |
---|
758 | <Store &EntryName /*empty*/>, |
---|
759 | <Store &Module_Name e.moduleName>, |
---|
760 | <ToWord <Intersperse ('.') e.moduleName>> :: s.refal_mod_name, |
---|
761 | <Store &Refal_Module_Name s.refal_mod_name>, |
---|
762 | <ToWord <Intersperse ('/') e.moduleName>> :: s.class_name, |
---|
763 | <Store &Class_Name s.class_name>, |
---|
764 | <Store &CWbox <ClassWriter <COMPUTE_MAXS>>>, |
---|
765 | <CWvisit <CW> <V1_5> <Add <ACC_PUBLIC> <ACC_SUPER>> s.class_name <Null> "java/lang/Object" ()>, |
---|
766 | <CWvisitSource <CW> <ToWord <R 0 e.moduleName> '.rf'> <Null>>, |
---|
767 | <Module_To_JBC e.module>, |
---|
768 | { |
---|
769 | <Get &EntryName> : s.name = |
---|
770 | /*<ASAIL-To-JBC-Temp <CW> e.module> : e, |
---|
771 | () |
---|
772 | ('public static void main (java.lang.String[] args) {' ( |
---|
773 | ('RefalRuntime.setArgs ("'e.java-module-name'", args);') |
---|
774 | ('try {' (v.name' (new Result ());') '}') |
---|
775 | ('catch (RefalException e) {' ( |
---|
776 | ('java.lang.System.out.println ("$error: " + e);') |
---|
777 | ('java.lang.System.exit (100);') |
---|
778 | )'}') |
---|
779 | )'}');; |
---|
780 | } :: e.entry,*/ |
---|
781 | <Store &MVbox <CWvisitMethod <CW> <Add <Add <ACC_PUBLIC> <ACC_STATIC>> <ACC_SYNTHETIC>> "main" "([Ljava/lang/String;)V" <Null> ()>>, |
---|
782 | <IIMVvisitLdcInsn <MV> s.refal_mod_name>, |
---|
783 | <IIMVvisitVarInsn <MV> <ALOAD> 0>, |
---|
784 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/RefalRuntime" "setArgs" "(Ljava/lang/String;[Ljava/lang/String;)V">, |
---|
785 | { |
---|
786 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Result">, |
---|
787 | <IIMVvisitInsn <MV> <DUP>>, |
---|
788 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Result" "<init>" "()V">, |
---|
789 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> s.class_name s.name "(Lorg/refal/plus/Result;)V">, |
---|
790 | <IIMVvisitInsn <MV> <RETURN>>, |
---|
791 | <IIMVvisitMaxs <MV> 0 0>, |
---|
792 | <IIMVvisitEnd <MV>>; |
---|
793 | };; |
---|
794 | }, |
---|
795 | { |
---|
796 | <Store &MVbox <CWvisitMethod <CW> <ACC_SYNTHETIC> "<init>" "()V" <Null> ()>>, |
---|
797 | <IIMVvisitVarInsn <MV> <ALOAD> 0>, |
---|
798 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "java/lang/Object" "<init>" "()V">, |
---|
799 | <IIMVvisitInsn <MV> <RETURN>>, |
---|
800 | <IIMVvisitMaxs <MV> 0 0>, |
---|
801 | <IIMVvisitEnd <MV>>; |
---|
802 | }, |
---|
803 | <Store &MVbox <CWvisitMethod <CW> <Add <ACC_STATIC> <ACC_SYNTHETIC>> "<clinit>" "()V" <Null> ()>>, |
---|
804 | { |
---|
805 | <Get &Objects> : e (s.tag s.name) e, |
---|
806 | { <ToChars s.tag> : s1 e2, <ToWord "new" s1 <ToLower e2>>; } :: s.objectType, |
---|
807 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Expr">, |
---|
808 | <IIMVvisitInsn <MV> <DUP>>, |
---|
809 | <IIMVvisitLdcInsn <MV> s.name>, |
---|
810 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Symbol" s.objectType "(Ljava/lang/String;)Ljava/lang/Comparable;">, |
---|
811 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Expr" "<init>" "(Ljava/lang/Comparable;)V">, |
---|
812 | <IIMVvisitFieldInsn <MV> <PUTSTATIC> s.class_name s.name "Lorg/refal/plus/Expr;">, |
---|
813 | $fail;; |
---|
814 | }, |
---|
815 | { |
---|
816 | <Get &Constants> : e (s.name e.expr) e, |
---|
817 | <Const_Expr_To_JBC e.expr>, |
---|
818 | <IIMVvisitFieldInsn <MV> <PUTSTATIC> s.class_name s.name "Lorg/refal/plus/Expr;">, |
---|
819 | $fail;; |
---|
820 | }, |
---|
821 | <IIMVvisitInsn <MV> <RETURN>>, |
---|
822 | <IIMVvisitMaxs <MV> 0 0>, |
---|
823 | <IIMVvisitEnd <MV>>, |
---|
824 | //{ |
---|
825 | // <? &Func-Refs> : e (s.cl-name s.mod-name s.func-name) e, |
---|
826 | // <CWvisitInnerClass <CW> s.cl-name <Null> <Null> <ACC_STATIC>>, |
---|
827 | // $fail;; |
---|
828 | //}, |
---|
829 | <CWvisitEnd <CW>>, |
---|
830 | <Box (<CWtoByteArray <CW>> e.moduleName)> :: s.res, |
---|
831 | { |
---|
832 | <Get &Func_Refs> : e (s.cl_name s.mod_name s.func_name s.type) e, |
---|
833 | <ClassWriter <COMPUTE_MAXS>> :: s.cw, |
---|
834 | <CWvisit s.cw <V1_5> <ACC_FINAL> <ToWord s.class_name '$' s.cl_name> <Null> "java/lang/Object" ("org/refal/plus/Func")>, |
---|
835 | <CWvisitMethod s.cw <ACC_SYNTHETIC> "<init>" "()V" <Null> ()> :: s.mv, |
---|
836 | <IIMVvisitVarInsn s.mv <ALOAD> 0>, |
---|
837 | <IIMVvisitMethodInsn s.mv <INVOKESPECIAL> "java/lang/Object" "<init>" "()V">, |
---|
838 | <IIMVvisitInsn s.mv <RETURN>>, |
---|
839 | <IIMVvisitMaxs s.mv 0 0>, |
---|
840 | <IIMVvisitEnd s.mv>, |
---|
841 | <CWvisitMethod s.cw <Add <ACC_PUBLIC> <ACC_SYNTHETIC>> "eval" "(Lorg/refal/plus/Expr;Lorg/refal/plus/Result;)Z" <Null> ("org/refal/plus/RefalException")> :: s.mv, |
---|
842 | <IIMVvisitVarInsn s.mv <ALOAD> 1>, |
---|
843 | <IIMVvisitVarInsn s.mv <ALOAD> 2>, |
---|
844 | s.type : { |
---|
845 | "FUNC?" = |
---|
846 | <IIMVvisitMethodInsn s.mv <INVOKESTATIC> s.mod_name s.func_name "(Lorg/refal/plus/Expr;Lorg/refal/plus/Result;)Z">, |
---|
847 | <IIMVvisitInsn s.mv <IRETURN>>; |
---|
848 | s.FUNC_or_TFUNC = |
---|
849 | <IIMVvisitMethodInsn s.mv <INVOKESTATIC> s.mod_name s.func_name "(Lorg/refal/plus/Expr;Lorg/refal/plus/Result;)V">, |
---|
850 | <IIMVvisitInsn s.mv <ICONST_1>> <IIMVvisitInsn s.mv <IRETURN>>; |
---|
851 | }, |
---|
852 | <IIMVvisitMaxs s.mv 0 0>, |
---|
853 | <IIMVvisitEnd s.mv>, |
---|
854 | <CWvisitEnd s.cw>, |
---|
855 | <Put s.res (<CWtoByteArray s.cw> |
---|
856 | <Middle 0 1 e.moduleName> <ToWord <R 0 e.moduleName> '$' s.cl_name>)>, |
---|
857 | $fail;; |
---|
858 | }, |
---|
859 | <Get s.res>; |
---|
860 | |
---|
861 | $box Block_Tables; |
---|
862 | |
---|
863 | $func Init_Block_Table = ; |
---|
864 | $func Push_Block_Table = ; |
---|
865 | $func Pop_Block_Table = ; |
---|
866 | $func Get_Block_Table = s.block_table; |
---|
867 | |
---|
868 | Init_Block_Table = |
---|
869 | <Table> :: s.block_table, |
---|
870 | <Bind s.block_table ("VAR-INDEX") (0)>, |
---|
871 | <Store &Block_Tables s.block_table>; |
---|
872 | |
---|
873 | Push_Block_Table = |
---|
874 | <Get &Block_Tables> : e.block_tables, |
---|
875 | e.block_tables : e s.block_table, |
---|
876 | <TableCopy s.block_table> :: s.copy_block_table, |
---|
877 | <Label> :: s.start, |
---|
878 | <IIMVvisitLabel <MV> s.start>, |
---|
879 | <Bind s.copy_block_table (START) (s.start)>, |
---|
880 | <Store &Block_Tables e.block_tables s.copy_block_table>; |
---|
881 | |
---|
882 | Pop_Block_Table = |
---|
883 | <Get &Block_Tables> : e.block_tables s.block_table1 s.block_table2, |
---|
884 | <Lookup s.block_table2 "VAR-INDEX"> : s.i, |
---|
885 | <Bind s.block_table1 ("VAR-INDEX") (s.i)>, |
---|
886 | <Store &Block_Tables e.block_tables s.block_table1>, |
---|
887 | <Label> :: s.stop, |
---|
888 | <IIMVvisitLabel <MV> s.stop>, |
---|
889 | <Lookup s.block_table2 START> : s.start, |
---|
890 | { |
---|
891 | <Entries s.block_table2> : e ((VAR t.var) (s.type s.ind)) e, |
---|
892 | # <IsInTable s.block_table1 VAR t.var>, |
---|
893 | t.var : \{ |
---|
894 | (SVAR (e.name)) = <ToWord 's.' e.name>; |
---|
895 | (TVAR (e.name)) = <ToWord 't.' e.name>; |
---|
896 | (VVAR (e.name)) = <ToWord 'v.' e.name>; |
---|
897 | (EVAR (e.name)) = <ToWord 'e.' e.name>; |
---|
898 | } :: s.name, |
---|
899 | # \{ <ToChars s.name> : e '$' e; }, |
---|
900 | s.type : \{ |
---|
901 | Expr = <IIMVvisitLocalVariable <MV> s.name "Lorg/refal/plus/Expr;" <Null> s.start s.stop sind>; |
---|
902 | Result = <IIMVvisitLocalVariable <MV> s.name "Lorg/refal/plus/Result;" <Null> s.start s.stop sind>; |
---|
903 | }, |
---|
904 | $fail; |
---|
905 | ; |
---|
906 | }; |
---|
907 | |
---|
908 | Get_Block_Table = |
---|
909 | <Get &Block_Tables> : e s.block_table, |
---|
910 | s.block_table; |
---|
911 | |
---|
912 | $func Bind_Vars s.type e.vars = ; |
---|
913 | $func Bind_Var s.type t.var = s.i; |
---|
914 | $func Lookup_Var t.var = s.type s.i; |
---|
915 | $func Bind_Iter_Var e.expr t.var1 t.var2 = s.i; |
---|
916 | $func Lookup_Iter_Var e.expr = s.i s.i1 s.i2; |
---|
917 | $func Bind_TMP_Var t.var = s.i; |
---|
918 | $func Lookup_TMP_Var t.var = s.i; |
---|
919 | |
---|
920 | Bind_Vars s.type e.vars = |
---|
921 | { |
---|
922 | e.vars : e t.var e, |
---|
923 | <Bind_Var s.type t.var> : e, |
---|
924 | $fail;; |
---|
925 | }; |
---|
926 | |
---|
927 | Bind_Var s.type t.var = |
---|
928 | <Lookup <Get_Block_Table> "VAR-INDEX"> : s.i, |
---|
929 | <Bind <Get_Block_Table> ("VAR-INDEX") (<Add s.i 1>)>, |
---|
930 | <Bind <Get_Block_Table> (VAR t.var) (s.type s.i)>, |
---|
931 | s.i; |
---|
932 | |
---|
933 | Lookup_Var t.var = <Lookup <Get_Block_Table> VAR t.var> : s.type s.i = s.type s.i; |
---|
934 | |
---|
935 | Bind_Iter_Var e.expr t.var1 t.var2 = |
---|
936 | <Lookup <Get_Block_Table> "VAR-INDEX"> : s.i, |
---|
937 | <Bind <Get_Block_Table> ("VAR-INDEX") (<Add s.i 1>)>, |
---|
938 | <Bind_Var Expr t.var1> :: s.i1, |
---|
939 | <Bind_Var Expr t.var2> :: s.i2, |
---|
940 | <Bind <Get_Block_Table> (ITER e.expr) (s.i s.i1 s.i2)>, |
---|
941 | s.i; |
---|
942 | |
---|
943 | Lookup_Iter_Var e.expr = <Lookup <Get_Block_Table> ITER e.expr> : s.i s.i1 s.i2 = s.i s.i1 s.i2; |
---|
944 | |
---|
945 | Bind_TMP_Var t.var = |
---|
946 | <Lookup <Get_Block_Table> "VAR-INDEX"> : s.i, |
---|
947 | <Bind <Get_Block_Table> ("VAR-INDEX") (<Add s.i 1>)>, |
---|
948 | <Bind <Get_Block_Table> (TMP t.var) (s.i)>, |
---|
949 | s.i; |
---|
950 | |
---|
951 | Lookup_TMP_Var t.var = <Lookup <Get_Block_Table> TMP t.var> : s.i = s.i; |
---|
952 | |
---|
953 | $func Bind_Label t.label = s.l; |
---|
954 | $func Lookup_Label t.label = s.l; |
---|
955 | |
---|
956 | Bind_Label t.label = |
---|
957 | <Label> :: s.l, |
---|
958 | <Bind <Get_Block_Table> (LABEL t.label) (s.l)>, |
---|
959 | s.l; |
---|
960 | |
---|
961 | Lookup_Label t.label = <Lookup <Get_Block_Table> LABEL t.label> : s.l = s.l; |
---|
962 | |
---|
963 | |
---|
964 | $box Traps; |
---|
965 | |
---|
966 | $func Push_Trap s.end s.handler = ; |
---|
967 | $func Get_Trap = s.handler; |
---|
968 | $func Pop_Trap = s.end; |
---|
969 | |
---|
970 | Push_Trap s.end s.handler = |
---|
971 | <Put &Traps s.end s.handler>; |
---|
972 | |
---|
973 | Get_Trap = <R 0 <Get &Traps>> : s.handler = s.handler; |
---|
974 | |
---|
975 | Pop_Trap = |
---|
976 | <Get &Traps> : e.traps s.end s, |
---|
977 | <Store &Traps e.traps>, |
---|
978 | s.end; |
---|
979 | |
---|
980 | |
---|
981 | |
---|
982 | $func Function_Description (e.args) (e.ress) s.retType = s.desc; |
---|
983 | |
---|
984 | Function_Description (e.args) (e.ress) s.retType = |
---|
985 | <ToWord '(' <Replicate <Length e.args> "Lorg/refal/plus/Expr;"> |
---|
986 | <Replicate <Length e.ress> "Lorg/refal/plus/Result;">')' s.retType>; |
---|
987 | |
---|
988 | $func Check_Name s.name = ; |
---|
989 | Check_Name s = ; |
---|
990 | |
---|
991 | |
---|
992 | Module_To_JBC e.module, <Map &Module_Item_To_JBC (e.module)> : e; |
---|
993 | |
---|
994 | Module_Item_To_JBC { |
---|
995 | (s.tag IMPORT e) = /*empty*/; |
---|
996 | (NATIVE s.linkage s.tag t.qname (e.in) (e.out) e.native) = <WrapGen s.linkage s.tag t.qname (e.in) (e.out) e.native>; |
---|
997 | (s.tag s.linkage t.qname (e.args) (e.ress) e.body), |
---|
998 | s.tag : \{ |
---|
999 | FUNC = 'V'; |
---|
1000 | TFUNC = 'V'; |
---|
1001 | "FUNC?" = 'Z'; |
---|
1002 | } : s.retType = |
---|
1003 | t.qname : (e s.name), |
---|
1004 | <Check_Name s.name>, |
---|
1005 | <Add <ACC_STATIC> <Access_Mode s.linkage>> :: s.access, |
---|
1006 | <Function_Description (e.args) (e.ress) s.retType> :: s.desc, |
---|
1007 | <Store &MVbox <CWvisitMethod <CW> s.access s.name s.desc <Null> ("org/refal/plus/RefalException")>>, |
---|
1008 | { |
---|
1009 | <PrintFunctionFormat t.qname> :: s.format = |
---|
1010 | <IIMVvisitAnnotation <MV> "Lorg/refal/plus/RefalFormat;" False> :: s.aw, |
---|
1011 | <IIAVvisit s.aw "value" s.format>, |
---|
1012 | <IIAVvisitEnd s.aw>;; |
---|
1013 | }, |
---|
1014 | <Store &FuncName s.name> <Init_Block_Table> <Push_Block_Table> <Bind_Vars Expr e.args> <Bind_Vars Result e.ress>, |
---|
1015 | <Body_To_JBC e.body>, |
---|
1016 | <Pop_Block_Table> |
---|
1017 | s.tag : { |
---|
1018 | FUNC = <IIMVvisitInsn <MV> <RETURN>>; |
---|
1019 | TFUNC = <IIMVvisitInsn <MV> <RETURN>>; |
---|
1020 | "FUNC?" = <IIMVvisitInsn <MV> <ICONST_1>> <IIMVvisitInsn <MV> <IRETURN>>; |
---|
1021 | }, |
---|
1022 | <IIMVvisitMaxs <MV> 0 0>, |
---|
1023 | <IIMVvisitEnd <MV>>, |
---|
1024 | { <Get &Entry> : e t.qname e = <Store &EntryName s.name>;; }; |
---|
1025 | (CONSTEXPR s.linkage t.qname (e.comment) e.expr) = |
---|
1026 | t.qname : { |
---|
1027 | (STATIC (e)) = <GetJBCName t.qname>; |
---|
1028 | (e s.name) = s.name; |
---|
1029 | } :: s.name, |
---|
1030 | <Check_Name s.name>, |
---|
1031 | <Add <ACC_FINAL> <Add <ACC_STATIC> <Access_Mode s.linkage>>> :: s.access, |
---|
1032 | <CWvisitField <CW> s.access s.name "Lorg/refal/plus/Expr;" <Null> <Null>> :: s.fv, |
---|
1033 | { |
---|
1034 | <PrintConstDefinition t.qname> :: s.def = |
---|
1035 | <IIFVvisitAnnotation s.fv "Lorg/refal/plus/RefalFormat;" False> :: s.aw, |
---|
1036 | <IIAVvisit s.aw "value" s.def>, |
---|
1037 | <IIAVvisitEnd s.aw>;; |
---|
1038 | }, |
---|
1039 | <IIFVvisitEnd s.fv>, |
---|
1040 | <Put &Constants (s.name e.expr)>; |
---|
1041 | (OBJ s.linkage s.tag t.qname) = |
---|
1042 | t.qname : (e s.name), |
---|
1043 | <Check_Name s.name>, |
---|
1044 | <Add <ACC_FINAL> <Add <ACC_STATIC> <Access_Mode s.linkage>>> :: s.access, |
---|
1045 | <CWvisitField <CW> s.access s.name "Lorg/refal/plus/Expr;" <Null> <Null>> :: s.fv, |
---|
1046 | { |
---|
1047 | <PrintObjectDefinition t.qname> :: s.def = |
---|
1048 | <IIFVvisitAnnotation s.fv "Lorg/refal/plus/RefalFormat;" False> :: s.aw, |
---|
1049 | <IIAVvisit s.aw "value" s.def>, |
---|
1050 | <IIAVvisitEnd s.aw>;; |
---|
1051 | }, |
---|
1052 | <IIFVvisitEnd s.fv>, |
---|
1053 | <Put &Objects (s.tag s.name)>; |
---|
1054 | ("DECL-OBJ" t.name) = ; |
---|
1055 | ("DECL-FUNC" t.name) = ; |
---|
1056 | (TRACE t.name) = |
---|
1057 | <Bind &RFP_Trace (t.name) ()>; |
---|
1058 | }; |
---|
1059 | |
---|
1060 | Body_To_JBC e.body, <Map &Body_Item_To_JBC (e.body)> : e; |
---|
1061 | |
---|
1062 | Body_Item_To_JBC { |
---|
1063 | (LINENUMBER sN) = |
---|
1064 | <Label> :: s.line, |
---|
1065 | <IIMVvisitLabel <MV> s.line>, |
---|
1066 | <IIMVvisitLineNumber <MV> sN s.line>; |
---|
1067 | (DECL (INT t.var) e.expr) = |
---|
1068 | <Bind_Var Int t.var> :: s.i, |
---|
1069 | <Expr_Int_To_JBC e.expr>, |
---|
1070 | <IIMVvisitVarInsn <MV> <ISTORE> s.i>; |
---|
1071 | (ASSIGN (INT t.var) e.expr) = |
---|
1072 | <Lookup_Var t.var> :: s s.i, |
---|
1073 | <Expr_Int_To_JBC e.expr>, |
---|
1074 | <IIMVvisitVarInsn <MV> <ISTORE> s.i>; |
---|
1075 | (DECL s.type t.var e.expr) = |
---|
1076 | <Bind_Var s.type t.var> :: s.i, |
---|
1077 | s.type : { |
---|
1078 | Result = |
---|
1079 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Result">, |
---|
1080 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1081 | <Expr_Ref_To_JBC e.expr>, |
---|
1082 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Result" "<init>" "(Lorg/refal/plus/Expr;)V">, |
---|
1083 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>; |
---|
1084 | Expr = |
---|
1085 | <Expr_Ref_To_JBC e.expr>, |
---|
1086 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>; |
---|
1087 | }; |
---|
1088 | (ASSIGN t.var e.expr) = |
---|
1089 | <Lookup_Var t.var> :: s.type s.i, |
---|
1090 | s.type : { |
---|
1091 | Result = |
---|
1092 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>, |
---|
1093 | <Expr_Ref_To_JBC e.expr>, |
---|
1094 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "assign" "(Lorg/refal/plus/Expr;)V">; |
---|
1095 | Expr = |
---|
1096 | <Expr_Ref_To_JBC e.expr>, |
---|
1097 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>; |
---|
1098 | }; |
---|
1099 | ("IF-INT-CMP" s.op (e.arg1) (e.arg2) e.body) = |
---|
1100 | <Push_Block_Table>, |
---|
1101 | <Label> :: s.label, |
---|
1102 | <Expr_Int_To_JBC e.arg1>, |
---|
1103 | <Expr_Int_To_JBC e.arg2>, |
---|
1104 | s.op : { |
---|
1105 | "!=" = <IF_ICMPEQ>; |
---|
1106 | "<" = <IF_ICMPGE>; |
---|
1107 | ">" = <IF_ICMPLE>; |
---|
1108 | } :: s.op, |
---|
1109 | <IIMVvisitJumpInsn <MV> s.op s.label>, |
---|
1110 | <Body_To_JBC e.body>, |
---|
1111 | <IIMVvisitLabel <MV> s.label>, |
---|
1112 | <Pop_Block_Table>; |
---|
1113 | (IF t.cond e.body) = |
---|
1114 | <Push_Block_Table>, |
---|
1115 | <Label> :: s.label, |
---|
1116 | <Cond_To_JBC t.cond> :: s.if, |
---|
1117 | <IIMVvisitJumpInsn <MV> s.if s.label>, |
---|
1118 | <Body_To_JBC e.body>, |
---|
1119 | <IIMVvisitLabel <MV> s.label>, |
---|
1120 | <Pop_Block_Table>; |
---|
1121 | (LSPLIT t.name (e.min) t.var1 t.var2) = |
---|
1122 | <Push_Block_Table>, |
---|
1123 | <Bind_Iter_Var t.name t.var1 t.var2> :: s.i, |
---|
1124 | <Expr_Ref_To_JBC t.name>, |
---|
1125 | <Expr_Int_To_JBC e.min>, |
---|
1126 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "leftSplit" "(I)Lorg/refal/plus/Expr$SplitIterator;">, |
---|
1127 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>; |
---|
1128 | (RSPLIT t.name (e.min) t.var1 t.var2) = |
---|
1129 | <Push_Block_Table>, |
---|
1130 | <Bind_Iter_Var t.name t.var1 t.var2> :: s.i, |
---|
1131 | <Expr_Ref_To_JBC t.name>, |
---|
1132 | <Expr_Int_To_JBC e.min>, |
---|
1133 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "rightSplit" "(I)Lorg/refal/plus/Expr$SplitIterator;">, |
---|
1134 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>; |
---|
1135 | (FOR (e.cont_label) (e.break_label) () (e.step) e.body) = |
---|
1136 | { e.step : /*empty*/, <Push_Block_Table>;; }, |
---|
1137 | { |
---|
1138 | e.cont_label : t.label = <Bind_Label t.label>; |
---|
1139 | <Label>; |
---|
1140 | } :: s.cont_label, |
---|
1141 | { |
---|
1142 | e.break_label : t.label = <Bind_Label t.label>; |
---|
1143 | <Label>; |
---|
1144 | } :: s.break_label, |
---|
1145 | <Label> :: s.for_label, |
---|
1146 | <IIMVvisitLabel <MV> s.for_label>, |
---|
1147 | { |
---|
1148 | e.step : (s.tag e.expr), s.tag : \{ "INC-ITER"; "DEC-ITER"; } = |
---|
1149 | <Lookup_Iter_Var e.expr> : s.i s.i1 s.i2, |
---|
1150 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>, |
---|
1151 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1152 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr$SplitIterator" "getLeft" "()Lorg/refal/plus/Expr;">, |
---|
1153 | <IIMVvisitVarInsn <MV> <ASTORE> s.i1>, |
---|
1154 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr$SplitIterator" "getRight" "()Lorg/refal/plus/Expr;">, |
---|
1155 | <IIMVvisitVarInsn <MV> <ASTORE> s.i2>;; |
---|
1156 | }, |
---|
1157 | <Body_To_JBC e.body>, |
---|
1158 | <IIMVvisitLabel <MV> s.cont_label>, |
---|
1159 | <Step_To_JBC e.step>, |
---|
1160 | <IIMVvisitJumpInsn <MV> <GOTO> s.for_label>, |
---|
1161 | <IIMVvisitLabel <MV> s.break_label>, |
---|
1162 | <Pop_Block_Table>; |
---|
1163 | (LABEL (t.label) e.body) = |
---|
1164 | <Push_Block_Table>, |
---|
1165 | <Bind_Label t.label> :: s.label, |
---|
1166 | <Body_To_JBC e.body>, |
---|
1167 | <IIMVvisitLabel <MV> s.label>, |
---|
1168 | <Pop_Block_Table>; |
---|
1169 | (s.tag t.label), s.tag : \{ CONTINUE; BREAK; } = |
---|
1170 | <IIMVvisitJumpInsn <MV> <GOTO> <Lookup_Label t.label>>; |
---|
1171 | RETFAIL = |
---|
1172 | <IIMVvisitInsn <MV> <ICONST_0>> <IIMVvisitInsn <MV> <IRETURN>>; |
---|
1173 | (TRY e.body) = |
---|
1174 | <Push_Block_Table>, |
---|
1175 | <Label> :: s.start, |
---|
1176 | <Label> :: s.end, |
---|
1177 | <Label> :: s.real_end, |
---|
1178 | <Label> :: s.handler, |
---|
1179 | <Push_Trap s.real_end s.handler>, |
---|
1180 | <IIMVvisitTryCatchBlock <MV> s.start s.end s.handler "org/refal/plus/RefalException">, |
---|
1181 | <IIMVvisitLabel <MV> s.start>, |
---|
1182 | <Body_To_JBC e.body>, |
---|
1183 | <IIMVvisitLabel <MV> s.end>, |
---|
1184 | <IIMVvisitJumpInsn <MV> <GOTO> s.real_end>, |
---|
1185 | <Pop_Block_Table>; |
---|
1186 | ("CATCH-ERROR" e.body) = |
---|
1187 | <Push_Block_Table>, |
---|
1188 | <Get_Trap> :: s.label, |
---|
1189 | <IIMVvisitLabel <MV> s.label>, |
---|
1190 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/RefalException" "getExpr" "()Lorg/refal/plus/Expr;">, |
---|
1191 | <IIMVvisitVarInsn <MV> <ASTORE> <Bind_Var Expr s.label>>, |
---|
1192 | <Body_To_JBC e.body>, |
---|
1193 | <IIMVvisitLabel <MV> <Pop_Trap>>, |
---|
1194 | <Pop_Block_Table>; |
---|
1195 | FATAL = |
---|
1196 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/RefalException">, |
---|
1197 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1198 | <Get &Refal_Module_Name> : s.mod_name, |
---|
1199 | <IIMVvisitLdcInsn <MV> s.mod_name>, |
---|
1200 | <Get &FuncName> : s.fname, |
---|
1201 | <IIMVvisitLdcInsn <MV> s.fname>, |
---|
1202 | <IIMVvisitLdcInsn <MV> "Unexpected fail">, |
---|
1203 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/RefalException" "<init>" "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V">, |
---|
1204 | <IIMVvisitInsn <MV> <ATHROW>>; |
---|
1205 | (ERROR e.expr) = |
---|
1206 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/RefalException">, |
---|
1207 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1208 | <Expr_Ref_To_JBC e.expr>, |
---|
1209 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/RefalException" "<init>" "(Lorg/refal/plus/Expr;)V">, |
---|
1210 | <IIMVvisitInsn <MV> <ATHROW>>; |
---|
1211 | (s.call (e.module s.name) (e.args) (e.ress)), |
---|
1212 | s.call : \{ CALL = V; TAILCALL = V; "TAILCALL?" = Z; } :: s.retType = |
---|
1213 | <Function_Description (e.args) (e.ress) s.retType> :: s.desc, |
---|
1214 | { |
---|
1215 | e.args : e (e.arg) e, |
---|
1216 | <Expr_Ref_To_JBC e.arg>, |
---|
1217 | $fail;; |
---|
1218 | }, |
---|
1219 | { |
---|
1220 | e.ress : e t.var e, <Lookup_Var t.var> : |
---|
1221 | { |
---|
1222 | Expr s = |
---|
1223 | <Bind_TMP_Var t.var> :: s.j, |
---|
1224 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Result">, |
---|
1225 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1226 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1227 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Result" "<init>" "()V">, |
---|
1228 | <IIMVvisitVarInsn <MV> <ASTORE> s.j>; |
---|
1229 | Result s.i = |
---|
1230 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>; |
---|
1231 | }, $fail;; |
---|
1232 | }, |
---|
1233 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> <GetJBCQName e.module s.name> s.desc>, |
---|
1234 | { |
---|
1235 | s.call : "TAILCALL?" = |
---|
1236 | <Label> :: s.label, |
---|
1237 | <IIMVvisitJumpInsn <MV> <IFNE> s.label>, |
---|
1238 | <IIMVvisitInsn <MV> <ICONST_0>>, |
---|
1239 | <IIMVvisitInsn <MV> <IRETURN>>, |
---|
1240 | <IIMVvisitLabel <MV> s.label>;; |
---|
1241 | }, |
---|
1242 | { |
---|
1243 | e.ress : e t.var e, <Lookup_Var t.var> : Expr s.i, |
---|
1244 | <Lookup_TMP_Var t.var> :: s.j, |
---|
1245 | <IIMVvisitVarInsn <MV> <ALOAD> s.j> |
---|
1246 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "getExpr" "()Lorg/refal/plus/Expr;">, |
---|
1247 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>, |
---|
1248 | $fail;; |
---|
1249 | }; |
---|
1250 | }; |
---|
1251 | |
---|
1252 | $func Expr_Ref_To_JBC_With_Type e.expr = s.type; // Expr or Comparable |
---|
1253 | $func Term_Ref_To_JBC_With_Type t.term = s.type; // Expr or Comparable |
---|
1254 | |
---|
1255 | Expr_Ref_To_JBC e.expr, |
---|
1256 | <Expr_Ref_To_JBC_With_Type e.expr> : s.type, |
---|
1257 | { |
---|
1258 | s.type : Comparable, |
---|
1259 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Expr">, |
---|
1260 | <IIMVvisitInsn <MV> <DUP_X1>>, |
---|
1261 | <IIMVvisitInsn <MV> <SWAP>>, |
---|
1262 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Expr" "<init>" "(Ljava/lang/Comparable;)V">;; |
---|
1263 | }; |
---|
1264 | |
---|
1265 | Expr_Ref_To_JBC_With_Type { |
---|
1266 | /*empty*/ = <IIMVvisitFieldInsn <MV> <GETSTATIC> "org/refal/plus/Expr" "empty" "Lorg/refal/plus/Expr;">, Expr; |
---|
1267 | t.term = <Term_Ref_To_JBC_With_Type t.term>; |
---|
1268 | t.term1 t.term2 = |
---|
1269 | <Term_Ref_To_JBC_With_Type t.term1> :: s.type1, |
---|
1270 | <Term_Ref_To_JBC_With_Type t.term2> :: s.type2, |
---|
1271 | { s.type1 : Comparable = "Ljava/lang/Comparable;"; "Lorg/refal/plus/Expr;"; } :: s.type1, |
---|
1272 | { s.type2 : Comparable = "Ljava/lang/Comparable;"; "Lorg/refal/plus/Expr;"; } :: s.type2, |
---|
1273 | <ToWord "(" s.type1 s.type2 ")Lorg/refal/plus/Expr;"> :: s.concatType, |
---|
1274 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Expr" "concat" s.concatType>, Expr; |
---|
1275 | e.expr = |
---|
1276 | <IIMVvisitLdcInsn <MV> <Integer <Length e.expr>>>, |
---|
1277 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Expr" "getConcatenator" "(I)Lorg/refal/plus/Expr$Concatenator;">, |
---|
1278 | { |
---|
1279 | e.expr : e t.term e, |
---|
1280 | <Term_Ref_To_JBC_With_Type t.term> :: s.type, |
---|
1281 | { s.type : Comparable = "Ljava/lang/Comparable;"; "Lorg/refal/plus/Expr;"; } :: s.type, |
---|
1282 | <ToWord "(" s.type ")Lorg/refal/plus/Expr$Concatenator;"> :: s.toRightType, |
---|
1283 | <IIMVvisitMethodInsn <MV> <INVOKEINTERFACE> "org/refal/plus/Expr$Concatenator" "toRight" s.toRightType>, |
---|
1284 | $fail;; |
---|
1285 | }, |
---|
1286 | <IIMVvisitMethodInsn <MV> <INVOKEINTERFACE> "org/refal/plus/Expr$Concatenator" "yield" "()Lorg/refal/plus/Expr;">, Expr; |
---|
1287 | }; |
---|
1288 | |
---|
1289 | Term_Ref_To_JBC_With_Type { |
---|
1290 | (PAREN e.expr) = <Expr_Ref_To_JBC e.expr>, Comparable; |
---|
1291 | (DEREF e.expr (e.pos)) = |
---|
1292 | <Expr_Ref_To_JBC e.expr>, |
---|
1293 | <Expr_Int_To_JBC e.pos>, |
---|
1294 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "at" "(I)Ljava/lang/Comparable;">, |
---|
1295 | <IIMVvisitTypeInsn <MV> <CHECKCAST> "org/refal/plus/Expr">, Expr; |
---|
1296 | (SUBEXPR e.expr (e.pos) (e.len)) = |
---|
1297 | <Expr_Ref_To_JBC e.expr>, |
---|
1298 | <Expr_Int_To_JBC e.pos>, |
---|
1299 | <Expr_Int_To_JBC e.len>, |
---|
1300 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "subexpr" "(II)Lorg/refal/plus/Expr;">, Expr; |
---|
1301 | t.term, t.term : \{ |
---|
1302 | (REF (e.module s.name)) = e.module s.name; |
---|
1303 | (STATIC (e)) = <Get &Module_Name> t.term; |
---|
1304 | } :: e.module t.name = |
---|
1305 | <IIMVvisitFieldInsn <MV> <GETSTATIC> <GetJBCQName e.module t.name> "Lorg/refal/plus/Expr;">, Expr; |
---|
1306 | "ERROR-EXPR" = <Var_To_JBC <Get_Trap>>, Expr; |
---|
1307 | t.term, t.term : (s.var_tag e), |
---|
1308 | s.var_tag : \{ VAR; SVAR; TVAR; EVAR; VVAR; } = |
---|
1309 | <Var_To_JBC t.term>, Expr; |
---|
1310 | }; |
---|
1311 | |
---|
1312 | Expr_Int_To_JBC { |
---|
1313 | s.ObjectSymbol = |
---|
1314 | { |
---|
1315 | <IsInt s.ObjectSymbol> = |
---|
1316 | <IIMVvisitLdcInsn <MV> <Integer s.ObjectSymbol>>; |
---|
1317 | $error ("Illegal int-symbol: " s.ObjectSymbol); |
---|
1318 | //FIXME: It is needed to check that s.pos and s.len |
---|
1319 | // are in allowable bounds. |
---|
1320 | // Set this bounds by options. |
---|
1321 | }; |
---|
1322 | (LENGTH e.x) = |
---|
1323 | <Expr_Ref_To_JBC e.x>, |
---|
1324 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "length" "()I">; |
---|
1325 | (s.tag (e.x) (e.y)), |
---|
1326 | s.tag : \{ MIN = "min"; MAX = "max"; } :: s.fn = |
---|
1327 | <Expr_Int_To_JBC e.x>, |
---|
1328 | <Expr_Int_To_JBC e.y>, |
---|
1329 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "java/lang/Math" s.fn "(II)I">; |
---|
1330 | (INFIX s.op e.args) = |
---|
1331 | <Infix_To_JBC &Expr_Int_To_JBC s.op e.args>; |
---|
1332 | (INT t.var) = <Var_To_JBC t.var>; |
---|
1333 | e.expr = <Infix_To_JBC &Expr_Int_To_JBC "+" <Paren e.expr>>; |
---|
1334 | }; |
---|
1335 | |
---|
1336 | Infix_To_JBC s.arg2java s.op (e.arg) e.args = |
---|
1337 | s.op : \{ |
---|
1338 | "+" = <IADD>; |
---|
1339 | "-" = <ISUB>; |
---|
1340 | "%" = <IREM>; |
---|
1341 | "*" = <IMUL>; |
---|
1342 | "/" = <IDIV>; |
---|
1343 | } :: s.jbcop, |
---|
1344 | <Apply s.arg2java e.arg> : e, |
---|
1345 | { |
---|
1346 | e.args : e (e.arg2) e, |
---|
1347 | <Apply s.arg2java e.arg2> : e, |
---|
1348 | <IIMVvisitInsn <MV> s.jbcop>, |
---|
1349 | $fail;; |
---|
1350 | }; |
---|
1351 | |
---|
1352 | Cond_To_JBC { |
---|
1353 | ("CALL-FAILS" (CALL (e.module s.name) (e.args) (e.ress))) = |
---|
1354 | <Function_Description (e.args) (e.ress) "Z"> :: s.desc, |
---|
1355 | { |
---|
1356 | e.args : e (e.arg) e, |
---|
1357 | <Expr_Ref_To_JBC e.arg>, |
---|
1358 | $fail;; |
---|
1359 | }, |
---|
1360 | { |
---|
1361 | e.ress : e t.var e, <Lookup_Var t.var> : |
---|
1362 | { |
---|
1363 | Expr s = |
---|
1364 | <Bind_TMP_Var t.var> :: s.j, |
---|
1365 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Result">, |
---|
1366 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1367 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1368 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Result" "<init>" "()V">, |
---|
1369 | <IIMVvisitVarInsn <MV> <ASTORE> s.j>; |
---|
1370 | Result s.i = |
---|
1371 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>; |
---|
1372 | }, $fail;; |
---|
1373 | }, |
---|
1374 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> <GetJBCQName e.module s.name> s.desc>, |
---|
1375 | { |
---|
1376 | e.ress : e t.var e, <Lookup_Var t.var> : Expr s.i, |
---|
1377 | <Lookup_TMP_Var t.var> :: s.j, |
---|
1378 | <IIMVvisitVarInsn <MV> <ALOAD> s.j> |
---|
1379 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "getExpr" "()Lorg/refal/plus/Expr;">, |
---|
1380 | <IIMVvisitVarInsn <MV> <ASTORE> s.i>, |
---|
1381 | $fail;; |
---|
1382 | }, |
---|
1383 | <IFNE>; |
---|
1384 | ("ITER-FAILS" e.expr) = |
---|
1385 | <Lookup_Iter_Var e.expr> :: s.i s s, |
---|
1386 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>, |
---|
1387 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr$SplitIterator" "isValid" "()Z">, |
---|
1388 | <IFNE>; |
---|
1389 | ("SYMBOL?" e.expr (e.pos)) = |
---|
1390 | <Expr_Ref_To_JBC e.expr>, |
---|
1391 | <Expr_Int_To_JBC e.pos>, |
---|
1392 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "isSymbolAt" "(I)Z">, |
---|
1393 | <IFEQ>; |
---|
1394 | (EQ e.expr1 (e.expr2) (e.pos)) = |
---|
1395 | <Expr_Ref_To_JBC e.expr1>, |
---|
1396 | <Expr_Ref_To_JBC e.expr2>, |
---|
1397 | <Expr_Int_To_JBC e.pos>, |
---|
1398 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "equals" "(Lorg/refal/plus/Expr;I)Z">, |
---|
1399 | <IFEQ>; |
---|
1400 | ("TERM-EQ" e.expr1 (e.expr2) (e.pos)) = |
---|
1401 | <Expr_Ref_To_JBC e.expr1>, |
---|
1402 | <Expr_Ref_To_JBC e.expr2>, |
---|
1403 | <Expr_Int_To_JBC e.pos>, |
---|
1404 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "termEquals" "(Lorg/refal/plus/Expr;I)Z">, |
---|
1405 | <IFEQ>; |
---|
1406 | (NOT t.cond) = |
---|
1407 | <IFEQ> :: s.IFEQ, |
---|
1408 | <IFNE> :: s.IFNE, |
---|
1409 | <Cond_To_JBC t.cond> : { |
---|
1410 | s.IFEQ = s.IFNE; |
---|
1411 | s.IFNE = s.IFEQ; |
---|
1412 | }; |
---|
1413 | }; |
---|
1414 | |
---|
1415 | |
---|
1416 | Step_To_JBC { |
---|
1417 | /*empty*/ = /*empty*/; |
---|
1418 | (s.tag e.expr), |
---|
1419 | s.tag : { |
---|
1420 | "INC-ITER" = "next"; |
---|
1421 | "DEC-ITER" = "prev"; |
---|
1422 | } :: s.m = |
---|
1423 | <Lookup_Iter_Var e.expr> :: s.i s s, |
---|
1424 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>, |
---|
1425 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr$SplitIterator" s.m "()Lorg/refal/plus/Expr$SplitIterator;">, |
---|
1426 | <IIMVvisitInsn <MV> <POP>>; |
---|
1427 | }; |
---|
1428 | |
---|
1429 | $func Const_Term_To_JBC t.term = ; |
---|
1430 | $func Get_String_From_Const_Expr e.expr = (e.chars) e.expr; |
---|
1431 | $func Convert_Const_Expr e.expr = e.expr; |
---|
1432 | |
---|
1433 | Const_Expr_To_JBC { |
---|
1434 | /*empty*/ = <IIMVvisitFieldInsn <MV> <GETSTATIC> "org/refal/plus/Expr" "empty" "Lorg/refal/plus/Expr;">; |
---|
1435 | (SUBEXPR t.name s.pos s.len) = |
---|
1436 | t.name : \{ |
---|
1437 | (REF (e.module s.obj_name)) = e.module s.obj_name; |
---|
1438 | (STATIC (e)) = <Get &Module_Name> t.name; |
---|
1439 | } :: e.module t.name = |
---|
1440 | <IIMVvisitFieldInsn <MV> <GETSTATIC> <GetJBCQName e.module t.name> "Lorg/refal/plus/Expr;">, |
---|
1441 | <IIMVvisitLdcInsn <MV> <Integer s.pos>>, |
---|
1442 | <IIMVvisitLdcInsn <MV> <Integer s.len>>, |
---|
1443 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "subexpr" "(II)Lorg/refal/plus/Expr;">; |
---|
1444 | //FIXME: It is needed to check that s.pos and s.len |
---|
1445 | // are in allowable bounds. |
---|
1446 | // Set this bounds by options. |
---|
1447 | e.expr = <Convert_Const_Expr e.expr> :: e.expr, |
---|
1448 | <IIMVvisitLdcInsn <MV> <Integer <Length e.expr>>>, |
---|
1449 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Expr" "getConcatenator" "(I)Lorg/refal/plus/Expr$Concatenator;">, |
---|
1450 | { |
---|
1451 | e.expr : e t.term e, |
---|
1452 | <Const_Term_To_JBC t.term>, |
---|
1453 | <IIMVvisitMethodInsn <MV> <INVOKEINTERFACE> "org/refal/plus/Expr$Concatenator" "toRight" "(Lorg/refal/plus/Expr;)Lorg/refal/plus/Expr$Concatenator;">, |
---|
1454 | $fail;; |
---|
1455 | }, |
---|
1456 | <IIMVvisitMethodInsn <MV> <INVOKEINTERFACE> "org/refal/plus/Expr$Concatenator" "yield" "()Lorg/refal/plus/Expr;">; |
---|
1457 | |
---|
1458 | /*e.expr = |
---|
1459 | <Const-Expr-Aux () e.expr> : { |
---|
1460 | (e.arrays) (e1) = e.arrays (e1); |
---|
1461 | (e.arrays) (e1) (e2) = e.arrays ('new Expr ('e1', 'e2')'); |
---|
1462 | (e.arrays) e.concat = |
---|
1463 | '_va_' :: e.new-var, |
---|
1464 | e.arrays |
---|
1465 | ('static private final Expr[] 'e.new-var' = { '<Concat <Intersperse (', ') e.concat>>' };') |
---|
1466 | ('Expr.concat ('e.new-var')'); |
---|
1467 | };*/ |
---|
1468 | }; |
---|
1469 | |
---|
1470 | Get_String_From_Const_Expr e.expr, |
---|
1471 | () e.expr F $iter { |
---|
1472 | e.expr : s.sym e.rest, <IsChar s.sym> = (e.chars s.sym) e.rest F; |
---|
1473 | (e.chars) e.expr T; |
---|
1474 | } :: (e.chars) e.expr s.flag, s.flag : T, |
---|
1475 | (e.chars) e.expr; |
---|
1476 | |
---|
1477 | Convert_Const_Expr e.expr, |
---|
1478 | () e.expr $iter { |
---|
1479 | <Get_String_From_Const_Expr e.expr> :: (e.chars) e.expr, |
---|
1480 | { |
---|
1481 | e.chars : v = (e.res (CHARS e.chars)) e.expr; |
---|
1482 | e.expr : t.term e.rest, (e.res t.term) e.rest; |
---|
1483 | }; |
---|
1484 | } :: (e.res) e.expr, e.expr : /*empry*/, |
---|
1485 | e.res; |
---|
1486 | |
---|
1487 | Const_Term_To_JBC { |
---|
1488 | (CHARS e.chars) = |
---|
1489 | <IIMVvisitLdcInsn <MV> <ToWord e.chars>>, |
---|
1490 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Expr" "fromSequence" "(Ljava/lang/CharSequence;)Lorg/refal/plus/Expr;">; |
---|
1491 | (PAREN e.expr) = |
---|
1492 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Expr">, |
---|
1493 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1494 | <Const_Expr_To_JBC e.expr>, |
---|
1495 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Expr" "<init>" "(Ljava/lang/Comparable;)V">; |
---|
1496 | t.term, t.term : \{ |
---|
1497 | (REF (e.module s.name)) = e.module s.name; |
---|
1498 | (STATIC (e)) = <Get &Module_Name> t.term; |
---|
1499 | } :: e.module t.name = |
---|
1500 | <IIMVvisitFieldInsn <MV> <GETSTATIC> <GetJBCQName e.module t.name> "Lorg/refal/plus/Expr;">; |
---|
1501 | (s.func (e.module s.name)), s.func : \{ FUNC; "FUNC?"; TFUNC; } = |
---|
1502 | <ToWord <Get &Class_Name> '$' <Length <Get &Func_Refs>>> :: s.cl_name, |
---|
1503 | <Put &Func_Refs (<Length <Get &Func_Refs>> <GetJBCQName e.module s.name> s.func)>, |
---|
1504 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Expr">, |
---|
1505 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1506 | <IIMVvisitLdcInsn <MV> s.cl_name>, |
---|
1507 | <IIMVvisitTypeInsn <MV> <NEW> s.cl_name>, |
---|
1508 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1509 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> s.cl_name "<init>" "()V">, |
---|
1510 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Symbol" "newFunc" "(Ljava/lang/String;Lorg/refal/plus/Func;)Ljava/lang/Comparable;">, |
---|
1511 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Expr" "<init>" "(Ljava/lang/Comparable;)V">; |
---|
1512 | s.sym = |
---|
1513 | { |
---|
1514 | <IsInt s.sym> = "newInt"; |
---|
1515 | <IsWord s.sym> = "newWord"; |
---|
1516 | } :: s.meth, |
---|
1517 | <IIMVvisitTypeInsn <MV> <NEW> "org/refal/plus/Expr">, |
---|
1518 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1519 | <IIMVvisitLdcInsn <MV> <ToWord s.sym>>, |
---|
1520 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Symbol" s.meth "(Ljava/lang/String;)Ljava/lang/Comparable;">, |
---|
1521 | <IIMVvisitMethodInsn <MV> <INVOKESPECIAL> "org/refal/plus/Expr" "<init>" "(Ljava/lang/Comparable;)V">; |
---|
1522 | }; |
---|
1523 | |
---|
1524 | Var_To_JBC t.var = |
---|
1525 | <Lookup_Var t.var> :: s.type s.i, |
---|
1526 | s.type : { |
---|
1527 | Result = |
---|
1528 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>, |
---|
1529 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "getExpr" "()Lorg/refal/plus/Expr;">; |
---|
1530 | Expr = |
---|
1531 | <IIMVvisitVarInsn <MV> <ALOAD> s.i>; |
---|
1532 | Int = |
---|
1533 | <IIMVvisitVarInsn <MV> <ILOAD> s.i>; |
---|
1534 | }; |
---|
1535 | |
---|
1536 | Access_Mode { |
---|
1537 | EXPORT = <ACC_PUBLIC>; |
---|
1538 | s = 0; |
---|
1539 | }; |
---|
1540 | |
---|
1541 | $func PutArgToStack s.javaArgType e.rfArgTypes s.num = ; |
---|
1542 | PutArgToStack s.javaArgType e.rfArgTypes s.num = |
---|
1543 | <IIMVvisitVarInsn <MV> <ALOAD> s.num>, |
---|
1544 | <L s.num e.rfArgTypes> : { |
---|
1545 | (SVAR e) = |
---|
1546 | <IIMVvisitInsn <MV> <ICONST_0>>, |
---|
1547 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "at" "(I)Ljava/lang/Comparable;">, |
---|
1548 | { |
---|
1549 | s.javaArgType : \{Z = "booleanValue"; C = "charValue"; B = "byteValue"; S = "shortValue"; I = "intValue"; J = "longValue";} :: s.methodName = |
---|
1550 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" s.methodName <ToWord "(Ljava/lang/Comparable;)"s.javaArgType>>; |
---|
1551 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" "objectValue" "(Ljava/lang/Comparable;)Ljava/lang/Object;">, |
---|
1552 | { |
---|
1553 | <ToChars s.javaArgType> : 'L' e.intName ';', |
---|
1554 | <ToWord e.intName>; |
---|
1555 | s.javaArgType; |
---|
1556 | } :: s.javaArgType2, |
---|
1557 | <IIMVvisitTypeInsn <MV> <CHECKCAST> s.javaArgType2>; |
---|
1558 | }; |
---|
1559 | (EVAR e) = |
---|
1560 | <ToChars s.javaArgType> : '[' e.elemType, |
---|
1561 | <ToWord e.elemType> :: s.javaElemType = |
---|
1562 | { |
---|
1563 | s.javaElemType : \{Z = "booleanArrayValue"; C = "charArrayValue"; B = "byteArrayValue"; S = "shortArrayValue"; I = "intArrayValue"; J = "longArrayValue";} :: s.methodName = |
---|
1564 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" s.methodName <ToWord "(Lorg/refal/plus/Expr;)"s.javaArgType>>; |
---|
1565 | <IIMVvisitInsn <MV> <DUP>>, |
---|
1566 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Expr" "length" "()I">, |
---|
1567 | { |
---|
1568 | <ToChars s.javaElemType> : '[' e = |
---|
1569 | <IIMVvisitTypeInsn <MV> <ANEWARRAY> s.javaElemType>; |
---|
1570 | <ToChars s.javaElemType> : 'L' e.intName ';', |
---|
1571 | <IIMVvisitTypeInsn <MV> <ANEWARRAY> <ToWord e.intName>>; |
---|
1572 | }, |
---|
1573 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" "objectArrayValue" "(Lorg/refal/plus/Expr;[Ljava/lang/Object;)[Ljava/lang/Object;">, |
---|
1574 | { |
---|
1575 | <ToChars s.javaArgType> : 'L' e.intName ';', |
---|
1576 | <ToWord e.intName>; |
---|
1577 | s.javaArgType; |
---|
1578 | } :: s.javaArgType2, |
---|
1579 | <IIMVvisitTypeInsn <MV> <CHECKCAST> s.javaArgType2>; |
---|
1580 | }; |
---|
1581 | }; |
---|
1582 | |
---|
1583 | $func GetResFromStack s.javaResType e.rfResTypes s.num = ; |
---|
1584 | GetResFromStack s.javaResType e.rfResTypes s.num = { |
---|
1585 | e.rfResTypes : /**/ = ; |
---|
1586 | <IIMVvisitVarInsn <MV> <ALOAD> s.num>, |
---|
1587 | <IIMVvisitInsn <MV> <SWAP>>, |
---|
1588 | e.rfResTypes : { |
---|
1589 | (SVAR e) = |
---|
1590 | { |
---|
1591 | <ToChars s.javaResType> : \{ 'L' e; '[' e; } = "Ljava/lang/Object;"; |
---|
1592 | s.javaResType; |
---|
1593 | } :: s.javaResType, |
---|
1594 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" "sValueOf" <ToWord "("s.javaResType")Ljava/lang/Comparable;">>, |
---|
1595 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "assign" "(Ljava/lang/Comparable;)V">; |
---|
1596 | (EVAR e) = |
---|
1597 | { |
---|
1598 | <ToChars s.javaResType> : \{ '[L' e; '[[' e; } = "[Ljava/lang/Object;"; |
---|
1599 | s.javaResType; |
---|
1600 | } :: s.javaResType, |
---|
1601 | <IIMVvisitMethodInsn <MV> <INVOKESTATIC> "org/refal/plus/Native" "eValueOf" <ToWord "("s.javaResType")Lorg/refal/plus/Expr;">>, |
---|
1602 | <IIMVvisitMethodInsn <MV> <INVOKEVIRTUAL> "org/refal/plus/Result" "assign" "(Lorg/refal/plus/Expr;)V">; |
---|
1603 | }; |
---|
1604 | }; |
---|
1605 | |
---|
1606 | $func ConvertType s.javaType = s.typeDesc; |
---|
1607 | $func ConvertResType s.javaResType = s.resDesc; |
---|
1608 | |
---|
1609 | ConvertResType { |
---|
1610 | "" = V; |
---|
1611 | s.javaType = <ConvertType s.javaType>; |
---|
1612 | }; |
---|
1613 | |
---|
1614 | ConvertType { |
---|
1615 | "void" = V; |
---|
1616 | "int" = I; |
---|
1617 | "boolean" = Z; |
---|
1618 | "char" = C; |
---|
1619 | "byte" = B; |
---|
1620 | "short" = S; |
---|
1621 | "int" = I; |
---|
1622 | "float" = F; |
---|
1623 | "long" = J; |
---|
1624 | "double" = D; |
---|
1625 | s.javaType, <ToChars s.javaType> : e.head '[]' = <ToWord "[" <ConvertType <ToWord e.head>>>; |
---|
1626 | s.javaType = <ToWord L s.javaType ";">; |
---|
1627 | }; |
---|
1628 | |
---|
1629 | $func ReplaceDots s = s; |
---|
1630 | ReplaceDots s.str = <ToWord <Subst ('.') (('/')) <ToChars s.str>>>; |
---|
1631 | |
---|
1632 | WrapGen s.linkage FUNC t.qname (e.in) (e.out) e.native = |
---|
1633 | t.qname : (e s.functionName), |
---|
1634 | { <Get &Entry> : e t.qname e = <Store &EntryName s.functionName>;; }, |
---|
1635 | <DeclarationReader <ToWord e.native>> :: s.static s.javaResType s.className s.methodName e.javaArgTypes, |
---|
1636 | <ReplaceDots s.javaResType> :: s.javaResType, |
---|
1637 | <ReplaceDots s.className> :: s.className, |
---|
1638 | <Add <ACC_STATIC> <Access_Mode s.linkage>> :: s.access, |
---|
1639 | <Vars e.in> :: e.rfArgTypes, |
---|
1640 | <Vars e.out> :: e.rfResTypes, |
---|
1641 | <Function_Description (e.rfArgTypes) (e.rfResTypes) 'V'> :: s.desc, |
---|
1642 | <Store &MVbox <CWvisitMethod <CW> s.access s.functionName s.desc <Null> ("org/refal/plus/RefalException")>>, |
---|
1643 | { |
---|
1644 | <PrintFunctionFormat t.qname> :: s.format = |
---|
1645 | <IIMVvisitAnnotation <MV> "Lorg/refal/plus/RefalFormat;" False> :: s.aw, |
---|
1646 | <IIAVvisit s.aw "value" s.format>, |
---|
1647 | <IIAVvisitEnd s.aw>;; |
---|
1648 | }, |
---|
1649 | <IIMVvisitCode <MV>>, |
---|
1650 | { |
---|
1651 | s.methodName : "" = |
---|
1652 | <IIMVvisitTypeInsn <MV> <NEW> s.className>, |
---|
1653 | <IIMVvisitInsn <MV> <DUP>>, 0; |
---|
1654 | s.static : "" = |
---|
1655 | <PutArgToStack <ConvertType s.className> e.rfArgTypes 0>, 1; |
---|
1656 | 0; |
---|
1657 | } :: s.shift, |
---|
1658 | { |
---|
1659 | e.javaArgTypes : /**/ = |
---|
1660 | { |
---|
1661 | s.static : "" = <GETFIELD>; |
---|
1662 | <GETSTATIC>; |
---|
1663 | } :: s.opcode, |
---|
1664 | <IIMVvisitFieldInsn <MV> s.opcode s.className s.methodName <ConvertType s.javaResType>>; |
---|
1665 | e.javaArgTypes : (e.javaArgTypes2), |
---|
1666 | <Map &ReplaceDots (e.javaArgTypes2)> :: e.javaArgTypes, |
---|
1667 | { |
---|
1668 | e.javaArgTypes : e.head s.javaArgType e, |
---|
1669 | <PutArgToStack <ConvertType s.javaArgType> e.rfArgTypes <Add s.shift <Length e.head>>>, $fail;; |
---|
1670 | }, |
---|
1671 | { |
---|
1672 | s.methodName : "" = <INVOKESPECIAL> "<init>"; |
---|
1673 | s.static : "" = { |
---|
1674 | <ToChars s.functionName> : 'II' e, |
---|
1675 | <INVOKEINTERFACE> s.methodName; |
---|
1676 | <INVOKEVIRTUAL> s.methodName; |
---|
1677 | }; |
---|
1678 | = <INVOKESTATIC> s.methodName; |
---|
1679 | } :: s.opcode s.methodName, |
---|
1680 | <ToWord "(" <Map &ConvertType (e.javaArgTypes)> ")" <ConvertResType s.javaResType>> :: s.methodDesc, |
---|
1681 | <IIMVvisitMethodInsn <MV> s.opcode s.className s.methodName s.methodDesc>; |
---|
1682 | }, |
---|
1683 | { |
---|
1684 | s.javaResType : "" = s.className; |
---|
1685 | s.javaResType; |
---|
1686 | } :: s.javaResType, |
---|
1687 | <GetResFromStack <ConvertType s.javaResType> e.rfResTypes <Length e.rfArgTypes>>, |
---|
1688 | <IIMVvisitInsn <MV> <RETURN>>, |
---|
1689 | <IIMVvisitMaxs <MV> 0 0>, |
---|
1690 | <IIMVvisitEnd <MV>>; |
---|