Debian Codegraph @

texk/web2c/luatexdir/luaffi/call_arm64.h

raw
1 /*
2 ** This file has been pre-processed with DynASM.
3 ** https://luajit.org/dynasm.html
4 ** DynASM version 1.5.0, DynASM arm version 1.5.0
5 ** DO NOT EDIT! The original file is in "call_arm64.dasc".
6 */
7
8 /* vim: ts=4 sw=4 sts=4 et tw=78
9 * Portions copyright (c) 2015-present, Facebook, Inc. All rights reserved.
10 * Portions copyright (c) 2011 James R. McKaskill.
11 *
12 * This source code is licensed under the BSD-style license found in the
13 * LICENSE file in the root directory of this source tree. An additional grant
14 * of patent rights can be found in the PATENTS file in the same directory.
15 */
16 //|.arch arm64
17 #if DASM_VERSION != 10500
18 #error "Version mismatch between DynASM and included encoding engine"
19 #endif
20
21 //|.actionlist build_actionlist
22 static const unsigned int build_actionlist[1378] = {
23 0xF84002A9,
24 0x000F0003,
25 0x00000000,
26 0x384002A9,
27 0x000F0000,
28 0x00000000,
29 0x784002A9,
30 0x000F0001,
31 0x00000000,
32 0xB84002A9,
33 0x000F0002,
34 0x00000000,
35 0xF84002A9,
36 0x000F0003,
37 0x00000000,
38 0xF80003E0,
39 0x000F0003,
40 0x00000000,
41 0x380003E0,
42 0x000F0000,
43 0x00000000,
44 0x780003E0,
45 0x000F0001,
46 0x00000000,
47 0xB80003E0,
48 0x000F0002,
49 0x00000000,
50 0xF80003E0,
51 0x000F0003,
52 0x00000000,
53 0xFC4002A0,
54 0x000F0003,
55 0x00000000,
56 0xBC4002B0,
57 0x000F0002,
58 0x1E22C200,
59 0x00000000,
60 0xFC4002A0,
61 0x000F0003,
62 0x00000000,
63 0xFC4002A1,
64 0x000F0003,
65 0x00000000,
66 0xBC4002A0,
67 0x000F0002,
68 0x00000000,
69 0xBC4002A1,
70 0x000F0002,
71 0x00000000,
72 0xFC4002A0,
73 0x000F0003,
74 0x00000000,
75 0xFC4002A1,
76 0x000F0003,
77 0x00000000,
78 0xBC4002A0,
79 0x000F0002,
80 0x00000000,
81 0xBC4002A1,
82 0x000F0002,
83 0x00000000,
84 0xFC0003E0,
85 0x000F0003,
86 0x00000000,
87 0x1E624000,
88 0x00000000,
89 0xBC0003E0,
90 0x000F0002,
91 0x00000000,
92 0xFC0003E0,
93 0x000F0003,
94 0x00000000,
95 0x1E624000,
96 0xBC0003E0,
97 0x000F0002,
98 0x00000000,
99 0xFC0003E0,
100 0x000F0003,
101 0x00000000,
102 0xFC0003E1,
103 0x000F0003,
104 0x00000000,
105 0xBC0003E0,
106 0x000F0002,
107 0x00000000,
108 0xBC0003E1,
109 0x000F0002,
110 0x00000000,
111 0xFC0003E0,
112 0x000F0003,
113 0x00000000,
114 0xFC0003E1,
115 0x000F0003,
116 0x00000000,
117 0xBC0003E0,
118 0x000F0002,
119 0x00000000,
120 0xBC0003E1,
121 0x000F0002,
122 0x00000000,
123 0xD10103FF,
124 0xA9037BFD,
125 0xA90263F7,
126 0xA9015BF5,
127 0xA90053F3,
128 0x910043F5,
129 0x00000000,
130 0xD10003FF,
131 0x000C0000,
132 0xFC1E02A0,
133 0xFC1D02A1,
134 0xFC1C02A2,
135 0xFC1B02A3,
136 0xFC1A82A4,
137 0xFC1A02A5,
138 0xFC1902A6,
139 0xFC1802A7,
140 0xF81782A0,
141 0xF81702A1,
142 0xF81682A2,
143 0xF81602A3,
144 0xF81582A4,
145 0xF81502A5,
146 0xF81482A6,
147 0xF81402A7,
148 0x00000000,
149 0xD2800013,
150 0x000A0205,
151 0xF2A00013,
152 0x000A0205,
153 0xF2C00013,
154 0x000A0205,
155 0xF2E00013,
156 0x000A0205,
157 0x00000000,
158 0x52800009,
159 0x000A0205,
160 0x72A00009,
161 0x000A0205,
162 0x5280000A,
163 0x000A0205,
164 0x72A0000A,
165 0x000A0205,
166 0x2A0A03E2,
167 0x2A0903E1,
168 0xAA1303E0,
169 0x94000000,
170 0x00030000,
171 0x00000000,
172 0x52800009,
173 0x000A0205,
174 0x72A00009,
175 0x000A0205,
176 0x52800002,
177 0x000A0205,
178 0x2A0903E1,
179 0xAA1303E0,
180 0x94000000,
181 0x00030000,
182 0x00000000,
183 0x52800009,
184 0x000A0205,
185 0x72A00009,
186 0x000A0205,
187 0x52800002,
188 0x000A0205,
189 0x2A0903E1,
190 0xAA1303E0,
191 0x94000000,
192 0x00030000,
193 0x52800009,
194 0x000A0205,
195 0x72A00009,
196 0x000A0205,
197 0xD2800002,
198 0x000A0205,
199 0xF2A00002,
200 0x000A0205,
201 0xF2C00002,
202 0x000A0205,
203 0xF2E00002,
204 0x000A0205,
205 0x2A0903E1,
206 0xAA1303E0,
207 0x94000000,
208 0x00030001,
209 0x00000000,
210 0xF9000009,
211 0x52800009,
212 0x000A0205,
213 0x72A00009,
214 0x000A0205,
215 0x2A0903E1,
216 0xAA1303E0,
217 0x94000000,
218 0x00030002,
219 0x00000000,
220 0xD2800002,
221 0x000A0205,
222 0xF2A00002,
223 0x000A0205,
224 0xF2C00002,
225 0x000A0205,
226 0xF2E00002,
227 0x000A0205,
228 0x52800001,
229 0xAA1303E0,
230 0x94000000,
231 0x00030001,
232 0x00000000,
233 0xF9000009,
234 0x00000000,
235 0xD2800002,
236 0x000A0205,
237 0xF2A00002,
238 0x000A0205,
239 0xF2C00002,
240 0x000A0205,
241 0xF2E00002,
242 0x000A0205,
243 0x52800001,
244 0xAA1303E0,
245 0x94000000,
246 0x00030001,
247 0x00000000,
248 0xF9000009,
249 0x00000000,
250 0xD2800002,
251 0x000A0205,
252 0xF2A00002,
253 0x000A0205,
254 0xF2C00002,
255 0x000A0205,
256 0xF2E00002,
257 0x000A0205,
258 0x52800001,
259 0xAA1303E0,
260 0x94000000,
261 0x00030001,
262 0x00000000,
263 0xBD000000,
264 0xBD000401,
265 0x00000000,
266 0xD2800002,
267 0x000A0205,
268 0xF2A00002,
269 0x000A0205,
270 0xF2C00002,
271 0x000A0205,
272 0xF2E00002,
273 0x000A0205,
274 0x52800001,
275 0xAA1303E0,
276 0x94000000,
277 0x00030001,
278 0x00000000,
279 0xFD000000,
280 0xFD000401,
281 0x00000000,
282 0xAA1303E0,
283 0x94000000,
284 0x00030003,
285 0x00000000,
286 0xAA1303E0,
287 0x94000000,
288 0x00030003,
289 0x00000000,
290 0x7100013F,
291 0x54000000,
292 0x00050801,
293 0x52800029,
294 0x0006000B,
295 0xD3401D29,
296 0xAA0903E1,
297 0xAA1303E0,
298 0x94000000,
299 0x00030004,
300 0x00000000,
301 0xD3401D29,
302 0x00000000,
303 0x93401D29,
304 0x00000000,
305 0xAA0903E1,
306 0xAA1303E0,
307 0x94000000,
308 0x00030005,
309 0x00000000,
310 0xD3403D29,
311 0x00000000,
312 0x93403D29,
313 0x00000000,
314 0xAA0903E1,
315 0xAA1303E0,
316 0x94000000,
317 0x00030005,
318 0x00000000,
319 0x2A0903E1,
320 0xAA1303E0,
321 0x94000000,
322 0x00030006,
323 0x00000000,
324 0x2A0903E1,
325 0xAA1303E0,
326 0x94000000,
327 0x00030005,
328 0x00000000,
329 0xD2800003,
330 0x000A0205,
331 0xF2A00003,
332 0x000A0205,
333 0xF2C00003,
334 0x000A0205,
335 0xF2E00003,
336 0x000A0205,
337 0x52800002,
338 0x000A0205,
339 0x52800001,
340 0x000A0205,
341 0xAA1303E0,
342 0x94000000,
343 0x00030007,
344 0x00000000,
345 0x52800009,
346 0x000A0205,
347 0x72A00009,
348 0x000A0205,
349 0x52800002,
350 0x000A0205,
351 0x2A0903E1,
352 0xAA1303E0,
353 0x94000000,
354 0x00030000,
355 0x52800009,
356 0x000A0205,
357 0x72A00009,
358 0x000A0205,
359 0x5280000A,
360 0x000A0205,
361 0x72A0000A,
362 0x000A0205,
363 0xD2800003,
364 0x000A0205,
365 0xF2A00003,
366 0x000A0205,
367 0xF2C00003,
368 0x000A0205,
369 0xF2E00003,
370 0x000A0205,
371 0x2A0A03E2,
372 0x2A0903E1,
373 0xAA1303E0,
374 0x94000000,
375 0x00030008,
376 0xF90013E0,
377 0x52800009,
378 0x000A0205,
379 0x72A00009,
380 0x000A0205,
381 0x2A0903E1,
382 0xAA1303E0,
383 0x94000000,
384 0x00030009,
385 0xF94013E0,
386 0x00000000,
387 0x52800009,
388 0x000A0205,
389 0x72A00009,
390 0x000A0205,
391 0x52800002,
392 0x000A0205,
393 0x2A0903E1,
394 0xAA1303E0,
395 0x94000000,
396 0x00030000,
397 0x52800009,
398 0x000A0205,
399 0x72A00009,
400 0x000A0205,
401 0x5280000A,
402 0x000A0205,
403 0x72A0000A,
404 0x000A0205,
405 0xD2800003,
406 0x000A0205,
407 0xF2A00003,
408 0x000A0205,
409 0xF2C00003,
410 0x000A0205,
411 0xF2E00003,
412 0x000A0205,
413 0x2A0A03E2,
414 0x2A0903E1,
415 0xAA1303E0,
416 0x94000000,
417 0x0003000A,
418 0xB90023E0,
419 0x52800009,
420 0x000A0205,
421 0x72A00009,
422 0x000A0205,
423 0x2A0903E1,
424 0xAA1303E0,
425 0x94000000,
426 0x00030009,
427 0xB94023E0,
428 0x00000000,
429 0x52800009,
430 0x000A0205,
431 0x72A00009,
432 0x000A0205,
433 0x2A0903E1,
434 0xAA1303E0,
435 0x94000000,
436 0x00030009,
437 0x00000000,
438 0x52800009,
439 0x000A0205,
440 0x72A00009,
441 0x000A0205,
442 0x2A0903E1,
443 0xAA1303E0,
444 0x94000000,
445 0x0003000B,
446 0x00000000,
447 0x52800009,
448 0x000A0205,
449 0x72A00009,
450 0x000A0205,
451 0x2A0903E1,
452 0xAA1303E0,
453 0x94000000,
454 0x0003000C,
455 0x00000000,
456 0xB90023E0,
457 0x52800009,
458 0x000A0205,
459 0x72A00009,
460 0x000A0205,
461 0x2A0903E1,
462 0xAA1303E0,
463 0x94000000,
464 0x00030009,
465 0xB94023E0,
466 0x00000000,
467 0x52800009,
468 0x000A0205,
469 0x72A00009,
470 0x000A0205,
471 0x2A0903E1,
472 0xAA1303E0,
473 0x94000000,
474 0x0003000D,
475 0x00000000,
476 0x52800009,
477 0x000A0205,
478 0x72A00009,
479 0x000A0205,
480 0x2A0903E1,
481 0xAA1303E0,
482 0x94000000,
483 0x0003000E,
484 0x00000000,
485 0xF90013E0,
486 0x52800009,
487 0x000A0205,
488 0x72A00009,
489 0x000A0205,
490 0x2A0903E1,
491 0xAA1303E0,
492 0x94000000,
493 0x00030009,
494 0xF94013E0,
495 0x00000000,
496 0x52800009,
497 0x000A0205,
498 0x72A00009,
499 0x000A0205,
500 0x2A0903E1,
501 0xAA1303E0,
502 0x94000000,
503 0x0003000F,
504 0xF90013E0,
505 0x52800009,
506 0x000A0205,
507 0x72A00009,
508 0x000A0205,
509 0x2A0903E1,
510 0xAA1303E0,
511 0x94000000,
512 0x00030009,
513 0xF94013E0,
514 0x00000000,
515 0x52800009,
516 0x000A0205,
517 0x72A00009,
518 0x000A0205,
519 0x2A0903E1,
520 0xAA1303E0,
521 0x94000000,
522 0x00030010,
523 0xFD0013E0,
524 0x52800009,
525 0x000A0205,
526 0x72A00009,
527 0x000A0205,
528 0x2A0903E1,
529 0xAA1303E0,
530 0x94000000,
531 0x00030009,
532 0xFD4013E1,
533 0x1E624020,
534 0x00000000,
535 0x52800009,
536 0x000A0205,
537 0x72A00009,
538 0x000A0205,
539 0x2A0903E1,
540 0xAA1303E0,
541 0x94000000,
542 0x00030010,
543 0xFD0013E0,
544 0x52800009,
545 0x000A0205,
546 0x72A00009,
547 0x000A0205,
548 0x2A0903E1,
549 0xAA1303E0,
550 0x94000000,
551 0x00030009,
552 0xFD4013E0,
553 0x00000000,
554 0x52800009,
555 0x000A0205,
556 0x72A00009,
557 0x000A0205,
558 0x2A0903E1,
559 0xAA1303E0,
560 0x94000000,
561 0x00030011,
562 0xBD0023E0,
563 0xBD0027E1,
564 0x52800009,
565 0x000A0205,
566 0x72A00009,
567 0x000A0205,
568 0x2A0903E1,
569 0xAA1303E0,
570 0x94000000,
571 0x00030009,
572 0xBD4023E0,
573 0xBD4027E1,
574 0x00000000,
575 0x52800009,
576 0x000A0205,
577 0x72A00009,
578 0x000A0205,
579 0x2A0903E1,
580 0xAA1303E0,
581 0x94000000,
582 0x00030012,
583 0xFD0013E0,
584 0xFD0017E1,
585 0x52800009,
586 0x000A0205,
587 0x72A00009,
588 0x000A0205,
589 0x2A0903E1,
590 0xAA1303E0,
591 0x94000000,
592 0x00030009,
593 0xFD4013E0,
594 0xFD4017E1,
595 0x00000000,
596 0xA97F52B3,
597 0x910002BF,
598 0xA9405BF5,
599 0x910043FF,
600 0xA94063F7,
601 0x910043FF,
602 0xA9407BFD,
603 0x910043FF,
604 0xD65F03C0,
605 0xD65F03C0,
606 0x00000000,
607 0xD10103FF,
608 0xA9037BFD,
609 0xA90263F7,
610 0xA9015BF5,
611 0xA90053F3,
612 0x910043F5,
613 0xAA0003F3,
614 0x00000000,
615 0xAA1303E0,
616 0x94000000,
617 0x00030013,
618 0xAA0003F4,
619 0xF100001F,
620 0x000C0000,
621 0x00000000,
622 0x5400000A,
623 0x00050802,
624 0xD2800009,
625 0x000A0205,
626 0xF2A00009,
627 0x000A0205,
628 0xF2C00009,
629 0x000A0205,
630 0xF2E00009,
631 0x000A0205,
632 0xAA0903E1,
633 0xAA1303E0,
634 0x94000000,
635 0x00030014,
636 0x0006000C,
637 0x5400000D,
638 0x00050801,
639 0xD2800009,
640 0x000A0205,
641 0xF2A00009,
642 0x000A0205,
643 0xF2C00009,
644 0x000A0205,
645 0xF2E00009,
646 0x000A0205,
647 0xAA0903E1,
648 0xAA1303E0,
649 0x94000000,
650 0x00030014,
651 0x00000000,
652 0x5400000A,
653 0x00050801,
654 0xD2800009,
655 0x000A0205,
656 0xF2A00009,
657 0x000A0205,
658 0xF2C00009,
659 0x000A0205,
660 0xF2E00009,
661 0x000A0205,
662 0xAA0903E1,
663 0xAA1303E0,
664 0x94000000,
665 0x00030014,
666 0x00000000,
667 0x0006000B,
668 0x00000000,
669 0xCB3473FF,
670 0xD10003FF,
671 0x000C0000,
672 0x00000000,
673 0x52800009,
674 0x000A0205,
675 0x72A00009,
676 0x000A0205,
677 0x93407D29,
678 0xD2800003,
679 0x000A0205,
680 0xF2A00003,
681 0x000A0205,
682 0xF2C00003,
683 0x000A0205,
684 0xF2E00003,
685 0x000A0205,
686 0x2A0903E2,
687 0x52800001,
688 0x000A0205,
689 0xAA1303E0,
690 0x94000000,
691 0x00030008,
692 0x00000000,
693 0x52800009,
694 0x000A0205,
695 0x72A00009,
696 0x000A0205,
697 0x93407D29,
698 0xD2800003,
699 0x000A0205,
700 0xF2A00003,
701 0x000A0205,
702 0xF2C00003,
703 0x000A0205,
704 0xF2E00003,
705 0x000A0205,
706 0x2A0903E2,
707 0x52800001,
708 0x000A0205,
709 0xAA1303E0,
710 0x94000000,
711 0x00030015,
712 0x00000000,
713 0x52800009,
714 0x000A0205,
715 0x72A00009,
716 0x000A0205,
717 0x93407D29,
718 0xD2800003,
719 0x000A0205,
720 0xF2A00003,
721 0x000A0205,
722 0xF2C00003,
723 0x000A0205,
724 0xF2E00003,
725 0x000A0205,
726 0x2A0903E2,
727 0x52800001,
728 0x000A0205,
729 0xAA1303E0,
730 0x94000000,
731 0x0003000A,
732 0x00000000,
733 0x52800001,
734 0x000A0205,
735 0xAA1303E0,
736 0x94000000,
737 0x0003000B,
738 0xD3401C00,
739 0x00000000,
740 0x52800001,
741 0x000A0205,
742 0xAA1303E0,
743 0x94000000,
744 0x0003000C,
745 0x93401C00,
746 0x00000000,
747 0x52800001,
748 0x000A0205,
749 0xAA1303E0,
750 0x94000000,
751 0x0003000B,
752 0xD3403C00,
753 0x00000000,
754 0x52800001,
755 0x000A0205,
756 0xAA1303E0,
757 0x94000000,
758 0x0003000C,
759 0x93403C00,
760 0x00000000,
761 0x52800001,
762 0x000A0205,
763 0xAA1303E0,
764 0x94000000,
765 0x0003000C,
766 0xF100001F,
767 0x54000000,
768 0x00050801,
769 0x52800020,
770 0x0006000B,
771 0xD3401C00,
772 0x00000000,
773 0x52800001,
774 0x000A0205,
775 0xAA1303E0,
776 0x94000000,
777 0x0003000B,
778 0x00000000,
779 0x52800001,
780 0x000A0205,
781 0xAA1303E0,
782 0x94000000,
783 0x0003000C,
784 0x00000000,
785 0x52800001,
786 0x000A0205,
787 0xAA1303E0,
788 0x94000000,
789 0x0003000F,
790 0x00000000,
791 0x52800001,
792 0x000A0205,
793 0xAA1303E0,
794 0x94000000,
795 0x0003000D,
796 0x00000000,
797 0x52800001,
798 0x000A0205,
799 0xAA1303E0,
800 0x94000000,
801 0x0003000E,
802 0x00000000,
803 0x52800001,
804 0x000A0205,
805 0xAA1303E0,
806 0x94000000,
807 0x00030010,
808 0x00000000,
809 0x52800001,
810 0x000A0205,
811 0xAA1303E0,
812 0x94000000,
813 0x00030012,
814 0x00000000,
815 0x52800001,
816 0x000A0205,
817 0xAA1303E0,
818 0x94000000,
819 0x00030010,
820 0x00000000,
821 0x52800001,
822 0x000A0205,
823 0xAA1303E0,
824 0x94000000,
825 0x00030011,
826 0x00000000,
827 0x910003E9,
828 0x91000129,
829 0x000C0000,
830 0xAA0903E4,
831 0x52800003,
832 0x000A0205,
833 0xAA1403E2,
834 0x52800001,
835 0x000A0205,
836 0xAA1303E0,
837 0x94000000,
838 0x00030016,
839 0x00000000,
840 0x910003E9,
841 0x91000129,
842 0x000C0000,
843 0xAA0903E4,
844 0x52800003,
845 0x000A0205,
846 0xAA1403E2,
847 0x52800001,
848 0x000A0205,
849 0xAA1303E0,
850 0x94000000,
851 0x00030017,
852 0x00000000,
853 0x910003E9,
854 0x91000129,
855 0x000C0000,
856 0xAA0903E5,
857 0x52800004,
858 0x000A0205,
859 0x52800003,
860 0x000A0205,
861 0xAA1403E2,
862 0x52800001,
863 0x000A0205,
864 0xAA1303E0,
865 0x94000000,
866 0x00030018,
867 0x00000000,
868 0x910003E9,
869 0x91000129,
870 0x000C0000,
871 0xAA0903E5,
872 0x52800004,
873 0x52800003,
874 0xAA1403E2,
875 0x52800001,
876 0x000A0205,
877 0xAA1303E0,
878 0x94000000,
879 0x00030018,
880 0x00000000,
881 0xD2800009,
882 0x000A0205,
883 0xF2A00009,
884 0x000A0205,
885 0xF2C00009,
886 0x000A0205,
887 0xF2E00009,
888 0x000A0205,
889 0xAA1F03EA,
890 0xB940012A,
891 0x2A0A03E0,
892 0x94000000,
893 0x00030019,
894 0x00000000,
895 0x910083FF,
896 0x00000000,
897 0xFC4003E7,
898 0x000F0003,
899 0x00000000,
900 0xFC4003E6,
901 0x000F0003,
902 0x00000000,
903 0xFC4003E5,
904 0x000F0003,
905 0x00000000,
906 0xFC4003E4,
907 0x000F0003,
908 0x00000000,
909 0xFC4003E3,
910 0x000F0003,
911 0x00000000,
912 0xFC4003E2,
913 0x000F0003,
914 0x00000000,
915 0xFC4003E1,
916 0x000F0003,
917 0x00000000,
918 0xFC4003E0,
919 0x000F0003,
920 0x00000000,
921 0xF9401FE7,
922 0x00000000,
923 0xF9401BE6,
924 0x00000000,
925 0xF94017E5,
926 0x00000000,
927 0xF94013E4,
928 0x00000000,
929 0xF9400FE3,
930 0x00000000,
931 0xF9400BE2,
932 0x00000000,
933 0xF94007E1,
934 0x00000000,
935 0xF94003E0,
936 0x00000000,
937 0x910003FF,
938 0x000C0000,
939 0x00000000,
940 0x94000000,
941 0x0003001A,
942 0x8B3473FF,
943 0xD100C3FF,
944 0x00000000,
945 0xF90013E0,
946 0x94000000,
947 0x0003001B,
948 0xD2800009,
949 0x000A0205,
950 0xF2A00009,
951 0x000A0205,
952 0xF2C00009,
953 0x000A0205,
954 0xF2E00009,
955 0x000A0205,
956 0xB9000120,
957 0x52800009,
958 0x000A0205,
959 0x72A00009,
960 0x000A0205,
961 0x93407D29,
962 0xD2800002,
963 0x000A0205,
964 0xF2A00002,
965 0x000A0205,
966 0xF2C00002,
967 0x000A0205,
968 0xF2E00002,
969 0x000A0205,
970 0x2A0903E1,
971 0xAA1303E0,
972 0x94000000,
973 0x00030001,
974 0xF94013E9,
975 0xF9000009,
976 0x52800020,
977 0xA97F52B3,
978 0x910002BF,
979 0xA9405BF5,
980 0x910043FF,
981 0xA94063F7,
982 0x910043FF,
983 0xA9407BFD,
984 0x910043FF,
985 0xD65F03C0,
986 0x00000000,
987 0xF90013E0,
988 0x94000000,
989 0x0003001B,
990 0xD2800009,
991 0x000A0205,
992 0xF2A00009,
993 0x000A0205,
994 0xF2C00009,
995 0x000A0205,
996 0xF2E00009,
997 0x000A0205,
998 0xB9000120,
999 0x52800009,
1000 0x000A0205,
1001 0x72A00009,
1002 0x000A0205,
1003 0x93407D29,
1004 0xD2800002,
1005 0x000A0205,
1006 0xF2A00002,
1007 0x000A0205,
1008 0xF2C00002,
1009 0x000A0205,
1010 0xF2E00002,
1011 0x000A0205,
1012 0x2A0903E1,
1013 0xAA1303E0,
1014 0x94000000,
1015 0x00030001,
1016 0xF94013E9,
1017 0xF9000009,
1018 0x52800020,
1019 0xA97F52B3,
1020 0x910002BF,
1021 0xA9405BF5,
1022 0x910043FF,
1023 0xA94063F7,
1024 0x910043FF,
1025 0xA9407BFD,
1026 0x910043FF,
1027 0xD65F03C0,
1028 0x00000000,
1029 0xF90013E0,
1030 0x94000000,
1031 0x0003001B,
1032 0xD2800009,
1033 0x000A0205,
1034 0xF2A00009,
1035 0x000A0205,
1036 0xF2C00009,
1037 0x000A0205,
1038 0xF2E00009,
1039 0x000A0205,
1040 0xB9000120,
1041 0xF94013E0,
1042 0xAA0003E1,
1043 0xAA1303E0,
1044 0x94000000,
1045 0x0003001C,
1046 0x52800020,
1047 0xA97F52B3,
1048 0x910002BF,
1049 0xA9405BF5,
1050 0x910043FF,
1051 0xA94063F7,
1052 0x910043FF,
1053 0xA9407BFD,
1054 0x910043FF,
1055 0xD65F03C0,
1056 0x00000000,
1057 0xF90013E0,
1058 0x94000000,
1059 0x0003001B,
1060 0xD2800009,
1061 0x000A0205,
1062 0xF2A00009,
1063 0x000A0205,
1064 0xF2C00009,
1065 0x000A0205,
1066 0xF2E00009,
1067 0x000A0205,
1068 0xB9000120,
1069 0xF94013E0,
1070 0xAA0003E1,
1071 0xAA1303E0,
1072 0x94000000,
1073 0x0003001C,
1074 0x52800020,
1075 0xA97F52B3,
1076 0x910002BF,
1077 0xA9405BF5,
1078 0x910043FF,
1079 0xA94063F7,
1080 0x910043FF,
1081 0xA9407BFD,
1082 0x910043FF,
1083 0xD65F03C0,
1084 0x00000000,
1085 0xBD002BE0,
1086 0xBD002FE1,
1087 0x94000000,
1088 0x0003001B,
1089 0xD2800009,
1090 0x000A0205,
1091 0xF2A00009,
1092 0x000A0205,
1093 0xF2C00009,
1094 0x000A0205,
1095 0xF2E00009,
1096 0x000A0205,
1097 0xB9000120,
1098 0x52800009,
1099 0x000A0205,
1100 0x72A00009,
1101 0x000A0205,
1102 0x93407D29,
1103 0xD2800002,
1104 0x000A0205,
1105 0xF2A00002,
1106 0x000A0205,
1107 0xF2C00002,
1108 0x000A0205,
1109 0xF2E00002,
1110 0x000A0205,
1111 0x2A0903E1,
1112 0xAA1303E0,
1113 0x94000000,
1114 0x00030001,
1115 0xBD402BE0,
1116 0xBD402FE1,
1117 0xBD000000,
1118 0xBD000401,
1119 0x52800020,
1120 0xA97F52B3,
1121 0x910002BF,
1122 0xA9405BF5,
1123 0x910043FF,
1124 0xA94063F7,
1125 0x910043FF,
1126 0xA9407BFD,
1127 0x910043FF,
1128 0xD65F03C0,
1129 0x00000000,
1130 0xFD0013E0,
1131 0xFD0017E1,
1132 0x94000000,
1133 0x0003001B,
1134 0xD2800009,
1135 0x000A0205,
1136 0xF2A00009,
1137 0x000A0205,
1138 0xF2C00009,
1139 0x000A0205,
1140 0xF2E00009,
1141 0x000A0205,
1142 0xB9000120,
1143 0x52800009,
1144 0x000A0205,
1145 0x72A00009,
1146 0x000A0205,
1147 0x93407D29,
1148 0xD2800002,
1149 0x000A0205,
1150 0xF2A00002,
1151 0x000A0205,
1152 0xF2C00002,
1153 0x000A0205,
1154 0xF2E00002,
1155 0x000A0205,
1156 0x2A0903E1,
1157 0xAA1303E0,
1158 0x94000000,
1159 0x00030001,
1160 0xFD4013E0,
1161 0xFD4017E1,
1162 0xFD000000,
1163 0xFD000401,
1164 0x52800020,
1165 0xA97F52B3,
1166 0x910002BF,
1167 0xA9405BF5,
1168 0x910043FF,
1169 0xA94063F7,
1170 0x910043FF,
1171 0xA9407BFD,
1172 0x910043FF,
1173 0xD65F03C0,
1174 0x00000000,
1175 0x94000000,
1176 0x0003001B,
1177 0xD2800009,
1178 0x000A0205,
1179 0xF2A00009,
1180 0x000A0205,
1181 0xF2C00009,
1182 0x000A0205,
1183 0xF2E00009,
1184 0x000A0205,
1185 0xB9000120,
1186 0xAA1F03E0,
1187 0xA97F52B3,
1188 0x910002BF,
1189 0xA9405BF5,
1190 0x910043FF,
1191 0xA94063F7,
1192 0x910043FF,
1193 0xA9407BFD,
1194 0x910043FF,
1195 0xD65F03C0,
1196 0x00000000,
1197 0xD3401C00,
1198 0xF90013E0,
1199 0x94000000,
1200 0x0003001B,
1201 0xD2800009,
1202 0x000A0205,
1203 0xF2A00009,
1204 0x000A0205,
1205 0xF2C00009,
1206 0x000A0205,
1207 0xF2E00009,
1208 0x000A0205,
1209 0xB9000120,
1210 0xB94023E9,
1211 0x2A0903E1,
1212 0xAA1303E0,
1213 0x94000000,
1214 0x00030004,
1215 0x52800020,
1216 0xA97F52B3,
1217 0x910002BF,
1218 0xA9405BF5,
1219 0x910043FF,
1220 0xA94063F7,
1221 0x910043FF,
1222 0xA9407BFD,
1223 0x910043FF,
1224 0xD65F03C0,
1225 0x00000000,
1226 0xD3401C00,
1227 0x00000000,
1228 0x93401C00,
1229 0x00000000,
1230 0xF90013E0,
1231 0x94000000,
1232 0x0003001B,
1233 0xD2800009,
1234 0x000A0205,
1235 0xF2A00009,
1236 0x000A0205,
1237 0xF2C00009,
1238 0x000A0205,
1239 0xF2E00009,
1240 0x000A0205,
1241 0xB9000120,
1242 0xB94023E9,
1243 0x2A0903E1,
1244 0xAA1303E0,
1245 0x94000000,
1246 0x00030005,
1247 0x52800020,
1248 0xA97F52B3,
1249 0x910002BF,
1250 0xA9405BF5,
1251 0x910043FF,
1252 0xA94063F7,
1253 0x910043FF,
1254 0xA9407BFD,
1255 0x910043FF,
1256 0xD65F03C0,
1257 0x00000000,
1258 0xD3403C00,
1259 0x00000000,
1260 0x93403C00,
1261 0x00000000,
1262 0xF90013E0,
1263 0x94000000,
1264 0x0003001B,
1265 0xD2800009,
1266 0x000A0205,
1267 0xF2A00009,
1268 0x000A0205,
1269 0xF2C00009,
1270 0x000A0205,
1271 0xF2E00009,
1272 0x000A0205,
1273 0xB9000120,
1274 0xB94023E9,
1275 0x2A0903E1,
1276 0xAA1303E0,
1277 0x94000000,
1278 0x00030005,
1279 0x52800020,
1280 0xA97F52B3,
1281 0x910002BF,
1282 0xA9405BF5,
1283 0x910043FF,
1284 0xA94063F7,
1285 0x910043FF,
1286 0xA9407BFD,
1287 0x910043FF,
1288 0xD65F03C0,
1289 0x00000000,
1290 0xF90013E0,
1291 0x94000000,
1292 0x0003001B,
1293 0xD2800009,
1294 0x000A0205,
1295 0xF2A00009,
1296 0x000A0205,
1297 0xF2C00009,
1298 0x000A0205,
1299 0xF2E00009,
1300 0x000A0205,
1301 0xB9000120,
1302 0xB94023E9,
1303 0x2A0903E1,
1304 0xAA1303E0,
1305 0x94000000,
1306 0x00030006,
1307 0x52800020,
1308 0xA97F52B3,
1309 0x910002BF,
1310 0xA9405BF5,
1311 0x910043FF,
1312 0xA94063F7,
1313 0x910043FF,
1314 0xA9407BFD,
1315 0x910043FF,
1316 0xD65F03C0,
1317 0x00000000,
1318 0xF90013E0,
1319 0x94000000,
1320 0x0003001B,
1321 0xD2800009,
1322 0x000A0205,
1323 0xF2A00009,
1324 0x000A0205,
1325 0xF2C00009,
1326 0x000A0205,
1327 0xF2E00009,
1328 0x000A0205,
1329 0xB9000120,
1330 0xB94023E9,
1331 0x2A0903E1,
1332 0xAA1303E0,
1333 0x94000000,
1334 0x00030005,
1335 0x52800020,
1336 0xA97F52B3,
1337 0x910002BF,
1338 0xA9405BF5,
1339 0x910043FF,
1340 0xA94063F7,
1341 0x910043FF,
1342 0xA9407BFD,
1343 0x910043FF,
1344 0xD65F03C0,
1345 0x00000000,
1346 0x1E22C000,
1347 0xFD0013E0,
1348 0x94000000,
1349 0x0003001B,
1350 0xD2800009,
1351 0x000A0205,
1352 0xF2A00009,
1353 0x000A0205,
1354 0xF2C00009,
1355 0x000A0205,
1356 0xF2E00009,
1357 0x000A0205,
1358 0xB9000120,
1359 0xFD4013E0,
1360 0xAA1303E0,
1361 0x94000000,
1362 0x00030003,
1363 0x52800020,
1364 0xA97F52B3,
1365 0x910002BF,
1366 0xA9405BF5,
1367 0x910043FF,
1368 0xA94063F7,
1369 0x910043FF,
1370 0xA9407BFD,
1371 0x910043FF,
1372 0xD65F03C0,
1373 0x00000000,
1374 0xFD0013E0,
1375 0x94000000,
1376 0x0003001B,
1377 0xD2800009,
1378 0x000A0205,
1379 0xF2A00009,
1380 0x000A0205,
1381 0xF2C00009,
1382 0x000A0205,
1383 0xF2E00009,
1384 0x000A0205,
1385 0xB9000120,
1386 0xFD4013E0,
1387 0xAA1303E0,
1388 0x94000000,
1389 0x00030003,
1390 0x52800020,
1391 0xA97F52B3,
1392 0x910002BF,
1393 0xA9405BF5,
1394 0x910043FF,
1395 0xA94063F7,
1396 0x910043FF,
1397 0xA9407BFD,
1398 0x910043FF,
1399 0xD65F03C0,
1400 0x00000000
1401 };
1402
1403 //|.globalnames globnames
1404 static const char *const globnames[] = {
1405 (const char *)0
1406 };
1407 //|.externnames extnames
1408 static const char *const extnames[] = {
1409 "lua_rawgeti",
1410 "push_cdata",
1411 "lua_remove",
1412 "lua_pushnumber",
1413 "lua_pushboolean",
1414 "push_int",
1415 "push_uint",
1416 "lua_callk",
1417 "check_typed_pointer",
1418 "lua_settop",
1419 "check_enum",
1420 "check_uint32",
1421 "check_int32",
1422 "check_uint64",
1423 "check_int64",
1424 "check_uintptr",
1425 "check_double",
1426 "check_complex_float",
1427 "check_complex_double",
1428 "lua_gettop",
1429 "luaL_error",
1430 "check_typed_cfunction",
1431 "unpack_varargs_float",
1432 "unpack_varargs_int",
1433 "unpack_varargs_stack_skip",
1434 "SetLastError",
1435 "FUNCTION",
1436 "GetLastError",
1437 "lua_pushinteger",
1438 (const char *)0
1439 };
1440
1441 //|.define L_ARG, x19
1442 //|.define TOP, x20
1443 //|.define rbp, x21
1444 //|.define EXTRA_REG_1, x22
1445 //|.define EXTRA_REG_2, x23
1446 //|.define EXTRA_REG_3, x24
1447
1448 #define ZERO_TO_FIFTEEN_OF_64(x) (0x000000000000FFFF & (int64_t)x)
1449 #define SIXTEEN_TO_THIRTYONE_OF_64(x) ((0x00000000FFFF0000 & (int64_t)x) >> 16)
1450 #define THIRTYTWO_TO_FORTYSEVEN_OF_64(x) ((0x0000FFFF00000000 & (int64_t)x) >> 32)
1451 #define FORTYEIGHT_TO_SIXTYTHREE_OF_64(x) ((0xFFFF000000000000 & (int64_t)x) >> 48)
1452
1453 //|.macro mov64, reg, imm
1454 //| movz reg, #(ZERO_TO_FIFTEEN_OF_64(imm))
1455 //| movk reg, #(SIXTEEN_TO_THIRTYONE_OF_64(imm)), lsl #16
1456 //| movk reg, #(THIRTYTWO_TO_FORTYSEVEN_OF_64(imm)), lsl #32
1457 //| movk reg, #(FORTYEIGHT_TO_SIXTYTHREE_OF_64(imm)), lsl #48
1458 //|.endmacro
1459
1460 //|.macro mov32, reg, imm
1461 //| movz reg, #(ZERO_TO_FIFTEEN_OF_64(imm))
1462 //| movk reg, #(SIXTEEN_TO_THIRTYONE_OF_64(imm)), lsl #16
1463 //|.endmacro
1464
1465 //| // the 5 and 6 arg forms are only used on posix x64
1466 //|.macro call_ririir, func, arg0, arg1, arg2, arg3, arg4, arg5
1467 //| mov x5, arg5
1468 //| mov x4, #arg4
1469 //| mov x3, #arg3
1470 //| mov x2, arg2
1471 //| mov x1, #arg1
1472 //| mov x0, arg0
1473 //| bl func
1474 //|.endmacro
1475 //|.macro call_rrrrrr, func, arg0, arg1, arg2, arg3, arg4, arg5
1476 //| mov x5, arg5
1477 //| mov x4, arg4
1478 //| mov x3, arg3
1479 //| mov x2, arg2
1480 //| mov x1, arg1
1481 //| mov x0, arg0
1482 //| bl func
1483 //|.endmacro
1484 //|.macro call_ririr, func, arg0, arg1, arg2, arg3, arg4
1485 //| mov x4, arg4
1486 //| mov x3, #arg3
1487 //| mov x2, arg2
1488 //| mov x1, #arg1
1489 //| mov x0, arg0
1490 //| bl func
1491 //|.endmacro
1492 //|.macro call_rrrrr, func, arg0, arg1, arg2, arg3, arg4
1493 //| mov x4, arg4
1494 //| mov x3, arg3
1495 //| mov x2, arg2
1496 //| mov x1, arg1
1497 //| mov x0, arg0
1498 //| bl func
1499 //|.endmacro
1500 //|
1501 //|.macro call_riwp, func, arg0, arg1, arg2, arg3
1502 //| mov64 x3, arg3
1503 //| mov w2, arg2
1504 //| mov x1, #arg1
1505 //| mov x0, arg0
1506 //| bl func
1507 //|.endmacro
1508 //|.macro call_rwwp, func, arg0, arg1, arg2, arg3
1509 //| mov64 x3, (arg3)
1510 //| mov w2, arg2
1511 //| mov w1, arg1
1512 //| mov x0, arg0
1513 //| bl func
1514 //|.endmacro
1515 //|.macro call_riip, func, arg0, arg1, arg2, arg3
1516 //| mov64 x3, (arg3)
1517 //| mov x2, #(arg2)
1518 //| mov x1, #(arg1)
1519 //| mov x0, arg0
1520 //| bl func
1521 //|.endmacro
1522 //|.macro call_rrrp, func, arg0, arg1, arg2, arg3
1523 //| mov64 x3, arg3
1524 //| mov x2, arg2
1525 //| mov x1, arg1
1526 //| mov x0, arg0
1527 //| bl func
1528 //|.endmacro
1529 //|.macro call_rrrr, func, arg0, arg1, arg2, arg3
1530 //| mov x3, arg3
1531 //| mov x2, arg2
1532 //| mov x1, arg1
1533 //| mov x0, arg0
1534 //| bl func
1535 //|.endmacro
1536 //|
1537 //|.macro call_rwp, func, arg0, arg1, arg2
1538 //| mov64 x2, arg2
1539 //| mov w1, arg1
1540 //| mov x0, arg0
1541 //| bl func
1542 //|.endmacro
1543 //|.macro call_rip, func, arg0, arg1, arg2
1544 //| mov64 x2, arg2
1545 //| mov x1, #arg1
1546 //| mov x0, arg0
1547 //| bl func
1548 //|.endmacro
1549 //|.macro call_rrp, func, arg0, arg1, arg2
1550 //| mov64 x2, arg2
1551 //| mov x1, arg1
1552 //| mov x0, arg0
1553 //| bl func
1554 //|.endmacro
1555 //|.macro call_rww, func, arg0, arg1, arg2
1556 //| mov w2, arg2
1557 //| mov w1, arg1
1558 //| mov x0, arg0
1559 //| bl func
1560 //|.endmacro
1561 //|.macro call_rwi, func, arg0, arg1, arg2
1562 //| mov x2, #(arg2)
1563 //| mov w1, arg1
1564 //| mov x0, arg0
1565 //| bl func
1566 //|.endmacro
1567 //|.macro call_rii, func, arg0, arg1, arg2
1568 //| mov x2, #(arg2)
1569 //| mov x1, #(arg1)
1570 //| mov x0, arg0
1571 //| bl func
1572 //|.endmacro
1573 //|.macro call_rrr, func, arg0, arg1, arg2
1574 //| mov x2, arg2
1575 //| mov x1, arg1
1576 //| mov x0, arg0
1577 //| bl func
1578 //|.endmacro
1579 //|
1580 //|.macro call_rp, func, arg0, arg1
1581 //| mov64 x1, arg1
1582 //| mov x0, arg0
1583 //| bl func
1584 //|.endmacro
1585 //|.macro call_ri, func, arg0, arg1
1586 //| mov x1, #(arg1)
1587 //| mov x0, arg0
1588 //| bl func
1589 //|.endmacro
1590 //|.macro call_rw, func, arg0, arg1
1591 //| mov w1, arg1
1592 //| mov x0, arg0
1593 //| bl func
1594 //|.endmacro
1595 //|.macro call_rr, func, arg0, arg1
1596 //| mov x1, arg1
1597 //| mov x0, arg0
1598 //| bl func
1599 //|.endmacro
1600 //|
1601 //|.macro call_w, func, arg0
1602 //| mov w0, arg0
1603 //| bl func
1604 //|.endmacro
1605 //|.macro call_r, func, arg0
1606 //| mov x0, arg0
1607 //| bl func
1608 //|.endmacro
1609 //|
1610
1611 //|.macro call_debug
1612 //| sub sp, sp, #(16*8)
1613 //| str x0, [sp]
1614 //| str x1, [sp,#8]
1615 //| str x2, [sp,#16]
1616 //| str x3, [sp,#24]
1617 //| str x4, [sp,#32]
1618 //| str x5, [sp,#40]
1619 //| str x6, [sp,#48]
1620 //| str x7, [sp,#56]
1621 //| str x8, [sp,#64]
1622 //| str x9, [sp,#72]
1623 //| str x10, [sp,#80]
1624 //| str x11, [sp,#88]
1625 //| str x12, [sp,#96]
1626 //| str x13, [sp,#104]
1627 //| str x14, [sp,#112]
1628 //| str x15, [sp,#120]
1629 //| bl extern debug_statement
1630 //| ldr x0, [sp]
1631 //| ldr x1, [sp,#8]
1632 //| ldr x2, [sp,#16]
1633 //| ldr x3, [sp,#24]
1634 //| ldr x4, [sp,#32]
1635 //| ldr x5, [sp,#40]
1636 //| ldr x6, [sp,#48]
1637 //| ldr x7, [sp,#56]
1638 //| ldr x8, [sp,#64]
1639 //| ldr x9, [sp,#72]
1640 //| ldr x10, [sp,#80]
1641 //| ldr x11, [sp,#88]
1642 //| ldr x12, [sp,#96]
1643 //| ldr x13, [sp,#104]
1644 //| ldr x14, [sp,#112]
1645 //| ldr x15, [sp,#120]
1646 //| add sp, sp, #(16*8)
1647 //|.endmacro
1648
1649 //|.macro call_debug_float, one
1650 //| sub sp, sp, #(16*8)
1651 //| str d0, [sp]
1652 //| str d1, [sp,#16]
1653 //| str d2, [sp,#32]
1654 //| str d3, [sp,#48]
1655 //| str d4, [sp,#64]
1656 //| str d5, [sp,#80]
1657 //| str d6, [sp,#96]
1658 //| str d7, [sp,#112]
1659 //| fmov s0, one
1660 //| bl extern debug_float
1661 //| ldr d0, [sp]
1662 //| ldr d1, [sp,#16]
1663 //| ldr d2, [sp,#32]
1664 //| ldr d3, [sp,#48]
1665 //| ldr d4, [sp,#64]
1666 //| ldr d5, [sp,#80]
1667 //| ldr d6, [sp,#96]
1668 //| ldr d7, [sp,#112]
1669 //| add sp, sp, #(16*8)
1670 //|.endmacro
1671
1672 //|.macro call_debug_double, one
1673 //| sub sp, sp, #(16*8)
1674 //| str d0, [sp]
1675 //| str d1, [sp,#16]
1676 //| str d2, [sp,#32]
1677 //| str d3, [sp,#48]
1678 //| str d4, [sp,#64]
1679 //| str d5, [sp,#80]
1680 //| str d6, [sp,#96]
1681 //| str d7, [sp,#112]
1682 //| fmov d0, one
1683 //| bl extern debug_double
1684 //| ldr d0, [sp]
1685 //| ldr d1, [sp,#16]
1686 //| ldr d2, [sp,#32]
1687 //| ldr d3, [sp,#48]
1688 //| ldr d4, [sp,#64]
1689 //| ldr d5, [sp,#80]
1690 //| ldr d6, [sp,#96]
1691 //| ldr d7, [sp,#112]
1692 //| add sp, sp, #(16*8)
1693 //|.endmacro
1694
1695 //|.macro call_debug_int, one
1696 //| sub sp, sp, #(16*8)
1697 //| str x0, [sp]
1698 //| str x1, [sp,#8]
1699 //| str x2, [sp,#16]
1700 //| str x3, [sp,#24]
1701 //| str x4, [sp,#32]
1702 //| str x5, [sp,#40]
1703 //| str x6, [sp,#48]
1704 //| str x7, [sp,#56]
1705 //| str x8, [sp,#64]
1706 //| str x9, [sp,#72]
1707 //| str x10, [sp,#80]
1708 //| str x11, [sp,#88]
1709 //| str x12, [sp,#96]
1710 //| str x13, [sp,#104]
1711 //| str x14, [sp,#112]
1712 //| str x15, [sp,#120]
1713 //| mov x0, one
1714 //| bl extern debug_int
1715 //| ldr x0, [sp]
1716 //| ldr x1, [sp,#8]
1717 //| ldr x2, [sp,#16]
1718 //| ldr x3, [sp,#24]
1719 //| ldr x4, [sp,#32]
1720 //| ldr x5, [sp,#40]
1721 //| ldr x6, [sp,#48]
1722 //| ldr x7, [sp,#56]
1723 //| ldr x8, [sp,#64]
1724 //| ldr x9, [sp,#72]
1725 //| ldr x10, [sp,#80]
1726 //| ldr x11, [sp,#88]
1727 //| ldr x12, [sp,#96]
1728 //| ldr x13, [sp,#104]
1729 //| ldr x14, [sp,#112]
1730 //| ldr x15, [sp,#120]
1731 //| add sp, sp, #(16*8)
1732 //|.endmacro
1733
1734 //|.macro call_debug_1, one
1735 //| sub sp, sp, #(16*8)
1736 //| str x0, [sp]
1737 //| str x1, [sp,#8]
1738 //| str x2, [sp,#16]
1739 //| str x3, [sp,#24]
1740 //| str x4, [sp,#32]
1741 //| str x5, [sp,#40]
1742 //| str x6, [sp,#48]
1743 //| str x7, [sp,#56]
1744 //| str x8, [sp,#64]
1745 //| str x9, [sp,#72]
1746 //| str x10, [sp,#80]
1747 //| str x11, [sp,#88]
1748 //| str x12, [sp,#96]
1749 //| str x13, [sp,#104]
1750 //| str x14, [sp,#112]
1751 //| str x15, [sp,#120]
1752 //| mov x0, one
1753 //| bl extern debug_statement_with_arg
1754 //| ldr x0, [sp]
1755 //| ldr x1, [sp,#8]
1756 //| ldr x2, [sp,#16]
1757 //| ldr x3, [sp,#24]
1758 //| ldr x4, [sp,#32]
1759 //| ldr x5, [sp,#40]
1760 //| ldr x6, [sp,#48]
1761 //| ldr x7, [sp,#56]
1762 //| ldr x8, [sp,#64]
1763 //| ldr x9, [sp,#72]
1764 //| ldr x10, [sp,#80]
1765 //| ldr x11, [sp,#88]
1766 //| ldr x12, [sp,#96]
1767 //| ldr x13, [sp,#104]
1768 //| ldr x14, [sp,#112]
1769 //| ldr x15, [sp,#120]
1770 //| add sp, sp, #(16*8)
1771 //|.endmacro
1772
1773 //|.macro call_debug_sp
1774 //| mov x15, sp
1775 //| call_debug_1 x15
1776 //|.endmacro
1777
1778 //|.macro epilog
1779 //| //ldr L_ARG, [rbp, #(-16)]
1780 //| //ldr TOP, [rbp, #(-8)]
1781 //| ldp L_ARG, TOP, [rbp, #(-16)]
1782 //| mov sp, rbp
1783 //| ldp rbp, EXTRA_REG_1, [sp]
1784 //| add sp, sp, #16
1785 //| ldp EXTRA_REG_2, EXTRA_REG_3, [sp]
1786 //| add sp, sp, #16
1787 //| ldp x29, x30, [sp]
1788 //| add sp, sp, #16
1789 //| ret
1790 //|.endmacro
1791
1792 //|.macro get_errno // note trashes registers
1793 //| bl extern GetLastError
1794 //| mov64 x9, perr
1795 //| str w0, [x9]
1796 //|.endmacro
1797
1798 #define MESSAGE_1 "Too few arguments"
1799 #define MESSAGE_2 "Too many arguments"
1800
1801 //|.macro too_few_arguments
1802 //| mov64 x9, MESSAGE_1
1803 //| call_rr extern luaL_error, L_ARG, x9
1804 //|.endmacro
1805
1806 //|.macro too_many_arguments
1807 //| mov64 x9, MESSAGE_2
1808 //| call_rr extern luaL_error, L_ARG, x9
1809 //|.endmacro
1810
1811 //|.macro lua_return_arg
1812 //| mov x0, #1
1813 //| epilog
1814 //|.endmacro
1815
1816 //|.macro lua_return_void
1817 //| get_errno
1818 //| mov x0, xzr
1819 //| epilog
1820 //|.endmacro
1821
1822 //|.macro lua_return_double
1823 //| str d0, [sp, #32]
1824 //| get_errno
1825 //| ldr d0, [sp, #32]
1826 //| mov x0, L_ARG
1827 //| bl extern lua_pushnumber
1828 //| lua_return_arg
1829 //|.endmacro
1830
1831 //|.macro lua_return_bool
1832 //| ubfm x0, x0, #0, #7
1833 //| str x0, [sp,#32]
1834 //| get_errno
1835 //| ldr w9, [sp,#32]
1836 //| call_rw extern lua_pushboolean, L_ARG, w9
1837 //| lua_return_arg
1838 //|.endmacro
1839
1840 //|.macro lua_return_int
1841 //| //mov [sp,#32], eax
1842 //| str x0, [sp,#32]
1843 //| get_errno
1844 //| ldr w9, [sp,#32]
1845 //| call_rw extern push_int, L_ARG, w9
1846 //| lua_return_arg
1847 //|.endmacro
1848
1849 //|.macro lua_return_uint
1850 //| str x0, [sp,#32]
1851 //| get_errno
1852 //| ldr w9, [sp,#32]
1853 //| call_rw extern push_uint, L_ARG, w9
1854 //| lua_return_arg
1855 //|.endmacro
1856
1857 //|.macro lua_return_long
1858 //| str x0, [sp,#32]
1859 //| get_errno
1860 //| ldr x0, [sp,#32]
1861 //| call_rr extern lua_pushinteger, L_ARG, x0
1862 //| lua_return_arg
1863 //|.endmacro
1864
1865 //|.macro lua_return_ulong
1866 //| str x0, [sp,#32]
1867 //| get_errno
1868 //| ldr x0, [sp,#32]
1869 //| call_rr extern lua_pushinteger, L_ARG, x0
1870 //| lua_return_arg
1871 //|.endmacro
1872
1873 //|.macro save_registers
1874 //| // use rbp relative so we store values in the outer stack frame
1875 //| // Floating point registers
1876 //| str d0, [rbp, #-32]
1877 //| str d1, [rbp, #-48]
1878 //| str d2, [rbp, #-64]
1879 //| str d3, [rbp, #-80]
1880 //| str d4, [rbp, #-88]
1881 //| str d5, [rbp, #-96]
1882 //| str d6, [rbp, #-112]
1883 //| str d7, [rbp, #-128]
1884
1885 //| // Integral registers
1886 //| str x0, [rbp, #-136]
1887 //| str x1, [rbp, #-144]
1888 //| str x2, [rbp, #-152]
1889 //| str x3, [rbp, #-160]
1890 //| str x4, [rbp, #-168]
1891 //| str x5, [rbp, #-176]
1892 //| str x6, [rbp, #-184]
1893 //| str x7, [rbp, #-192]
1894 //|.endmacro
1895
1896 #define JUMP_SIZE 24
1897 #define MIN_BRANCH ((INT32_MIN) >> 6)
1898 #define MAX_BRANCH ((INT32_MAX) >> 6)
1899 #define BRANCH_OFF -4
1900
1901 static void compile_extern_jump(struct jit* jit, lua_State* L, cfunction func, uint8_t* code)
1902 {
1903 /* The jump code is the function pointer followed by a stub to call the
1904 * function pointer. The stub exists so we can jump to functions with an
1905 * offset farther than +/-128MB.
1906 *
1907 * Note we have to manually set this up since there are commands buffered
1908 * in the jit state.
1909 */
1910 //printf("%s:%d code = [%p]\n", __FILE__, __LINE__, code);
1911 *((cfunction*) (&code[0])) = func;
1912 *((uint32_t*) (&code[8])) = (uint32_t)0x10FFFFC9U; // ADR X9, #-8
1913 *((uint32_t*) (&code[12])) = (uint32_t)0xF940012aU; // LDR X10, [X9]
1914 *((uint32_t*) (&code[16])) = (uint32_t)0xD61F0140U; // BR X10
1915 *((uint32_t*) (&code[20])) = (uint32_t)0x0; // NULL
1916 //printf("%s:%d addr = [%p] sizeof(cfunction) = [%zu] function=[%p]\n",
1917 //__FILE__, __LINE__, &(code[8]), sizeof(cfunction), (*((cfunction*)(&code[0]))));
1918 }
1919
1920 void compile_globals(struct jit* jit, lua_State* L)
1921 {
1922 struct jit* Dst = jit;
1923 int* perr = &jit->last_errno;
1924 dasm_setup(Dst, build_actionlist);
1925
1926 /* Note: since the return code uses EBP to reset the stack pointer, we
1927 * don't have to track the amount of stack space used. It also means we
1928 * can handle stdcall and cdecl with the same code.
1929 */
1930
1931 /* Note the various call_* functions want 32 bytes of 16 byte aligned
1932 * stack
1933 */
1934
1935 compile(Dst, L, NULL, LUA_NOREF);
1936 }
1937
1938 int arm64_return_size(lua_State* L, int usr, const struct ctype* ct)
1939 {
1940 int ret = 0;
1941 const struct ctype* mt;
1942
1943 if (ct->calling_convention != C_CALL) {
1944 size_t i;
1945 size_t argn = lua_rawlen(L, usr);
1946 for (i = 1; i <= argn; i++) {
1947 lua_rawgeti(L, usr, (int) i);
1948 mt = (const struct ctype*) lua_touserdata(L, -1);
1949
1950 if (mt->pointers || mt->is_reference) {
1951 ret += sizeof(void*);
1952 } else {
1953 switch (mt->type) {
1954 case DOUBLE_TYPE:
1955 case COMPLEX_FLOAT_TYPE:
1956 case INT64_TYPE:
1957 ret += 8;
1958 break;
1959 case COMPLEX_DOUBLE_TYPE:
1960 ret += 16;
1961 break;
1962 case INTPTR_TYPE:
1963 ret += sizeof(intptr_t);
1964 break;
1965 case FUNCTION_PTR_TYPE:
1966 ret += sizeof(cfunction);
1967 break;
1968 case BOOL_TYPE:
1969 case FLOAT_TYPE:
1970 case INT8_TYPE:
1971 case INT16_TYPE:
1972 case INT32_TYPE:
1973 case ENUM_TYPE:
1974 ret += 4;
1975 break;
1976 default:
1977 return luaL_error(L, "NYI - argument type");
1978 }
1979 }
1980
1981 lua_pop(L, 1);
1982 }
1983 }
1984
1985 return ret;
1986 }
1987
1988 #define MAX_INT_REGISTERS(ct) 8 /* x0-x7 */
1989 #define MAX_FLOAT_REGISTERS(ct) 8 /* q0-q7 */
1990
1991 struct reg_alloc {
1992 int floats;
1993 int ints;
1994 int off;
1995 };
1996
1997 #define REGISTER_STACK_SPACE(ct) ((8*8) + (128*8)) /* 8, 64 bit registers x0-x7 and 8, 128 bit registers v0-v7 */
1998
1999 /* Fastcall:
2000 * Uses ecx, edx as first two int registers
2001 * Everything else on stack (include 64bit ints)
2002 * No overflow stack space
2003 * Pops the stack before returning
2004 * Returns int in eax, float in ST0
2005 * We use the same register allocation logic as posix x64 with 2 int regs and 0 float regs
2006 */
2007
2008 typedef enum {
2009 int8,
2010 int16,
2011 int32,
2012 int64,
2013 int128
2014 } int_type_enum;
2015
2016 static void get_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int_type_enum int_type)
2017 {
2018 /* grab the register from the shadow space */
2019 if (reg->ints < MAX_INT_REGISTERS(ct)) {
2020 int x = -(136 + 8*reg->ints);
2021 //| ldr x9, [rbp , #(x)]
2022 dasm_put(Dst, 0, (x));
2023 reg->ints++;
2024 }
2025 else {
2026 switch (int_type) {
2027 case int8:
2028 #ifdef OS_OSX
2029 //| ldrb w9, [rbp , #(reg->off)]
2030 dasm_put(Dst, 3, (reg->off));
2031 reg->off += 1;
2032 break;
2033 #endif
2034 case int16:
2035 #ifdef OS_OSX
2036 //| ldrh w9, [rbp , #(reg->off)]
2037 dasm_put(Dst, 6, (reg->off));
2038 reg->off += 2;
2039 break;
2040 #endif
2041 case int32:
2042 //| ldr w9, [rbp , #(reg->off)]
2043 dasm_put(Dst, 9, (reg->off));
2044 #ifdef OS_OSX
2045 reg->off += 4;
2046 #else
2047 reg->off += 8;
2048 #endif
2049 break;
2050 case int64:
2051 //| ldr x9, [rbp , #(reg->off)] // x9 is a scratch register
2052 dasm_put(Dst, 12, (reg->off));
2053 reg->off += 8;
2054 break;
2055 case int128:
2056 default:
2057 fprintf(stderr, "Unsupported data type\n");
2058 abort();
2059 break;
2060 }
2061 }
2062 }
2063
2064 static void add_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int_type_enum int_type)
2065 {
2066 if (reg->ints < MAX_INT_REGISTERS(ct)) {
2067 //| str x0, [sp , #(32 + 8*reg->ints)]
2068 dasm_put(Dst, 15, (32 + 8*reg->ints));
2069 reg->ints++;
2070 }
2071 else {
2072 #ifndef OS_OSX
2073 if (reg->off % 8 != 0) {
2074 reg->off += 8 - (reg->off % 8);
2075 }
2076 #endif
2077 switch (int_type) {
2078 case int8:
2079 #ifdef OS_OSX
2080 //| strb w0, [sp , #(reg->off)]
2081 dasm_put(Dst, 18, (reg->off));
2082 reg->off += 1;
2083 break;
2084 #endif
2085 case int16:
2086 #ifdef OS_OSX
2087 //| strh w0, [sp , #(reg->off)]
2088 dasm_put(Dst, 21, (reg->off));
2089 reg->off += 2;
2090 break;
2091 #endif
2092 case int32:
2093 //| str w0, [sp , #(reg->off)]
2094 dasm_put(Dst, 24, (reg->off));
2095 #ifdef OS_OSX
2096 reg->off += 4;
2097 #else
2098 reg->off += 8;
2099 #endif
2100 break;
2101 case int64:
2102 //| str x0, [sp , #(reg->off)]
2103 dasm_put(Dst, 27, (reg->off));
2104 reg->off += 8;
2105 break;
2106 case int128:
2107 default:
2108 fprintf(stderr, "Unsupported data type\n");
2109 abort();
2110 break;
2111 }
2112 }
2113 }
2114
2115 static void get_float(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int is_double)
2116 {
2117 int off;
2118
2119 if (reg->floats < MAX_FLOAT_REGISTERS(ct)) {
2120 off = -32 - 16*reg->floats;
2121 reg->floats++;
2122 }
2123 else {
2124 off = reg->off;
2125 if (is_double) {
2126 reg->off += 8;
2127 }
2128 else {
2129 #ifdef OS_OSX
2130 reg->off += 4;
2131 #else
2132 reg->off += 8;
2133 #endif
2134 }
2135 }
2136
2137 if (is_double) {
2138 //| ldr d0, [rbp, #off]
2139 dasm_put(Dst, 30, off);
2140 } else {
2141 //| ldr s16, [rbp, #off] // s16 is a scratch register
2142 //| fcvt d0, s16
2143 dasm_put(Dst, 33, off);
2144 }
2145 }
2146
2147 static void get_complex_float(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int is_double)
2148 {
2149 if (reg->floats < (MAX_FLOAT_REGISTERS(ct)-1)) {
2150 int off = 0;
2151 if (is_double) {
2152 off = -32 - 16*reg->floats;
2153 //| ldr d0, [rbp, #off]
2154 dasm_put(Dst, 37, off);
2155 reg->floats++;
2156 off = -32 - 16*reg->floats;
2157 //| ldr d1, [rbp, #off]
2158 dasm_put(Dst, 40, off);
2159 reg->floats++;
2160 } else {
2161 off = -32 - 16*reg->floats;
2162 //| ldr s0, [rbp, #off] // s16 is a scratch register
2163 dasm_put(Dst, 43, off);
2164 reg->floats++;
2165 off = -32 - 16*reg->floats;
2166 //| ldr s1, [rbp, #off] // s16 is a scratch register
2167 dasm_put(Dst, 46, off);
2168 reg->floats++;
2169 }
2170 }
2171 else {
2172 if (reg->floats == (MAX_FLOAT_REGISTERS(ct)-1)) {
2173 reg->floats = MAX_FLOAT_REGISTERS(ct);
2174 }
2175 if (is_double) {
2176 //| ldr d0, [rbp, #(reg->off)]
2177 dasm_put(Dst, 49, (reg->off));
2178 reg->off += 8;
2179 //| ldr d1, [rbp, #(reg->off)]
2180 dasm_put(Dst, 52, (reg->off));
2181 reg->off += 8;
2182 } else {
2183 //| ldr s0, [rbp, #(reg->off)] // s16 is a scratch register
2184 dasm_put(Dst, 55, (reg->off));
2185 #ifdef OS_OSX
2186 reg->off += 4;
2187 #else
2188 reg->off += 8;
2189 #endif
2190 //| ldr s1, [rbp, #(reg->off)] // s16 is a scratch register
2191 dasm_put(Dst, 58, (reg->off));
2192 #ifdef OS_OSX
2193 reg->off += 4;
2194 #else
2195 reg->off += 8;
2196 #endif
2197 }
2198 }
2199
2200 }
2201
2202 static void add_float(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int is_double)
2203 {
2204 if (reg->floats < MAX_FLOAT_REGISTERS(ct)) {
2205 if (is_double) {
2206 //| str d0, [sp , #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2207 dasm_put(Dst, 61, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2208 } else {
2209 //| fcvt s0, d0 // This is necessary because in lua float is also
2210 dasm_put(Dst, 64);
2211 // handled as doube
2212 //| str s0, [sp, #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2213 dasm_put(Dst, 66, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2214 }
2215 reg->floats++;
2216 }
2217 else if (is_double) {
2218 //| str d0, [sp, #(reg->off)]
2219 dasm_put(Dst, 69, (reg->off));
2220 reg->off += 8;
2221 } else {
2222 //| fcvt s0, d0
2223 //| str s0, [sp, #(reg->off)]
2224 dasm_put(Dst, 72, (reg->off));
2225 #ifdef OS_OSX
2226 reg->off += 4;
2227 #else
2228 reg->off += 8;
2229 #endif
2230 }
2231 }
2232
2233 static void add_complex_float(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int is_double)
2234 {
2235 //printf("%s:%d floats = [%d]\n", __FILE__, __LINE__, reg->floats);
2236 if (reg->floats < (MAX_FLOAT_REGISTERS(ct)-1)) {
2237 if (is_double) {
2238 //| str d0, [sp , #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2239 dasm_put(Dst, 76, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2240 reg->floats++;
2241 //| str d1, [sp , #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2242 dasm_put(Dst, 79, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2243 reg->floats++;
2244 } else {
2245 //| str s0, [sp, #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2246 dasm_put(Dst, 82, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2247 reg->floats++;
2248 //| str s1, [sp, #(32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats))]
2249 dasm_put(Dst, 85, (32 + 8*(MAX_INT_REGISTERS(ct) + reg->floats)));
2250 reg->floats++;
2251 }
2252 if (reg->floats > (MAX_FLOAT_REGISTERS(ct)-1)) {
2253 reg->floats = MAX_FLOAT_REGISTERS(ct);
2254 }
2255 }
2256 else {
2257 //printf("%s:%d floats = [%d]\n", __FILE__, __LINE__, reg->floats);
2258 if (reg->floats == (MAX_FLOAT_REGISTERS(ct)-1)) {
2259 reg->floats = MAX_FLOAT_REGISTERS(ct);
2260 }
2261 //printf("%s:%d floats = [%d]\n", __FILE__, __LINE__, reg->floats);
2262 if (is_double) {
2263 //| str d0, [sp, #(reg->off)]
2264 dasm_put(Dst, 88, (reg->off));
2265 reg->off += 8;
2266 //| str d1, [sp, #(reg->off)]
2267 dasm_put(Dst, 91, (reg->off));
2268 reg->off += 8;
2269 } else {
2270 //| str s0, [sp, #(reg->off)]
2271 dasm_put(Dst, 94, (reg->off));
2272 #ifdef OS_OSX
2273 reg->off += 4;
2274 #else
2275 reg->off += 8;
2276 #endif
2277 //| str s1, [sp, #(reg->off)]
2278 dasm_put(Dst, 97, (reg->off));
2279 #ifdef OS_OSX
2280 reg->off += 4;
2281 #else
2282 reg->off += 8;
2283 #endif
2284 }
2285 }
2286 }
2287
2288 #define add_pointer(jit, ct, reg) add_int(jit, ct, reg, int64)
2289 #define get_pointer(jit, ct, reg) get_int(jit, ct, reg, int64)
2290
2291 cfunction compile_callback(lua_State* L, int fidx, int ct_usr, const struct ctype* ct)
2292 {
2293 int i, nargs;
2294 cfunction* pf;
2295 struct ctype ct2 = *ct;
2296 const struct ctype* mt;
2297 struct reg_alloc reg;
2298 int num_upvals = 0;
2299 int top = lua_gettop(L);
2300 struct jit* Dst = get_jit(L);
2301 int ref;
2302 int hidden_arg_off = 0;
2303
2304 ct_usr = lua_absindex(L, ct_usr);
2305 fidx = lua_absindex(L, fidx);
2306
2307 assert(lua_isnil(L, fidx) || lua_isfunction(L, fidx));
2308
2309 memset(&reg, 0, sizeof(reg));
2310 reg.off = 48;
2311
2312 dasm_setup(Dst, build_actionlist);
2313
2314 // add a table to store ctype and function upvalues
2315 // callback_set assumes the first value is the lua function
2316 nargs = (int) lua_rawlen(L, ct_usr);
2317 lua_newtable(L);
2318 lua_pushvalue(L, -1);
2319 ref = luaL_ref(L, LUA_REGISTRYINDEX);
2320
2321 if (ct->has_var_arg) {
2322 luaL_error(L, "can't create callbacks with varargs");
2323 }
2324
2325 // setup a stack frame to hold args for the call into lua_call
2326
2327 //| sub sp, sp, #64 // = -64
2328 //| stp x29, x30, [sp, #48] // 16-byte Folded Spill
2329 //| stp EXTRA_REG_2, EXTRA_REG_3, [sp, #32] // 16-byte Folded Spill
2330 //| stp rbp, EXTRA_REG_1, [sp, #16] // 16-byte Folded Spill
2331 //| stp L_ARG, TOP, [sp]
2332 //| // -64 -56 -48 -40 -32 -24 -16 -8
2333 //| // stack is -64 (mod 16) (L_ARG, TOP, rbp, EXTRA_REG_1, EXTRA_REG_2, EXTRA_REG_3, x29, x30)
2334 //| // L_ARG -> -64
2335 //| // TOP -> -56
2336 //| // rbp -> -48
2337 //| // EXTRA_REG_1 -> -40
2338 //| // EXTRA_REG_2 -> -32
2339 //| // EXTRA_REG_3 -> -24
2340 //| // x29 -> -16
2341 //| // x30 -> -8
2342 //| //
2343 //| add rbp, sp, #16
2344 //|
2345 dasm_put(Dst, 100);
2346
2347 //| // stack -64 (mod 16) (L_ARG, rbp, rip)
2348 //| // 16 for return vars, 32 for local calls, rest to save registers
2349 //| sub sp, sp, #(16 + 32 + REGISTER_STACK_SPACE(ct))
2350 //| save_registers
2351 dasm_put(Dst, 107, (16 + 32 + REGISTER_STACK_SPACE(ct)));
2352
2353 //| mov64 L_ARG, L
2354 dasm_put(Dst, 126, (ZERO_TO_FIFTEEN_OF_64(L)), (SIXTEEN_TO_THIRTYONE_OF_64(L)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(L)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(L)));
2355
2356 /* get the upval table */
2357 //| mov32 w9, LUA_REGISTRYINDEX
2358 //| mov32 w10, ref
2359 //| call_rww extern lua_rawgeti, L_ARG, w9, w10
2360 dasm_put(Dst, 135, (ZERO_TO_FIFTEEN_OF_64(LUA_REGISTRYINDEX)), (SIXTEEN_TO_THIRTYONE_OF_64(LUA_REGISTRYINDEX)), (ZERO_TO_FIFTEEN_OF_64(ref)), (SIXTEEN_TO_THIRTYONE_OF_64(ref)));
2361
2362 /* get the lua function */
2363 lua_pushvalue(L, fidx);
2364 lua_rawseti(L, -2, ++num_upvals);
2365 assert(num_upvals == CALLBACK_FUNC_USR_IDX);
2366 //| mov32 w9, -1
2367 //| call_rwi extern lua_rawgeti, L_ARG, w9, num_upvals
2368 dasm_put(Dst, 149, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (num_upvals));
2369
2370 (void) hidden_arg_off;
2371
2372 for (i = 1; i <= nargs; i++) {
2373 lua_rawgeti(L, ct_usr, i);
2374 mt = (const struct ctype*) lua_touserdata(L, -1);
2375
2376 if (mt->pointers || mt->is_reference) {
2377 lua_getuservalue(L, -1);
2378 lua_rawseti(L, -3, ++num_upvals); /* usr value */
2379 lua_rawseti(L, -2, ++num_upvals); /* mt */
2380 /* on the lua stack in the callback:
2381 * upval tbl, lua func, i-1 args
2382 */
2383 //| mov32 w9, -i-1
2384 //| call_rwi extern lua_rawgeti, L_ARG, w9, num_upvals-1
2385 //| mov32 w9, -1
2386 //| call_rwp extern push_cdata, L_ARG, w9, mt
2387 dasm_put(Dst, 160, (ZERO_TO_FIFTEEN_OF_64(-i-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-i-1)), (num_upvals-1), (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(mt)), (SIXTEEN_TO_THIRTYONE_OF_64(mt)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mt)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mt)));
2388 get_pointer(Dst, ct, &reg);
2389 //| str x9, [x0]
2390 //| mov32 w9, -2
2391 //| call_rw, extern lua_remove, L_ARG, w9
2392 dasm_put(Dst, 187, (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)));
2393 } else {
2394 switch (mt->type) {
2395 case INT64_TYPE:
2396 lua_getuservalue(L, -1);
2397 lua_rawseti(L, -3, ++num_upvals); /* mt */
2398 lua_pop(L, 1);
2399 //| call_rip extern push_cdata, L_ARG, 0, mt
2400 dasm_put(Dst, 197, (ZERO_TO_FIFTEEN_OF_64(mt)), (SIXTEEN_TO_THIRTYONE_OF_64(mt)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mt)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mt)));
2401 get_int(Dst, ct, &reg, int64);
2402 //| str x9, [x0]
2403 dasm_put(Dst, 210);
2404 break;
2405
2406 case INTPTR_TYPE:
2407 lua_getuservalue(L, -1);
2408 lua_rawseti(L, -3, ++num_upvals); /* mt */
2409 lua_pop(L, 1);
2410 //| call_rip extern push_cdata, L_ARG, 0, mt
2411 dasm_put(Dst, 212, (ZERO_TO_FIFTEEN_OF_64(mt)), (SIXTEEN_TO_THIRTYONE_OF_64(mt)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mt)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mt)));
2412 get_pointer(Dst, ct, &reg);
2413 //| str x9, [x0]
2414 dasm_put(Dst, 225);
2415 break;
2416
2417 case COMPLEX_FLOAT_TYPE:
2418 lua_pop(L, 1);
2419 /* complex floats are two floats packed into a double */
2420 //| call_rip extern push_cdata, L_ARG, 0, mt
2421 dasm_put(Dst, 227, (ZERO_TO_FIFTEEN_OF_64(mt)), (SIXTEEN_TO_THIRTYONE_OF_64(mt)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mt)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mt)));
2422 get_complex_float(Dst, ct, &reg, 0);
2423 //| str s0, [x0]
2424 //| str s1, [x0, #4]
2425 dasm_put(Dst, 240);
2426 break;
2427
2428 case COMPLEX_DOUBLE_TYPE:
2429 lua_pop(L, 1);
2430 //| call_rip extern push_cdata, L_ARG, 0, mt
2431 dasm_put(Dst, 243, (ZERO_TO_FIFTEEN_OF_64(mt)), (SIXTEEN_TO_THIRTYONE_OF_64(mt)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mt)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mt)));
2432 get_complex_float(Dst, ct, &reg, 1);
2433 //| str d0, [x0]
2434 //| str d1, [x0, #8]
2435 dasm_put(Dst, 256);
2436 break;
2437
2438 case FLOAT_TYPE:
2439 lua_pop(L, 1);
2440 get_float(Dst, ct, &reg, 0);
2441 //| // for 64bit xmm0 is already set
2442 //| mov x0, L_ARG
2443 //| bl extern lua_pushnumber
2444 dasm_put(Dst, 259);
2445 break;
2446
2447 case DOUBLE_TYPE:
2448 lua_pop(L, 1);
2449 get_float(Dst, ct, &reg, 1);
2450 //| // for 64bit xmm0 is already set
2451 //| mov x0, L_ARG
2452 //| bl extern lua_pushnumber
2453 dasm_put(Dst, 263);
2454 break;
2455
2456 case BOOL_TYPE:
2457 lua_pop(L, 1);
2458 get_int(Dst, ct, &reg, int8);
2459 //| //movzx ecx, cl
2460 //| cmp w9, #0
2461 //| beq >1
2462 //| mov b9, #1
2463 //| 1:
2464 //| ubfm x9, x9, #0, #7
2465 //| call_rr extern lua_pushboolean, L_ARG, x9
2466 dasm_put(Dst, 267);
2467 break;
2468
2469 case INT8_TYPE:
2470 lua_pop(L, 1);
2471 get_int(Dst, ct, &reg, int8);
2472 if (mt->is_unsigned) {
2473 //| ubfm x9, x9, #0, #7
2474 dasm_put(Dst, 278);
2475 } else {
2476 //| sbfm x9, x9, #0, #7
2477 dasm_put(Dst, 280);
2478 }
2479 //| call_rr extern push_int, L_ARG, x9
2480 dasm_put(Dst, 282);
2481 break;
2482
2483 case INT16_TYPE:
2484 lua_pop(L, 1);
2485 get_int(Dst, ct, &reg, int16);
2486 if (mt->is_unsigned) {
2487 //| ubfm x9, x9, #0, #15
2488 dasm_put(Dst, 287);
2489 } else {
2490 //| sbfm x9, x9, #0, #15
2491 dasm_put(Dst, 289);
2492 }
2493 //| call_rr extern push_int, L_ARG, x9
2494 dasm_put(Dst, 291);
2495 break;
2496
2497 case ENUM_TYPE:
2498 case INT32_TYPE:
2499 lua_pop(L, 1);
2500 get_int(Dst, ct, &reg, int32);
2501 if (mt->is_unsigned) {
2502 //| call_rw extern push_uint, L_ARG, w9
2503 dasm_put(Dst, 296);
2504 } else {
2505 //| call_rw extern push_int, L_ARG, w9
2506 dasm_put(Dst, 301);
2507 }
2508 break;
2509
2510 default:
2511 luaL_error(L, "NYI: callback arg type");
2512 }
2513 }
2514 }
2515
2516 lua_rawgeti(L, ct_usr, 0);
2517 mt = (const struct ctype*) lua_touserdata(L, -1);
2518
2519 //| call_riip extern lua_callk, L_ARG, nargs, ((mt->pointers || mt->is_reference || mt->type != VOID_TYPE) ? 1 : 0), 0
2520 dasm_put(Dst, 306, (ZERO_TO_FIFTEEN_OF_64((0))), (SIXTEEN_TO_THIRTYONE_OF_64((0))), (THIRTYTWO_TO_FORTYSEVEN_OF_64((0))), (FORTYEIGHT_TO_SIXTYTHREE_OF_64((0))), (((mt->pointers || mt->is_reference || mt->type != VOID_TYPE) ? 1 : 0)), (nargs));
2521
2522 // Unpack the return argument if not "void", also clean-up the lua stack
2523 // to remove the return argument and bind table. Use lua_settop rather
2524 // than lua_pop as lua_pop is implemented as a macro.
2525 if (mt->pointers || mt->is_reference) {
2526 lua_getuservalue(L, -1);
2527 lua_rawseti(L, -3, ++num_upvals); /* usr value */
2528 lua_rawseti(L, -2, ++num_upvals); /* mt */
2529 //| mov32 w9, -2
2530 //| call_rwi extern lua_rawgeti, L_ARG, w9, num_upvals-1
2531 //| mov32 w9, -2
2532 //| mov32 w10, -1
2533 //| call_rwwp extern check_typed_pointer, L_ARG, w9, w10, mt
2534 //| str x0, [sp, #32]
2535 //| mov32 w9, -4
2536 //| call_rw extern lua_settop, L_ARG, w9
2537 //| ldr x0, [sp, #32]
2538 dasm_put(Dst, 322, (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)), (num_upvals-1), (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)), (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64((mt))), (SIXTEEN_TO_THIRTYONE_OF_64((mt))), (THIRTYTWO_TO_FORTYSEVEN_OF_64((mt))), (FORTYEIGHT_TO_SIXTYTHREE_OF_64((mt))), (ZERO_TO_FIFTEEN_OF_64(-4)), (SIXTEEN_TO_THIRTYONE_OF_64(-4)));
2539
2540 } else {
2541 switch (mt->type) {
2542 case ENUM_TYPE:
2543 lua_getuservalue(L, -1);
2544 lua_rawseti(L, -3, ++num_upvals); /* usr value */
2545 lua_rawseti(L, -2, ++num_upvals); /* mt */
2546 //| mov32 w9, -2
2547 //| call_rwi extern lua_rawgeti, L_ARG, w9, num_upvals-1
2548 //| mov32 w9, -2
2549 //| mov32 w10, -1
2550 //| call_rwwp, extern check_enum, L_ARG, w9, w10, mt
2551 //| str w0, [sp, #32]
2552 //| mov32 w9, -4
2553 //| call_rw extern lua_settop, L_ARG, w9
2554 //| ldr w0, [sp, #32]
2555 dasm_put(Dst, 364, (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)), (num_upvals-1), (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)), (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64((mt))), (SIXTEEN_TO_THIRTYONE_OF_64((mt))), (THIRTYTWO_TO_FORTYSEVEN_OF_64((mt))), (FORTYEIGHT_TO_SIXTYTHREE_OF_64((mt))), (ZERO_TO_FIFTEEN_OF_64(-4)), (SIXTEEN_TO_THIRTYONE_OF_64(-4)));
2556 break;
2557
2558 case VOID_TYPE:
2559 lua_pop(L, 1);
2560 //| mov32 w9, -2
2561 //| call_rw extern lua_settop, L_ARG, w9
2562 dasm_put(Dst, 406, (ZERO_TO_FIFTEEN_OF_64(-2)), (SIXTEEN_TO_THIRTYONE_OF_64(-2)));
2563 break;
2564
2565 case BOOL_TYPE:
2566 case INT8_TYPE:
2567 case INT16_TYPE:
2568 case INT32_TYPE:
2569 lua_pop(L, 1);
2570 if (mt->is_unsigned) {
2571 //| mov32 w9, -1
2572 //| call_rw extern check_uint32, L_ARG, w9
2573 dasm_put(Dst, 415, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)));
2574 } else {
2575 //| mov32 w9, -1
2576 //| call_rw extern check_int32, L_ARG, w9
2577 dasm_put(Dst, 424, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)));
2578 }
2579 //| str w0, [sp, #32]
2580 //| mov32 w9, -3
2581 //| call_rw extern lua_settop, L_ARG, w9
2582 //| ldr w0, [sp, #32]
2583 dasm_put(Dst, 433, (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2584 break;
2585
2586 case INT64_TYPE:
2587 lua_pop(L, 1);
2588
2589 if (mt->is_unsigned) {
2590 //| mov32 w9, -1
2591 //| call_rw extern check_uint64, L_ARG, w9
2592 dasm_put(Dst, 444, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)));
2593 } else {
2594 //| mov32 w9, -1
2595 //| call_rw extern check_int64, L_ARG, w9
2596 dasm_put(Dst, 453, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)));
2597 }
2598
2599 //| str x0, [sp, #32]
2600 //| mov32 w9, -4
2601 //| call_rw extern lua_settop, L_ARG, w9
2602 //| ldr x0, [sp, #32]
2603 dasm_put(Dst, 462, (ZERO_TO_FIFTEEN_OF_64(-4)), (SIXTEEN_TO_THIRTYONE_OF_64(-4)));
2604 break;
2605
2606 case INTPTR_TYPE:
2607 lua_pop(L, 1);
2608 //| mov32 w9, -1
2609 //| call_rw extern check_uintptr, L_ARG, w9
2610 //| str x0, [sp, #32]
2611 //| mov32 w9, -3
2612 //| call_rw extern lua_settop, L_ARG, w9
2613 //| ldr x0, [sp, #32]
2614 dasm_put(Dst, 473, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2615 break;
2616
2617 case FLOAT_TYPE:
2618 lua_pop(L, 1);
2619 //| mov32 w9, -1
2620 //| call_rw extern check_double, L_ARG, w9
2621 //| str d0, [sp, #32]
2622 //| mov32 w9, -3
2623 //| call_rw extern lua_settop, L_ARG, w9
2624 //| ldr d1, [sp, #32]
2625 //| fcvt s0, d1
2626 dasm_put(Dst, 492, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2627 break;
2628
2629 case DOUBLE_TYPE:
2630 lua_pop(L, 1);
2631 //| mov32 w9, -1
2632 //| call_rw extern check_double, L_ARG, w9
2633 //| str d0, [sp, #32]
2634 //| mov32 w9, -3
2635 //| call_rw extern lua_settop, L_ARG, w9
2636 //| ldr d0, [sp, #32]
2637 dasm_put(Dst, 512, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2638 break;
2639
2640 case COMPLEX_FLOAT_TYPE:
2641 lua_pop(L, 1);
2642 #if !defined HAVE_COMPLEX
2643 luaL_error(L, "ffi lib compiled without complex number support");
2644 #endif
2645 //| mov32 w9, -1
2646 //| call_rw extern check_complex_float, L_ARG, w9
2647 //|
2648 //| str s0, [sp,#32]
2649 //| str s1, [sp,#36]
2650 //|
2651 //| mov32 w9, -3
2652 //| call_rw extern lua_settop, L_ARG, w9
2653 //|
2654 //| ldr s0, [sp,#32]
2655 //| ldr s1, [sp,#36]
2656 //|
2657 dasm_put(Dst, 531, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2658 break;
2659
2660 case COMPLEX_DOUBLE_TYPE:
2661 lua_pop(L, 1);
2662 #if !defined HAVE_COMPLEX
2663 luaL_error(L, "ffi lib compiled without complex number support");
2664 #endif
2665 //| mov32 w9, -1
2666 //| call_rw extern check_complex_double, L_ARG, w9
2667 //|
2668 //| str d0, [sp,#32]
2669 //| str d1, [sp,#40]
2670 //|
2671 //| mov32 w9, -3
2672 //| call_rw extern lua_settop, L_ARG, w9
2673 //|
2674 //| ldr d0, [sp,#32]
2675 //| ldr d1, [sp,#40]
2676 //|
2677 dasm_put(Dst, 552, (ZERO_TO_FIFTEEN_OF_64(-1)), (SIXTEEN_TO_THIRTYONE_OF_64(-1)), (ZERO_TO_FIFTEEN_OF_64(-3)), (SIXTEEN_TO_THIRTYONE_OF_64(-3)));
2678 break;
2679
2680 default:
2681 luaL_error(L, "NYI: callback return type");
2682 }
2683 }
2684
2685 //| epilog
2686 //| ret
2687 dasm_put(Dst, 573);
2688
2689 lua_pop(L, 1); /* upval table - already in registry */
2690 assert(lua_gettop(L) == top);
2691
2692 ct2.is_jitted = 1;
2693 pf = (cfunction*) push_cdata(L, ct_usr, &ct2);
2694 *pf = compile(Dst, L, NULL, ref);
2695
2696 assert(lua_gettop(L) == top + 1);
2697
2698 return *pf;
2699 }
2700
2701 void compile_function(lua_State* L, cfunction func, int ct_usr, const struct ctype* ct)
2702 {
2703 size_t i, nargs;
2704 int num_upvals;
2705 int orig_top;
2706 const struct ctype* mbr_ct;
2707 struct jit* Dst = get_jit(L);
2708 struct reg_alloc reg;
2709 void* p = NULL;
2710 int top = lua_gettop(L);
2711 int* perr = &Dst->last_errno;
2712
2713 ct_usr = lua_absindex(L, ct_usr);
2714
2715 memset(&reg, 0, sizeof(reg));
2716 reg.off = 32 + REGISTER_STACK_SPACE(ct);
2717
2718 dasm_setup(Dst, build_actionlist);
2719
2720 orig_top = lua_gettop(L);
2721 p = push_cdata(L, ct_usr, ct);
2722 memcpy(p,func, ctype_size(L, ct));
2723
2724 nargs = lua_rawlen(L, ct_usr);
2725 assert(nargs <= ((unsigned int)(0xFFE))); // <= 4094 s.t. 4095 can fit into imm12
2726
2727 if (ct->calling_convention != C_CALL && ct->has_var_arg) {
2728 luaL_error(L, "vararg is only allowed with the c calling convention");
2729 }
2730
2731 //| sub sp, sp, #64 // = -64
2732 //| stp x29, x30, [sp, #48] // 16-byte Folded Spill
2733 //| stp EXTRA_REG_2, EXTRA_REG_3, [sp, #32] // 16-byte Folded Spill
2734 //| stp rbp, EXTRA_REG_1, [sp, #16] // 16-byte Folded Spill
2735 //| stp L_ARG, TOP, [sp]
2736 //| // -64 -56 -48 -40 -32 -24 -16 -8
2737 //| // stack is -64 (mod 16) (L_ARG, TOP, rbp, EXTRA_REG_1, EXTRA_REG_2, EXTRA_REG_3, x29, x30)
2738 //| // L_ARG -> -64
2739 //| // TOP -> -56
2740 //| // rbp -> -48
2741 //| // EXTRA_REG_1 -> -40
2742 //| // EXTRA_REG_2 -> -32
2743 //| // EXTRA_REG_3 -> -24
2744 //| // x29 -> -16
2745 //| // x30 -> -8
2746 //| add rbp, sp, #16
2747 //|
2748 //| // Get L from our arguments and allocate some stack for lua_gettop
2749 //| mov L_ARG, x0 // First argument to the lua function int f(lua_State * L);
2750 dasm_put(Dst, 584);
2751
2752 //|
2753 //| call_r extern lua_gettop, L_ARG
2754 //| mov TOP, x0
2755 //| cmp x0, #(nargs)
2756 dasm_put(Dst, 592, (nargs));
2757 if (!ct->has_var_arg) {
2758 //| bge >2
2759 //| too_few_arguments
2760 //| 2:
2761 //| ble >1
2762 //| too_many_arguments
2763 dasm_put(Dst, 599, (ZERO_TO_FIFTEEN_OF_64(MESSAGE_1)), (SIXTEEN_TO_THIRTYONE_OF_64(MESSAGE_1)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(MESSAGE_1)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(MESSAGE_1)), (ZERO_TO_FIFTEEN_OF_64(MESSAGE_2)), (SIXTEEN_TO_THIRTYONE_OF_64(MESSAGE_2)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(MESSAGE_2)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(MESSAGE_2)));
2764 } else {
2765 //| bge >1
2766 //| too_few_arguments
2767 dasm_put(Dst, 629, (ZERO_TO_FIFTEEN_OF_64(MESSAGE_1)), (SIXTEEN_TO_THIRTYONE_OF_64(MESSAGE_1)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(MESSAGE_1)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(MESSAGE_1)));
2768 }
2769
2770 //| 1:
2771 dasm_put(Dst, 644);
2772
2773 //| sub sp, sp, TOP, lsl #4 // reserve 16 bytes per argument - this maintains the alignment mod 16
2774 //| sub sp, sp, #(32 + REGISTER_STACK_SPACE(ct)) // reserve an extra 32 to call local functions
2775 dasm_put(Dst, 646, (32 + REGISTER_STACK_SPACE(ct)));
2776
2777 for (i = 1; i <= nargs; i++) {
2778 lua_rawgeti(L, ct_usr, (int) i);
2779 mbr_ct = (const struct ctype*) lua_touserdata(L, -1);
2780
2781 if (mbr_ct->pointers || mbr_ct->is_reference) {
2782 lua_getuservalue(L, -1);
2783 num_upvals = lua_gettop(L) - orig_top;
2784 //printf("%s:%d lua_upvalueindex(num_upvals) = [%d] \n", __FILE__, __LINE__, lua_upvalueindex(num_upvals));
2785 //| mov32 w9, lua_upvalueindex(num_upvals)
2786 //| sxtw x9, w9
2787 //| call_riwp extern check_typed_pointer, L_ARG, i, w9, mbr_ct
2788 dasm_put(Dst, 650, (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)), i);
2789 add_pointer(Dst, ct, &reg);
2790 } else {
2791 switch (mbr_ct->type) {
2792 case FUNCTION_PTR_TYPE:
2793 lua_getuservalue(L, -1);
2794 num_upvals = lua_gettop(L) - orig_top;
2795 //| mov32 w9, lua_upvalueindex(num_upvals)
2796 //| sxtw x9, w9
2797 //| call_riwp extern check_typed_cfunction, L_ARG, i, w9, mbr_ct
2798 dasm_put(Dst, 670, (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)), i);
2799 add_pointer(Dst, ct, &reg);
2800 break;
2801
2802 case ENUM_TYPE:
2803 lua_getuservalue(L, -1);
2804 num_upvals = lua_gettop(L) - orig_top;
2805 //| mov32 w9, lua_upvalueindex(num_upvals)
2806 //| sxtw x9, w9
2807 //| call_riwp, extern check_enum, L_ARG, i, w9, mbr_ct
2808 dasm_put(Dst, 690, (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)), i);
2809 add_int(Dst, ct, &reg, int32);
2810 break;
2811
2812 case INT8_TYPE:
2813 //| call_ri extern check_int32, L_ARG, i
2814 if (mbr_ct->is_unsigned) {
2815 //| call_ri extern check_uint8, L_ARG, i
2816 //| call_ri extern check_uint32, L_ARG, i
2817 //| ubfm x0, x0, #0, #7
2818 dasm_put(Dst, 710, (i));
2819 } else {
2820 //| call_ri extern check_int8, L_ARG, i
2821 //| call_ri extern check_int32, L_ARG, i
2822 //| sbfm x0, x0, #0, #7
2823 dasm_put(Dst, 717, (i));
2824 }
2825 add_int(Dst, ct, &reg, int8);
2826 lua_pop(L, 1);
2827 break;
2828
2829 case INT16_TYPE:
2830 //| call_ri extern check_int32, L_ARG, i
2831 if (mbr_ct->is_unsigned) {
2832 //| call_ri extern check_uint16, L_ARG, i
2833 //| call_ri extern check_uint32, L_ARG, i
2834 //| ubfm x0, x0, #0, #15
2835 dasm_put(Dst, 724, (i));
2836 } else {
2837 //| call_ri extern check_int16, L_ARG, i
2838 //| call_ri extern check_int32, L_ARG, i
2839 //| sbfm x0, x0, #0, #15
2840 dasm_put(Dst, 731, (i));
2841 }
2842 add_int(Dst, ct, &reg, int16);
2843 lua_pop(L, 1);
2844 break;
2845
2846 case BOOL_TYPE:
2847 //| call_ri extern check_int32, L_ARG, i
2848 //| cmp x0, #0
2849 //| beq >1
2850 //| mov b0, #1
2851 //| 1:
2852 //| ubfm x0, x0, #0, #7
2853 dasm_put(Dst, 738, (i));
2854 add_int(Dst, ct, &reg, int8);
2855 lua_pop(L, 1);
2856 break;
2857
2858 case INT32_TYPE:
2859 if (mbr_ct->is_unsigned) {
2860 //| call_ri extern check_uint32, L_ARG, i
2861 dasm_put(Dst, 750, (i));
2862 } else {
2863 //| call_ri extern check_int32, L_ARG, i
2864 dasm_put(Dst, 756, (i));
2865 }
2866 add_int(Dst, ct, &reg, int32);
2867 lua_pop(L, 1);
2868 break;
2869
2870 case INTPTR_TYPE:
2871 //| call_ri extern check_uintptr, L_ARG, i
2872 dasm_put(Dst, 762, (i));
2873 add_pointer(Dst, ct, &reg);
2874 lua_pop(L, 1);
2875 break;
2876
2877 case INT64_TYPE:
2878 if (mbr_ct->is_unsigned) {
2879 //| call_ri extern check_uint64, L_ARG, i
2880 dasm_put(Dst, 768, (i));
2881 } else {
2882 //| call_ri extern check_int64, L_ARG, i
2883 dasm_put(Dst, 774, (i));
2884 }
2885 add_int(Dst, ct, &reg, int64);
2886 lua_pop(L, 1);
2887 break;
2888
2889 case DOUBLE_TYPE:
2890 //| call_ri extern check_double, L_ARG, i
2891 dasm_put(Dst, 780, (i));
2892 add_float(Dst, ct, &reg, 1);
2893 lua_pop(L, 1);
2894 break;
2895
2896 case COMPLEX_DOUBLE_TYPE:
2897 /* on 64 bit, returned complex doubles use xmm0, xmm1, on 32 bit
2898 * there is a hidden first parameter that points to 16 bytes where
2899 * the returned arg is stored (this is popped by the called
2900 * function) */
2901 //| call_ri extern check_complex_double, L_ARG, i
2902 dasm_put(Dst, 786, (i));
2903 add_complex_float(Dst, ct, &reg, 1);
2904 lua_pop(L, 1);
2905 break;
2906
2907 case FLOAT_TYPE:
2908 //| call_ri extern check_double, L_ARG, i
2909 dasm_put(Dst, 792, (i));
2910 add_float(Dst, ct, &reg, 0);
2911 lua_pop(L, 1);
2912 break;
2913
2914 case COMPLEX_FLOAT_TYPE:
2915 /* complex floats are returned as s0 and s1 */
2916 //| call_ri extern check_complex_float, L_ARG, i
2917 dasm_put(Dst, 798, (i));
2918 add_complex_float(Dst, ct, &reg, 0);
2919 lua_pop(L, 1);
2920 break;
2921
2922 default:
2923 luaL_error(L, "NYI: call arg type");
2924 }
2925 }
2926 }
2927
2928 if (ct->has_var_arg) {
2929 #ifndef OS_OSX //{
2930 if (reg.floats < MAX_FLOAT_REGISTERS(ct)) {
2931 //| mov x9, sp
2932 //| add x9, x9, #(32 + 8*(MAX_INT_REGISTERS(ct) + reg.floats))
2933 //| call_ririr extern unpack_varargs_float, L_ARG, (nargs+1), TOP, (MAX_FLOAT_REGISTERS(ct) - reg.floats), x9
2934 dasm_put(Dst, 804, (32 + 8*(MAX_INT_REGISTERS(ct) + reg.floats)), (MAX_FLOAT_REGISTERS(ct) - reg.floats), (nargs+1));
2935 }
2936
2937 if (reg.ints < MAX_INT_REGISTERS(ct)) {
2938 //| mov x9, sp
2939 //| add x9, x9, #(32 + 8*(reg.ints))
2940 //| call_ririr extern unpack_varargs_int, L_ARG, (nargs+1), TOP, (MAX_INT_REGISTERS(ct) - reg.ints), x9
2941 dasm_put(Dst, 817, (32 + 8*(reg.ints)), (MAX_INT_REGISTERS(ct) - reg.ints), (nargs+1));
2942 }
2943
2944 //| mov x9, sp
2945 //| add x9, x9, #(reg.off)
2946 //| call_ririir extern unpack_varargs_stack_skip, L_ARG, (nargs+1), TOP, (MAX_INT_REGISTERS(ct) - reg.ints), (MAX_FLOAT_REGISTERS(ct) - reg.floats), x9
2947 dasm_put(Dst, 830, (reg.off), (MAX_FLOAT_REGISTERS(ct) - reg.floats), (MAX_INT_REGISTERS(ct) - reg.ints), (nargs+1));
2948
2949 reg.floats = MAX_FLOAT_REGISTERS(ct);
2950 reg.ints = MAX_INT_REGISTERS(ct);
2951 #else //}{
2952 /* On OSX M1 all variadic acruments on stack are 8 byte aligned */
2953 if (reg.off % 8 != 0) {
2954 reg.off += 8 - (reg.off % 8);
2955 }
2956 //| mov x9, sp
2957 //| add x9, x9, #(reg.off)
2958 //| call_ririir extern unpack_varargs_stack_skip, L_ARG, (nargs+1), TOP, 0, 0, x9
2959 dasm_put(Dst, 845, (reg.off), (nargs+1));
2960
2961 reg.floats = MAX_FLOAT_REGISTERS(ct);
2962 reg.ints = MAX_INT_REGISTERS(ct);
2963 #endif //}
2964 }
2965
2966 //| mov64 x9, perr
2967 //| mov x10, xzr
2968 //| ldr w10, [x9]
2969 //| call_w extern SetLastError, w10
2970 dasm_put(Dst, 858, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
2971
2972 /* remove the stack space to call local functions */
2973 //| add sp, sp, #(32)
2974 dasm_put(Dst, 872);
2975
2976 switch (reg.floats) {
2977 case 8:
2978 //| ldr d7, [sp, #(8*(MAX_INT_REGISTERS(ct)+7))]
2979 dasm_put(Dst, 874, (8*(MAX_INT_REGISTERS(ct)+7)));
2980 case 7:
2981 //| ldr d6, [sp, #(8*(MAX_INT_REGISTERS(ct)+6))]
2982 dasm_put(Dst, 877, (8*(MAX_INT_REGISTERS(ct)+6)));
2983 case 6:
2984 //| ldr d5, [sp, #(8*(MAX_INT_REGISTERS(ct)+5))]
2985 dasm_put(Dst, 880, (8*(MAX_INT_REGISTERS(ct)+5)));
2986 case 5:
2987 //| ldr d4, [sp, #(8*(MAX_INT_REGISTERS(ct)+4))]
2988 dasm_put(Dst, 883, (8*(MAX_INT_REGISTERS(ct)+4)));
2989 case 4:
2990 //| ldr d3, [sp, #(8*(MAX_INT_REGISTERS(ct)+3))]
2991 dasm_put(Dst, 886, (8*(MAX_INT_REGISTERS(ct)+3)));
2992 case 3:
2993 //| ldr d2, [sp, #(8*(MAX_INT_REGISTERS(ct)+2))]
2994 dasm_put(Dst, 889, (8*(MAX_INT_REGISTERS(ct)+2)));
2995 case 2:
2996 //| ldr d1, [sp, #(8*(MAX_INT_REGISTERS(ct)+1))]
2997 dasm_put(Dst, 892, (8*(MAX_INT_REGISTERS(ct)+1)));
2998 case 1:
2999 //| ldr d0, [sp, #(8*(MAX_INT_REGISTERS(ct)))]
3000 dasm_put(Dst, 895, (8*(MAX_INT_REGISTERS(ct))));
3001 case 0:
3002 break;
3003 }
3004
3005 switch (reg.ints) {
3006 case 8:
3007 //| ldr x7, [sp, #(8*7)]
3008 dasm_put(Dst, 898);
3009 case 7:
3010 //| ldr x6, [sp, #(8*6)]
3011 dasm_put(Dst, 900);
3012 case 6:
3013 //| ldr x5, [sp, #(8*5)]
3014 dasm_put(Dst, 902);
3015 case 5:
3016 //| ldr x4, [sp, #(8*4)]
3017 dasm_put(Dst, 904);
3018 case 4:
3019 //| ldr x3, [sp, #(8*3)]
3020 dasm_put(Dst, 906);
3021 case 3:
3022 //| ldr x2, [sp, #(8*2)]
3023 dasm_put(Dst, 908);
3024 case 2:
3025 //| ldr x1, [sp, #(8*1)]
3026 dasm_put(Dst, 910);
3027 case 1:
3028 //| ldr x0, [sp]
3029 dasm_put(Dst, 912);
3030 case 0:
3031 break;
3032 }
3033
3034 //| add sp, sp, #(REGISTER_STACK_SPACE(ct))
3035 dasm_put(Dst, 914, (REGISTER_STACK_SPACE(ct)));
3036
3037 //printf("%s:%d compiling call \n", __FILE__, __LINE__);
3038 //| bl extern FUNCTION
3039 //|
3040 //| add sp, sp, TOP, lsl #4 // Free up the stack space reserved for FUNCTION call
3041 //| sub sp, sp, #48 // 32 to be able to call local functions, 16 so we can store some local variables
3042 dasm_put(Dst, 917);
3043
3044 lua_rawgeti(L, ct_usr, 0); /* i = 0 is the return type */
3045 mbr_ct = (const struct ctype*) lua_touserdata(L, -1);
3046
3047 if (mbr_ct->pointers || mbr_ct->is_reference || mbr_ct->type == INTPTR_TYPE) {
3048 lua_getuservalue(L, -1);
3049 num_upvals = lua_gettop(L) - orig_top;
3050 //| str x0, [sp, #32] // save the pointer
3051 //| get_errno
3052 //| mov32 w9, lua_upvalueindex(num_upvals)
3053 //| sxtw x9, w9
3054 //| call_rwp extern push_cdata, L_ARG, w9, mbr_ct
3055 //| ldr x9, [sp, #32]
3056 //| str x9, [x0] // *(void**) cdata = val
3057 //| lua_return_arg
3058 dasm_put(Dst, 922, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)), (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)));
3059 } else {
3060 switch (mbr_ct->type) {
3061 case FUNCTION_PTR_TYPE:
3062 lua_getuservalue(L, -1);
3063 num_upvals = lua_gettop(L) - orig_top;
3064 //| str x0, [sp, #32] // save the function pointer
3065 //| get_errno
3066 //| mov32 w9, lua_upvalueindex(num_upvals)
3067 //| sxtw x9, w9
3068 //| call_rwp extern push_cdata, L_ARG, w9, mbr_ct
3069 //| ldr x9, [sp, #32]
3070 //| str x9, [x0] // *(void**) cdata = val
3071 //| lua_return_arg
3072 dasm_put(Dst, 964, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)), (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)));
3073 break;
3074
3075 case INT64_TYPE:
3076 lua_pop(L, 1);
3077 if (mbr_ct->is_unsigned) {
3078 //| lua_return_ulong
3079 dasm_put(Dst, 1006, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3080 } else {
3081 //| lua_return_long
3082 dasm_put(Dst, 1034, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3083 }
3084 break;
3085
3086 case COMPLEX_FLOAT_TYPE:
3087 lua_getuservalue(L, -1);
3088 num_upvals = lua_gettop(L) - orig_top;
3089 //| // complex floats are returned as two floats packed into s0 and s1
3090 //| str s0, [sp, #40]
3091 //| str s1, [sp, #44]
3092 //|
3093 //| get_errno
3094 //| mov32 w9, lua_upvalueindex(num_upvals)
3095 //| sxtw x9, w9
3096 //| call_rwp extern push_cdata, L_ARG, w9, mbr_ct
3097 //|
3098 //| // ((complex_float*) cdata) = val
3099 //| ldr s0, [sp, #40]
3100 //| ldr s1, [sp, #44]
3101 //| str s0, [x0]
3102 //| str s1, [x0, #4]
3103 //|
3104 //| lua_return_arg
3105 dasm_put(Dst, 1062, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)), (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)));
3106 break;
3107
3108 case COMPLEX_DOUBLE_TYPE:
3109 lua_getuservalue(L, -1);
3110 num_upvals = lua_gettop(L) - orig_top;
3111 //| // complex doubles are returned as d0 and d1
3112 //| str d0, [sp, #32]
3113 //| str d1, [sp, #40]
3114 //|
3115 //| get_errno
3116 //| mov32 w9, lua_upvalueindex(num_upvals)
3117 //| sxtw x9, w9
3118 //| call_rwp extern push_cdata, L_ARG, w9, mbr_ct
3119 //|
3120 //| // ((complex_float*) cdata) = val
3121 //| ldr d0, [sp, #32]
3122 //| ldr d1, [sp, #40]
3123 //| str d0, [x0]
3124 //| str d1, [x0, #8]
3125 //|
3126 //| lua_return_arg
3127 dasm_put(Dst, 1107, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)), (ZERO_TO_FIFTEEN_OF_64(lua_upvalueindex(num_upvals))), (SIXTEEN_TO_THIRTYONE_OF_64(lua_upvalueindex(num_upvals))), (ZERO_TO_FIFTEEN_OF_64(mbr_ct)), (SIXTEEN_TO_THIRTYONE_OF_64(mbr_ct)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(mbr_ct)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(mbr_ct)));
3128 break;
3129
3130 case VOID_TYPE:
3131 lua_pop(L, 1);
3132 //| lua_return_void
3133 dasm_put(Dst, 1152, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3134 break;
3135
3136 case BOOL_TYPE:
3137 lua_pop(L, 1);
3138 //| lua_return_bool
3139 dasm_put(Dst, 1174, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3140 break;
3141
3142 case INT8_TYPE:
3143 lua_pop(L, 1);
3144 if (mbr_ct->is_unsigned) {
3145 //| // movzx eax, al
3146 //| ubfm x0, x0, #0, #7
3147 dasm_put(Dst, 1203);
3148 } else {
3149 //| //movsx eax, al
3150 //| sbfm x0, x0, #0, #7
3151 dasm_put(Dst, 1205);
3152 }
3153 //| lua_return_int
3154 dasm_put(Dst, 1207, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3155 break;
3156
3157 case INT16_TYPE:
3158 lua_pop(L, 1);
3159 if (mbr_ct->is_unsigned) {
3160 //| //movzx eax, ax
3161 //| ubfm x0, x0, #0, #15
3162 dasm_put(Dst, 1235);
3163 } else {
3164 //| //movsx eax, ax
3165 //| sbfm x0, x0, #0, #15
3166 dasm_put(Dst, 1237);
3167 }
3168 //| lua_return_int
3169 dasm_put(Dst, 1239, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3170 break;
3171
3172 case INT32_TYPE:
3173 case ENUM_TYPE:
3174 lua_pop(L, 1);
3175 if (mbr_ct->is_unsigned) {
3176 //| lua_return_uint
3177 dasm_put(Dst, 1267, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3178 } else {
3179 //| lua_return_int
3180 dasm_put(Dst, 1295, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3181 }
3182 break;
3183
3184 case FLOAT_TYPE:
3185 lua_pop(L, 1);
3186 //| fcvt d0, s0
3187 //| lua_return_double
3188 dasm_put(Dst, 1323, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3189 break;
3190
3191 case DOUBLE_TYPE:
3192 lua_pop(L, 1);
3193 //| lua_return_double
3194 dasm_put(Dst, 1351, (ZERO_TO_FIFTEEN_OF_64(perr)), (SIXTEEN_TO_THIRTYONE_OF_64(perr)), (THIRTYTWO_TO_FORTYSEVEN_OF_64(perr)), (FORTYEIGHT_TO_SIXTYTHREE_OF_64(perr)));
3195 break;
3196
3197 default:
3198 luaL_error(L, "NYI: call return type");
3199 }
3200 }
3201
3202 {
3203 cfunction f = compile(Dst, L, func, LUA_NOREF);
3204 /* add a callback as an upval so that the jitted code gets cleaned up when
3205 * the function gets gc'd */
3206 push_callback(L, f, func);
3207 num_upvals = lua_gettop(L) - orig_top;
3208 lua_pushcclosure(L, (lua_CFunction) f, num_upvals);
3209 }
3210 }
3211