1/*
2** This file has been pre-processed with DynASM.
3** https://luajit.org/dynasm.html
4** DynASM version 1.4.0, DynASM x64 version 1.4.0
5** DO NOT EDIT! The original file is in "vm_x64.dasc".
6*/
7
8#line 1 "vm_x64.dasc"
9//|// Low-level VM code for x64 CPUs in LJ_GC64 mode.
10//|// Bytecode interpreter, fast functions and helper functions.
11//|// Copyright (C) 2005-2021 Mike Pall. See Copyright Notice in luajit.h
12//|
13//|.arch x64
14#if DASM_VERSION != 10400
15#error "Version mismatch between DynASM and included encoding engine"
16#endif
17#line 6 "vm_x64.dasc"
18//|.section code_op, code_sub
19#define DASM_SECTION_CODE_OP 0
20#define DASM_SECTION_CODE_SUB 1
21#define DASM_MAXSECTION 2
22#line 7 "vm_x64.dasc"
23//|
24//|.actionlist build_actionlist
25static const unsigned char build_actionlist[16150] = {
26 254,1,248,10,252,247,195,237,15,132,244,11,72,131,227,252,248,72,41,218,72,
27 141,76,25,252,248,72,139,90,252,248,73,187,237,237,76,137,28,10,248,12,131,
28 192,1,15,132,244,13,137,4,36,72,252,247,195,237,15,132,244,14,248,15,72,129,
29 252,243,239,252,247,195,237,15,133,244,10,65,199,134,233,237,255,72,131,227,
30 252,248,72,41,211,72,252,247,219,131,232,1,15,132,244,248,248,1,72,139,44,
31 10,72,137,106,252,240,72,131,194,8,131,232,1,15,133,244,1,248,2,72,139,108,
32 36,16,72,137,157,233,248,3,139,4,36,139,76,36,8,248,4,57,193,15,133,244,252,
33 248,5,72,131,252,234,16,72,137,149,233,248,16,72,139,76,36,32,72,137,141,
34 233,49,192,248,17,72,131,196,40,65,94,65,95,91,93,195,248,6,15,130,244,253,
35 255,72,59,149,233,15,135,244,254,72,199,66,252,240,237,72,131,194,8,131,192,
36 1,252,233,244,4,248,7,133,201,15,132,244,5,72,41,193,72,141,20,202,252,233,
37 244,5,248,8,72,137,149,233,137,4,36,137,206,72,137,252,239,232,251,1,0,72,
38 139,149,233,252,233,244,3,248,13,176,235,252,233,244,18,248,19,255,137,252,
39 240,72,137,252,252,248,18,72,139,108,36,16,72,139,173,233,199,133,233,237,
40 252,233,244,17,248,20,72,139,124,36,16,137,198,72,131,196,40,65,94,65,95,
41 91,93,252,233,251,1,1,248,21,72,129,231,239,72,137,252,252,248,22,72,139,
42 108,36,16,184,237,72,139,149,233,76,139,181,233,73,129,198,239,72,139,90,
43 252,248,72,185,237,237,72,139,42,72,137,74,252,240,72,137,106,252,248,72,
44 199,193,252,240,252,255,252,255,252,255,65,199,134,233,237,252,233,244,12,
45 248,23,255,190,237,252,233,244,248,248,24,72,131,232,16,252,233,244,247,248,
46 25,72,141,68,194,252,248,248,1,15,182,139,233,72,131,195,4,72,137,149,233,
47 72,137,133,233,72,137,92,36,24,72,137,206,248,2,72,137,252,239,232,251,1,
48 0,72,139,149,233,72,139,133,233,72,139,106,252,240,72,193,229,17,72,193,252,
49 237,17,72,41,208,193,232,3,131,192,1,72,139,157,233,139,11,15,182,252,233,
50 15,182,205,72,131,195,4,65,252,255,36,252,238,248,26,85,83,65,87,65,86,72,
51 131,252,236,40,72,137,252,253,72,137,124,36,16,72,137,252,241,187,237,49,
52 192,76,141,188,253,36,233,76,139,181,233,255,73,129,198,239,72,137,68,36,
53 24,72,137,68,36,32,137,68,36,8,137,68,36,12,76,137,189,233,56,133,233,15,
54 132,244,248,73,137,174,233,65,199,134,233,237,136,133,233,72,139,149,233,
55 72,139,133,233,72,41,200,193,232,3,131,192,1,72,41,209,72,139,90,252,248,
56 137,4,36,252,247,195,237,15,132,244,14,252,233,244,15,248,27,85,83,65,87,
57 65,86,72,131,252,236,40,187,237,137,76,36,12,252,233,244,247,248,28,255,85,
58 83,65,87,65,86,72,131,252,236,40,187,237,248,1,137,84,36,8,72,137,252,253,
59 72,137,124,36,16,72,137,252,241,76,139,181,233,76,139,189,233,76,137,124,
60 36,32,72,137,108,36,24,73,129,198,239,72,137,165,233,248,2,73,137,174,233,
61 65,199,134,233,237,72,139,149,233,72,1,203,72,41,211,72,139,133,233,72,41,
62 200,193,232,3,131,192,1,248,29,72,139,105,252,240,73,137,252,235,72,193,229,
63 17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,30,248,
64 31,72,137,202,72,137,90,252,248,72,139,157,233,139,11,15,182,252,233,15,182,
65 205,72,131,195,4,65,252,255,36,252,238,248,32,255,85,83,65,87,65,86,72,131,
66 252,236,40,72,137,252,253,72,137,124,36,16,72,137,108,36,24,76,139,189,233,
67 76,43,189,233,76,139,181,233,199,68,36,12,0,0,0,0,68,137,124,36,8,73,129,
68 198,239,76,139,189,233,76,137,124,36,32,72,137,165,233,73,137,174,233,252,
69 255,209,72,133,192,15,132,244,16,72,137,193,187,237,252,233,244,2,248,11,
70 72,1,209,72,131,227,252,248,72,137,213,72,41,218,72,199,68,193,252,248,237,
71 72,137,200,72,139,93,232,72,139,77,224,72,131,252,249,1,15,134,244,247,76,
72 139,122,252,240,73,193,231,17,73,193,252,239,17,77,139,191,233,77,139,191,
73 233,252,255,225,248,1,255,15,132,244,33,72,41,213,193,252,237,3,141,69,252,
74 253,252,233,244,34,248,35,15,182,75,252,255,72,131,252,237,32,72,141,12,202,
75 72,41,252,233,15,132,244,36,72,252,247,217,193,252,233,3,72,139,124,36,16,
76 72,137,151,233,137,202,72,139,8,72,137,77,0,72,137,252,238,252,233,244,37,
77 248,38,73,187,237,237,76,9,216,72,137,4,36,72,141,4,36,128,123,252,252,235,
78 15,133,244,247,72,185,237,237,72,9,252,233,73,141,174,233,255,72,137,77,0,
79 252,233,244,248,248,39,15,182,67,252,254,252,242,15,42,192,252,242,15,17,
80 4,36,72,141,4,36,252,233,244,247,248,40,15,182,67,252,254,72,141,4,194,248,
81 1,15,182,107,252,255,72,141,44,252,234,248,2,72,139,124,36,16,72,137,151,
82 233,72,137,252,238,72,137,194,72,137,252,253,72,137,92,36,24,232,251,1,2,
83 72,139,149,233,72,133,192,15,132,244,249,248,36,15,182,75,252,253,72,139,
84 40,72,137,44,202,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,
85 255,36,252,238,248,3,72,139,141,233,72,137,89,232,72,141,153,233,72,41,211,
86 72,139,105,252,240,184,237,72,193,229,17,72,193,252,237,17,252,233,244,31,
87 248,41,255,72,137,252,239,72,137,213,137,198,232,251,1,3,15,182,75,252,253,
88 72,137,252,234,72,133,192,15,133,244,42,73,199,195,237,252,233,244,43,248,
89 44,73,187,237,237,76,9,216,72,137,4,36,72,141,4,36,128,123,252,252,235,15,
90 133,244,247,72,185,237,237,72,9,252,233,73,141,174,233,72,137,77,0,252,233,
91 244,248,248,45,15,182,67,252,254,252,242,15,42,192,252,242,15,17,4,36,72,
92 141,4,36,252,233,244,247,248,46,255,15,182,67,252,254,72,141,4,194,248,1,
93 15,182,107,252,255,72,141,44,252,234,248,2,72,139,124,36,16,72,137,151,233,
94 72,137,252,238,72,137,194,72,137,252,253,72,137,92,36,24,232,251,1,4,72,139,
95 149,233,72,133,192,15,132,244,249,15,182,75,252,253,72,139,44,202,72,137,
96 40,248,47,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,
97 36,252,238,248,3,72,139,141,233,72,137,89,232,15,182,67,252,253,72,139,44,
98 194,72,137,105,16,72,141,153,233,72,41,211,72,139,105,252,240,184,237,72,
99 193,229,17,72,193,252,237,17,252,233,244,31,248,48,72,139,124,36,16,72,137,
100 252,238,72,137,151,233,72,137,213,137,194,72,137,92,36,24,232,251,1,5,15,
101 182,75,252,253,72,137,252,234,252,233,244,49,248,50,15,183,67,252,254,15,
102 182,75,252,253,72,139,108,36,16,72,137,149,233,255,72,141,52,202,72,141,20,
103 194,72,137,252,239,15,182,75,252,252,72,137,92,36,24,232,251,1,6,248,3,72,
104 139,149,233,72,131,252,248,1,15,135,244,51,248,4,72,141,91,4,15,130,244,252,
105 248,5,15,183,67,252,254,72,141,156,253,131,233,248,6,139,3,15,182,204,15,
106 182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,52,72,131,195,4,
107 76,139,24,73,193,252,251,47,65,129,252,251,239,15,130,244,5,252,233,244,6,
108 248,53,76,139,24,73,193,252,251,47,65,129,252,251,239,252,233,244,4,248,54,
109 255,72,193,224,17,72,193,232,17,72,131,252,235,4,72,137,206,137,252,233,72,
110 139,108,36,16,72,137,149,233,72,137,194,72,137,252,239,72,137,92,36,24,232,
111 251,1,7,252,233,244,3,248,55,72,131,252,235,4,72,139,108,36,16,72,137,149,
112 233,72,137,252,239,139,115,252,252,72,137,92,36,24,232,251,1,8,252,233,244,
113 3,248,56,72,139,108,36,16,72,137,149,233,137,206,137,194,72,137,252,239,72,
114 137,92,36,24,232,251,1,9,72,139,149,233,252,233,244,6,248,57,248,58,73,141,
115 4,199,252,233,244,247,248,59,248,60,77,141,20,199,72,141,4,252,234,76,137,
116 213,252,233,244,248,248,61,255,72,141,4,194,72,137,197,252,233,244,248,248,
117 62,248,63,72,141,4,194,248,1,72,141,44,252,234,248,2,72,141,12,202,68,15,
118 182,67,252,252,72,137,206,72,137,193,72,139,124,36,16,72,137,151,233,72,137,
119 252,234,72,137,252,253,72,137,92,36,24,232,251,1,10,72,139,149,233,72,133,
120 192,15,132,244,47,248,51,72,137,193,72,41,208,72,137,89,232,72,141,152,233,
121 184,237,252,233,244,29,248,64,15,183,67,252,254,72,139,108,36,16,72,137,149,
122 233,72,141,52,194,72,137,252,239,72,137,92,36,24,232,251,1,11,72,139,149,
123 233,255,72,133,192,15,133,244,51,15,183,67,252,254,72,139,60,194,72,193,231,
124 17,72,193,252,239,17,252,233,244,65,255,252,233,244,51,255,248,66,72,141,
125 76,202,16,248,30,137,4,36,72,137,205,72,139,124,36,16,72,137,151,233,72,141,
126 113,252,240,72,141,84,193,252,248,72,137,92,36,24,232,251,1,12,72,137,252,
127 233,72,139,108,36,16,72,139,149,233,139,4,36,72,139,105,252,240,131,192,1,
128 73,57,215,15,132,244,67,72,193,229,17,72,193,252,237,17,72,137,202,72,137,
129 90,252,248,72,139,157,233,139,11,15,182,252,233,15,182,205,72,131,195,4,65,
130 252,255,36,252,238,248,68,72,139,108,36,16,72,137,149,233,72,137,206,72,137,
131 252,239,72,137,92,36,24,232,251,1,13,72,139,149,233,139,67,252,252,15,182,
132 204,15,182,232,193,232,16,65,252,255,164,253,252,238,233,248,69,129,252,248,
133 239,15,130,244,70,76,139,26,76,137,221,73,193,252,251,47,65,129,252,251,239,
134 15,131,244,70,72,139,90,252,248,137,4,36,72,139,42,72,137,106,252,240,131,
135 232,2,15,132,244,248,255,72,137,209,248,1,72,131,193,8,72,139,41,72,137,105,
136 252,240,131,232,1,15,133,244,1,248,2,139,4,36,252,233,244,71,248,72,129,252,
137 248,239,15,130,244,70,72,139,2,72,193,252,248,47,189,237,57,232,15,66,197,
138 252,247,208,248,2,72,139,106,252,240,72,193,229,17,72,193,252,237,17,72,139,
139 132,253,197,233,72,139,90,252,248,73,187,237,237,76,9,216,72,137,66,252,240,
140 252,233,244,73,248,74,129,252,248,239,255,15,130,244,70,72,139,42,72,139,
141 90,252,248,73,137,252,235,72,193,229,17,72,193,252,237,17,73,193,252,251,
142 47,65,129,252,251,239,15,133,244,252,248,1,72,139,173,233,248,2,72,133,252,
143 237,72,199,66,252,240,237,15,132,244,73,72,184,237,237,72,9,232,72,137,66,
144 252,240,73,139,134,233,139,141,233,35,136,233,73,187,237,237,76,9,216,105,
145 201,239,255,72,3,141,233,248,3,72,57,129,233,15,132,244,251,248,4,72,139,
146 137,233,72,133,201,15,133,244,3,252,233,244,73,248,5,72,139,169,233,72,129,
147 252,253,239,15,132,244,73,72,137,106,252,240,252,233,244,73,248,6,255,65,
148 129,252,251,239,15,132,244,1,65,129,252,251,239,15,135,244,253,65,187,237,
149 248,7,65,252,247,211,75,139,172,253,222,233,252,233,244,2,248,75,129,252,
150 248,239,15,130,244,70,72,139,42,73,137,252,234,73,137,252,235,72,193,229,
151 17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,70,72,
152 131,189,233,0,255,15,133,244,70,72,139,74,8,73,137,203,72,193,225,17,72,193,
153 252,233,17,73,193,252,251,47,65,129,252,251,239,15,133,244,70,72,137,141,
154 233,72,139,90,252,248,76,137,82,252,240,252,246,133,233,235,15,132,244,247,
155 128,165,233,235,73,139,134,233,73,137,174,233,72,137,133,233,248,1,252,233,
156 244,73,248,76,255,129,252,248,239,15,130,244,70,72,139,50,73,137,252,243,
157 72,193,230,17,72,193,252,238,17,73,193,252,251,47,65,129,252,251,239,15,133,
158 244,70,72,137,213,72,141,82,8,72,139,124,36,16,232,251,1,14,72,137,252,234,
159 72,139,40,72,139,90,252,248,72,137,106,252,240,252,233,244,73,248,77,129,
160 252,248,239,15,133,244,70,72,139,42,73,137,252,235,73,193,252,251,47,65,129,
161 252,251,239,15,135,244,70,72,139,90,252,248,72,137,106,252,240,252,233,244,
162 73,248,78,129,252,248,239,255,15,130,244,70,72,139,90,252,248,72,139,42,73,
163 137,252,235,73,193,252,251,47,65,129,252,251,239,15,133,244,249,248,2,72,
164 137,106,252,240,252,233,244,73,248,3,65,129,252,251,239,15,135,244,79,73,
165 131,190,233,0,15,133,244,70,73,139,174,233,73,59,174,233,15,130,244,247,255,
166 232,244,80,248,1,72,139,108,36,16,72,137,149,233,72,137,92,36,24,72,137,214,
167 72,137,252,239,232,251,1,15,72,139,149,233,72,189,237,237,72,9,197,252,233,
168 244,2,248,81,129,252,248,239,15,130,244,70,15,132,244,248,248,1,72,139,50,
169 73,137,252,243,72,193,230,17,72,193,252,238,17,73,193,252,251,47,65,129,252,
170 251,239,15,133,244,70,255,72,139,108,36,16,72,137,149,233,72,137,149,233,
171 72,139,90,252,248,72,141,82,8,72,137,252,239,72,137,92,36,24,232,251,1,16,
172 72,139,149,233,133,192,15,132,244,249,72,139,106,8,72,139,66,16,72,137,106,
173 252,240,72,137,66,252,248,248,82,184,237,252,233,244,83,248,2,72,199,66,8,
174 237,252,233,244,1,248,3,72,199,66,252,240,237,252,233,244,73,248,84,129,252,
175 248,239,255,15,130,244,70,72,139,42,73,137,252,234,73,137,252,235,72,193,
176 229,17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,
177 70,255,72,131,189,233,0,15,133,244,70,255,72,139,66,252,240,72,193,224,17,
178 72,193,232,17,72,139,128,233,73,187,237,237,76,9,216,72,139,90,252,248,72,
179 137,66,252,240,76,137,82,252,248,72,199,2,237,184,237,252,233,244,83,248,
180 85,129,252,248,239,15,130,244,70,72,139,42,73,137,252,235,72,193,229,17,72,
181 193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,70,76,139,
182 90,8,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,66,
183 8,72,139,90,252,248,73,186,237,237,255,102,73,15,110,202,252,242,15,88,193,
184 252,242,15,44,200,252,242,15,17,66,252,240,59,141,233,15,131,244,248,72,139,
185 133,233,72,141,4,200,248,1,72,129,56,239,15,132,244,86,72,139,40,72,137,106,
186 252,248,252,233,244,82,248,2,131,189,233,0,15,132,244,86,72,137,252,239,72,
187 137,213,137,206,232,251,1,3,72,137,252,234,72,133,192,15,133,244,1,248,86,
188 184,237,252,233,244,83,248,87,255,129,252,248,239,15,130,244,70,72,139,42,
189 73,137,252,234,73,137,252,235,72,193,229,17,72,193,252,237,17,73,193,252,
190 251,47,65,129,252,251,239,15,133,244,70,255,72,139,66,252,240,72,193,224,
191 17,72,193,232,17,72,139,128,233,73,187,237,237,76,9,216,72,139,90,252,248,
192 72,137,66,252,240,76,137,82,252,248,72,199,2,0,0,0,0,184,237,252,233,244,
193 83,248,88,129,252,248,239,15,130,244,70,72,141,74,16,131,232,1,187,237,248,
194 1,65,15,182,174,233,72,193,252,237,235,72,131,229,1,72,1,252,235,73,137,199,
195 248,2,74,139,108,252,249,232,74,137,108,252,249,252,240,73,131,252,239,1,
196 15,135,244,2,252,233,244,29,248,89,255,129,252,248,239,15,130,244,70,72,139,
197 74,8,73,137,203,73,193,252,251,47,65,129,252,251,239,15,133,244,70,72,139,
198 42,72,137,10,72,137,106,8,72,141,74,24,131,232,2,187,237,252,233,244,1,248,
199 90,129,252,248,239,15,130,244,70,72,139,42,72,193,229,17,72,193,252,237,17,
200 72,139,90,252,248,72,137,92,36,24,72,137,44,36,76,139,26,73,193,252,251,47,
201 65,129,252,251,239,15,133,244,70,72,131,189,233,0,15,133,244,70,255,128,189,
202 233,235,15,135,244,70,72,139,141,233,15,132,244,247,72,59,141,233,15,132,
203 244,70,72,139,89,252,248,72,137,25,72,131,193,8,248,1,72,141,92,193,252,240,
204 72,59,157,233,15,135,244,70,72,137,157,233,72,139,108,36,16,72,137,149,233,
205 72,131,194,8,72,137,149,233,72,141,108,194,232,72,41,221,72,57,203,15,132,
206 244,249,248,2,255,72,139,4,43,72,137,67,252,248,72,131,252,235,8,72,57,203,
207 15,133,244,2,248,3,72,137,206,72,139,60,36,232,244,26,72,139,108,36,16,72,
208 139,28,36,72,139,149,233,73,137,174,233,65,199,134,233,237,129,252,248,239,
209 15,135,244,254,248,4,72,139,139,233,76,139,187,233,72,137,139,233,76,137,
210 252,251,72,41,203,15,132,244,252,72,141,4,26,193,252,235,3,72,59,133,233,
211 255,15,135,244,255,72,137,213,72,41,205,248,5,72,139,1,72,137,4,41,72,131,
212 193,8,76,57,252,249,15,133,244,5,248,6,141,67,2,73,187,237,237,76,137,90,
213 252,248,248,7,72,139,92,36,24,137,4,36,72,199,193,252,248,252,255,252,255,
214 252,255,252,247,195,237,15,132,244,14,252,233,244,15,248,8,73,187,237,237,
215 76,137,90,252,248,72,139,139,233,72,131,252,233,8,72,137,139,233,255,72,139,
216 1,72,137,2,184,237,252,233,244,7,248,9,72,139,12,36,76,137,185,233,72,137,
217 222,72,137,252,239,232,251,1,0,72,139,28,36,72,139,149,233,252,233,244,4,
218 248,91,72,139,106,252,240,72,193,229,17,72,193,252,237,17,72,139,173,233,
219 72,193,229,17,72,193,252,237,17,72,139,90,252,248,72,137,92,36,24,72,137,
220 44,36,72,131,189,233,0,15,133,244,70,128,189,233,235,15,135,244,70,72,139,
221 141,233,15,132,244,247,255,72,59,141,233,15,132,244,70,72,139,89,252,248,
222 72,137,25,72,131,193,8,248,1,72,141,92,193,252,248,72,59,157,233,15,135,244,
223 70,72,137,157,233,72,139,108,36,16,72,137,149,233,72,137,149,233,72,141,108,
224 194,252,240,72,41,221,72,57,203,15,132,244,249,248,2,72,139,4,43,72,137,67,
225 252,248,72,131,252,235,8,72,57,203,15,133,244,2,248,3,72,137,206,72,139,60,
226 36,232,244,26,72,139,108,36,16,72,139,28,36,72,139,149,233,255,73,137,174,
227 233,65,199,134,233,237,129,252,248,239,15,135,244,254,248,4,72,139,139,233,
228 76,139,187,233,72,137,139,233,76,137,252,251,72,41,203,15,132,244,252,72,
229 141,4,26,193,252,235,3,72,59,133,233,15,135,244,255,72,137,213,72,41,205,
230 248,5,72,139,1,72,137,4,41,72,131,193,8,76,57,252,249,15,133,244,5,248,6,
231 255,141,67,1,248,7,72,139,92,36,24,137,4,36,49,201,252,247,195,237,15,132,
232 244,14,252,233,244,15,248,8,72,137,222,72,137,252,239,232,251,1,17,248,9,
233 72,139,12,36,76,137,185,233,72,137,222,72,137,252,239,232,251,1,0,72,139,
234 28,36,72,139,149,233,252,233,244,4,248,92,72,139,108,36,16,72,252,247,133,
235 233,237,15,132,244,70,72,137,149,233,72,141,68,194,252,248,72,137,133,233,
236 255,49,192,72,137,133,233,176,235,136,133,233,252,233,244,17,248,93,129,252,
237 248,239,15,130,244,70,72,139,42,73,137,252,235,73,193,252,251,47,65,129,252,
238 251,239,15,131,244,70,72,209,229,72,209,252,237,72,139,90,252,248,72,137,
239 106,252,240,252,233,244,73,248,94,129,252,248,239,15,130,244,70,76,139,26,
240 73,193,252,251,47,65,129,252,251,239,255,15,131,244,70,252,242,15,81,2,248,
241 95,72,139,90,252,248,252,242,15,17,66,252,240,248,73,184,237,248,83,137,4,
242 36,248,71,252,247,195,237,15,133,244,253,248,5,56,67,252,255,15,135,244,252,
243 15,182,75,252,253,72,252,247,217,72,141,84,202,252,240,139,3,15,182,204,15,
244 182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,6,72,199,68,194,
245 232,237,72,131,192,1,252,233,244,5,248,7,72,199,193,252,240,252,255,252,255,
246 252,255,252,233,244,15,248,96,255,76,139,26,73,193,252,251,47,65,129,252,
247 251,239,15,131,244,70,252,242,15,16,2,232,244,97,252,233,244,95,248,98,76,
248 139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,
249 232,244,99,252,233,244,95,248,100,129,252,248,239,15,133,244,70,255,76,139,
250 26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,
251 137,213,232,251,1,18,72,137,252,234,252,233,244,95,248,101,129,252,248,239,
252 15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,
253 252,242,15,16,2,72,137,213,232,251,1,19,72,137,252,234,252,233,244,95,248,
254 102,129,252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,
255 251,239,255,15,131,244,70,252,242,15,16,2,72,137,213,232,251,1,20,72,137,
256 252,234,252,233,244,95,248,103,129,252,248,239,15,130,244,70,76,139,26,73,
257 193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,137,213,
258 232,251,1,21,72,137,252,234,252,233,244,95,248,104,129,252,248,239,15,130,
259 244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,255,252,
260 242,15,16,2,72,137,213,232,251,1,22,72,137,252,234,252,233,244,95,248,105,
261 129,252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,251,
262 239,15,131,244,70,252,242,15,16,2,72,137,213,232,251,1,23,72,137,252,234,
263 252,233,244,95,248,106,129,252,248,239,15,130,244,70,76,139,26,73,193,252,
264 251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,137,213,232,251,
265 1,24,72,137,252,234,252,233,244,95,248,107,255,129,252,248,239,15,130,244,
266 70,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,
267 16,2,72,137,213,232,251,1,25,72,137,252,234,252,233,244,95,248,108,129,252,
268 248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,
269 244,70,252,242,15,16,2,72,137,213,232,251,1,26,72,137,252,234,252,233,244,
270 95,248,109,129,252,248,239,255,15,130,244,70,76,139,26,73,193,252,251,47,
271 65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,137,213,232,251,1,27,
272 72,137,252,234,252,233,244,95,248,110,129,252,248,239,15,130,244,70,76,139,
273 26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,
274 137,213,232,251,1,28,72,137,252,234,252,233,244,95,248,111,129,252,248,239,
275 15,130,244,70,255,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,
276 70,252,242,15,16,2,72,137,213,232,251,1,29,72,137,252,234,252,233,244,95,
277 248,112,129,252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,
278 252,251,239,15,131,244,70,76,139,90,8,73,193,252,251,47,65,129,252,251,239,
279 15,131,244,70,252,242,15,16,2,252,242,15,16,74,8,72,137,213,232,251,1,30,
280 72,137,252,234,252,233,244,95,248,113,129,252,248,239,255,15,130,244,70,76,
281 139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,76,139,90,8,73,
282 193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,252,242,15,
283 16,74,8,72,137,213,232,251,1,31,72,137,252,234,252,233,244,95,248,114,129,
284 252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,
285 15,131,244,70,76,139,90,8,73,193,252,251,47,65,129,252,251,239,15,131,244,
286 70,255,252,242,15,16,2,252,242,15,16,74,8,72,137,213,232,251,1,32,72,137,
287 252,234,252,233,244,95,248,115,129,252,248,239,15,130,244,70,76,139,26,73,
288 193,252,251,47,65,129,252,251,239,15,131,244,70,76,139,90,8,73,193,252,251,
289 47,65,129,252,251,239,15,131,244,70,221,66,8,221,2,217,252,253,221,217,72,
290 139,90,252,248,221,90,252,240,252,233,244,73,248,116,129,252,248,239,15,130,
291 244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,255,15,131,244,70,252,
292 242,15,16,2,72,137,213,72,141,60,36,232,251,1,33,72,137,252,234,139,44,36,
293 72,139,90,252,248,252,242,15,17,66,252,240,252,242,15,42,205,252,242,15,17,
294 74,252,248,184,237,252,233,244,83,248,117,129,252,248,239,15,130,244,70,76,
295 139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,
296 72,137,213,72,141,122,252,240,232,251,1,34,72,137,252,234,72,139,90,252,248,
297 252,242,15,17,66,252,248,184,237,252,233,244,83,248,118,129,252,248,239,15,
298 130,244,70,255,185,2,0,0,0,76,139,26,73,193,252,251,47,65,129,252,251,239,
299 15,131,244,70,252,242,15,16,2,248,5,57,193,15,131,244,95,76,139,92,202,252,
300 248,73,193,252,251,47,65,129,252,251,239,15,131,244,70,248,6,252,242,15,16,
301 76,202,252,248,248,7,252,242,15,93,193,131,193,1,252,233,244,5,248,119,129,
302 252,248,239,15,130,244,70,185,2,0,0,0,76,139,26,73,193,252,251,47,65,129,
303 252,251,239,15,131,244,70,255,252,242,15,16,2,248,5,57,193,15,131,244,95,
304 76,139,92,202,252,248,73,193,252,251,47,65,129,252,251,239,15,131,244,70,
305 248,6,252,242,15,16,76,202,252,248,248,7,252,242,15,95,193,131,193,1,252,
306 233,244,5,248,120,129,252,248,239,15,133,244,70,72,139,42,73,137,252,235,
307 72,193,229,17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,
308 244,70,72,139,90,252,248,131,189,233,1,15,130,244,86,255,15,182,173,233,252,
309 242,15,42,197,252,233,244,95,248,121,73,139,174,233,73,59,174,233,15,130,
310 244,247,232,244,80,248,1,129,252,248,239,15,133,244,70,76,139,26,73,193,252,
311 251,47,65,129,252,251,239,15,131,244,70,252,242,15,44,42,129,252,253,252,
312 255,0,0,0,15,135,244,70,255,137,44,36,65,186,1,0,0,0,72,141,4,36,248,122,
313 72,139,108,36,16,72,137,149,233,68,137,210,72,137,198,72,137,252,239,72,137,
314 92,36,24,232,251,1,35,248,123,72,139,149,233,72,139,90,252,248,73,187,237,
315 237,76,9,216,72,137,66,252,240,252,233,244,73,248,124,73,139,174,233,73,59,
316 174,233,15,130,244,247,232,244,80,248,1,65,186,252,255,252,255,252,255,252,
317 255,129,252,248,239,15,130,244,70,255,15,134,244,247,76,139,90,16,73,193,
318 252,251,47,65,129,252,251,239,15,131,244,70,252,242,68,15,44,82,16,248,1,
319 72,139,42,73,137,252,235,72,193,229,17,72,193,252,237,17,73,193,252,251,47,
320 65,129,252,251,239,15,133,244,70,76,139,90,8,73,193,252,251,47,65,129,252,
321 251,239,15,131,244,70,252,242,15,44,74,8,139,133,233,68,57,208,15,130,244,
322 251,248,2,133,201,15,142,244,253,248,3,255,65,41,202,15,140,244,125,72,141,
323 132,253,13,233,65,131,194,1,248,4,252,233,244,122,248,5,15,140,244,252,69,
324 141,84,2,1,252,233,244,2,248,6,65,137,194,252,233,244,2,248,7,15,132,244,
325 254,1,193,131,193,1,15,143,244,3,248,8,255,185,1,0,0,0,252,233,244,3,248,
326 125,69,49,210,252,233,244,4,248,126,129,252,248,239,15,130,244,70,73,139,
327 174,233,73,59,174,233,15,130,244,247,232,244,80,248,1,72,139,50,73,137,252,
328 243,72,193,230,17,72,193,252,238,17,73,193,252,251,47,65,129,252,251,239,
329 15,133,244,70,255,72,139,108,36,16,73,141,190,233,72,137,149,233,72,139,135,
330 233,72,137,175,233,72,137,135,233,72,137,92,36,24,232,251,1,36,72,137,199,
331 232,251,1,37,252,233,244,123,248,127,129,252,248,239,15,130,244,70,73,139,
332 174,233,73,59,174,233,15,130,244,247,232,244,80,248,1,72,139,50,73,137,252,
333 243,72,193,230,17,72,193,252,238,17,73,193,252,251,47,65,129,252,251,239,
334 255,15,133,244,70,72,139,108,36,16,73,141,190,233,72,137,149,233,72,139,135,
335 233,72,137,175,233,72,137,135,233,72,137,92,36,24,232,251,1,38,72,137,199,
336 232,251,1,37,252,233,244,123,248,128,129,252,248,239,15,130,244,70,73,139,
337 174,233,73,59,174,233,15,130,244,247,232,244,80,248,1,255,72,139,50,73,137,
338 252,243,72,193,230,17,72,193,252,238,17,73,193,252,251,47,65,129,252,251,
339 239,15,133,244,70,72,139,108,36,16,73,141,190,233,72,137,149,233,72,139,135,
340 233,72,137,175,233,72,137,135,233,72,137,92,36,24,232,251,1,39,72,137,199,
341 232,251,1,37,252,233,244,123,248,129,129,252,248,239,15,130,244,70,76,139,
342 26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,
343 189,237,237,255,102,72,15,110,205,252,242,15,88,193,102,15,126,197,248,2,
344 252,233,244,130,248,131,129,252,248,239,15,130,244,70,72,189,237,237,102,
345 72,15,110,205,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,
346 252,242,15,16,2,252,242,15,88,193,102,15,126,197,248,2,65,137,194,72,141,
347 68,194,252,240,248,1,72,57,208,15,134,244,130,76,139,24,73,193,252,251,47,
348 65,129,252,251,239,15,131,244,132,255,252,242,15,16,0,252,242,15,88,193,102,
349 15,126,193,33,205,72,131,232,8,252,233,244,1,248,133,129,252,248,239,15,130,
350 244,70,72,189,237,237,102,72,15,110,205,76,139,26,73,193,252,251,47,65,129,
351 252,251,239,15,131,244,70,252,242,15,16,2,252,242,15,88,193,102,15,126,197,
352 248,2,65,137,194,72,141,68,194,252,240,248,1,72,57,208,15,134,244,130,76,
353 139,24,73,193,252,251,47,65,129,252,251,239,15,131,244,132,252,242,15,16,
354 0,252,242,15,88,193,102,15,126,193,9,205,72,131,232,8,252,233,244,1,248,134,
355 255,129,252,248,239,15,130,244,70,72,189,237,237,102,72,15,110,205,76,139,
356 26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,252,
357 242,15,88,193,102,15,126,197,248,2,65,137,194,72,141,68,194,252,240,248,1,
358 72,57,208,15,134,244,130,76,139,24,73,193,252,251,47,65,129,252,251,239,15,
359 131,244,132,252,242,15,16,0,252,242,15,88,193,102,15,126,193,49,205,72,131,
360 232,8,252,233,244,1,248,135,129,252,248,239,255,15,130,244,70,76,139,26,73,
361 193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,189,237,
362 237,102,72,15,110,205,252,242,15,88,193,102,15,126,197,248,2,15,205,252,233,
363 244,130,248,136,129,252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,
364 65,129,252,251,239,15,131,244,70,252,242,15,16,2,72,189,237,237,255,102,72,
365 15,110,205,252,242,15,88,193,102,15,126,197,248,2,252,247,213,248,130,252,
366 242,15,42,197,252,233,244,95,248,132,68,137,208,252,233,244,70,248,137,129,
367 252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,251,239,
368 15,131,244,70,76,139,90,8,73,193,252,251,47,65,129,252,251,239,15,131,244,
369 70,252,242,15,16,2,252,242,15,16,74,8,72,189,237,237,255,102,72,15,110,213,
370 252,242,15,88,194,252,242,15,88,202,102,15,126,197,102,15,126,201,211,229,
371 252,233,244,130,248,138,129,252,248,239,15,130,244,70,76,139,26,73,193,252,
372 251,47,65,129,252,251,239,15,131,244,70,76,139,90,8,73,193,252,251,47,65,
373 129,252,251,239,15,131,244,70,252,242,15,16,2,252,242,15,16,74,8,72,189,237,
374 237,102,72,15,110,213,252,242,15,88,194,252,242,15,88,202,102,15,126,197,
375 102,15,126,201,211,252,237,252,233,244,130,248,139,129,252,248,239,15,130,
376 244,70,255,76,139,26,73,193,252,251,47,65,129,252,251,239,15,131,244,70,76,
377 139,90,8,73,193,252,251,47,65,129,252,251,239,15,131,244,70,252,242,15,16,
378 2,252,242,15,16,74,8,72,189,237,237,102,72,15,110,213,252,242,15,88,194,252,
379 242,15,88,202,102,15,126,197,102,15,126,201,211,252,253,252,233,244,130,248,
380 140,129,252,248,239,15,130,244,70,76,139,26,73,193,252,251,47,65,129,252,
381 251,239,15,131,244,70,76,139,90,8,73,193,252,251,47,65,129,252,251,239,15,
382 131,244,70,255,252,242,15,16,2,252,242,15,16,74,8,72,189,237,237,102,72,15,
383 110,213,252,242,15,88,194,252,242,15,88,202,102,15,126,197,102,15,126,201,
384 211,197,252,233,244,130,248,141,129,252,248,239,15,130,244,70,76,139,26,73,
385 193,252,251,47,65,129,252,251,239,15,131,244,70,76,139,90,8,73,193,252,251,
386 47,65,129,252,251,239,15,131,244,70,252,242,15,16,2,252,242,15,16,74,8,72,
387 189,237,237,102,72,15,110,213,252,242,15,88,194,252,242,15,88,202,102,15,
388 126,197,102,15,126,201,211,205,252,233,244,130,248,142,255,184,237,252,233,
389 244,70,248,79,184,237,248,70,72,139,108,36,16,72,139,90,252,248,72,137,92,
390 36,24,72,137,149,233,72,141,68,194,252,248,72,141,136,233,72,137,133,233,
391 72,139,66,252,240,72,193,224,17,72,193,232,17,72,59,141,233,15,135,244,251,
392 72,137,252,239,252,255,144,233,72,139,149,233,133,192,15,143,244,83,248,1,
393 72,139,141,233,72,41,209,193,252,233,3,133,192,141,65,1,72,139,106,252,240,
394 15,133,244,34,255,72,193,229,17,72,193,252,237,17,72,139,157,233,139,11,15,
395 182,252,233,15,182,205,72,131,195,4,65,252,255,36,252,238,248,34,72,137,209,
396 252,247,195,237,15,133,244,249,15,182,107,252,253,72,252,247,221,72,141,84,
397 252,234,252,240,252,233,244,29,248,3,72,137,221,72,131,229,252,248,72,41,
398 252,234,252,233,244,29,248,5,190,237,72,137,252,239,232,251,1,0,72,139,149,
399 233,49,192,252,233,244,1,248,80,93,72,137,44,36,72,139,108,36,16,72,137,92,
400 36,24,72,137,149,233,72,141,68,194,252,248,72,137,252,239,72,137,133,233,
401 232,251,1,40,72,139,149,233,255,72,139,133,233,72,41,208,193,232,3,131,192,
402 1,72,139,44,36,85,195,248,143,65,15,182,134,233,168,235,15,133,244,251,168,
403 235,15,133,244,247,168,235,15,132,244,247,65,252,255,142,233,252,233,244,
404 247,248,144,65,15,182,134,233,168,235,15,133,244,251,255,252,233,244,247,
405 248,145,65,15,182,134,233,168,235,15,133,244,251,168,235,15,132,244,251,65,
406 252,255,142,233,15,132,244,247,168,235,15,132,244,251,248,1,72,139,108,36,
407 16,72,137,149,233,72,137,222,72,137,252,239,232,251,1,41,248,3,255,72,139,
408 149,233,248,4,15,182,75,252,253,248,5,15,182,107,252,252,15,183,67,252,254,
409 65,252,255,164,253,252,238,233,248,146,72,131,195,4,72,139,77,216,137,12,
410 36,252,233,244,4,248,147,72,139,106,252,240,72,193,229,17,72,193,252,237,
411 17,72,139,173,233,15,182,133,233,72,141,4,194,72,139,108,36,16,72,137,149,
412 233,72,137,133,233,72,137,222,73,141,190,233,73,137,174,233,72,137,92,36,
413 24,232,251,1,42,252,233,244,3,248,148,72,137,92,36,24,252,233,244,247,248,
414 149,255,72,137,92,36,24,72,131,203,1,248,1,72,141,68,194,252,248,72,139,108,
415 36,16,72,137,149,233,72,137,133,233,72,137,222,72,137,252,239,232,251,1,43,
416 72,199,68,36,24,0,0,0,0,72,131,227,252,254,72,139,149,233,72,137,193,72,139,
417 133,233,72,41,208,72,137,205,15,182,75,252,253,193,232,3,131,192,1,252,255,
418 229,248,150,76,139,93,216,73,193,227,17,73,193,252,235,17,68,139,20,36,15,
419 182,75,252,253,72,141,12,202,65,131,252,234,1,15,132,244,248,248,1,72,139,
420 40,72,137,41,72,131,192,8,72,131,193,8,65,131,252,234,1,15,133,244,1,248,
421 2,15,182,67,252,253,15,182,107,252,255,72,1,232,72,141,68,194,252,248,248,
422 3,72,57,200,15,135,244,255,77,133,219,15,132,244,47,65,15,183,171,233,65,
423 15,183,131,233,255,57,232,15,132,244,47,133,192,15,133,245,73,137,174,233,
424 72,139,108,36,16,72,137,149,233,72,137,222,73,141,190,233,73,137,174,233,
425 232,251,1,44,72,139,149,233,252,233,244,47,248,9,72,199,1,237,72,131,193,
426 8,252,233,244,3,248,151,255,72,139,108,36,16,72,137,149,233,72,137,222,72,
427 137,252,239,232,251,1,45,72,139,149,233,72,131,252,235,4,252,233,244,47,255,
428 248,152,65,85,65,84,65,83,65,82,65,81,65,80,87,86,85,72,141,108,36,88,85,
429 83,82,81,80,15,182,69,252,248,138,101,252,240,76,137,125,252,248,76,137,117,
430 252,240,65,139,142,233,65,199,134,233,237,65,137,134,233,65,137,142,233,72,
431 129,252,236,239,72,131,197,128,252,242,68,15,17,125,252,248,252,242,68,15,
432 17,117,252,240,252,242,68,15,17,109,232,252,242,68,15,17,101,224,252,242,
433 68,15,17,93,216,252,242,68,15,17,85,208,252,242,68,15,17,77,200,252,242,68,
434 15,17,69,192,252,242,15,17,125,184,252,242,15,17,117,176,252,242,15,17,109,
435 168,252,242,15,17,101,160,252,242,15,17,93,152,252,242,15,17,85,144,252,242,
436 15,17,77,136,252,242,15,17,69,128,73,139,174,233,73,139,150,233,73,137,174,
437 233,72,137,149,233,72,137,230,73,141,190,233,73,199,134,233,0,0,0,0,232,251,
438 1,46,72,139,141,233,72,129,225,239,72,137,169,233,72,139,149,233,72,139,153,
439 233,252,233,244,247,248,153,255,72,141,76,36,16,248,1,76,139,105,252,248,
440 76,139,33,72,137,204,133,192,15,136,244,255,72,139,108,36,16,137,4,36,76,
441 139,122,252,240,73,193,231,17,73,193,252,239,17,77,139,191,233,77,139,191,
442 233,72,137,149,233,73,199,134,233,0,0,0,0,65,199,134,233,237,139,3,15,182,
443 204,15,182,232,72,131,195,4,193,232,16,129,252,253,239,15,130,244,249,129,
444 252,253,239,15,131,244,250,248,2,139,4,36,248,3,65,252,255,36,252,238,248,
445 4,72,139,66,252,248,169,237,255,15,133,244,2,15,182,64,252,253,72,252,247,
446 216,76,139,124,194,224,73,193,231,17,73,193,252,239,17,77,139,191,233,77,
447 139,191,233,252,233,244,2,248,9,137,198,72,137,252,239,252,247,222,232,251,
448 1,47,248,154,248,97,72,184,237,237,102,72,15,110,208,72,184,237,237,102,72,
449 15,110,216,15,40,200,102,15,84,202,102,15,46,217,15,134,244,247,102,15,85,
450 208,252,242,15,88,203,252,242,15,92,203,102,15,86,202,72,184,237,237,102,
451 72,15,110,208,252,242,15,194,193,1,102,15,84,194,252,242,15,92,200,15,40,
452 193,248,1,195,248,155,248,99,72,184,237,237,255,102,72,15,110,208,72,184,
453 237,237,102,72,15,110,216,15,40,200,102,15,84,202,102,15,46,217,15,134,244,
454 247,102,15,85,208,252,242,15,88,203,252,242,15,92,203,102,15,86,202,72,184,
455 237,237,102,72,15,110,208,252,242,15,194,193,6,102,15,84,194,252,242,15,92,
456 200,15,40,193,248,1,195,248,156,248,157,72,184,237,237,102,72,15,110,208,
457 72,184,237,237,102,72,15,110,216,15,40,200,102,15,84,202,102,15,46,217,15,
458 134,244,247,102,15,85,208,15,40,193,252,242,15,88,203,252,242,15,92,203,72,
459 184,237,237,102,72,15,110,216,252,242,15,194,193,1,102,15,84,195,252,242,
460 15,92,200,102,15,86,202,15,40,193,248,1,195,248,158,255,15,40,232,252,242,
461 15,94,193,72,184,237,237,102,72,15,110,208,72,184,237,237,102,72,15,110,216,
462 15,40,224,102,15,84,226,102,15,46,220,15,134,244,247,102,15,85,208,252,242,
463 15,88,227,252,242,15,92,227,102,15,86,226,72,184,237,237,102,72,15,110,208,
464 252,242,15,194,196,1,102,15,84,194,252,242,15,92,224,15,40,197,252,242,15,
465 89,204,252,242,15,92,193,195,248,1,252,242,15,89,200,15,40,197,252,242,15,
466 92,193,195,248,159,131,252,248,1,15,142,244,252,248,1,169,1,0,0,0,15,133,
467 244,248,252,242,15,89,192,209,232,252,233,244,1,248,2,209,232,15,132,244,
468 251,255,15,40,200,248,3,252,242,15,89,192,209,232,15,132,244,250,15,131,244,
469 3,252,242,15,89,200,252,233,244,3,248,4,252,242,15,89,193,248,5,195,248,6,
470 15,132,244,5,15,130,244,253,252,247,216,232,244,1,72,184,237,237,102,72,15,
471 110,200,252,242,15,94,200,15,40,193,195,248,7,72,184,237,237,255,102,72,15,
472 110,192,195,248,160,137,252,248,83,49,201,15,162,137,6,137,94,4,137,78,8,
473 137,86,12,91,195,248,161,255,204,255,204,248,162,83,65,87,65,86,72,131,252,
474 236,40,76,141,181,233,72,139,157,233,15,183,192,137,131,233,72,137,187,233,
475 72,137,179,233,72,137,147,233,72,137,139,233,252,242,15,17,131,233,252,242,
476 15,17,139,233,252,242,15,17,147,233,252,242,15,17,155,233,72,141,132,253,
477 36,233,76,137,131,233,76,137,139,233,252,242,15,17,163,233,252,242,15,17,
478 171,233,252,242,15,17,179,233,252,242,15,17,187,233,255,72,137,131,233,72,
479 137,230,72,137,92,36,24,72,137,223,232,251,1,48,65,199,134,233,237,72,139,
480 144,233,72,139,128,233,72,41,208,72,139,106,252,240,72,193,229,17,72,193,
481 252,237,17,72,193,232,3,72,131,192,1,72,139,157,233,139,11,15,182,252,233,
482 15,182,205,72,131,195,4,65,252,255,36,252,238,248,33,72,139,76,36,16,73,139,
483 158,233,72,137,139,233,72,137,145,233,72,137,169,233,72,137,223,72,137,198,
484 232,251,1,49,72,139,131,233,252,242,15,16,131,233,252,233,244,17,248,163,
485 85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,15,182,139,233,131,
486 252,233,1,15,136,244,248,248,1,255,72,139,132,253,203,233,72,137,132,253,
487 204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,187,233,72,
488 139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,76,139,139,233,133,
489 192,15,132,244,251,15,40,131,233,15,40,139,233,15,40,147,233,15,40,155,233,
490 131,252,248,4,15,134,244,251,255,15,40,163,233,15,40,171,233,15,40,179,233,
491 15,40,187,233,248,5,252,255,147,233,72,137,131,233,15,41,131,233,72,137,147,
492 233,15,41,139,233,72,139,93,252,248,201,195,255,249,255,76,139,28,202,72,
493 139,44,194,76,137,217,72,137,232,73,193,252,251,47,72,193,252,253,47,65,129,
494 252,251,239,15,131,244,50,129,252,253,239,15,131,244,50,248,1,102,72,15,110,
495 192,248,2,102,72,15,110,201,248,3,72,131,195,4,102,15,46,193,255,15,134,244,
496 247,255,15,135,244,247,255,15,131,244,247,255,15,183,67,252,254,72,141,156,
497 253,131,233,248,1,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,
498 252,255,36,252,238,255,72,139,44,194,76,139,28,202,72,131,195,4,72,137,232,
499 76,137,217,72,193,252,253,47,73,193,252,251,47,255,129,252,253,239,15,131,
500 244,251,65,129,252,251,239,15,131,244,251,102,72,15,110,200,248,1,102,72,
501 15,110,193,248,2,102,15,46,193,248,4,255,15,138,244,248,15,133,244,248,255,
502 15,138,244,248,15,132,244,247,255,248,1,15,183,67,252,254,72,141,156,253,
503 131,233,248,2,255,248,2,15,183,67,252,254,72,141,156,253,131,233,248,1,255,
504 252,233,244,9,255,248,5,129,252,253,239,15,132,244,55,65,129,252,251,239,
505 15,132,244,55,72,57,193,15,132,244,1,68,57,221,15,133,244,2,129,252,253,239,
506 15,135,244,2,72,193,225,17,72,193,252,233,17,72,139,169,233,72,133,252,237,
507 15,132,244,2,252,246,133,233,235,255,15,133,244,2,255,49,252,237,255,189,
508 1,0,0,0,255,252,233,244,54,255,248,3,65,129,252,251,239,255,15,133,244,9,
509 255,252,233,244,55,255,72,252,247,208,72,139,44,202,72,131,195,4,73,137,252,
510 235,72,193,229,17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,
511 15,133,244,249,73,59,44,199,255,72,139,44,202,72,131,195,4,255,73,137,252,
512 235,73,193,252,251,47,65,129,252,251,239,15,131,244,249,248,1,252,242,65,
513 15,16,4,199,248,2,102,15,46,4,202,248,4,255,72,252,247,208,72,139,44,202,
514 72,193,252,253,47,72,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,
515 72,141,156,253,131,233,248,2,139,3,15,182,204,15,182,232,72,131,195,4,193,
516 232,16,65,252,255,36,252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,
517 55,255,15,132,244,248,129,252,253,239,15,132,244,55,15,183,67,252,254,72,
518 141,156,253,131,233,248,2,139,3,15,182,204,15,182,232,72,131,195,4,193,232,
519 16,65,252,255,36,252,238,255,76,139,28,194,72,131,195,4,255,76,137,221,255,
520 72,137,44,202,255,72,139,44,202,72,193,252,253,47,1,197,15,133,244,56,139,
521 3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,
522 76,139,28,202,73,193,252,251,47,65,129,252,251,239,15,131,244,56,139,3,15,
523 182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,72,139,
524 44,194,72,137,44,202,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,
525 65,252,255,36,252,238,255,72,139,44,194,72,193,252,253,47,184,2,0,0,0,72,
526 129,252,253,239,131,216,0,72,193,224,47,72,252,247,208,72,137,4,202,139,3,
527 15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,72,
528 139,44,194,73,137,252,235,73,193,252,251,47,65,129,252,251,239,15,131,244,
529 61,72,184,237,237,72,49,197,72,137,44,202,139,3,15,182,204,15,182,232,72,
530 131,195,4,193,232,16,65,252,255,36,252,238,255,72,139,4,194,73,137,195,72,
531 193,224,17,72,193,232,17,73,193,252,251,47,65,129,252,251,239,15,133,244,
532 248,15,87,192,252,242,15,42,128,233,248,1,252,242,15,17,4,202,139,3,15,182,
533 204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,2,65,129,
534 252,251,239,15,133,244,64,72,137,199,255,72,139,168,233,72,131,252,253,0,
535 15,133,244,255,248,3,255,248,65,72,137,213,232,251,1,50,252,242,15,42,192,
536 72,137,252,234,15,182,75,252,253,252,233,244,1,255,248,9,252,246,133,233,
537 235,15,133,244,3,252,233,244,64,255,15,182,252,236,15,182,192,255,76,139,
538 28,252,234,73,193,252,251,47,65,129,252,251,239,15,131,244,58,252,242,15,
539 16,4,252,234,252,242,65,15,88,4,199,255,76,139,28,252,234,73,193,252,251,
540 47,65,129,252,251,239,15,131,244,60,252,242,65,15,16,4,199,252,242,15,88,
541 4,252,234,255,76,139,28,252,234,73,193,252,251,47,65,129,252,251,239,15,131,
542 244,63,76,139,28,194,73,193,252,251,47,65,129,252,251,239,15,131,244,63,252,
543 242,15,16,4,252,234,252,242,15,88,4,194,255,252,242,15,17,4,202,139,3,15,
544 182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,76,139,
545 28,252,234,73,193,252,251,47,65,129,252,251,239,15,131,244,58,252,242,15,
546 16,4,252,234,252,242,65,15,92,4,199,255,76,139,28,252,234,73,193,252,251,
547 47,65,129,252,251,239,15,131,244,60,252,242,65,15,16,4,199,252,242,15,92,
548 4,252,234,255,76,139,28,252,234,73,193,252,251,47,65,129,252,251,239,15,131,
549 244,63,76,139,28,194,73,193,252,251,47,65,129,252,251,239,15,131,244,63,252,
550 242,15,16,4,252,234,252,242,15,92,4,194,255,76,139,28,252,234,73,193,252,
551 251,47,65,129,252,251,239,15,131,244,58,252,242,15,16,4,252,234,252,242,65,
552 15,89,4,199,255,76,139,28,252,234,73,193,252,251,47,65,129,252,251,239,15,
553 131,244,60,252,242,65,15,16,4,199,252,242,15,89,4,252,234,255,76,139,28,252,
554 234,73,193,252,251,47,65,129,252,251,239,15,131,244,63,76,139,28,194,73,193,
555 252,251,47,65,129,252,251,239,15,131,244,63,252,242,15,16,4,252,234,252,242,
556 15,89,4,194,255,76,139,28,252,234,73,193,252,251,47,65,129,252,251,239,15,
557 131,244,58,252,242,15,16,4,252,234,252,242,65,15,94,4,199,255,76,139,28,252,
558 234,73,193,252,251,47,65,129,252,251,239,15,131,244,60,252,242,65,15,16,4,
559 199,252,242,15,94,4,252,234,255,76,139,28,252,234,73,193,252,251,47,65,129,
560 252,251,239,15,131,244,63,76,139,28,194,73,193,252,251,47,65,129,252,251,
561 239,15,131,244,63,252,242,15,16,4,252,234,252,242,15,94,4,194,255,76,139,
562 28,252,234,73,193,252,251,47,65,129,252,251,239,15,131,244,58,252,242,15,
563 16,4,252,234,252,242,65,15,16,12,199,255,76,139,28,252,234,73,193,252,251,
564 47,65,129,252,251,239,15,131,244,60,252,242,65,15,16,4,199,252,242,15,16,
565 12,252,234,255,76,139,28,252,234,73,193,252,251,47,65,129,252,251,239,15,
566 131,244,63,76,139,28,194,73,193,252,251,47,65,129,252,251,239,15,131,244,
567 63,252,242,15,16,4,252,234,252,242,15,16,12,194,255,248,164,232,244,158,252,
568 242,15,17,4,202,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,
569 255,36,252,238,255,252,233,244,164,255,72,137,213,232,251,1,30,15,182,75,
570 252,253,72,137,252,234,252,242,15,17,4,202,139,3,15,182,204,15,182,232,72,
571 131,195,4,193,232,16,65,252,255,36,252,238,255,15,182,252,236,15,182,192,
572 72,139,124,36,16,72,137,151,233,72,141,52,194,137,194,41,252,234,248,37,72,
573 137,252,253,72,137,92,36,24,232,251,1,51,72,139,149,233,72,133,192,15,133,
574 244,51,15,182,107,252,255,15,182,75,252,253,72,139,4,252,234,72,137,4,202,
575 139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,
576 255,72,252,247,208,73,139,4,199,73,187,237,237,76,9,216,72,137,4,202,139,
577 3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,
578 15,191,192,252,242,15,42,192,252,242,15,17,4,202,139,3,15,182,204,15,182,
579 232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,252,242,65,15,16,4,
580 199,252,242,15,17,4,202,139,3,15,182,204,15,182,232,72,131,195,4,193,232,
581 16,65,252,255,36,252,238,255,72,141,76,202,8,72,141,4,194,72,199,197,237,
582 72,137,105,252,248,248,1,72,137,41,72,131,193,8,72,57,193,15,134,244,1,139,
583 3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,
584 72,139,106,252,240,72,193,229,17,72,193,252,237,17,72,139,172,253,197,233,
585 72,139,173,233,72,139,69,0,72,137,4,202,139,3,15,182,204,15,182,232,72,131,
586 195,4,193,232,16,65,252,255,36,252,238,255,72,139,106,252,240,72,193,229,
587 17,72,193,252,237,17,72,139,172,253,205,233,128,189,233,0,72,139,173,233,
588 72,139,12,194,72,137,77,0,15,132,244,247,252,246,133,233,235,15,133,244,248,
589 248,1,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,
590 238,248,2,72,137,200,72,193,252,248,47,129,232,239,129,252,248,239,15,134,
591 244,1,72,193,225,17,72,193,252,233,17,252,246,129,233,235,15,132,244,1,255,
592 72,137,252,238,72,137,213,73,141,190,233,232,251,1,52,72,137,252,234,252,
593 233,244,1,255,72,252,247,208,72,139,106,252,240,72,193,229,17,72,193,252,
594 237,17,72,139,172,253,205,233,73,139,12,199,72,139,133,233,73,187,237,237,
595 73,9,203,76,137,24,252,246,133,233,235,15,133,244,248,248,1,139,3,15,182,
596 204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,2,252,246,
597 129,233,235,15,132,244,1,128,189,233,0,15,132,244,1,72,137,213,72,137,198,
598 73,141,190,233,232,251,1,52,72,137,252,234,252,233,244,1,255,72,139,106,252,
599 240,72,193,229,17,72,193,252,237,17,252,242,65,15,16,4,199,72,139,172,253,
600 205,233,72,139,141,233,252,242,15,17,1,139,3,15,182,204,15,182,232,72,131,
601 195,4,193,232,16,65,252,255,36,252,238,255,72,139,106,252,240,72,193,229,
602 17,72,193,252,237,17,72,139,172,253,205,233,72,193,224,47,72,252,247,208,
603 72,139,141,233,72,137,1,139,3,15,182,204,15,182,232,72,131,195,4,193,232,
604 16,65,252,255,36,252,238,255,72,141,156,253,131,233,72,139,108,36,16,72,131,
605 189,233,0,15,132,244,247,72,137,149,233,72,141,52,202,72,137,252,239,232,
606 251,1,53,72,139,149,233,248,1,139,3,15,182,204,15,182,232,72,131,195,4,193,
607 232,16,65,252,255,36,252,238,255,72,252,247,208,72,139,108,36,16,72,137,149,
608 233,72,139,82,252,240,72,193,226,17,72,193,252,234,17,73,139,52,199,72,137,
609 252,239,72,137,92,36,24,232,251,1,54,72,139,149,233,15,182,75,252,253,73,
610 187,237,237,76,9,216,72,137,4,202,139,3,15,182,204,15,182,232,72,131,195,
611 4,193,232,16,65,252,255,36,252,238,255,72,139,108,36,16,72,137,149,233,73,
612 139,142,233,73,59,142,233,72,137,92,36,24,15,131,244,251,248,1,137,194,37,
613 252,255,7,0,0,193,252,234,11,61,252,255,7,0,0,15,132,244,249,248,2,72,137,
614 252,239,137,198,232,251,1,55,72,139,149,233,15,182,75,252,253,73,187,237,
615 237,76,9,216,72,137,4,202,139,3,15,182,204,15,182,232,72,131,195,4,193,232,
616 16,65,252,255,36,252,238,248,3,184,1,8,0,0,252,233,244,2,248,5,72,137,252,
617 239,232,251,1,56,15,183,67,252,254,252,233,244,1,255,72,252,247,208,72,139,
618 108,36,16,73,139,142,233,72,137,92,36,24,73,59,142,233,72,137,149,233,15,
619 131,244,249,248,2,73,139,52,199,72,137,252,239,232,251,1,57,72,139,149,233,
620 15,182,75,252,253,73,187,237,237,76,9,216,72,137,4,202,139,3,15,182,204,15,
621 182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,3,72,137,252,239,
622 232,251,1,56,15,183,67,252,254,72,252,247,208,252,233,244,2,255,72,252,247,
623 208,72,139,106,252,240,72,193,229,17,72,193,252,237,17,72,139,173,233,73,
624 139,4,199,252,233,244,165,255,72,252,247,208,72,139,106,252,240,72,193,229,
625 17,72,193,252,237,17,72,139,173,233,73,139,4,199,252,233,244,166,255,15,182,
626 252,236,15,182,192,72,139,44,252,234,72,139,4,194,73,137,252,235,72,193,229,
627 17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,40,73,
628 137,195,73,193,252,251,47,65,129,252,251,239,15,131,244,251,102,72,15,110,
629 192,252,242,15,44,192,252,242,15,42,200,102,15,46,193,15,133,244,40,59,133,
630 233,15,131,244,40,193,224,3,72,3,133,233,76,139,24,73,129,252,251,239,15,
631 132,244,248,248,1,76,137,28,202,139,3,15,182,204,15,182,232,72,131,195,4,
632 193,232,16,65,252,255,36,252,238,248,2,76,139,149,233,77,133,210,15,132,244,
633 1,255,65,252,246,130,233,235,15,132,244,40,252,233,244,1,248,5,65,129,252,
634 251,239,15,133,244,40,72,193,224,17,72,193,232,17,252,233,244,165,255,15,
635 182,252,236,15,182,192,72,139,44,252,234,72,252,247,208,73,139,4,199,73,137,
636 252,235,72,193,229,17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,
637 239,15,133,244,38,248,165,68,139,149,233,68,35,144,233,69,105,210,239,76,
638 3,149,233,73,187,237,237,73,9,195,248,1,77,57,154,233,15,133,244,250,77,139,
639 154,233,73,129,252,251,239,15,132,244,251,248,2,255,76,137,28,202,139,3,15,
640 182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,4,77,
641 139,146,233,77,133,210,15,133,244,1,73,199,195,237,248,5,76,139,149,233,77,
642 133,210,15,132,244,2,65,252,246,130,233,235,15,133,244,2,252,233,244,38,255,
643 15,182,252,236,15,182,192,72,139,44,252,234,73,137,252,235,72,193,229,17,
644 72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,39,59,133,
645 233,15,131,244,39,193,224,3,72,3,133,233,76,139,24,73,129,252,251,239,15,
646 132,244,248,248,1,76,137,28,202,139,3,15,182,204,15,182,232,72,131,195,4,
647 193,232,16,65,252,255,36,252,238,248,2,76,139,149,233,77,133,210,15,132,244,
648 1,65,252,246,130,233,235,15,132,244,39,255,15,182,252,236,15,182,192,72,139,
649 44,252,234,72,193,229,17,72,193,252,237,17,252,242,15,44,4,194,59,133,233,
650 15,131,244,41,193,224,3,72,3,133,233,248,42,76,139,24,248,43,76,137,28,202,
651 139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,
652 255,15,182,252,236,15,182,192,72,139,44,252,234,72,139,4,194,73,137,252,235,
653 72,193,229,17,72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,
654 244,46,73,137,195,73,193,252,251,47,65,129,252,251,239,15,131,244,251,102,
655 72,15,110,192,252,242,15,44,192,252,242,15,42,200,102,15,46,193,15,133,244,
656 46,59,133,233,15,131,244,46,193,224,3,72,3,133,233,72,129,56,239,15,132,244,
657 249,248,1,252,246,133,233,235,15,133,244,253,248,2,255,72,139,44,202,72,137,
658 40,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,
659 238,248,3,76,139,149,233,77,133,210,15,132,244,1,65,252,246,130,233,235,15,
660 132,244,46,252,233,244,1,248,5,65,129,252,251,239,15,133,244,46,72,193,224,
661 17,72,193,232,17,252,233,244,166,248,7,128,165,233,235,255,77,139,150,233,
662 73,137,174,233,76,137,149,233,252,233,244,2,255,15,182,252,236,15,182,192,
663 72,139,44,252,234,72,252,247,208,73,139,4,199,73,137,252,235,72,193,229,17,
664 72,193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,44,248,
665 166,68,139,149,233,68,35,144,233,69,105,210,239,198,133,233,0,76,3,149,233,
666 73,187,237,237,73,9,195,248,1,77,57,154,233,15,133,244,251,73,129,58,239,
667 15,132,244,250,248,2,255,252,246,133,233,235,15,133,244,253,248,3,76,139,
668 28,202,77,137,26,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,
669 255,36,252,238,248,4,76,139,157,233,77,133,219,15,132,244,2,65,252,246,131,
670 233,235,15,132,244,44,252,233,244,2,248,5,77,139,146,233,77,133,210,15,133,
671 244,1,255,76,139,149,233,77,133,210,15,132,244,252,65,252,246,130,233,235,
672 15,132,244,44,248,6,76,137,28,36,72,139,124,36,16,72,137,151,233,72,141,20,
673 36,72,137,252,238,72,137,92,36,24,232,251,1,58,72,139,124,36,16,72,139,151,
674 233,73,137,194,15,182,75,252,253,252,233,244,2,248,7,128,165,233,235,77,139,
675 158,233,73,137,174,233,76,137,157,233,252,233,244,3,255,15,182,252,236,15,
676 182,192,72,139,44,252,234,73,137,252,235,72,193,229,17,72,193,252,237,17,
677 73,193,252,251,47,65,129,252,251,239,15,133,244,45,59,133,233,15,131,244,
678 45,193,224,3,72,3,133,233,72,129,56,239,15,132,244,249,248,1,252,246,133,
679 233,235,15,133,244,253,248,2,76,139,28,202,76,137,24,139,3,15,182,204,15,
680 182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,3,76,139,149,233,
681 77,133,210,15,132,244,1,255,65,252,246,130,233,235,15,132,244,45,252,233,
682 244,1,248,7,128,165,233,235,77,139,150,233,73,137,174,233,76,137,149,233,
683 252,233,244,2,255,15,182,252,236,15,182,192,72,139,44,252,234,72,193,229,
684 17,72,193,252,237,17,252,242,15,44,4,194,252,246,133,233,235,15,133,244,253,
685 248,2,59,133,233,15,131,244,48,193,224,3,72,3,133,233,248,49,76,139,28,202,
686 76,137,24,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,
687 36,252,238,248,7,128,165,233,235,77,139,150,233,73,137,174,233,76,137,149,
688 233,252,233,244,2,255,248,1,69,139,20,199,72,141,12,202,72,139,105,252,248,
689 72,193,229,17,72,193,252,237,17,252,246,133,233,235,15,133,244,253,248,2,
690 139,4,36,131,232,1,15,132,244,250,68,1,208,59,133,233,15,135,244,251,68,41,
691 208,65,193,226,3,76,3,149,233,248,3,72,139,41,72,131,193,8,73,137,42,73,131,
692 194,8,131,232,1,15,133,244,3,248,4,139,3,15,182,204,15,182,232,72,131,195,
693 4,193,232,16,65,252,255,36,252,238,248,5,72,139,124,36,16,72,137,151,233,
694 72,137,252,238,137,194,72,137,252,253,72,137,92,36,24,232,251,1,59,72,139,
695 149,233,255,15,182,75,252,253,15,183,67,252,254,252,233,244,1,248,7,128,165,
696 233,235,73,139,134,233,73,137,174,233,72,137,133,233,252,233,244,2,255,3,
697 4,36,255,72,139,44,202,73,137,252,235,72,193,229,17,72,193,252,237,17,73,
698 193,252,251,47,65,129,252,251,239,15,133,244,66,72,141,84,202,16,72,137,90,
699 252,248,72,139,157,233,139,11,15,182,252,233,15,182,205,72,131,195,4,65,252,
700 255,36,252,238,255,72,141,76,202,16,73,137,215,72,139,105,252,240,73,137,
701 252,235,73,193,252,251,47,65,129,252,251,239,15,133,244,30,248,67,72,139,
702 90,252,248,252,247,195,237,15,133,244,253,248,1,72,137,106,252,240,137,4,
703 36,131,232,1,15,132,244,249,248,2,72,139,41,72,131,193,8,73,137,47,73,131,
704 199,8,131,232,1,15,133,244,2,72,139,106,252,240,248,3,72,193,229,17,72,193,
705 252,237,17,139,4,36,128,189,233,1,15,135,244,251,248,4,72,139,157,233,255,
706 139,11,15,182,252,233,15,182,205,72,131,195,4,65,252,255,36,252,238,248,5,
707 252,247,195,237,15,133,244,4,15,182,75,252,253,72,252,247,217,76,139,124,
708 202,224,73,193,231,17,73,193,252,239,17,77,139,191,233,77,139,191,233,252,
709 233,244,4,248,7,72,129,252,235,239,252,247,195,237,15,133,244,254,72,41,218,
710 73,137,215,72,139,90,252,248,252,233,244,1,248,8,129,195,239,252,233,244,
711 1,255,72,141,76,202,16,72,139,105,224,72,139,65,232,72,137,41,72,137,65,8,
712 72,139,105,216,72,137,105,252,240,184,237,73,137,252,235,72,193,229,17,72,
713 193,252,237,17,73,193,252,251,47,65,129,252,251,239,15,133,244,30,72,137,
714 202,72,137,90,252,248,72,139,157,233,139,11,15,182,252,233,15,182,205,72,
715 131,195,4,65,252,255,36,252,238,255,72,139,108,202,252,240,72,193,229,17,
716 72,193,252,237,17,139,68,202,252,248,68,139,149,233,72,131,195,4,76,139,157,
717 233,248,1,68,57,208,15,131,244,251,73,129,60,253,195,239,15,132,244,250,252,
718 242,15,42,192,73,139,44,195,72,137,108,202,8,252,242,15,17,4,202,131,192,
719 1,137,68,202,252,248,248,2,15,183,67,252,254,72,141,156,253,131,233,248,3,
720 139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,
721 248,4,131,192,1,252,233,244,1,248,5,68,41,208,248,6,59,133,233,15,135,244,
722 3,255,68,105,216,239,76,3,157,233,73,129,187,233,239,15,132,244,253,70,141,
723 84,16,1,73,139,171,233,73,139,131,233,72,137,44,202,72,137,68,202,8,68,137,
724 84,202,252,248,252,233,244,2,248,7,131,192,1,252,233,244,6,255,72,139,108,
725 202,232,73,137,252,235,72,193,229,17,72,193,252,237,17,73,193,252,251,47,
726 65,129,252,251,239,15,133,244,251,76,139,92,202,252,240,73,193,252,251,47,
727 65,129,252,251,239,15,133,244,251,72,129,124,253,202,252,248,239,15,133,244,
728 251,128,189,233,235,15,133,244,251,72,141,156,253,131,233,73,186,237,237,
729 76,137,84,202,252,248,248,1,139,3,15,182,204,15,182,232,72,131,195,4,193,
730 232,16,65,252,255,36,252,238,248,5,198,67,252,252,235,255,72,141,156,253,
731 131,233,198,3,235,252,233,244,1,255,15,182,252,236,15,182,192,76,141,148,
732 253,194,233,72,141,12,202,76,43,82,252,248,72,133,252,237,15,132,244,251,
733 72,141,108,252,233,252,248,73,57,210,15,131,244,248,248,1,73,139,66,252,240,
734 73,131,194,8,72,137,1,72,131,193,8,72,57,252,233,15,131,244,249,73,57,210,
735 15,130,244,1,248,2,72,199,1,237,72,131,193,8,72,57,252,233,15,130,244,2,248,
736 3,139,3,15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,
737 248,5,199,4,36,1,0,0,0,72,137,208,76,41,208,15,134,244,3,137,197,193,252,
738 237,3,131,197,1,137,44,36,72,139,108,36,16,72,1,200,72,59,133,233,255,15,
739 135,244,253,248,6,73,139,66,252,240,73,131,194,8,72,137,1,72,131,193,8,73,
740 57,210,15,130,244,6,252,233,244,3,248,7,72,137,149,233,72,137,141,233,72,
741 137,92,36,24,73,41,210,68,137,84,36,4,139,52,36,131,252,238,1,72,137,252,
742 239,232,251,1,0,72,139,149,233,76,99,84,36,4,72,139,141,233,73,1,210,252,
743 233,244,6,255,193,225,3,255,248,1,72,139,90,252,248,137,4,36,252,247,195,
744 237,15,133,244,253,255,248,14,73,137,215,131,232,1,15,132,244,249,248,2,73,
745 139,44,15,73,137,111,252,240,73,131,199,8,131,232,1,15,133,244,2,248,3,139,
746 4,36,15,182,107,252,255,248,5,57,197,15,135,244,252,255,72,139,44,10,72,137,
747 106,252,240,255,248,5,56,67,252,255,15,135,244,252,255,15,182,75,252,253,
748 72,252,247,217,72,141,84,202,252,240,76,139,122,252,240,73,193,231,17,73,
749 193,252,239,17,77,139,191,233,77,139,191,233,139,3,15,182,204,15,182,232,
750 72,131,195,4,193,232,16,65,252,255,36,252,238,248,6,255,73,199,71,252,240,
751 237,73,131,199,8,255,72,199,68,194,232,237,255,72,131,192,1,252,233,244,5,
752 248,7,72,141,171,233,252,247,197,237,15,133,244,15,72,41,252,234,255,72,1,
753 252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233,238,
754 15,130,244,147,255,72,141,12,202,255,72,139,41,73,137,252,235,73,193,252,
755 251,47,65,129,252,251,239,15,133,244,255,76,139,81,8,255,77,137,211,73,193,
756 252,251,47,65,129,252,251,239,15,133,244,68,76,139,89,16,69,133,219,15,136,
757 244,251,73,193,252,251,47,65,129,252,251,239,15,133,244,68,255,76,139,89,
758 8,73,193,252,251,47,65,129,252,251,239,15,133,244,161,76,139,89,16,73,193,
759 252,251,47,65,129,252,251,239,15,133,244,161,255,76,139,89,16,69,133,219,
760 15,136,244,251,68,1,221,15,128,244,247,73,187,237,237,76,9,221,72,137,41,
761 255,68,57,213,72,137,105,24,255,15,142,244,253,248,1,248,6,72,141,156,253,
762 131,233,255,72,141,156,253,131,233,15,183,67,252,254,15,142,245,248,1,248,
763 6,255,15,143,244,253,248,6,72,141,156,253,131,233,248,1,255,248,7,139,3,15,
764 182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,248,5,255,
765 68,1,221,15,128,244,1,73,187,237,237,76,9,221,72,137,41,255,15,141,244,7,
766 255,72,141,156,253,131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,
767 255,252,233,244,6,248,9,255,15,131,244,68,255,76,139,25,73,193,252,251,47,
768 65,129,252,251,239,15,131,244,68,255,76,139,89,8,73,193,252,251,47,65,129,
769 252,251,239,15,131,244,68,255,76,139,89,8,73,193,252,251,47,65,129,252,251,
770 239,15,131,244,161,76,139,89,16,73,193,252,251,47,65,129,252,251,239,15,131,
771 244,161,255,72,139,105,16,255,73,137,252,235,73,193,252,251,47,65,129,252,
772 251,239,15,131,244,68,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,
773 15,88,65,16,252,242,15,17,1,72,133,252,237,15,136,244,249,255,15,140,244,
774 249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,15,131,244,248,72,141,
775 156,253,131,233,255,72,141,156,253,131,233,15,183,67,252,254,15,131,245,255,
776 15,130,244,248,72,141,156,253,131,233,255,248,2,139,3,15,182,204,15,182,232,
777 72,131,195,4,193,232,16,65,252,255,36,252,238,248,3,102,15,46,193,252,233,
778 244,1,255,72,141,12,202,72,139,41,72,129,252,253,239,15,132,244,247,255,72,
779 137,105,252,248,252,233,245,255,72,141,156,253,131,233,72,137,105,252,248,
780 255,73,139,142,233,72,139,4,193,72,139,128,233,72,139,108,36,16,73,137,150,
781 233,73,137,174,233,72,131,252,236,16,76,137,100,36,16,76,137,108,36,8,252,
782 255,224,255,72,141,156,253,131,233,139,3,15,182,204,15,182,232,72,131,195,
783 4,193,232,16,65,252,255,36,252,238,255,137,221,209,252,237,129,229,239,102,
784 65,129,172,253,46,233,238,15,130,244,149,255,76,139,187,233,72,139,108,36,
785 16,72,141,12,202,72,59,141,233,15,135,244,25,15,182,139,233,57,200,15,134,
786 244,249,248,2,255,15,183,67,252,254,252,233,245,255,248,3,72,199,68,194,252,
787 248,237,131,192,1,57,200,15,134,244,3,252,233,244,2,255,141,44,197,237,72,
788 141,68,194,8,76,139,122,252,240,72,137,104,252,248,76,137,120,252,240,72,
789 139,108,36,16,72,141,12,200,72,59,141,233,15,135,244,24,72,137,209,72,137,
790 194,15,182,171,233,133,252,237,15,132,244,248,72,131,193,8,248,1,72,131,193,
791 8,72,57,209,15,131,244,249,76,139,121,252,240,76,137,56,72,131,192,8,72,199,
792 65,252,240,237,131,252,237,1,15,133,244,1,248,2,255,76,139,187,233,139,3,
793 15,182,204,15,182,232,72,131,195,4,193,232,16,65,252,255,36,252,238,255,248,
794 3,72,199,0,237,72,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,
795 72,139,106,252,240,72,193,229,17,72,193,252,237,17,76,139,189,233,72,139,
796 108,36,16,72,141,68,194,252,248,72,137,149,233,72,141,136,233,72,59,141,233,
797 72,137,133,233,255,72,137,252,239,255,76,137,252,254,72,137,252,239,255,15,
798 135,244,23,65,199,134,233,237,255,65,252,255,215,255,65,252,255,150,233,255,
799 72,139,149,233,73,137,174,233,65,199,134,233,237,72,141,12,194,72,252,247,
800 217,72,3,141,233,72,139,90,252,248,252,233,244,12,255,254,0
801};
802
803#line 9 "vm_x64.dasc"
804//|.globals GLOB_
805enum {
806 GLOB_vm_returnp,
807 GLOB_cont_dispatch,
808 GLOB_vm_returnc,
809 GLOB_vm_unwind_yield,
810 GLOB_BC_RET_Z,
811 GLOB_vm_return,
812 GLOB_vm_leave_cp,
813 GLOB_vm_leave_unw,
814 GLOB_vm_unwind_c_eh,
815 GLOB_vm_unwind_c,
816 GLOB_vm_unwind_rethrow,
817 GLOB_vm_unwind_ff,
818 GLOB_vm_unwind_ff_eh,
819 GLOB_vm_growstack_c,
820 GLOB_vm_growstack_v,
821 GLOB_vm_growstack_f,
822 GLOB_vm_resume,
823 GLOB_vm_pcall,
824 GLOB_vm_call,
825 GLOB_vm_call_dispatch,
826 GLOB_vmeta_call,
827 GLOB_vm_call_dispatch_f,
828 GLOB_vm_cpcall,
829 GLOB_cont_ffi_callback,
830 GLOB_vm_call_tail,
831 GLOB_cont_cat,
832 GLOB_cont_ra,
833 GLOB_BC_CAT_Z,
834 GLOB_vmeta_tgets,
835 GLOB_vmeta_tgetb,
836 GLOB_vmeta_tgetv,
837 GLOB_vmeta_tgetr,
838 GLOB_BC_TGETR_Z,
839 GLOB_BC_TGETR2_Z,
840 GLOB_vmeta_tsets,
841 GLOB_vmeta_tsetb,
842 GLOB_vmeta_tsetv,
843 GLOB_cont_nop,
844 GLOB_vmeta_tsetr,
845 GLOB_BC_TSETR_Z,
846 GLOB_vmeta_comp,
847 GLOB_vmeta_binop,
848 GLOB_cont_condt,
849 GLOB_cont_condf,
850 GLOB_vmeta_equal,
851 GLOB_vmeta_equal_cd,
852 GLOB_vmeta_istype,
853 GLOB_vmeta_arith_vno,
854 GLOB_vmeta_arith_vn,
855 GLOB_vmeta_arith_nvo,
856 GLOB_vmeta_arith_nv,
857 GLOB_vmeta_unm,
858 GLOB_vmeta_arith_vvo,
859 GLOB_vmeta_arith_vv,
860 GLOB_vmeta_len,
861 GLOB_BC_LEN_Z,
862 GLOB_vmeta_call_ra,
863 GLOB_BC_CALLT_Z,
864 GLOB_vmeta_for,
865 GLOB_ff_assert,
866 GLOB_fff_fallback,
867 GLOB_fff_res_,
868 GLOB_ff_type,
869 GLOB_fff_res1,
870 GLOB_ff_getmetatable,
871 GLOB_ff_setmetatable,
872 GLOB_ff_rawget,
873 GLOB_ff_tonumber,
874 GLOB_ff_tostring,
875 GLOB_fff_fallback_1,
876 GLOB_fff_gcstep,
877 GLOB_ff_next,
878 GLOB_fff_res2,
879 GLOB_fff_res,
880 GLOB_ff_pairs,
881 GLOB_ff_ipairs_aux,
882 GLOB_fff_res0,
883 GLOB_ff_ipairs,
884 GLOB_ff_pcall,
885 GLOB_ff_xpcall,
886 GLOB_ff_coroutine_resume,
887 GLOB_ff_coroutine_wrap_aux,
888 GLOB_ff_coroutine_yield,
889 GLOB_ff_math_abs,
890 GLOB_ff_math_sqrt,
891 GLOB_fff_resxmm0,
892 GLOB_ff_math_floor,
893 GLOB_vm_floor_sse,
894 GLOB_ff_math_ceil,
895 GLOB_vm_ceil_sse,
896 GLOB_ff_math_log,
897 GLOB_ff_math_log10,
898 GLOB_ff_math_exp,
899 GLOB_ff_math_sin,
900 GLOB_ff_math_cos,
901 GLOB_ff_math_tan,
902 GLOB_ff_math_asin,
903 GLOB_ff_math_acos,
904 GLOB_ff_math_atan,
905 GLOB_ff_math_sinh,
906 GLOB_ff_math_cosh,
907 GLOB_ff_math_tanh,
908 GLOB_ff_math_pow,
909 GLOB_ff_math_atan2,
910 GLOB_ff_math_fmod,
911 GLOB_ff_math_ldexp,
912 GLOB_ff_math_frexp,
913 GLOB_ff_math_modf,
914 GLOB_ff_math_min,
915 GLOB_ff_math_max,
916 GLOB_ff_string_byte,
917 GLOB_ff_string_char,
918 GLOB_fff_newstr,
919 GLOB_fff_resstr,
920 GLOB_ff_string_sub,
921 GLOB_fff_emptystr,
922 GLOB_ff_string_reverse,
923 GLOB_ff_string_lower,
924 GLOB_ff_string_upper,
925 GLOB_ff_bit_tobit,
926 GLOB_fff_resbit,
927 GLOB_ff_bit_band,
928 GLOB_fff_fallback_bit_op,
929 GLOB_ff_bit_bor,
930 GLOB_ff_bit_bxor,
931 GLOB_ff_bit_bswap,
932 GLOB_ff_bit_bnot,
933 GLOB_ff_bit_lshift,
934 GLOB_ff_bit_rshift,
935 GLOB_ff_bit_arshift,
936 GLOB_ff_bit_rol,
937 GLOB_ff_bit_ror,
938 GLOB_fff_fallback_2,
939 GLOB_vm_record,
940 GLOB_vm_rethook,
941 GLOB_vm_inshook,
942 GLOB_cont_hook,
943 GLOB_vm_hotloop,
944 GLOB_vm_callhook,
945 GLOB_vm_hotcall,
946 GLOB_cont_stitch,
947 GLOB_vm_profhook,
948 GLOB_vm_exit_handler,
949 GLOB_vm_exit_interp,
950 GLOB_vm_floor,
951 GLOB_vm_ceil,
952 GLOB_vm_trunc,
953 GLOB_vm_trunc_sse,
954 GLOB_vm_mod,
955 GLOB_vm_powi_sse,
956 GLOB_vm_cpuid,
957 GLOB_assert_bad_for_arg_type,
958 GLOB_vm_ffi_callback,
959 GLOB_vm_ffi_call,
960 GLOB_BC_MODVN_Z,
961 GLOB_BC_TGETS_Z,
962 GLOB_BC_TSETS_Z,
963 GLOB__MAX
964};
965#line 10 "vm_x64.dasc"
966//|.globalnames globnames
967static const char *const globnames[] = {
968 "vm_returnp",
969 "cont_dispatch",
970 "vm_returnc",
971 "vm_unwind_yield",
972 "BC_RET_Z",
973 "vm_return",
974 "vm_leave_cp",
975 "vm_leave_unw",
976 "vm_unwind_c_eh",
977 "vm_unwind_c",
978 "vm_unwind_rethrow",
979 "vm_unwind_ff",
980 "vm_unwind_ff_eh",
981 "vm_growstack_c",
982 "vm_growstack_v",
983 "vm_growstack_f",
984 "vm_resume",
985 "vm_pcall",
986 "vm_call",
987 "vm_call_dispatch",
988 "vmeta_call",
989 "vm_call_dispatch_f",
990 "vm_cpcall",
991 "cont_ffi_callback",
992 "vm_call_tail",
993 "cont_cat",
994 "cont_ra",
995 "BC_CAT_Z",
996 "vmeta_tgets",
997 "vmeta_tgetb",
998 "vmeta_tgetv",
999 "vmeta_tgetr",
1000 "BC_TGETR_Z",
1001 "BC_TGETR2_Z",
1002 "vmeta_tsets",
1003 "vmeta_tsetb",
1004 "vmeta_tsetv",
1005 "cont_nop",
1006 "vmeta_tsetr",
1007 "BC_TSETR_Z",
1008 "vmeta_comp",
1009 "vmeta_binop",
1010 "cont_condt",
1011 "cont_condf",
1012 "vmeta_equal",
1013 "vmeta_equal_cd",
1014 "vmeta_istype",
1015 "vmeta_arith_vno",
1016 "vmeta_arith_vn",
1017 "vmeta_arith_nvo",
1018 "vmeta_arith_nv",
1019 "vmeta_unm",
1020 "vmeta_arith_vvo",
1021 "vmeta_arith_vv",
1022 "vmeta_len",
1023 "BC_LEN_Z",
1024 "vmeta_call_ra",
1025 "BC_CALLT_Z",
1026 "vmeta_for",
1027 "ff_assert",
1028 "fff_fallback",
1029 "fff_res_",
1030 "ff_type",
1031 "fff_res1",
1032 "ff_getmetatable",
1033 "ff_setmetatable",
1034 "ff_rawget",
1035 "ff_tonumber",
1036 "ff_tostring",
1037 "fff_fallback_1",
1038 "fff_gcstep",
1039 "ff_next",
1040 "fff_res2",
1041 "fff_res",
1042 "ff_pairs",
1043 "ff_ipairs_aux",
1044 "fff_res0",
1045 "ff_ipairs",
1046 "ff_pcall",
1047 "ff_xpcall",
1048 "ff_coroutine_resume",
1049 "ff_coroutine_wrap_aux",
1050 "ff_coroutine_yield",
1051 "ff_math_abs",
1052 "ff_math_sqrt",
1053 "fff_resxmm0",
1054 "ff_math_floor",
1055 "vm_floor_sse",
1056 "ff_math_ceil",
1057 "vm_ceil_sse",
1058 "ff_math_log",
1059 "ff_math_log10",
1060 "ff_math_exp",
1061 "ff_math_sin",
1062 "ff_math_cos",
1063 "ff_math_tan",
1064 "ff_math_asin",
1065 "ff_math_acos",
1066 "ff_math_atan",
1067 "ff_math_sinh",
1068 "ff_math_cosh",
1069 "ff_math_tanh",
1070 "ff_math_pow",
1071 "ff_math_atan2",
1072 "ff_math_fmod",
1073 "ff_math_ldexp",
1074 "ff_math_frexp",
1075 "ff_math_modf",
1076 "ff_math_min",
1077 "ff_math_max",
1078 "ff_string_byte",
1079 "ff_string_char",
1080 "fff_newstr",
1081 "fff_resstr",
1082 "ff_string_sub",
1083 "fff_emptystr",
1084 "ff_string_reverse",
1085 "ff_string_lower",
1086 "ff_string_upper",
1087 "ff_bit_tobit",
1088 "fff_resbit",
1089 "ff_bit_band",
1090 "fff_fallback_bit_op",
1091 "ff_bit_bor",
1092 "ff_bit_bxor",
1093 "ff_bit_bswap",
1094 "ff_bit_bnot",
1095 "ff_bit_lshift",
1096 "ff_bit_rshift",
1097 "ff_bit_arshift",
1098 "ff_bit_rol",
1099 "ff_bit_ror",
1100 "fff_fallback_2",
1101 "vm_record",
1102 "vm_rethook",
1103 "vm_inshook",
1104 "cont_hook",
1105 "vm_hotloop",
1106 "vm_callhook",
1107 "vm_hotcall",
1108 "cont_stitch",
1109 "vm_profhook",
1110 "vm_exit_handler",
1111 "vm_exit_interp",
1112 "vm_floor",
1113 "vm_ceil",
1114 "vm_trunc",
1115 "vm_trunc_sse",
1116 "vm_mod",
1117 "vm_powi_sse",
1118 "vm_cpuid",
1119 "assert_bad_for_arg_type",
1120 "vm_ffi_callback",
1121 "vm_ffi_call",
1122 "BC_MODVN_Z",
1123 "BC_TGETS_Z",
1124 "BC_TSETS_Z",
1125 (const char *)0
1126};
1127#line 11 "vm_x64.dasc"
1128//|.externnames extnames
1129static const char *const extnames[] = {
1130 "lj_state_growstack",
1131 "lj_err_throw",
1132 "lj_meta_tget",
1133 "lj_tab_getinth",
1134 "lj_meta_tset",
1135 "lj_tab_setinth",
1136 "lj_meta_comp",
1137 "lj_meta_equal",
1138 "lj_meta_equal_cd",
1139 "lj_meta_istype",
1140 "lj_meta_arith",
1141 "lj_meta_len",
1142 "lj_meta_call",
1143 "lj_meta_for",
1144 "lj_tab_get",
1145 "lj_strfmt_num",
1146 "lj_tab_next",
1147 "lj_ffh_coroutine_wrap_err",
1148 "log",
1149 "log10",
1150 "exp",
1151 "sin",
1152 "cos",
1153 "tan",
1154 "asin",
1155 "acos",
1156 "atan",
1157 "sinh",
1158 "cosh",
1159 "tanh",
1160 "pow",
1161 "atan2",
1162 "fmod",
1163 "frexp",
1164 "modf",
1165 "lj_str_new",
1166 "lj_buf_putstr_reverse",
1167 "lj_buf_tostr",
1168 "lj_buf_putstr_lower",
1169 "lj_buf_putstr_upper",
1170 "lj_gc_step",
1171 "lj_dispatch_ins",
1172 "lj_trace_hot",
1173 "lj_dispatch_call",
1174 "lj_dispatch_stitch",
1175 "lj_dispatch_profile",
1176 "lj_trace_exit",
1177 "lj_err_trace",
1178 "lj_ccallback_enter",
1179 "lj_ccallback_leave",
1180 "lj_tab_len",
1181 "lj_meta_cat",
1182 "lj_gc_barrieruv",
1183 "lj_func_closeuv",
1184 "lj_func_newL_gc",
1185 "lj_tab_new",
1186 "lj_gc_step_fixtop",
1187 "lj_tab_dup",
1188 "lj_tab_newkey",
1189 "lj_tab_reasize",
1190 (const char *)0
1191};
1192#line 12 "vm_x64.dasc"
1193//|
1194//|//-----------------------------------------------------------------------
1195//|
1196//|.if WIN
1197//|.define X64WIN, 1 // Windows/x64 calling conventions.
1198//|.endif
1199//|
1200//|// Fixed register assignments for the interpreter.
1201//|// This is very fragile and has many dependencies. Caveat emptor.
1202//|.define BASE, rdx // Not C callee-save, refetched anyway.
1203//|.if X64WIN
1204//|.define KBASE, rdi // Must be C callee-save.
1205//|.define PC, rsi // Must be C callee-save.
1206//|.define DISPATCH, rbx // Must be C callee-save.
1207//|.define KBASEd, edi
1208//|.define PCd, esi
1209//|.define DISPATCHd, ebx
1210//|.else
1211//|.define KBASE, r15 // Must be C callee-save.
1212//|.define PC, rbx // Must be C callee-save.
1213//|.define DISPATCH, r14 // Must be C callee-save.
1214//|.define KBASEd, r15d
1215//|.define PCd, ebx
1216//|.define DISPATCHd, r14d
1217//|.endif
1218//|
1219//|.define RA, rcx
1220//|.define RAd, ecx
1221//|.define RAH, ch
1222//|.define RAL, cl
1223//|.define RB, rbp // Must be rbp (C callee-save).
1224//|.define RBd, ebp
1225//|.define RC, rax // Must be rax.
1226//|.define RCd, eax
1227//|.define RCW, ax
1228//|.define RCH, ah
1229//|.define RCL, al
1230//|.define OP, RBd
1231//|.define RD, RC
1232//|.define RDd, RCd
1233//|.define RDW, RCW
1234//|.define RDL, RCL
1235//|.define TMPR, r10
1236//|.define TMPRd, r10d
1237//|.define ITYPE, r11
1238//|.define ITYPEd, r11d
1239//|
1240//|.if X64WIN
1241//|.define CARG1, rcx // x64/WIN64 C call arguments.
1242//|.define CARG2, rdx
1243//|.define CARG3, r8
1244//|.define CARG4, r9
1245//|.define CARG1d, ecx
1246//|.define CARG2d, edx
1247//|.define CARG3d, r8d
1248//|.define CARG4d, r9d
1249//|.else
1250//|.define CARG1, rdi // x64/POSIX C call arguments.
1251//|.define CARG2, rsi
1252//|.define CARG3, rdx
1253//|.define CARG4, rcx
1254//|.define CARG5, r8
1255//|.define CARG6, r9
1256//|.define CARG1d, edi
1257//|.define CARG2d, esi
1258//|.define CARG3d, edx
1259//|.define CARG4d, ecx
1260//|.define CARG5d, r8d
1261//|.define CARG6d, r9d
1262//|.endif
1263//|
1264//|// Type definitions. Some of these are only used for documentation.
1265//|.type L, lua_State
1266#define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
1267#line 85 "vm_x64.dasc"
1268//|.type GL, global_State
1269#define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
1270#line 86 "vm_x64.dasc"
1271//|.type TVALUE, TValue
1272#define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
1273#line 87 "vm_x64.dasc"
1274//|.type GCOBJ, GCobj
1275#define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
1276#line 88 "vm_x64.dasc"
1277//|.type STR, GCstr
1278#define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
1279#line 89 "vm_x64.dasc"
1280//|.type TAB, GCtab
1281#define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
1282#line 90 "vm_x64.dasc"
1283//|.type LFUNC, GCfuncL
1284#define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
1285#line 91 "vm_x64.dasc"
1286//|.type CFUNC, GCfuncC
1287#define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
1288#line 92 "vm_x64.dasc"
1289//|.type PROTO, GCproto
1290#define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
1291#line 93 "vm_x64.dasc"
1292//|.type UPVAL, GCupval
1293#define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
1294#line 94 "vm_x64.dasc"
1295//|.type NODE, Node
1296#define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
1297#line 95 "vm_x64.dasc"
1298//|.type NARGS, int
1299#define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
1300#line 96 "vm_x64.dasc"
1301//|.type TRACE, GCtrace
1302#define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
1303#line 97 "vm_x64.dasc"
1304//|.type SBUF, SBuf
1305#define DtE(_V) (int)(ptrdiff_t)&(((SBuf *)0)_V)
1306#line 98 "vm_x64.dasc"
1307//|
1308//|// Stack layout while in interpreter. Must match with lj_frame.h.
1309//|//-----------------------------------------------------------------------
1310//|.if X64WIN // x64/Windows stack layout
1311//|
1312//|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
1313//|.macro saveregs_
1314//| push rdi; push rsi; push rbx
1315//| sub rsp, CFRAME_SPACE
1316//|.endmacro
1317//|.macro saveregs
1318//| push rbp; saveregs_
1319//|.endmacro
1320//|.macro restoreregs
1321//| add rsp, CFRAME_SPACE
1322//| pop rbx; pop rsi; pop rdi; pop rbp
1323//|.endmacro
1324//|
1325//|.define SAVE_CFRAME, aword [rsp+aword*13]
1326//|.define SAVE_PC, aword [rsp+aword*12]
1327//|.define SAVE_L, aword [rsp+aword*11]
1328//|.define SAVE_ERRF, dword [rsp+dword*21]
1329//|.define SAVE_NRES, dword [rsp+dword*20]
1330//|//----- 16 byte aligned, ^^^ 32 byte register save area, owned by interpreter
1331//|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
1332//|.define SAVE_R4, aword [rsp+aword*8]
1333//|.define SAVE_R3, aword [rsp+aword*7]
1334//|.define SAVE_R2, aword [rsp+aword*6]
1335//|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
1336//|.define ARG5, aword [rsp+aword*4]
1337//|.define CSAVE_4, aword [rsp+aword*3]
1338//|.define CSAVE_3, aword [rsp+aword*2]
1339//|.define CSAVE_2, aword [rsp+aword*1]
1340//|.define CSAVE_1, aword [rsp] //<-- rsp while in interpreter.
1341//|//----- 16 byte aligned, ^^^ 32 byte register save area, owned by callee
1342//|
1343//|.define ARG5d, dword [rsp+dword*8]
1344//|.define TMP1, ARG5 // TMP1 overlaps ARG5
1345//|.define TMP1d, ARG5d
1346//|.define TMP1hi, dword [rsp+dword*9]
1347//|.define MULTRES, TMP1d // MULTRES overlaps TMP1d.
1348//|
1349//|//-----------------------------------------------------------------------
1350//|.else // x64/POSIX stack layout
1351//|
1352//|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
1353//|.macro saveregs_
1354//| push rbx; push r15; push r14
1355//|.if NO_UNWIND
1356//| push r13; push r12
1357//|.endif
1358//| sub rsp, CFRAME_SPACE
1359//|.endmacro
1360//|.macro saveregs
1361//| push rbp; saveregs_
1362//|.endmacro
1363//|.macro restoreregs
1364//| add rsp, CFRAME_SPACE
1365//|.if NO_UNWIND
1366//| pop r12; pop r13
1367//|.endif
1368//| pop r14; pop r15; pop rbx; pop rbp
1369//|.endmacro
1370//|
1371//|//----- 16 byte aligned,
1372//|.if NO_UNWIND
1373//|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
1374//|.define SAVE_R4, aword [rsp+aword*10]
1375//|.define SAVE_R3, aword [rsp+aword*9]
1376//|.define SAVE_R2, aword [rsp+aword*8]
1377//|.define SAVE_R1, aword [rsp+aword*7]
1378//|.define SAVE_RU2, aword [rsp+aword*6]
1379//|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
1380//|.else
1381//|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
1382//|.define SAVE_R4, aword [rsp+aword*8]
1383//|.define SAVE_R3, aword [rsp+aword*7]
1384//|.define SAVE_R2, aword [rsp+aword*6]
1385//|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
1386//|.endif
1387//|.define SAVE_CFRAME, aword [rsp+aword*4]
1388//|.define SAVE_PC, aword [rsp+aword*3]
1389//|.define SAVE_L, aword [rsp+aword*2]
1390//|.define SAVE_ERRF, dword [rsp+dword*3]
1391//|.define SAVE_NRES, dword [rsp+dword*2]
1392//|.define TMP1, aword [rsp] //<-- rsp while in interpreter.
1393//|//----- 16 byte aligned
1394//|
1395//|.define TMP1d, dword [rsp]
1396//|.define TMP1hi, dword [rsp+dword*1]
1397//|.define MULTRES, TMP1d // MULTRES overlaps TMP1d.
1398//|
1399//|.endif
1400//|
1401//|//-----------------------------------------------------------------------
1402//|
1403//|// Instruction headers.
1404//|.macro ins_A; .endmacro
1405//|.macro ins_AD; .endmacro
1406//|.macro ins_AJ; .endmacro
1407//|.macro ins_ABC; movzx RBd, RCH; movzx RCd, RCL; .endmacro
1408//|.macro ins_AB_; movzx RBd, RCH; .endmacro
1409//|.macro ins_A_C; movzx RCd, RCL; .endmacro
1410//|.macro ins_AND; not RD; .endmacro
1411//|
1412//|// Instruction decode+dispatch. Carefully tuned (nope, lodsd is not faster).
1413//|.macro ins_NEXT
1414//| mov RCd, [PC]
1415//| movzx RAd, RCH
1416//| movzx OP, RCL
1417//| add PC, 4
1418//| shr RCd, 16
1419//| jmp aword [DISPATCH+OP*8]
1420//|.endmacro
1421//|
1422//|// Instruction footer.
1423//|.if 1
1424//| // Replicated dispatch. Less unpredictable branches, but higher I-Cache use.
1425//| .define ins_next, ins_NEXT
1426//| .define ins_next_, ins_NEXT
1427//|.else
1428//| // Common dispatch. Lower I-Cache use, only one (very) unpredictable branch.
1429//| // Affects only certain kinds of benchmarks (and only with -j off).
1430//| // Around 10%-30% slower on Core2, a lot more slower on P4.
1431//| .macro ins_next
1432//| jmp ->ins_next
1433//| .endmacro
1434//| .macro ins_next_
1435//| ->ins_next:
1436//| ins_NEXT
1437//| .endmacro
1438//|.endif
1439//|
1440//|// Call decode and dispatch.
1441//|.macro ins_callt
1442//| // BASE = new base, RB = LFUNC, RD = nargs+1, [BASE-8] = PC
1443//| mov PC, LFUNC:RB->pc
1444//| mov RAd, [PC]
1445//| movzx OP, RAL
1446//| movzx RAd, RAH
1447//| add PC, 4
1448//| jmp aword [DISPATCH+OP*8]
1449//|.endmacro
1450//|
1451//|.macro ins_call
1452//| // BASE = new base, RB = LFUNC, RD = nargs+1
1453//| mov [BASE-8], PC
1454//| ins_callt
1455//|.endmacro
1456//|
1457//|//-----------------------------------------------------------------------
1458//|
1459//|// Macros to clear or set tags.
1460//|.macro cleartp, reg; shl reg, 17; shr reg, 17; .endmacro
1461//|.macro settp, reg, tp
1462//| mov64 ITYPE, ((uint64_t)tp<<47)
1463//| or reg, ITYPE
1464//|.endmacro
1465//|.macro settp, dst, reg, tp
1466//| mov64 dst, ((uint64_t)tp<<47)
1467//| or dst, reg
1468//|.endmacro
1469//|.macro setint, reg
1470//| settp reg, LJ_TISNUM
1471//|.endmacro
1472//|.macro setint, dst, reg
1473//| settp dst, reg, LJ_TISNUM
1474//|.endmacro
1475//|
1476//|// Macros to test operand types.
1477//|.macro checktp_nc, reg, tp, target
1478//| mov ITYPE, reg
1479//| sar ITYPE, 47
1480//| cmp ITYPEd, tp
1481//| jne target
1482//|.endmacro
1483//|.macro checktp, reg, tp, target
1484//| mov ITYPE, reg
1485//| cleartp reg
1486//| sar ITYPE, 47
1487//| cmp ITYPEd, tp
1488//| jne target
1489//|.endmacro
1490//|.macro checktptp, src, tp, target
1491//| mov ITYPE, src
1492//| sar ITYPE, 47
1493//| cmp ITYPEd, tp
1494//| jne target
1495//|.endmacro
1496//|.macro checkstr, reg, target; checktp reg, LJ_TSTR, target; .endmacro
1497//|.macro checktab, reg, target; checktp reg, LJ_TTAB, target; .endmacro
1498//|.macro checkfunc, reg, target; checktp reg, LJ_TFUNC, target; .endmacro
1499//|
1500//|.macro checknumx, reg, target, jump
1501//| mov ITYPE, reg
1502//| sar ITYPE, 47
1503//| cmp ITYPEd, LJ_TISNUM
1504//| jump target
1505//|.endmacro
1506//|.macro checkint, reg, target; checknumx reg, target, jne; .endmacro
1507//|.macro checkinttp, src, target; checknumx src, target, jne; .endmacro
1508//|.macro checknum, reg, target; checknumx reg, target, jae; .endmacro
1509//|.macro checknumtp, src, target; checknumx src, target, jae; .endmacro
1510//|.macro checknumber, src, target; checknumx src, target, ja; .endmacro
1511//|
1512//|.macro mov_false, reg; mov64 reg, (int64_t)~((uint64_t)1<<47); .endmacro
1513//|.macro mov_true, reg; mov64 reg, (int64_t)~((uint64_t)2<<47); .endmacro
1514//|
1515//|// These operands must be used with movzx.
1516//|.define PC_OP, byte [PC-4]
1517//|.define PC_RA, byte [PC-3]
1518//|.define PC_RB, byte [PC-1]
1519//|.define PC_RC, byte [PC-2]
1520//|.define PC_RD, word [PC-2]
1521//|
1522//|.macro branchPC, reg
1523//| lea PC, [PC+reg*4-BCBIAS_J*4]
1524//|.endmacro
1525//|
1526//|// Assumes DISPATCH is relative to GL.
1527#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
1528#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
1529//|
1530#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
1531//|
1532//|// Decrement hashed hotcount and trigger trace recorder if zero.
1533//|.macro hotloop, reg
1534//| mov reg, PCd
1535//| shr reg, 1
1536//| and reg, HOTCOUNT_PCMASK
1537//| sub word [DISPATCH+reg+GG_DISP2HOT], HOTCOUNT_LOOP
1538//| jb ->vm_hotloop
1539//|.endmacro
1540//|
1541//|.macro hotcall, reg
1542//| mov reg, PCd
1543//| shr reg, 1
1544//| and reg, HOTCOUNT_PCMASK
1545//| sub word [DISPATCH+reg+GG_DISP2HOT], HOTCOUNT_CALL
1546//| jb ->vm_hotcall
1547//|.endmacro
1548//|
1549//|// Set current VM state.
1550//|.macro set_vmstate, st
1551//| mov dword [DISPATCH+DISPATCH_GL(vmstate)], ~LJ_VMST_..st
1552//|.endmacro
1553//|
1554//|.macro fpop1; fstp st1; .endmacro
1555//|
1556//|// Synthesize SSE FP constants.
1557//|.macro sseconst_abs, reg, tmp // Synthesize abs mask.
1558//| mov64 tmp, U64x(7fffffff,ffffffff); movd reg, tmp
1559//|.endmacro
1560//|
1561//|.macro sseconst_hi, reg, tmp, val // Synthesize hi-32 bit const.
1562//| mov64 tmp, U64x(val,00000000); movd reg, tmp
1563//|.endmacro
1564//|
1565//|.macro sseconst_sign, reg, tmp // Synthesize sign mask.
1566//| sseconst_hi reg, tmp, 80000000
1567//|.endmacro
1568//|.macro sseconst_1, reg, tmp // Synthesize 1.0.
1569//| sseconst_hi reg, tmp, 3ff00000
1570//|.endmacro
1571//|.macro sseconst_m1, reg, tmp // Synthesize -1.0.
1572//| sseconst_hi reg, tmp, bff00000
1573//|.endmacro
1574//|.macro sseconst_2p52, reg, tmp // Synthesize 2^52.
1575//| sseconst_hi reg, tmp, 43300000
1576//|.endmacro
1577//|.macro sseconst_tobit, reg, tmp // Synthesize 2^52 + 2^51.
1578//| sseconst_hi reg, tmp, 43380000
1579//|.endmacro
1580//|
1581//|// Move table write barrier back. Overwrites reg.
1582//|.macro barrierback, tab, reg
1583//| and byte tab->marked, (uint8_t)~LJ_GC_BLACK // black2gray(tab)
1584//| mov reg, [DISPATCH+DISPATCH_GL(gc.grayagain)]
1585//| mov [DISPATCH+DISPATCH_GL(gc.grayagain)], tab
1586//| mov tab->gclist, reg
1587//|.endmacro
1588//|
1589//|//-----------------------------------------------------------------------
1590
1591/* Generate subroutines used by opcodes and other parts of the VM. */
1592/* The .code_sub section should be last to help static branch prediction. */
1593static void build_subroutines(BuildCtx *ctx)
1594{
1595 //|.code_sub
1596 dasm_put(Dst, 0);
1597#line 387 "vm_x64.dasc"
1598 //|
1599 //|//-----------------------------------------------------------------------
1600 //|//-- Return handling ----------------------------------------------------
1601 //|//-----------------------------------------------------------------------
1602 //|
1603 //|->vm_returnp:
1604 //| test PCd, FRAME_P
1605 //| jz ->cont_dispatch
1606 //|
1607 //| // Return from pcall or xpcall fast func.
1608 //| and PC, -8
1609 //| sub BASE, PC // Restore caller base.
1610 //| lea RA, [RA+PC-8] // Rebase RA and prepend one result.
1611 //| mov PC, [BASE-8] // Fetch PC of previous frame.
1612 //| // Prepending may overwrite the pcall frame, so do it at the end.
1613 //| mov_true ITYPE
1614 //| mov aword [BASE+RA], ITYPE // Prepend true to results.
1615 //|
1616 //|->vm_returnc:
1617 //| add RDd, 1 // RD = nresults+1
1618 //| jz ->vm_unwind_yield
1619 //| mov MULTRES, RDd
1620 //| test PC, FRAME_TYPE
1621 //| jz ->BC_RET_Z // Handle regular return to Lua.
1622 //|
1623 //|->vm_return:
1624 //| // BASE = base, RA = resultofs, RD = nresults+1 (= MULTRES), PC = return
1625 //| xor PC, FRAME_C
1626 //| test PCd, FRAME_TYPE
1627 //| jnz ->vm_returnp
1628 //|
1629 //| // Return to C.
1630 //| set_vmstate C
1631 //| and PC, -8
1632 dasm_put(Dst, 2, FRAME_P, (unsigned int)((int64_t)~((uint64_t)2<<47)), (unsigned int)(((int64_t)~((uint64_t)2<<47))>>32), FRAME_TYPE, FRAME_C, FRAME_TYPE, DISPATCH_GL(vmstate), ~LJ_VMST_C);
1633#line 421 "vm_x64.dasc"
1634 //| sub PC, BASE
1635 //| neg PC // Previous base = BASE - delta.
1636 //|
1637 //| sub RDd, 1
1638 //| jz >2
1639 //|1: // Move results down.
1640 //| mov RB, [BASE+RA]
1641 //| mov [BASE-16], RB
1642 //| add BASE, 8
1643 //| sub RDd, 1
1644 //| jnz <1
1645 //|2:
1646 //| mov L:RB, SAVE_L
1647 //| mov L:RB->base, PC
1648 //|3:
1649 //| mov RDd, MULTRES
1650 //| mov RAd, SAVE_NRES // RA = wanted nresults+1
1651 //|4:
1652 //| cmp RAd, RDd
1653 //| jne >6 // More/less results wanted?
1654 //|5:
1655 //| sub BASE, 16
1656 //| mov L:RB->top, BASE
1657 //|
1658 //|->vm_leave_cp:
1659 //| mov RA, SAVE_CFRAME // Restore previous C frame.
1660 //| mov L:RB->cframe, RA
1661 //| xor eax, eax // Ok return status for vm_pcall.
1662 //|
1663 //|->vm_leave_unw:
1664 //| restoreregs
1665 //| ret
1666 //|
1667 //|6:
1668 //| jb >7 // Less results wanted?
1669 //| // More results wanted. Check stack size and fill up results with nil.
1670 //| cmp BASE, L:RB->maxstack
1671 dasm_put(Dst, 81, Dt1(->base), Dt1(->top), Dt1(->cframe));
1672#line 458 "vm_x64.dasc"
1673 //| ja >8
1674 //| mov aword [BASE-16], LJ_TNIL
1675 //| add BASE, 8
1676 //| add RDd, 1
1677 //| jmp <4
1678 //|
1679 //|7: // Less results wanted.
1680 //| test RAd, RAd
1681 //| jz <5 // But check for LUA_MULTRET+1.
1682 //| sub RA, RD // Negative result!
1683 //| lea BASE, [BASE+RA*8] // Correct top.
1684 //| jmp <5
1685 //|
1686 //|8: // Corner case: need to grow stack for filling up results.
1687 //| // This can happen if:
1688 //| // - A C function grows the stack (a lot).
1689 //| // - The GC shrinks the stack in between.
1690 //| // - A return back from a lua_call() with (high) nresults adjustment.
1691 //| mov L:RB->top, BASE // Save current top held in BASE (yes).
1692 //| mov MULTRES, RDd // Need to fill only remainder with nil.
1693 //| mov CARG2d, RAd
1694 //| mov CARG1, L:RB
1695 //| call extern lj_state_growstack // (lua_State *L, int n)
1696 //| mov BASE, L:RB->top // Need the (realloced) L->top in BASE.
1697 //| jmp <3
1698 //|
1699 //|->vm_unwind_yield:
1700 //| mov al, LUA_YIELD
1701 //| jmp ->vm_unwind_c_eh
1702 //|
1703 //|->vm_unwind_c: // Unwind C stack, return from vm_pcall.
1704 //| // (void *cframe, int errcode)
1705 //| mov eax, CARG2d // Error return status for vm_pcall.
1706 dasm_put(Dst, 194, Dt1(->maxstack), LJ_TNIL, Dt1(->top), Dt1(->top), LUA_YIELD);
1707#line 491 "vm_x64.dasc"
1708 //| mov rsp, CARG1
1709 //|->vm_unwind_c_eh: // Landing pad for external unwinder.
1710 //| mov L:RB, SAVE_L
1711 //| mov GL:RB, L:RB->glref
1712 //| mov dword GL:RB->vmstate, ~LJ_VMST_C
1713 //| jmp ->vm_leave_unw
1714 //|
1715 //|->vm_unwind_rethrow:
1716 //|.if not X64WIN
1717 //| mov CARG1, SAVE_L
1718 //| mov CARG2d, eax
1719 //| restoreregs
1720 //| jmp extern lj_err_throw // (lua_State *L, int errcode)
1721 //|.endif
1722 //|
1723 //|->vm_unwind_ff: // Unwind C stack, return from ff pcall.
1724 //| // (void *cframe)
1725 //| and CARG1, CFRAME_RAWMASK
1726 //| mov rsp, CARG1
1727 //|->vm_unwind_ff_eh: // Landing pad for external unwinder.
1728 //| mov L:RB, SAVE_L
1729 //| mov RDd, 1+1 // Really 1+2 results, incr. later.
1730 //| mov BASE, L:RB->base
1731 //| mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
1732 //| add DISPATCH, GG_G2DISP
1733 //| mov PC, [BASE-8] // Fetch PC of previous frame.
1734 //| mov_false RA
1735 //| mov RB, [BASE]
1736 //| mov [BASE-16], RA // Prepend false to error message.
1737 //| mov [BASE-8], RB
1738 //| mov RA, -16 // Results start at BASE+RA = BASE-16.
1739 //| set_vmstate INTERP
1740 //| jmp ->vm_returnc // Increments RD/MULTRES and returns.
1741 //|
1742 //|//-----------------------------------------------------------------------
1743 //|//-- Grow stack for calls -----------------------------------------------
1744 //|//-----------------------------------------------------------------------
1745 //|
1746 //|->vm_growstack_c: // Grow stack for C function.
1747 //| mov CARG2d, LUA_MINSTACK
1748 dasm_put(Dst, 276, Dt1(->glref), Dt2(->vmstate), ~LJ_VMST_C, CFRAME_RAWMASK, 1+1, Dt1(->base), Dt1(->glref), GG_G2DISP, (unsigned int)((int64_t)~((uint64_t)1<<47)), (unsigned int)(((int64_t)~((uint64_t)1<<47))>>32), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP);
1749#line 531 "vm_x64.dasc"
1750 //| jmp >2
1751 //|
1752 //|->vm_growstack_v: // Grow stack for vararg Lua function.
1753 //| sub RD, 16 // LJ_FR2
1754 //| jmp >1
1755 //|
1756 //|->vm_growstack_f: // Grow stack for fixarg Lua function.
1757 //| // BASE = new base, RD = nargs+1, RB = L, PC = first PC
1758 //| lea RD, [BASE+NARGS:RD*8-8]
1759 //|1:
1760 //| movzx RAd, byte [PC-4+PC2PROTO(framesize)]
1761 //| add PC, 4 // Must point after first instruction.
1762 //| mov L:RB->base, BASE
1763 //| mov L:RB->top, RD
1764 //| mov SAVE_PC, PC
1765 //| mov CARG2, RA
1766 //|2:
1767 //| // RB = L, L->base = new base, L->top = top
1768 //| mov CARG1, L:RB
1769 //| call extern lj_state_growstack // (lua_State *L, int n)
1770 //| mov BASE, L:RB->base
1771 //| mov RD, L:RB->top
1772 //| mov LFUNC:RB, [BASE-16]
1773 //| cleartp LFUNC:RB
1774 //| sub RD, BASE
1775 //| shr RDd, 3
1776 //| add NARGS:RDd, 1
1777 //| // BASE = new base, RB = LFUNC, RD = nargs+1
1778 //| ins_callt // Just retry the call.
1779 //|
1780 //|//-----------------------------------------------------------------------
1781 //|//-- Entry points into the assembler VM ---------------------------------
1782 //|//-----------------------------------------------------------------------
1783 //|
1784 //|->vm_resume: // Setup C frame and resume thread.
1785 //| // (lua_State *L, TValue *base, int nres1 = 0, ptrdiff_t ef = 0)
1786 //| saveregs
1787 //| mov L:RB, CARG1 // Caveat: CARG1 may be RA.
1788 //| mov SAVE_L, CARG1
1789 //| mov RA, CARG2
1790 //| mov PCd, FRAME_CP
1791 //| xor RDd, RDd
1792 //| lea KBASE, [esp+CFRAME_RESUME]
1793 //| mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
1794 //| add DISPATCH, GG_G2DISP
1795 dasm_put(Dst, 402, LUA_MINSTACK, -4+PC2PROTO(framesize), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), Dt7(->pc), FRAME_CP, CFRAME_RESUME, Dt1(->glref));
1796#line 576 "vm_x64.dasc"
1797 //| mov SAVE_PC, RD // Any value outside of bytecode is ok.
1798 //| mov SAVE_CFRAME, RD
1799 //| mov SAVE_NRES, RDd
1800 //| mov SAVE_ERRF, RDd
1801 //| mov L:RB->cframe, KBASE
1802 //| cmp byte L:RB->status, RDL
1803 //| je >2 // Initial resume (like a call).
1804 //|
1805 //| // Resume after yield (like a return).
1806 //| mov [DISPATCH+DISPATCH_GL(cur_L)], L:RB
1807 //| set_vmstate INTERP
1808 //| mov byte L:RB->status, RDL
1809 //| mov BASE, L:RB->base
1810 //| mov RD, L:RB->top
1811 //| sub RD, RA
1812 //| shr RDd, 3
1813 //| add RDd, 1 // RD = nresults+1
1814 //| sub RA, BASE // RA = resultofs
1815 //| mov PC, [BASE-8]
1816 //| mov MULTRES, RDd
1817 //| test PCd, FRAME_TYPE
1818 //| jz ->BC_RET_Z
1819 //| jmp ->vm_return
1820 //|
1821 //|->vm_pcall: // Setup protected C frame and enter VM.
1822 //| // (lua_State *L, TValue *base, int nres1, ptrdiff_t ef)
1823 //| saveregs
1824 //| mov PCd, FRAME_CP
1825 //| mov SAVE_ERRF, CARG4d
1826 //| jmp >1
1827 //|
1828 //|->vm_call: // Setup C frame and enter VM.
1829 //| // (lua_State *L, TValue *base, int nres1)
1830 //| saveregs
1831 dasm_put(Dst, 557, GG_G2DISP, Dt1(->cframe), Dt1(->status), DISPATCH_GL(cur_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->status), Dt1(->base), Dt1(->top), FRAME_TYPE, FRAME_CP);
1832#line 610 "vm_x64.dasc"
1833 //| mov PCd, FRAME_C
1834 //|
1835 //|1: // Entry point for vm_pcall above (PC = ftype).
1836 //| mov SAVE_NRES, CARG3d
1837 //| mov L:RB, CARG1 // Caveat: CARG1 may be RA.
1838 //| mov SAVE_L, CARG1
1839 //| mov RA, CARG2
1840 //|
1841 //| mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
1842 //| mov KBASE, L:RB->cframe // Add our C frame to cframe chain.
1843 //| mov SAVE_CFRAME, KBASE
1844 //| mov SAVE_PC, L:RB // Any value outside of bytecode is ok.
1845 //| add DISPATCH, GG_G2DISP
1846 //| mov L:RB->cframe, rsp
1847 //|
1848 //|2: // Entry point for vm_resume/vm_cpcall (RA = base, RB = L, PC = ftype).
1849 //| mov [DISPATCH+DISPATCH_GL(cur_L)], L:RB
1850 //| set_vmstate INTERP
1851 //| mov BASE, L:RB->base // BASE = old base (used in vmeta_call).
1852 //| add PC, RA
1853 //| sub PC, BASE // PC = frame delta + frame type
1854 //|
1855 //| mov RD, L:RB->top
1856 //| sub RD, RA
1857 //| shr NARGS:RDd, 3
1858 //| add NARGS:RDd, 1 // RD = nargs+1
1859 //|
1860 //|->vm_call_dispatch:
1861 //| mov LFUNC:RB, [RA-16]
1862 //| checkfunc LFUNC:RB, ->vmeta_call // Ensure KBASE defined and != BASE.
1863 //|
1864 //|->vm_call_dispatch_f:
1865 //| mov BASE, RA
1866 //| ins_call
1867 //| // BASE = new base, RB = func, RD = nargs+1, PC = caller PC
1868 //|
1869 //|->vm_cpcall: // Setup protected C frame, call C.
1870 //| // (lua_State *L, lua_CFunction func, void *ud, lua_CPFunction cp)
1871 //| saveregs
1872 dasm_put(Dst, 668, FRAME_C, Dt1(->glref), Dt1(->cframe), GG_G2DISP, Dt1(->cframe), DISPATCH_GL(cur_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top), LJ_TFUNC, Dt7(->pc));
1873#line 649 "vm_x64.dasc"
1874 //| mov L:RB, CARG1 // Caveat: CARG1 may be RA.
1875 //| mov SAVE_L, CARG1
1876 //| mov SAVE_PC, L:RB // Any value outside of bytecode is ok.
1877 //|
1878 //| mov KBASE, L:RB->stack // Compute -savestack(L, L->top).
1879 //| sub KBASE, L:RB->top
1880 //| mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
1881 //| mov SAVE_ERRF, 0 // No error function.
1882 //| mov SAVE_NRES, KBASEd // Neg. delta means cframe w/o frame.
1883 //| add DISPATCH, GG_G2DISP
1884 //| // Handler may change cframe_nres(L->cframe) or cframe_errfunc(L->cframe).
1885 //|
1886 //| mov KBASE, L:RB->cframe // Add our C frame to cframe chain.
1887 //| mov SAVE_CFRAME, KBASE
1888 //| mov L:RB->cframe, rsp
1889 //| mov [DISPATCH+DISPATCH_GL(cur_L)], L:RB
1890 //|
1891 //| call CARG4 // (lua_State *L, lua_CFunction func, void *ud)
1892 //| // TValue * (new base) or NULL returned in eax (RC).
1893 //| test RC, RC
1894 //| jz ->vm_leave_cp // No base? Just remove C frame.
1895 //| mov RA, RC
1896 //| mov PCd, FRAME_CP
1897 //| jmp <2 // Else continue with the call.
1898 //|
1899 //|//-----------------------------------------------------------------------
1900 //|//-- Metamethod handling ------------------------------------------------
1901 //|//-----------------------------------------------------------------------
1902 //|
1903 //|//-- Continuation dispatch ----------------------------------------------
1904 //|
1905 //|->cont_dispatch:
1906 //| // BASE = meta base, RA = resultofs, RD = nresults+1 (also in MULTRES)
1907 //| add RA, BASE
1908 //| and PC, -8
1909 //| mov RB, BASE
1910 //| sub BASE, PC // Restore caller BASE.
1911 //| mov aword [RA+RD*8-8], LJ_TNIL // Ensure one valid arg.
1912 //| mov RC, RA // ... in [RC]
1913 //| mov PC, [RB-24] // Restore PC from [cont|PC].
1914 //| mov RA, qword [RB-32] // May be negative on WIN64 with debug.
1915 //|.if FFI
1916 //| cmp RA, 1
1917 //| jbe >1
1918 //|.endif
1919 //| mov LFUNC:KBASE, [BASE-16]
1920 //| cleartp LFUNC:KBASE
1921 //| mov KBASE, LFUNC:KBASE->pc
1922 //| mov KBASE, [KBASE+PC2PROTO(k)]
1923 //| // BASE = base, RC = result, RB = meta base
1924 //| jmp RA // Jump to continuation.
1925 //|
1926 //|.if FFI
1927 //|1:
1928 //| je ->cont_ffi_callback // cont = 1: return from FFI callback.
1929 dasm_put(Dst, 830, Dt1(->stack), Dt1(->top), Dt1(->glref), GG_G2DISP, Dt1(->cframe), Dt1(->cframe), DISPATCH_GL(cur_L), FRAME_CP, LJ_TNIL, Dt7(->pc), PC2PROTO(k));
1930#line 704 "vm_x64.dasc"
1931 //| // cont = 0: Tail call from C function.
1932 //| sub RB, BASE
1933 //| shr RBd, 3
1934 //| lea RDd, [RBd-3]
1935 //| jmp ->vm_call_tail
1936 //|.endif
1937 //|
1938 //|->cont_cat: // BASE = base, RC = result, RB = mbase
1939 //| movzx RAd, PC_RB
1940 //| sub RB, 32
1941 //| lea RA, [BASE+RA*8]
1942 //| sub RA, RB
1943 //| je ->cont_ra
1944 //| neg RA
1945 //| shr RAd, 3
1946 //|.if X64WIN
1947 //| mov CARG3d, RAd
1948 //| mov L:CARG1, SAVE_L
1949 //| mov L:CARG1->base, BASE
1950 //| mov RC, [RC]
1951 //| mov [RB], RC
1952 //| mov CARG2, RB
1953 //|.else
1954 //| mov L:CARG1, SAVE_L
1955 //| mov L:CARG1->base, BASE
1956 //| mov CARG3d, RAd
1957 //| mov RA, [RC]
1958 //| mov [RB], RA
1959 //| mov CARG2, RB
1960 //|.endif
1961 //| jmp ->BC_CAT_Z
1962 //|
1963 //|//-- Table indexing metamethods -----------------------------------------
1964 //|
1965 //|->vmeta_tgets:
1966 //| settp STR:RC, LJ_TSTR // STR:RC = GCstr *
1967 //| mov TMP1, STR:RC
1968 //| lea RC, TMP1
1969 //| cmp PC_OP, BC_GGET
1970 //| jne >1
1971 //| settp TAB:RA, TAB:RB, LJ_TTAB // TAB:RB = GCtab *
1972 //| lea RB, [DISPATCH+DISPATCH_GL(tmptv)] // Store fn->l.env in g->tmptv.
1973 //| mov [RB], TAB:RA
1974 dasm_put(Dst, 991, Dt1(->base), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), BC_GGET, (unsigned int)(((uint64_t)LJ_TTAB<<47)), (unsigned int)((((uint64_t)LJ_TTAB<<47))>>32), DISPATCH_GL(tmptv));
1975#line 747 "vm_x64.dasc"
1976 //| jmp >2
1977 //|
1978 //|->vmeta_tgetb:
1979 //| movzx RCd, PC_RC
1980 //|.if DUALNUM
1981 //| setint RC
1982 //| mov TMP1, RC
1983 //|.else
1984 //| cvtsi2sd xmm0, RCd
1985 //| movsd TMP1, xmm0
1986 //|.endif
1987 //| lea RC, TMP1
1988 //| jmp >1
1989 //|
1990 //|->vmeta_tgetv:
1991 //| movzx RCd, PC_RC // Reload TValue *k from RC.
1992 //| lea RC, [BASE+RC*8]
1993 //|1:
1994 //| movzx RBd, PC_RB // Reload TValue *t from RB.
1995 //| lea RB, [BASE+RB*8]
1996 //|2:
1997 //| mov L:CARG1, SAVE_L
1998 //| mov L:CARG1->base, BASE // Caveat: CARG2/CARG3 may be BASE.
1999 //| mov CARG2, RB
2000 //| mov CARG3, RC
2001 //| mov L:RB, L:CARG1
2002 //| mov SAVE_PC, PC
2003 //| call extern lj_meta_tget // (lua_State *L, TValue *o, TValue *k)
2004 //| // TValue * (finished) or NULL (metamethod) returned in eax (RC).
2005 //| mov BASE, L:RB->base
2006 //| test RC, RC
2007 //| jz >3
2008 //|->cont_ra: // BASE = base, RC = result
2009 //| movzx RAd, PC_RA
2010 //| mov RB, [RC]
2011 //| mov [BASE+RA*8], RB
2012 //| ins_next
2013 //|
2014 //|3: // Call __index metamethod.
2015 //| // BASE = base, L->top = new base, stack = cont/func/t/k
2016 //| mov RA, L:RB->top
2017 //| mov [RA-24], PC // [cont|PC]
2018 //| lea PC, [RA+FRAME_CONT]
2019 //| sub PC, BASE
2020 //| mov LFUNC:RB, [RA-16] // Guaranteed to be a function here.
2021 //| mov NARGS:RDd, 2+1 // 2 args for func(t, k).
2022 //| cleartp LFUNC:RB
2023 //| jmp ->vm_call_dispatch_f
2024 //|
2025 //|->vmeta_tgetr:
2026 //| mov CARG1, TAB:RB
2027 dasm_put(Dst, 1107, Dt1(->base), Dt1(->base), Dt1(->top), FRAME_CONT, 2+1);
2028#line 798 "vm_x64.dasc"
2029 //| mov RB, BASE // Save BASE.
2030 //| mov CARG2d, RCd // Caveat: CARG2 == BASE
2031 //| call extern lj_tab_getinth // (GCtab *t, int32_t key)
2032 //| // cTValue * or NULL returned in eax (RC).
2033 //| movzx RAd, PC_RA
2034 //| mov BASE, RB // Restore BASE.
2035 //| test RC, RC
2036 //| jnz ->BC_TGETR_Z
2037 //| mov ITYPE, LJ_TNIL
2038 //| jmp ->BC_TGETR2_Z
2039 //|
2040 //|//-----------------------------------------------------------------------
2041 //|
2042 //|->vmeta_tsets:
2043 //| settp STR:RC, LJ_TSTR // STR:RC = GCstr *
2044 //| mov TMP1, STR:RC
2045 //| lea RC, TMP1
2046 //| cmp PC_OP, BC_GSET
2047 //| jne >1
2048 //| settp TAB:RA, TAB:RB, LJ_TTAB // TAB:RB = GCtab *
2049 //| lea RB, [DISPATCH+DISPATCH_GL(tmptv)] // Store fn->l.env in g->tmptv.
2050 //| mov [RB], TAB:RA
2051 //| jmp >2
2052 //|
2053 //|->vmeta_tsetb:
2054 //| movzx RCd, PC_RC
2055 //|.if DUALNUM
2056 //| setint RC
2057 //| mov TMP1, RC
2058 //|.else
2059 //| cvtsi2sd xmm0, RCd
2060 //| movsd TMP1, xmm0
2061 //|.endif
2062 //| lea RC, TMP1
2063 //| jmp >1
2064 //|
2065 //|->vmeta_tsetv:
2066 //| movzx RCd, PC_RC // Reload TValue *k from RC.
2067 dasm_put(Dst, 1281, LJ_TNIL, (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), BC_GSET, (unsigned int)(((uint64_t)LJ_TTAB<<47)), (unsigned int)((((uint64_t)LJ_TTAB<<47))>>32), DISPATCH_GL(tmptv));
2068#line 836 "vm_x64.dasc"
2069 //| lea RC, [BASE+RC*8]
2070 //|1:
2071 //| movzx RBd, PC_RB // Reload TValue *t from RB.
2072 //| lea RB, [BASE+RB*8]
2073 //|2:
2074 //| mov L:CARG1, SAVE_L
2075 //| mov L:CARG1->base, BASE // Caveat: CARG2/CARG3 may be BASE.
2076 //| mov CARG2, RB
2077 //| mov CARG3, RC
2078 //| mov L:RB, L:CARG1
2079 //| mov SAVE_PC, PC
2080 //| call extern lj_meta_tset // (lua_State *L, TValue *o, TValue *k)
2081 //| // TValue * (finished) or NULL (metamethod) returned in eax (RC).
2082 //| mov BASE, L:RB->base
2083 //| test RC, RC
2084 //| jz >3
2085 //| // NOBARRIER: lj_meta_tset ensures the table is not black.
2086 //| movzx RAd, PC_RA
2087 //| mov RB, [BASE+RA*8]
2088 //| mov [RC], RB
2089 //|->cont_nop: // BASE = base, (RC = result)
2090 //| ins_next
2091 //|
2092 //|3: // Call __newindex metamethod.
2093 //| // BASE = base, L->top = new base, stack = cont/func/t/k/(v)
2094 //| mov RA, L:RB->top
2095 //| mov [RA-24], PC // [cont|PC]
2096 //| movzx RCd, PC_RA
2097 //| // Copy value to third argument.
2098 //| mov RB, [BASE+RC*8]
2099 //| mov [RA+16], RB
2100 //| lea PC, [RA+FRAME_CONT]
2101 //| sub PC, BASE
2102 //| mov LFUNC:RB, [RA-16] // Guaranteed to be a function here.
2103 //| mov NARGS:RDd, 3+1 // 3 args for func(t, k, v).
2104 //| cleartp LFUNC:RB
2105 //| jmp ->vm_call_dispatch_f
2106 //|
2107 //|->vmeta_tsetr:
2108 //|.if X64WIN
2109 //| mov L:CARG1, SAVE_L
2110 //| mov CARG3d, RCd
2111 //| mov L:CARG1->base, BASE
2112 //| xchg CARG2, TAB:RB // Caveat: CARG2 == BASE.
2113 //|.else
2114 //| mov L:CARG1, SAVE_L
2115 //| mov CARG2, TAB:RB
2116 //| mov L:CARG1->base, BASE
2117 //| mov RB, BASE // Save BASE.
2118 //| mov CARG3d, RCd // Caveat: CARG3 == BASE.
2119 //|.endif
2120 //| mov SAVE_PC, PC
2121 //| call extern lj_tab_setinth // (lua_State *L, GCtab *t, int32_t key)
2122 //| // TValue * returned in eax (RC).
2123 //| movzx RAd, PC_RA
2124 //| mov BASE, RB // Restore BASE.
2125 //| jmp ->BC_TSETR_Z
2126 //|
2127 //|//-- Comparison metamethods ---------------------------------------------
2128 //|
2129 //|->vmeta_comp:
2130 //| movzx RDd, PC_RD
2131 //| movzx RAd, PC_RA
2132 //| mov L:RB, SAVE_L
2133 //| mov L:RB->base, BASE // Caveat: CARG2/CARG3 == BASE.
2134 //|.if X64WIN
2135 //| lea CARG3, [BASE+RD*8]
2136 //| lea CARG2, [BASE+RA*8]
2137 //|.else
2138 //| lea CARG2, [BASE+RA*8]
2139 dasm_put(Dst, 1393, Dt1(->base), Dt1(->base), Dt1(->top), FRAME_CONT, 3+1, Dt1(->base), Dt1(->base));
2140#line 906 "vm_x64.dasc"
2141 //| lea CARG3, [BASE+RD*8]
2142 //|.endif
2143 //| mov CARG1, L:RB // Caveat: CARG1/CARG4 == RA.
2144 //| movzx CARG4d, PC_OP
2145 //| mov SAVE_PC, PC
2146 //| call extern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op)
2147 //| // 0/1 or TValue * (metamethod) returned in eax (RC).
2148 //|3:
2149 //| mov BASE, L:RB->base
2150 //| cmp RC, 1
2151 //| ja ->vmeta_binop
2152 //|4:
2153 //| lea PC, [PC+4]
2154 //| jb >6
2155 //|5:
2156 //| movzx RDd, PC_RD
2157 //| branchPC RD
2158 //|6:
2159 //| ins_next
2160 //|
2161 //|->cont_condt: // BASE = base, RC = result
2162 //| add PC, 4
2163 //| mov ITYPE, [RC]
2164 //| sar ITYPE, 47
2165 //| cmp ITYPEd, LJ_TISTRUECOND // Branch if result is true.
2166 //| jb <5
2167 //| jmp <6
2168 //|
2169 //|->cont_condf: // BASE = base, RC = result
2170 //| mov ITYPE, [RC]
2171 //| sar ITYPE, 47
2172 //| cmp ITYPEd, LJ_TISTRUECOND // Branch if result is false.
2173 //| jmp <4
2174 //|
2175 //|->vmeta_equal:
2176 //| cleartp TAB:RD
2177 dasm_put(Dst, 1605, Dt1(->base), -BCBIAS_J*4, LJ_TISTRUECOND, LJ_TISTRUECOND);
2178#line 942 "vm_x64.dasc"
2179 //| sub PC, 4
2180 //|.if X64WIN
2181 //| mov CARG3, RD
2182 //| mov CARG4d, RBd
2183 //| mov L:RB, SAVE_L
2184 //| mov L:RB->base, BASE // Caveat: CARG2 == BASE.
2185 //| mov CARG2, RA
2186 //| mov CARG1, L:RB // Caveat: CARG1 == RA.
2187 //|.else
2188 //| mov CARG2, RA
2189 //| mov CARG4d, RBd // Caveat: CARG4 == RA.
2190 //| mov L:RB, SAVE_L
2191 //| mov L:RB->base, BASE // Caveat: CARG3 == BASE.
2192 //| mov CARG3, RD
2193 //| mov CARG1, L:RB
2194 //|.endif
2195 //| mov SAVE_PC, PC
2196 //| call extern lj_meta_equal // (lua_State *L, GCobj *o1, *o2, int ne)
2197 //| // 0/1 or TValue * (metamethod) returned in eax (RC).
2198 //| jmp <3
2199 //|
2200 //|->vmeta_equal_cd:
2201 //|.if FFI
2202 //| sub PC, 4
2203 //| mov L:RB, SAVE_L
2204 //| mov L:RB->base, BASE
2205 //| mov CARG1, L:RB
2206 //| mov CARG2d, dword [PC-4]
2207 //| mov SAVE_PC, PC
2208 //| call extern lj_meta_equal_cd // (lua_State *L, BCIns ins)
2209 //| // 0/1 or TValue * (metamethod) returned in eax (RC).
2210 //| jmp <3
2211 //|.endif
2212 //|
2213 //|->vmeta_istype:
2214 //| mov L:RB, SAVE_L
2215 //| mov L:RB->base, BASE // Caveat: CARG2/CARG3 may be BASE.
2216 //| mov CARG2d, RAd
2217 //| mov CARG3d, RDd
2218 //| mov L:CARG1, L:RB
2219 //| mov SAVE_PC, PC
2220 //| call extern lj_meta_istype // (lua_State *L, BCReg ra, BCReg tp)
2221 //| mov BASE, L:RB->base
2222 //| jmp <6
2223 //|
2224 //|//-- Arithmetic metamethods ---------------------------------------------
2225 //|
2226 //|->vmeta_arith_vno:
2227 //|.if DUALNUM
2228 //| movzx RBd, PC_RB
2229 //| movzx RCd, PC_RC
2230 //|.endif
2231 //|->vmeta_arith_vn:
2232 //| lea RC, [KBASE+RC*8]
2233 //| jmp >1
2234 //|
2235 //|->vmeta_arith_nvo:
2236 //|.if DUALNUM
2237 //| movzx RBd, PC_RB
2238 //| movzx RCd, PC_RC
2239 //|.endif
2240 //|->vmeta_arith_nv:
2241 //| lea TMPR, [KBASE+RC*8]
2242 //| lea RC, [BASE+RB*8]
2243 //| mov RB, TMPR
2244 //| jmp >2
2245 //|
2246 //|->vmeta_unm:
2247 //| lea RC, [BASE+RD*8]
2248 dasm_put(Dst, 1741, Dt1(->base), Dt1(->base), Dt1(->base), Dt1(->base));
2249#line 1011 "vm_x64.dasc"
2250 //| mov RB, RC
2251 //| jmp >2
2252 //|
2253 //|->vmeta_arith_vvo:
2254 //|.if DUALNUM
2255 //| movzx RBd, PC_RB
2256 //| movzx RCd, PC_RC
2257 //|.endif
2258 //|->vmeta_arith_vv:
2259 //| lea RC, [BASE+RC*8]
2260 //|1:
2261 //| lea RB, [BASE+RB*8]
2262 //|2:
2263 //| lea RA, [BASE+RA*8]
2264 //|.if X64WIN
2265 //| mov CARG3, RB
2266 //| mov CARG4, RC
2267 //| movzx RCd, PC_OP
2268 //| mov ARG5d, RCd
2269 //| mov L:RB, SAVE_L
2270 //| mov L:RB->base, BASE // Caveat: CARG2 == BASE.
2271 //| mov CARG2, RA
2272 //| mov CARG1, L:RB // Caveat: CARG1 == RA.
2273 //|.else
2274 //| movzx CARG5d, PC_OP
2275 //| mov CARG2, RA
2276 //| mov CARG4, RC // Caveat: CARG4 == RA.
2277 //| mov L:CARG1, SAVE_L
2278 //| mov L:CARG1->base, BASE // Caveat: CARG3 == BASE.
2279 //| mov CARG3, RB
2280 //| mov L:RB, L:CARG1
2281 //|.endif
2282 //| mov SAVE_PC, PC
2283 //| call extern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op)
2284 //| // NULL (finished) or TValue * (metamethod) returned in eax (RC).
2285 //| mov BASE, L:RB->base
2286 //| test RC, RC
2287 //| jz ->cont_nop
2288 //|
2289 //| // Call metamethod for binary op.
2290 //|->vmeta_binop:
2291 //| // BASE = base, RC = new base, stack = cont/func/o1/o2
2292 //| mov RA, RC
2293 //| sub RC, BASE
2294 //| mov [RA-24], PC // [cont|PC]
2295 //| lea PC, [RC+FRAME_CONT]
2296 //| mov NARGS:RDd, 2+1 // 2 args for func(o1, o2).
2297 //| jmp ->vm_call_dispatch
2298 //|
2299 //|->vmeta_len:
2300 //| movzx RDd, PC_RD
2301 //| mov L:RB, SAVE_L
2302 //| mov L:RB->base, BASE
2303 //| lea CARG2, [BASE+RD*8] // Caveat: CARG2 == BASE
2304 //| mov L:CARG1, L:RB
2305 //| mov SAVE_PC, PC
2306 //| call extern lj_meta_len // (lua_State *L, TValue *o)
2307 //| // NULL (retry) or TValue * (metamethod) returned in eax (RC).
2308 //| mov BASE, L:RB->base
2309 dasm_put(Dst, 1897, Dt1(->base), Dt1(->base), FRAME_CONT, 2+1, Dt1(->base), Dt1(->base));
2310#line 1070 "vm_x64.dasc"
2311#if LJ_52
2312 //| test RC, RC
2313 //| jne ->vmeta_binop // Binop call for compatibility.
2314 //| movzx RDd, PC_RD
2315 //| mov TAB:CARG1, [BASE+RD*8]
2316 //| cleartp TAB:CARG1
2317 //| jmp ->BC_LEN_Z
2318 dasm_put(Dst, 2038);
2319#line 1077 "vm_x64.dasc"
2320#else
2321 //| jmp ->vmeta_binop // Binop call for compatibility.
2322 dasm_put(Dst, 2068);
2323#line 1079 "vm_x64.dasc"
2324#endif
2325 //|
2326 //|//-- Call metamethod ----------------------------------------------------
2327 //|
2328 //|->vmeta_call_ra:
2329 //| lea RA, [BASE+RA*8+16]
2330 //|->vmeta_call: // Resolve and call __call metamethod.
2331 //| // BASE = old base, RA = new base, RC = nargs+1, PC = return
2332 //| mov TMP1d, NARGS:RDd // Save RA, RC for us.
2333 //| mov RB, RA
2334 //|.if X64WIN
2335 //| mov L:TMPR, SAVE_L
2336 //| mov L:TMPR->base, BASE // Caveat: CARG2 is BASE.
2337 //| lea CARG2, [RA-16]
2338 //| lea CARG3, [RA+NARGS:RD*8-8]
2339 //| mov CARG1, L:TMPR // Caveat: CARG1 is RA.
2340 //|.else
2341 //| mov L:CARG1, SAVE_L
2342 //| mov L:CARG1->base, BASE // Caveat: CARG3 is BASE.
2343 //| lea CARG2, [RA-16]
2344 //| lea CARG3, [RA+NARGS:RD*8-8]
2345 //|.endif
2346 //| mov SAVE_PC, PC
2347 //| call extern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
2348 //| mov RA, RB
2349 //| mov L:RB, SAVE_L
2350 //| mov BASE, L:RB->base
2351 //| mov NARGS:RDd, TMP1d
2352 //| mov LFUNC:RB, [RA-16]
2353 //| add NARGS:RDd, 1
2354 //| // This is fragile. L->base must not move, KBASE must always be defined.
2355 //| cmp KBASE, BASE // Continue with CALLT if flag set.
2356 //| je ->BC_CALLT_Z
2357 //| cleartp LFUNC:RB
2358 //| mov BASE, RA
2359 //| ins_call // Otherwise call resolved metamethod.
2360 //|
2361 //|//-- Argument coercion for 'for' statement ------------------------------
2362 //|
2363 //|->vmeta_for:
2364 //| mov L:RB, SAVE_L
2365 //| mov L:RB->base, BASE
2366 //| mov CARG2, RA // Caveat: CARG2 == BASE
2367 //| mov L:CARG1, L:RB // Caveat: CARG1 == RA
2368 //| mov SAVE_PC, PC
2369 //| call extern lj_meta_for // (lua_State *L, TValue *base)
2370 //| mov BASE, L:RB->base
2371 //| mov RCd, [PC-4]
2372 //| movzx RAd, RCH
2373 //| movzx OP, RCL
2374 //| shr RCd, 16
2375 //| jmp aword [DISPATCH+OP*8+GG_DISP2STATIC] // Retry FORI or JFORI.
2376 //|
2377 //|//-----------------------------------------------------------------------
2378 //|//-- Fast functions -----------------------------------------------------
2379 //|//-----------------------------------------------------------------------
2380 //|
2381 //|.macro .ffunc, name
2382 //|->ff_ .. name:
2383 //|.endmacro
2384 //|
2385 //|.macro .ffunc_1, name
2386 //|->ff_ .. name:
2387 //| cmp NARGS:RDd, 1+1; jb ->fff_fallback
2388 //|.endmacro
2389 //|
2390 //|.macro .ffunc_2, name
2391 //|->ff_ .. name:
2392 //| cmp NARGS:RDd, 2+1; jb ->fff_fallback
2393 //|.endmacro
2394 //|
2395 //|.macro .ffunc_n, name, op
2396 //| .ffunc_1 name
2397 //| checknumtp [BASE], ->fff_fallback
2398 //| op xmm0, qword [BASE]
2399 //|.endmacro
2400 //|
2401 //|.macro .ffunc_n, name
2402 //| .ffunc_n name, movsd
2403 //|.endmacro
2404 //|
2405 //|.macro .ffunc_nn, name
2406 //| .ffunc_2 name
2407 //| checknumtp [BASE], ->fff_fallback
2408 //| checknumtp [BASE+8], ->fff_fallback
2409 //| movsd xmm0, qword [BASE]
2410 //| movsd xmm1, qword [BASE+8]
2411 //|.endmacro
2412 //|
2413 //|// Inlined GC threshold check. Caveat: uses label 1.
2414 //|.macro ffgccheck
2415 //| mov RB, [DISPATCH+DISPATCH_GL(gc.total)]
2416 //| cmp RB, [DISPATCH+DISPATCH_GL(gc.threshold)]
2417 //| jb >1
2418 //| call ->fff_gcstep
2419 //|1:
2420 //|.endmacro
2421 //|
2422 //|//-- Base library: checks -----------------------------------------------
2423 //|
2424 //|.ffunc_1 assert
2425 //| mov ITYPE, [BASE]
2426 //| mov RB, ITYPE
2427 //| sar ITYPE, 47
2428 //| cmp ITYPEd, LJ_TISTRUECOND; jae ->fff_fallback
2429 //| mov PC, [BASE-8]
2430 //| mov MULTRES, RDd
2431 //| mov RB, [BASE]
2432 //| mov [BASE-16], RB
2433 //| sub RDd, 2
2434 //| jz >2
2435 //| mov RA, BASE
2436 dasm_put(Dst, 2073, Dt1(->base), Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base), GG_DISP2STATIC, 1+1, LJ_TISTRUECOND);
2437#line 1191 "vm_x64.dasc"
2438 //|1:
2439 //| add RA, 8
2440 //| mov RB, [RA]
2441 //| mov [RA-16], RB
2442 //| sub RDd, 1
2443 //| jnz <1
2444 //|2:
2445 //| mov RDd, MULTRES
2446 //| jmp ->fff_res_
2447 //|
2448 //|.ffunc_1 type
2449 //| mov RC, [BASE]
2450 //| sar RC, 47
2451 //| mov RBd, LJ_TISNUM
2452 //| cmp RCd, RBd
2453 //| cmovb RCd, RBd
2454 //| not RCd
2455 //|2:
2456 //| mov CFUNC:RB, [BASE-16]
2457 //| cleartp CFUNC:RB
2458 //| mov STR:RC, [CFUNC:RB+RC*8+((char *)(&((GCfuncC *)0)->upvalue))]
2459 //| mov PC, [BASE-8]
2460 //| settp STR:RC, LJ_TSTR
2461 //| mov [BASE-16], STR:RC
2462 //| jmp ->fff_res1
2463 //|
2464 //|//-- Base library: getters and setters ---------------------------------
2465 //|
2466 //|.ffunc_1 getmetatable
2467 dasm_put(Dst, 2294, 1+1, LJ_TISNUM, ((char *)(&((GCfuncC *)0)->upvalue)), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), 1+1);
2468#line 1220 "vm_x64.dasc"
2469 //| mov TAB:RB, [BASE]
2470 //| mov PC, [BASE-8]
2471 //| checktab TAB:RB, >6
2472 //|1: // Field metatable must be at same offset for GCtab and GCudata!
2473 //| mov TAB:RB, TAB:RB->metatable
2474 //|2:
2475 //| test TAB:RB, TAB:RB
2476 //| mov aword [BASE-16], LJ_TNIL
2477 //| jz ->fff_res1
2478 //| settp TAB:RC, TAB:RB, LJ_TTAB
2479 //| mov [BASE-16], TAB:RC // Store metatable as default result.
2480 //| mov STR:RC, [DISPATCH+DISPATCH_GL(gcroot)+8*(GCROOT_MMNAME+MM_metatable)]
2481 //| mov RAd, TAB:RB->hmask
2482 //| and RAd, STR:RC->sid
2483 //| settp STR:RC, LJ_TSTR
2484 //| imul RAd, #NODE
2485 //| add NODE:RA, TAB:RB->node
2486 dasm_put(Dst, 2405, LJ_TTAB, Dt6(->metatable), LJ_TNIL, (unsigned int)(((uint64_t)LJ_TTAB<<47)), (unsigned int)((((uint64_t)LJ_TTAB<<47))>>32), DISPATCH_GL(gcroot)+8*(GCROOT_MMNAME+MM_metatable), Dt6(->hmask), Dt5(->sid), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), sizeof(Node));
2487#line 1237 "vm_x64.dasc"
2488 //|3: // Rearranged logic, because we expect _not_ to find the key.
2489 //| cmp NODE:RA->key, STR:RC
2490 //| je >5
2491 //|4:
2492 //| mov NODE:RA, NODE:RA->next
2493 //| test NODE:RA, NODE:RA
2494 //| jnz <3
2495 //| jmp ->fff_res1 // Not found, keep default result.
2496 //|5:
2497 //| mov RB, NODE:RA->val
2498 //| cmp RB, LJ_TNIL; je ->fff_res1 // Ditto for nil value.
2499 //| mov [BASE-16], RB // Return value of mt.__metatable.
2500 //| jmp ->fff_res1
2501 //|
2502 //|6:
2503 //| cmp ITYPEd, LJ_TUDATA; je <1
2504 dasm_put(Dst, 2499, Dt6(->node), DtB(->key), DtB(->next), DtB(->val), LJ_TNIL);
2505#line 1253 "vm_x64.dasc"
2506 //| cmp ITYPEd, LJ_TISNUM; ja >7
2507 //| mov ITYPEd, LJ_TISNUM
2508 //|7:
2509 //| not ITYPEd
2510 //| mov TAB:RB, [DISPATCH+ITYPE*8+DISPATCH_GL(gcroot[GCROOT_BASEMT])]
2511 //| jmp <2
2512 //|
2513 //|.ffunc_2 setmetatable
2514 //| mov TAB:RB, [BASE]
2515 //| mov TAB:TMPR, TAB:RB
2516 //| checktab TAB:RB, ->fff_fallback
2517 //| // Fast path: no mt for table yet and not clearing the mt.
2518 //| cmp aword TAB:RB->metatable, 0; jne ->fff_fallback
2519 dasm_put(Dst, 2557, LJ_TUDATA, LJ_TISNUM, LJ_TISNUM, DISPATCH_GL(gcroot[GCROOT_BASEMT]), 2+1, LJ_TTAB, Dt6(->metatable));
2520#line 1266 "vm_x64.dasc"
2521 //| mov TAB:RA, [BASE+8]
2522 //| checktab TAB:RA, ->fff_fallback
2523 //| mov TAB:RB->metatable, TAB:RA
2524 //| mov PC, [BASE-8]
2525 //| mov [BASE-16], TAB:TMPR // Return original table.
2526 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
2527 //| jz >1
2528 //| // Possible write barrier. Table is black, but skip iswhite(mt) check.
2529 //| barrierback TAB:RB, RC
2530 //|1:
2531 //| jmp ->fff_res1
2532 //|
2533 //|.ffunc_2 rawget
2534 dasm_put(Dst, 2644, LJ_TTAB, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2535#line 1279 "vm_x64.dasc"
2536 //|.if X64WIN
2537 //| mov TAB:RA, [BASE]
2538 //| checktab TAB:RA, ->fff_fallback
2539 //| mov RB, BASE // Save BASE.
2540 //| lea CARG3, [BASE+8]
2541 //| mov CARG2, TAB:RA // Caveat: CARG2 == BASE.
2542 //| mov CARG1, SAVE_L
2543 //|.else
2544 //| mov TAB:CARG2, [BASE]
2545 //| checktab TAB:CARG2, ->fff_fallback
2546 //| mov RB, BASE // Save BASE.
2547 //| lea CARG3, [BASE+8] // Caveat: CARG3 == BASE.
2548 //| mov CARG1, SAVE_L
2549 //|.endif
2550 //| call extern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key)
2551 //| // cTValue * returned in eax (RD).
2552 //| mov BASE, RB // Restore BASE.
2553 //| // Copy table slot.
2554 //| mov RB, [RD]
2555 //| mov PC, [BASE-8]
2556 //| mov [BASE-16], RB
2557 //| jmp ->fff_res1
2558 //|
2559 //|//-- Base library: conversions ------------------------------------------
2560 //|
2561 //|.ffunc tonumber
2562 //| // Only handles the number case inline (without a base argument).
2563 //| cmp NARGS:RDd, 1+1; jne ->fff_fallback // Exactly one argument.
2564 //| mov RB, [BASE]
2565 //| checknumber RB, ->fff_fallback
2566 //| mov PC, [BASE-8]
2567 //| mov [BASE-16], RB
2568 //| jmp ->fff_res1
2569 //|
2570 //|.ffunc_1 tostring
2571 dasm_put(Dst, 2726, 2+1, LJ_TTAB, 1+1, LJ_TISNUM, 1+1);
2572#line 1314 "vm_x64.dasc"
2573 //| // Only handles the string or number case inline.
2574 //| mov PC, [BASE-8]
2575 //| mov STR:RB, [BASE]
2576 //| checktp_nc STR:RB, LJ_TSTR, >3
2577 //| // A __tostring method in the string base metatable is ignored.
2578 //|2:
2579 //| mov [BASE-16], STR:RB
2580 //| jmp ->fff_res1
2581 //|3: // Handle numbers inline, unless a number base metatable is present.
2582 //| cmp ITYPEd, LJ_TISNUM; ja ->fff_fallback_1
2583 //| cmp aword [DISPATCH+DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM])], 0
2584 //| jne ->fff_fallback
2585 //| ffgccheck // Caveat: uses label 1.
2586 dasm_put(Dst, 2853, LJ_TSTR, LJ_TISNUM, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
2587#line 1327 "vm_x64.dasc"
2588 //| mov L:RB, SAVE_L
2589 //| mov L:RB->base, BASE // Add frame since C call can throw.
2590 //| mov SAVE_PC, PC // Redundant (but a defined value).
2591 //|.if not X64WIN
2592 //| mov CARG2, BASE // Otherwise: CARG2 == BASE
2593 //|.endif
2594 //| mov L:CARG1, L:RB
2595 //|.if DUALNUM
2596 //| call extern lj_strfmt_number // (lua_State *L, cTValue *o)
2597 //|.else
2598 //| call extern lj_strfmt_num // (lua_State *L, lua_Number *np)
2599 //|.endif
2600 //| // GCstr returned in eax (RD).
2601 //| mov BASE, L:RB->base
2602 //| settp STR:RB, RD, LJ_TSTR
2603 //| jmp <2
2604 //|
2605 //|//-- Base library: iterators -------------------------------------------
2606 //|
2607 //|.ffunc_1 next
2608 //| je >2 // Missing 2nd arg?
2609 //|1:
2610 //|.if X64WIN
2611 //| mov RA, [BASE]
2612 //| checktab RA, ->fff_fallback
2613 //|.else
2614 //| mov CARG2, [BASE]
2615 //| checktab CARG2, ->fff_fallback
2616 //|.endif
2617 //| mov L:RB, SAVE_L
2618 dasm_put(Dst, 2927, Dt1(->base), Dt1(->base), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), 1+1, LJ_TTAB);
2619#line 1357 "vm_x64.dasc"
2620 //| mov L:RB->base, BASE // Add frame since C call can throw.
2621 //| mov L:RB->top, BASE // Dummy frame length is ok.
2622 //| mov PC, [BASE-8]
2623 //|.if X64WIN
2624 //| lea CARG3, [BASE+8]
2625 //| mov CARG2, RA // Caveat: CARG2 == BASE.
2626 //| mov CARG1, L:RB
2627 //|.else
2628 //| lea CARG3, [BASE+8] // Caveat: CARG3 == BASE.
2629 //| mov CARG1, L:RB
2630 //|.endif
2631 //| mov SAVE_PC, PC // Needed for ITERN fallback.
2632 //| call extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key)
2633 //| // Flag returned in eax (RD).
2634 //| mov BASE, L:RB->base
2635 //| test RDd, RDd; jz >3 // End of traversal?
2636 //| // Copy key and value to results.
2637 //| mov RB, [BASE+8]
2638 //| mov RD, [BASE+16]
2639 //| mov [BASE-16], RB
2640 //| mov [BASE-8], RD
2641 //|->fff_res2:
2642 //| mov RDd, 1+2
2643 //| jmp ->fff_res
2644 //|2: // Set missing 2nd arg to nil.
2645 //| mov aword [BASE+8], LJ_TNIL
2646 //| jmp <1
2647 //|3: // End of traversal: return nil.
2648 //| mov aword [BASE-16], LJ_TNIL
2649 //| jmp ->fff_res1
2650 //|
2651 //|.ffunc_1 pairs
2652 dasm_put(Dst, 3019, Dt1(->base), Dt1(->top), Dt1(->base), 1+2, LJ_TNIL, LJ_TNIL, 1+1);
2653#line 1389 "vm_x64.dasc"
2654 //| mov TAB:RB, [BASE]
2655 //| mov TMPR, TAB:RB
2656 //| checktab TAB:RB, ->fff_fallback
2657 dasm_put(Dst, 3120, LJ_TTAB);
2658#line 1392 "vm_x64.dasc"
2659#if LJ_52
2660 //| cmp aword TAB:RB->metatable, 0; jne ->fff_fallback
2661 dasm_put(Dst, 3159, Dt6(->metatable));
2662#line 1394 "vm_x64.dasc"
2663#endif
2664 //| mov CFUNC:RD, [BASE-16]
2665 //| cleartp CFUNC:RD
2666 //| mov CFUNC:RD, CFUNC:RD->upvalue[0]
2667 //| settp CFUNC:RD, LJ_TFUNC
2668 //| mov PC, [BASE-8]
2669 //| mov [BASE-16], CFUNC:RD
2670 //| mov [BASE-8], TMPR
2671 //| mov aword [BASE], LJ_TNIL
2672 //| mov RDd, 1+3
2673 //| jmp ->fff_res
2674 //|
2675 //|.ffunc_2 ipairs_aux
2676 //| mov TAB:RB, [BASE]
2677 //| checktab TAB:RB, ->fff_fallback
2678 //|.if DUALNUM
2679 //| mov RA, [BASE+8]
2680 //| checkint RA, ->fff_fallback
2681 //|.else
2682 //| checknumtp [BASE+8], ->fff_fallback
2683 //| movsd xmm0, qword [BASE+8]
2684 //|.endif
2685 //| mov PC, [BASE-8]
2686 //|.if DUALNUM
2687 //| add RAd, 1
2688 //| setint ITYPE, RA
2689 //| mov [BASE-16], ITYPE
2690 //|.else
2691 //| sseconst_1 xmm1, TMPR
2692 dasm_put(Dst, 3169, Dt8(->upvalue[0]), (unsigned int)(((uint64_t)LJ_TFUNC<<47)), (unsigned int)((((uint64_t)LJ_TFUNC<<47))>>32), LJ_TNIL, 1+3, 2+1, LJ_TTAB, LJ_TISNUM, (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32));
2693#line 1423 "vm_x64.dasc"
2694 //| addsd xmm0, xmm1
2695 //| cvttsd2si RAd, xmm0
2696 //| movsd qword [BASE-16], xmm0
2697 //|.endif
2698 //| cmp RAd, TAB:RB->asize; jae >2 // Not in array part?
2699 //| mov RD, TAB:RB->array
2700 //| lea RD, [RD+RA*8]
2701 //|1:
2702 //| cmp aword [RD], LJ_TNIL; je ->fff_res0
2703 //| // Copy array slot.
2704 //| mov RB, [RD]
2705 //| mov [BASE-8], RB
2706 //| jmp ->fff_res2
2707 //|2: // Check for empty hash part first. Otherwise call C function.
2708 //| cmp dword TAB:RB->hmask, 0; je ->fff_res0
2709 //|.if X64WIN
2710 //| mov TMPR, BASE
2711 //| mov CARG2d, RAd
2712 //| mov CARG1, TAB:RB
2713 //| mov RB, TMPR
2714 //|.else
2715 //| mov CARG1, TAB:RB
2716 //| mov RB, BASE // Save BASE.
2717 //| mov CARG2d, RAd // Caveat: CARG2 == BASE
2718 //|.endif
2719 //| call extern lj_tab_getinth // (GCtab *t, int32_t key)
2720 //| // cTValue * or NULL returned in eax (RD).
2721 //| mov BASE, RB
2722 //| test RD, RD
2723 //| jnz <1
2724 //|->fff_res0:
2725 //| mov RDd, 1+0
2726 //| jmp ->fff_res
2727 //|
2728 //|.ffunc_1 ipairs
2729 dasm_put(Dst, 3292, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->hmask), 1+0);
2730#line 1458 "vm_x64.dasc"
2731 //| mov TAB:RB, [BASE]
2732 //| mov TMPR, TAB:RB
2733 //| checktab TAB:RB, ->fff_fallback
2734 dasm_put(Dst, 3396, 1+1, LJ_TTAB);
2735#line 1461 "vm_x64.dasc"
2736#if LJ_52
2737 //| cmp aword TAB:RB->metatable, 0; jne ->fff_fallback
2738 dasm_put(Dst, 3159, Dt6(->metatable));
2739#line 1463 "vm_x64.dasc"
2740#endif
2741 //| mov CFUNC:RD, [BASE-16]
2742 //| cleartp CFUNC:RD
2743 //| mov CFUNC:RD, CFUNC:RD->upvalue[0]
2744 //| settp CFUNC:RD, LJ_TFUNC
2745 //| mov PC, [BASE-8]
2746 //| mov [BASE-16], CFUNC:RD
2747 //| mov [BASE-8], TMPR
2748 //|.if DUALNUM
2749 //| mov64 RD, ((uint64_t)LJ_TISNUM<<47)
2750 //| mov [BASE], RD
2751 //|.else
2752 //| mov qword [BASE], 0
2753 //|.endif
2754 //| mov RDd, 1+3
2755 //| jmp ->fff_res
2756 //|
2757 //|//-- Base library: catch errors ----------------------------------------
2758 //|
2759 //|.ffunc_1 pcall
2760 //| lea RA, [BASE+16]
2761 //| sub NARGS:RDd, 1
2762 //| mov PCd, 16+FRAME_PCALL
2763 //|1:
2764 //| movzx RBd, byte [DISPATCH+DISPATCH_GL(hookmask)]
2765 //| shr RB, HOOK_ACTIVE_SHIFT
2766 //| and RB, 1
2767 //| add PC, RB // Remember active hook before pcall.
2768 //| // Note: this does a (harmless) copy of the function to the PC slot, too.
2769 //| mov KBASE, RD
2770 //|2:
2771 //| mov RB, [RA+KBASE*8-24]
2772 //| mov [RA+KBASE*8-16], RB
2773 //| sub KBASE, 1
2774 //| ja <2
2775 //| jmp ->vm_call_dispatch
2776 //|
2777 //|.ffunc_2 xpcall
2778 dasm_put(Dst, 3439, Dt8(->upvalue[0]), (unsigned int)(((uint64_t)LJ_TFUNC<<47)), (unsigned int)((((uint64_t)LJ_TFUNC<<47))>>32), 1+3, 1+1, 16+FRAME_PCALL, DISPATCH_GL(hookmask), HOOK_ACTIVE_SHIFT);
2779#line 1501 "vm_x64.dasc"
2780 //| mov LFUNC:RA, [BASE+8]
2781 //| checktp_nc LFUNC:RA, LJ_TFUNC, ->fff_fallback
2782 //| mov LFUNC:RB, [BASE] // Swap function and traceback.
2783 //| mov [BASE], LFUNC:RA
2784 //| mov [BASE+8], LFUNC:RB
2785 //| lea RA, [BASE+24]
2786 //| sub NARGS:RDd, 2
2787 //| mov PCd, 24+FRAME_PCALL
2788 //| jmp <1
2789 //|
2790 //|//-- Coroutine library --------------------------------------------------
2791 //|
2792 //|.macro coroutine_resume_wrap, resume
2793 //|.if resume
2794 //|.ffunc_1 coroutine_resume
2795 //| mov L:RB, [BASE]
2796 //| cleartp L:RB
2797 //|.else
2798 //|.ffunc coroutine_wrap_aux
2799 //| mov CFUNC:RB, [BASE-16]
2800 //| cleartp CFUNC:RB
2801 //| mov L:RB, CFUNC:RB->upvalue[0].gcr
2802 //| cleartp L:RB
2803 //|.endif
2804 //| mov PC, [BASE-8]
2805 //| mov SAVE_PC, PC
2806 //| mov TMP1, L:RB
2807 //|.if resume
2808 //| checktptp [BASE], LJ_TTHREAD, ->fff_fallback
2809 //|.endif
2810 //| cmp aword L:RB->cframe, 0; jne ->fff_fallback
2811 //| cmp byte L:RB->status, LUA_YIELD; ja ->fff_fallback
2812 //| mov RA, L:RB->top
2813 //| je >1 // Status != LUA_YIELD (i.e. 0)?
2814 //| cmp RA, L:RB->base // Check for presence of initial func.
2815 //| je ->fff_fallback
2816 //| mov PC, [RA-8] // Move initial function up.
2817 //| mov [RA], PC
2818 //| add RA, 8
2819 //|1:
2820 //|.if resume
2821 //| lea PC, [RA+NARGS:RD*8-16] // Check stack space (-1-thread).
2822 //|.else
2823 //| lea PC, [RA+NARGS:RD*8-8] // Check stack space (-1).
2824 //|.endif
2825 //| cmp PC, L:RB->maxstack; ja ->fff_fallback
2826 //| mov L:RB->top, PC
2827 //|
2828 //| mov L:RB, SAVE_L
2829 //| mov L:RB->base, BASE
2830 //|.if resume
2831 //| add BASE, 8 // Keep resumed thread in stack for GC.
2832 //|.endif
2833 //| mov L:RB->top, BASE
2834 //|.if resume
2835 //| lea RB, [BASE+NARGS:RD*8-24] // RB = end of source for stack move.
2836 //|.else
2837 //| lea RB, [BASE+NARGS:RD*8-16] // RB = end of source for stack move.
2838 //|.endif
2839 //| sub RB, PC // Relative to PC.
2840 //|
2841 //| cmp PC, RA
2842 //| je >3
2843 //|2: // Move args to coroutine.
2844 //| mov RC, [PC+RB]
2845 //| mov [PC-8], RC
2846 //| sub PC, 8
2847 //| cmp PC, RA
2848 //| jne <2
2849 //|3:
2850 //| mov CARG2, RA
2851 //| mov CARG1, TMP1
2852 //| call ->vm_resume // (lua_State *L, TValue *base, 0, 0)
2853 //|
2854 //| mov L:RB, SAVE_L
2855 //| mov L:PC, TMP1
2856 //| mov BASE, L:RB->base
2857 //| mov [DISPATCH+DISPATCH_GL(cur_L)], L:RB
2858 //| set_vmstate INTERP
2859 //|
2860 //| cmp eax, LUA_YIELD
2861 //| ja >8
2862 //|4:
2863 //| mov RA, L:PC->base
2864 //| mov KBASE, L:PC->top
2865 //| mov L:PC->top, RA // Clear coroutine stack.
2866 //| mov PC, KBASE
2867 //| sub PC, RA
2868 //| je >6 // No results?
2869 //| lea RD, [BASE+PC]
2870 //| shr PCd, 3
2871 //| cmp RD, L:RB->maxstack
2872 //| ja >9 // Need to grow stack?
2873 //|
2874 //| mov RB, BASE
2875 //| sub RB, RA
2876 //|5: // Move results from coroutine.
2877 //| mov RD, [RA]
2878 //| mov [RA+RB], RD
2879 //| add RA, 8
2880 //| cmp RA, KBASE
2881 //| jne <5
2882 //|6:
2883 //|.if resume
2884 //| lea RDd, [PCd+2] // nresults+1 = 1 + true + results.
2885 //| mov_true ITYPE // Prepend true to results.
2886 //| mov [BASE-8], ITYPE
2887 //|.else
2888 //| lea RDd, [PCd+1] // nresults+1 = 1 + results.
2889 //|.endif
2890 //|7:
2891 //| mov PC, SAVE_PC
2892 //| mov MULTRES, RDd
2893 //|.if resume
2894 //| mov RA, -8
2895 //|.else
2896 //| xor RAd, RAd
2897 //|.endif
2898 //| test PCd, FRAME_TYPE
2899 //| jz ->BC_RET_Z
2900 //| jmp ->vm_return
2901 //|
2902 //|8: // Coroutine returned with error (at co->top-1).
2903 //|.if resume
2904 //| mov_false ITYPE // Prepend false to results.
2905 //| mov [BASE-8], ITYPE
2906 //| mov RA, L:PC->top
2907 //| sub RA, 8
2908 //| mov L:PC->top, RA // Clear error from coroutine stack.
2909 //| // Copy error message.
2910 //| mov RD, [RA]
2911 //| mov [BASE], RD
2912 //| mov RDd, 1+2 // nresults+1 = 1 + false + error.
2913 //| jmp <7
2914 //|.else
2915 //| mov CARG2, L:PC
2916 //| mov CARG1, L:RB
2917 //| call extern lj_ffh_coroutine_wrap_err // (lua_State *L, lua_State *co)
2918 //| // Error function does not return.
2919 //|.endif
2920 //|
2921 //|9: // Handle stack expansion on return from yield.
2922 //| mov L:RA, TMP1
2923 //| mov L:RA->top, KBASE // Undo coroutine stack clearing.
2924 //| mov CARG2, PC
2925 //| mov CARG1, L:RB
2926 //| call extern lj_state_growstack // (lua_State *L, int n)
2927 //| mov L:PC, TMP1
2928 //| mov BASE, L:RB->base
2929 //| jmp <4 // Retry the stack move.
2930 //|.endmacro
2931 //|
2932 //| coroutine_resume_wrap 1 // coroutine.resume
2933 dasm_put(Dst, 3564, 2+1, LJ_TFUNC, 24+FRAME_PCALL, 1+1, LJ_TTHREAD, Dt1(->cframe));
2934 dasm_put(Dst, 3679, Dt1(->status), LUA_YIELD, Dt1(->top), Dt1(->base), Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->top));
2935 dasm_put(Dst, 3770, Dt1(->base), DISPATCH_GL(cur_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, LUA_YIELD, Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->maxstack));
2936 dasm_put(Dst, 3871, (unsigned int)((int64_t)~((uint64_t)2<<47)), (unsigned int)(((int64_t)~((uint64_t)2<<47))>>32), FRAME_TYPE, (unsigned int)((int64_t)~((uint64_t)1<<47)), (unsigned int)(((int64_t)~((uint64_t)1<<47))>>32), Dt1(->top), Dt1(->top));
2937#line 1654 "vm_x64.dasc"
2938 //| coroutine_resume_wrap 0 // coroutine.wrap
2939 dasm_put(Dst, 3974, 1+2, Dt1(->top), Dt1(->base), Dt8(->upvalue[0].gcr), Dt1(->cframe), Dt1(->status), LUA_YIELD, Dt1(->top));
2940 dasm_put(Dst, 4088, Dt1(->base), Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->top), Dt1(->base));
2941 dasm_put(Dst, 4206, DISPATCH_GL(cur_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, LUA_YIELD, Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->maxstack));
2942#line 1655 "vm_x64.dasc"
2943 //|
2944 //|.ffunc coroutine_yield
2945 //| mov L:RB, SAVE_L
2946 //| test aword L:RB->cframe, CFRAME_RESUME
2947 //| jz ->fff_fallback
2948 //| mov L:RB->base, BASE
2949 //| lea RD, [BASE+NARGS:RD*8-8]
2950 //| mov L:RB->top, RD
2951 //| xor RDd, RDd
2952 dasm_put(Dst, 4294, FRAME_TYPE, Dt1(->top), Dt1(->base), Dt1(->cframe), CFRAME_RESUME, Dt1(->base), Dt1(->top));
2953#line 1664 "vm_x64.dasc"
2954 //| mov aword L:RB->cframe, RD
2955 //| mov al, LUA_YIELD
2956 //| mov byte L:RB->status, al
2957 //| jmp ->vm_leave_unw
2958 //|
2959 //|//-- Math library -------------------------------------------------------
2960 //|
2961 //| .ffunc_1 math_abs
2962 //| mov RB, [BASE]
2963 //|.if DUALNUM
2964 //| checkint RB, >3
2965 //| cmp RBd, 0; jns ->fff_resi
2966 //| neg RBd; js >2
2967 //|->fff_resbit:
2968 //|->fff_resi:
2969 //| setint RB
2970 //|->fff_resRB:
2971 //| mov PC, [BASE-8]
2972 //| mov [BASE-16], RB
2973 //| jmp ->fff_res1
2974 //|2:
2975 //| mov64 RB, U64x(41e00000,00000000) // 2^31.
2976 //| jmp ->fff_resRB
2977 //|3:
2978 //| ja ->fff_fallback
2979 //|.else
2980 //| checknum RB, ->fff_fallback
2981 //|.endif
2982 //| shl RB, 1
2983 //| shr RB, 1
2984 //| mov PC, [BASE-8]
2985 //| mov [BASE-16], RB
2986 //| jmp ->fff_res1
2987 //|
2988 //|.ffunc_n math_sqrt, sqrtsd
2989 dasm_put(Dst, 4399, Dt1(->cframe), LUA_YIELD, Dt1(->status), 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
2990#line 1699 "vm_x64.dasc"
2991 //|->fff_resxmm0:
2992 //| mov PC, [BASE-8]
2993 //| movsd qword [BASE-16], xmm0
2994 //| // fallthrough
2995 //|
2996 //|->fff_res1:
2997 //| mov RDd, 1+1
2998 //|->fff_res:
2999 //| mov MULTRES, RDd
3000 //|->fff_res_:
3001 //| test PCd, FRAME_TYPE
3002 //| jnz >7
3003 //|5:
3004 //| cmp PC_RB, RDL // More results expected?
3005 //| ja >6
3006 //| // Adjust BASE. KBASE is assumed to be set for the calling frame.
3007 //| movzx RAd, PC_RA
3008 //| neg RA
3009 //| lea BASE, [BASE+RA*8-16] // base = base - (RA+2)*8
3010 //| ins_next
3011 //|
3012 //|6: // Fill up results with nil.
3013 //| mov aword [BASE+RD*8-24], LJ_TNIL
3014 //| add RD, 1
3015 //| jmp <5
3016 //|
3017 //|7: // Non-standard return case.
3018 //| mov RA, -16 // Results start at BASE+RA = BASE-16.
3019 //| jmp ->vm_return
3020 //|
3021 //|.macro math_round, func
3022 //| .ffunc math_ .. func
3023 //|.if DUALNUM
3024 //| mov RB, [BASE]
3025 //| checknumx RB, ->fff_resRB, je
3026 //| ja ->fff_fallback
3027 //|.else
3028 //| checknumtp [BASE], ->fff_fallback
3029 //|.endif
3030 //| movsd xmm0, qword [BASE]
3031 //| call ->vm_ .. func .. _sse
3032 //|.if DUALNUM
3033 //| cvttsd2si RBd, xmm0
3034 //| cmp RBd, 0x80000000
3035 //| jne ->fff_resi
3036 //| cvtsi2sd xmm1, RBd
3037 //| ucomisd xmm0, xmm1
3038 //| jp ->fff_resxmm0
3039 //| je ->fff_resi
3040 //|.endif
3041 //| jmp ->fff_resxmm0
3042 //|.endmacro
3043 //|
3044 //| math_round floor
3045 dasm_put(Dst, 4490, 1+1, FRAME_TYPE, LJ_TNIL);
3046#line 1753 "vm_x64.dasc"
3047 //| math_round ceil
3048 //|
3049 //|.ffunc math_log
3050 //| cmp NARGS:RDd, 1+1; jne ->fff_fallback // Exactly one argument.
3051 //| checknumtp [BASE], ->fff_fallback
3052 dasm_put(Dst, 4614, LJ_TISNUM, LJ_TISNUM, 1+1);
3053#line 1758 "vm_x64.dasc"
3054 //| movsd xmm0, qword [BASE]
3055 //| mov RB, BASE
3056 //| call extern log
3057 //| mov BASE, RB
3058 //| jmp ->fff_resxmm0
3059 //|
3060 //|.macro math_extern, func
3061 //| .ffunc_n math_ .. func
3062 //| mov RB, BASE
3063 //| call extern func
3064 //| mov BASE, RB
3065 //| jmp ->fff_resxmm0
3066 //|.endmacro
3067 //|
3068 //|.macro math_extern2, func
3069 //| .ffunc_nn math_ .. func
3070 //| mov RB, BASE
3071 //| call extern func
3072 //| mov BASE, RB
3073 //| jmp ->fff_resxmm0
3074 //|.endmacro
3075 //|
3076 //| math_extern log10
3077 //| math_extern exp
3078 dasm_put(Dst, 4685, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
3079#line 1782 "vm_x64.dasc"
3080 //| math_extern sin
3081 //| math_extern cos
3082 dasm_put(Dst, 4793, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
3083#line 1784 "vm_x64.dasc"
3084 //| math_extern tan
3085 //| math_extern asin
3086 //| math_extern acos
3087 dasm_put(Dst, 4892, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
3088#line 1787 "vm_x64.dasc"
3089 //| math_extern atan
3090 //| math_extern sinh
3091 dasm_put(Dst, 5009, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
3092#line 1789 "vm_x64.dasc"
3093 //| math_extern cosh
3094 //| math_extern tanh
3095 dasm_put(Dst, 5108, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
3096#line 1791 "vm_x64.dasc"
3097 //| math_extern2 pow
3098 //| math_extern2 atan2
3099 dasm_put(Dst, 5207, LJ_TISNUM, 2+1, LJ_TISNUM, LJ_TISNUM, 2+1);
3100#line 1793 "vm_x64.dasc"
3101 //| math_extern2 fmod
3102 dasm_put(Dst, 5322, LJ_TISNUM, LJ_TISNUM, 2+1, LJ_TISNUM, LJ_TISNUM);
3103#line 1794 "vm_x64.dasc"
3104 //|
3105 //|.ffunc_2 math_ldexp
3106 //| checknumtp [BASE], ->fff_fallback
3107 //| checknumtp [BASE+8], ->fff_fallback
3108 //| fld qword [BASE+8]
3109 //| fld qword [BASE]
3110 //| fscale
3111 //| fpop1
3112 //| mov PC, [BASE-8]
3113 //| fstp qword [BASE-16]
3114 //| jmp ->fff_res1
3115 //|
3116 //|.ffunc_n math_frexp
3117 dasm_put(Dst, 5433, 2+1, LJ_TISNUM, LJ_TISNUM, 1+1, LJ_TISNUM);
3118#line 1807 "vm_x64.dasc"
3119 //| mov RB, BASE
3120 //|.if X64WIN
3121 //| lea CARG2, TMP1 // Caveat: CARG2 == BASE
3122 //|.else
3123 //| lea CARG1, TMP1
3124 //|.endif
3125 //| call extern frexp
3126 //| mov BASE, RB
3127 //| mov RBd, TMP1d
3128 //| mov PC, [BASE-8]
3129 //| movsd qword [BASE-16], xmm0
3130 //|.if DUALNUM
3131 //| setint RB
3132 //| mov [BASE-8], RB
3133 //|.else
3134 //| cvtsi2sd xmm1, RBd
3135 //| movsd qword [BASE-8], xmm1
3136 //|.endif
3137 //| mov RDd, 1+2
3138 //| jmp ->fff_res
3139 //|
3140 //|.ffunc_n math_modf
3141 //| mov RB, BASE
3142 //|.if X64WIN
3143 //| lea CARG2, [BASE-16] // Caveat: CARG2 == BASE
3144 //|.else
3145 //| lea CARG1, [BASE-16]
3146 //|.endif
3147 //| call extern modf
3148 //| mov BASE, RB
3149 //| mov PC, [BASE-8]
3150 //| movsd qword [BASE-8], xmm0
3151 //| mov RDd, 1+2
3152 //| jmp ->fff_res
3153 //|
3154 //|.macro math_minmax, name, cmovop, sseop
3155 //| .ffunc_1 name
3156 //| mov RAd, 2
3157 //|.if DUALNUM
3158 //| mov RB, [BASE]
3159 //| checkint RB, >4
3160 //|1: // Handle integers.
3161 //| cmp RAd, RDd; jae ->fff_resRB
3162 //| mov TMPR, [BASE+RA*8-8]
3163 //| checkint TMPR, >3
3164 //| cmp RBd, TMPRd
3165 //| cmovop RB, TMPR
3166 //| add RAd, 1
3167 //| jmp <1
3168 //|3:
3169 //| ja ->fff_fallback
3170 //| // Convert intermediate result to number and continue below.
3171 //| cvtsi2sd xmm0, RBd
3172 //| jmp >6
3173 //|4:
3174 //| ja ->fff_fallback
3175 //|.else
3176 //| checknumtp [BASE], ->fff_fallback
3177 //|.endif
3178 //|
3179 //| movsd xmm0, qword [BASE]
3180 //|5: // Handle numbers or integers.
3181 //| cmp RAd, RDd; jae ->fff_resxmm0
3182 //|.if DUALNUM
3183 //| mov RB, [BASE+RA*8-8]
3184 //| checknumx RB, >6, jb
3185 //| ja ->fff_fallback
3186 //| cvtsi2sd xmm1, RBd
3187 //| jmp >7
3188 //|.else
3189 //| checknumtp [BASE+RA*8-8], ->fff_fallback
3190 //|.endif
3191 //|6:
3192 //| movsd xmm1, qword [BASE+RA*8-8]
3193 //|7:
3194 //| sseop xmm0, xmm1
3195 //| add RAd, 1
3196 //| jmp <5
3197 //|.endmacro
3198 //|
3199 //| math_minmax math_min, cmovg, minsd
3200 dasm_put(Dst, 5551, 1+2, 1+1, LJ_TISNUM, 1+2, 1+1);
3201#line 1888 "vm_x64.dasc"
3202 //| math_minmax math_max, cmovl, maxsd
3203 dasm_put(Dst, 5685, LJ_TISNUM, LJ_TISNUM, 1+1, LJ_TISNUM);
3204#line 1889 "vm_x64.dasc"
3205 //|
3206 //|//-- String library -----------------------------------------------------
3207 //|
3208 //|.ffunc string_byte // Only handle the 1-arg case here.
3209 //| cmp NARGS:RDd, 1+1; jne ->fff_fallback
3210 //| mov STR:RB, [BASE]
3211 //| checkstr STR:RB, ->fff_fallback
3212 //| mov PC, [BASE-8]
3213 //| cmp dword STR:RB->len, 1
3214 //| jb ->fff_res0 // Return no results for empty string.
3215 //| movzx RBd, byte STR:RB[1]
3216 dasm_put(Dst, 5797, LJ_TISNUM, 1+1, LJ_TSTR, Dt5(->len));
3217#line 1900 "vm_x64.dasc"
3218 //|.if DUALNUM
3219 //| jmp ->fff_resi
3220 //|.else
3221 //| cvtsi2sd xmm0, RBd; jmp ->fff_resxmm0
3222 //|.endif
3223 //|
3224 //|.ffunc string_char // Only handle the 1-arg case here.
3225 //| ffgccheck
3226 //| cmp NARGS:RDd, 1+1; jne ->fff_fallback // *Exactly* 1 arg.
3227 //|.if DUALNUM
3228 //| mov RB, [BASE]
3229 //| checkint RB, ->fff_fallback
3230 //|.else
3231 //| checknumtp [BASE], ->fff_fallback
3232 //| cvttsd2si RBd, qword [BASE]
3233 //|.endif
3234 //| cmp RBd, 255; ja ->fff_fallback
3235 //| mov TMP1d, RBd
3236 dasm_put(Dst, 5908, Dt5([1]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), 1+1, LJ_TISNUM);
3237#line 1918 "vm_x64.dasc"
3238 //| mov TMPRd, 1
3239 //| lea RD, TMP1 // Points to stack. Little-endian.
3240 //|->fff_newstr:
3241 //| mov L:RB, SAVE_L
3242 //| mov L:RB->base, BASE
3243 //| mov CARG3d, TMPRd // Zero-extended to size_t.
3244 //| mov CARG2, RD
3245 //| mov CARG1, L:RB
3246 //| mov SAVE_PC, PC
3247 //| call extern lj_str_new // (lua_State *L, char *str, size_t l)
3248 //|->fff_resstr:
3249 //| // GCstr * returned in eax (RD).
3250 //| mov BASE, L:RB->base
3251 //| mov PC, [BASE-8]
3252 //| settp STR:RD, LJ_TSTR
3253 //| mov [BASE-16], STR:RD
3254 //| jmp ->fff_res1
3255 //|
3256 //|.ffunc string_sub
3257 //| ffgccheck
3258 //| mov TMPRd, -1
3259 //| cmp NARGS:RDd, 1+2; jb ->fff_fallback
3260 //| jna >1
3261 dasm_put(Dst, 5983, Dt1(->base), Dt1(->base), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), 1+2);
3262#line 1941 "vm_x64.dasc"
3263 //|.if DUALNUM
3264 //| mov TMPR, [BASE+16]
3265 //| checkint TMPR, ->fff_fallback
3266 //|.else
3267 //| checknumtp [BASE+16], ->fff_fallback
3268 //| cvttsd2si TMPRd, qword [BASE+16]
3269 //|.endif
3270 //|1:
3271 //| mov STR:RB, [BASE]
3272 //| checkstr STR:RB, ->fff_fallback
3273 //|.if DUALNUM
3274 //| mov ITYPE, [BASE+8]
3275 //| mov RAd, ITYPEd // Must clear hiword for lea below.
3276 //| sar ITYPE, 47
3277 //| cmp ITYPEd, LJ_TISNUM
3278 //| jne ->fff_fallback
3279 //|.else
3280 //| checknumtp [BASE+8], ->fff_fallback
3281 //| cvttsd2si RAd, qword [BASE+8]
3282 //|.endif
3283 //| mov RCd, STR:RB->len
3284 //| cmp RCd, TMPRd // len < end? (unsigned compare)
3285 //| jb >5
3286 //|2:
3287 //| test RAd, RAd // start <= 0?
3288 //| jle >7
3289 //|3:
3290 //| sub TMPRd, RAd // start > end?
3291 dasm_put(Dst, 6091, LJ_TISNUM, LJ_TSTR, LJ_TISNUM, Dt5(->len));
3292#line 1969 "vm_x64.dasc"
3293 //| jl ->fff_emptystr
3294 //| lea RD, [STR:RB+RAd+#STR-1]
3295 //| add TMPRd, 1
3296 //|4:
3297 //| jmp ->fff_newstr
3298 //|
3299 //|5: // Negative end or overflow.
3300 //| jl >6
3301 //| lea TMPRd, [TMPRd+RCd+1] // end = end+(len+1)
3302 //| jmp <2
3303 //|6: // Overflow.
3304 //| mov TMPRd, RCd // end = len
3305 //| jmp <2
3306 //|
3307 //|7: // Negative start or underflow.
3308 //| je >8
3309 //| add RAd, RCd // start = start+(len+1)
3310 //| add RAd, 1
3311 //| jg <3 // start > 0?
3312 //|8: // Underflow.
3313 //| mov RAd, 1 // start = 1
3314 dasm_put(Dst, 6197, sizeof(GCstr)-1);
3315#line 1990 "vm_x64.dasc"
3316 //| jmp <3
3317 //|
3318 //|->fff_emptystr: // Range underflow.
3319 //| xor TMPRd, TMPRd // Zero length. Any ptr in RD is ok.
3320 //| jmp <4
3321 //|
3322 //|.macro ffstring_op, name
3323 //| .ffunc_1 string_ .. name
3324 //| ffgccheck
3325 //|.if X64WIN
3326 //| mov STR:TMPR, [BASE]
3327 //| checkstr STR:TMPR, ->fff_fallback
3328 //|.else
3329 //| mov STR:CARG2, [BASE]
3330 //| checkstr STR:CARG2, ->fff_fallback
3331 //|.endif
3332 //| mov L:RB, SAVE_L
3333 //| lea SBUF:CARG1, [DISPATCH+DISPATCH_GL(tmpbuf)]
3334 //| mov L:RB->base, BASE
3335 //|.if X64WIN
3336 //| mov STR:CARG2, STR:TMPR // Caveat: CARG2 == BASE
3337 //|.endif
3338 //| mov RC, SBUF:CARG1->b
3339 //| mov SBUF:CARG1->L, L:RB
3340 //| mov SBUF:CARG1->p, RC
3341 //| mov SAVE_PC, PC
3342 //| call extern lj_buf_putstr_ .. name
3343 //| mov CARG1, rax
3344 //| call extern lj_buf_tostr
3345 //| jmp ->fff_resstr
3346 //|.endmacro
3347 //|
3348 //|ffstring_op reverse
3349 dasm_put(Dst, 6262, 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), LJ_TSTR);
3350#line 2023 "vm_x64.dasc"
3351 //|ffstring_op lower
3352 dasm_put(Dst, 6338, DISPATCH_GL(tmpbuf), Dt1(->base), DtE(->b), DtE(->L), DtE(->p), 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), LJ_TSTR);
3353#line 2024 "vm_x64.dasc"
3354 //|ffstring_op upper
3355 dasm_put(Dst, 6437, DISPATCH_GL(tmpbuf), Dt1(->base), DtE(->b), DtE(->L), DtE(->p), 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
3356#line 2025 "vm_x64.dasc"
3357 //|
3358 //|//-- Bit library --------------------------------------------------------
3359 //|
3360 //|.macro .ffunc_bit, name, kind, fdef
3361 //| fdef name
3362 //|.if kind == 2
3363 //| sseconst_tobit xmm1, RB
3364 //|.endif
3365 //|.if DUALNUM
3366 //| mov RB, [BASE]
3367 //| checkint RB, >1
3368 //|.if kind > 0
3369 //| jmp >2
3370 //|.else
3371 //| jmp ->fff_resbit
3372 //|.endif
3373 //|1:
3374 //| ja ->fff_fallback
3375 //| movd xmm0, RB
3376 //|.else
3377 //| checknumtp [BASE], ->fff_fallback
3378 //| movsd xmm0, qword [BASE]
3379 //|.endif
3380 //|.if kind < 2
3381 //| sseconst_tobit xmm1, RB
3382 //|.endif
3383 //| addsd xmm0, xmm1
3384 //| movd RBd, xmm0
3385 //|2:
3386 //|.endmacro
3387 //|
3388 //|.macro .ffunc_bit, name, kind
3389 //| .ffunc_bit name, kind, .ffunc_1
3390 //|.endmacro
3391 //|
3392 //|.ffunc_bit bit_tobit, 0
3393 dasm_put(Dst, 6514, LJ_TSTR, DISPATCH_GL(tmpbuf), Dt1(->base), DtE(->b), DtE(->L), DtE(->p), 1+1, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32));
3394#line 2061 "vm_x64.dasc"
3395 //| jmp ->fff_resbit
3396 //|
3397 //|.macro .ffunc_bit_op, name, ins
3398 //| .ffunc_bit name, 2
3399 //| mov TMPRd, NARGS:RDd // Save for fallback.
3400 //| lea RD, [BASE+NARGS:RD*8-16]
3401 //|1:
3402 //| cmp RD, BASE
3403 //| jbe ->fff_resbit
3404 //|.if DUALNUM
3405 //| mov RA, [RD]
3406 //| checkint RA, >2
3407 //| ins RBd, RAd
3408 //| sub RD, 8
3409 //| jmp <1
3410 //|2:
3411 //| ja ->fff_fallback_bit_op
3412 //| movd xmm0, RA
3413 //|.else
3414 //| checknumtp [RD], ->fff_fallback_bit_op
3415 //| movsd xmm0, qword [RD]
3416 //|.endif
3417 //| addsd xmm0, xmm1
3418 //| movd RAd, xmm0
3419 //| ins RBd, RAd
3420 //| sub RD, 8
3421 //| jmp <1
3422 //|.endmacro
3423 //|
3424 //|.ffunc_bit_op bit_band, and
3425 dasm_put(Dst, 6626, 1+1, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), LJ_TISNUM, LJ_TISNUM);
3426#line 2091 "vm_x64.dasc"
3427 //|.ffunc_bit_op bit_bor, or
3428 //|.ffunc_bit_op bit_bxor, xor
3429 dasm_put(Dst, 6734, 1+1, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), LJ_TISNUM, LJ_TISNUM);
3430#line 2093 "vm_x64.dasc"
3431 //|
3432 //|.ffunc_bit bit_bswap, 1
3433 dasm_put(Dst, 6872, 1+1, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), LJ_TISNUM, LJ_TISNUM, 1+1);
3434#line 2095 "vm_x64.dasc"
3435 //| bswap RBd
3436 //| jmp ->fff_resbit
3437 //|
3438 //|.ffunc_bit bit_bnot, 1
3439 dasm_put(Dst, 6988, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), 1+1, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32));
3440#line 2099 "vm_x64.dasc"
3441 //| not RBd
3442 //|.if DUALNUM
3443 //| jmp ->fff_resbit
3444 //|.else
3445 //|->fff_resbit:
3446 //| cvtsi2sd xmm0, RBd
3447 //| jmp ->fff_resxmm0
3448 //|.endif
3449 //|
3450 //|->fff_fallback_bit_op:
3451 //| mov NARGS:RDd, TMPRd // Restore for fallback
3452 //| jmp ->fff_fallback
3453 //|
3454 //|.macro .ffunc_bit_sh, name, ins
3455 //|.if DUALNUM
3456 //| .ffunc_bit name, 1, .ffunc_2
3457 //| // Note: no inline conversion from number for 2nd argument!
3458 //| mov RA, [BASE+8]
3459 //| checkint RA, ->fff_fallback
3460 //|.else
3461 //| .ffunc_nn name
3462 //| sseconst_tobit xmm2, RB
3463 //| addsd xmm0, xmm2
3464 //| addsd xmm1, xmm2
3465 //| movd RBd, xmm0
3466 //| movd RAd, xmm1
3467 //|.endif
3468 //| ins RBd, cl // Assumes RA is ecx.
3469 //| jmp ->fff_resbit
3470 //|.endmacro
3471 //|
3472 //|.ffunc_bit_sh bit_lshift, shl
3473 dasm_put(Dst, 7077, 2+1, LJ_TISNUM, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32));
3474#line 2131 "vm_x64.dasc"
3475 //|.ffunc_bit_sh bit_rshift, shr
3476 //|.ffunc_bit_sh bit_arshift, sar
3477 dasm_put(Dst, 7177, 2+1, LJ_TISNUM, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), 2+1);
3478#line 2133 "vm_x64.dasc"
3479 //|.ffunc_bit_sh bit_rol, rol
3480 dasm_put(Dst, 7307, LJ_TISNUM, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), 2+1, LJ_TISNUM, LJ_TISNUM);
3481#line 2134 "vm_x64.dasc"
3482 //|.ffunc_bit_sh bit_ror, ror
3483 //|
3484 //|//-----------------------------------------------------------------------
3485 //|
3486 //|->fff_fallback_2:
3487 //| mov NARGS:RDd, 1+2 // Other args are ignored, anyway.
3488 dasm_put(Dst, 7433, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32), 2+1, LJ_TISNUM, LJ_TISNUM, (unsigned int)(U64x(43380000,00000000)), (unsigned int)((U64x(43380000,00000000))>>32));
3489#line 2140 "vm_x64.dasc"
3490 //| jmp ->fff_fallback
3491 //|->fff_fallback_1:
3492 //| mov NARGS:RDd, 1+1 // Other args are ignored, anyway.
3493 //|->fff_fallback: // Call fast function fallback handler.
3494 //| // BASE = new base, RD = nargs+1
3495 //| mov L:RB, SAVE_L
3496 //| mov PC, [BASE-8] // Fallback may overwrite PC.
3497 //| mov SAVE_PC, PC // Redundant (but a defined value).
3498 //| mov L:RB->base, BASE
3499 //| lea RD, [BASE+NARGS:RD*8-8]
3500 //| lea RA, [RD+8*LUA_MINSTACK] // Ensure enough space for handler.
3501 //| mov L:RB->top, RD
3502 //| mov CFUNC:RD, [BASE-16]
3503 //| cleartp CFUNC:RD
3504 //| cmp RA, L:RB->maxstack
3505 //| ja >5 // Need to grow stack.
3506 //| mov CARG1, L:RB
3507 //| call aword CFUNC:RD->f // (lua_State *L)
3508 //| mov BASE, L:RB->base
3509 //| // Either throws an error, or recovers and returns -1, 0 or nresults+1.
3510 //| test RDd, RDd; jg ->fff_res // Returned nresults+1?
3511 //|1:
3512 //| mov RA, L:RB->top
3513 //| sub RA, BASE
3514 //| shr RAd, 3
3515 //| test RDd, RDd
3516 //| lea NARGS:RDd, [RAd+1]
3517 //| mov LFUNC:RB, [BASE-16]
3518 //| jne ->vm_call_tail // Returned -1?
3519 //| cleartp LFUNC:RB
3520 dasm_put(Dst, 7569, 1+2, 1+1, Dt1(->base), 8*LUA_MINSTACK, Dt1(->top), Dt1(->maxstack), Dt8(->f), Dt1(->base), Dt1(->top));
3521#line 2170 "vm_x64.dasc"
3522 //| ins_callt // Returned 0: retry fast path.
3523 //|
3524 //|// Reconstruct previous base for vmeta_call during tailcall.
3525 //|->vm_call_tail:
3526 //| mov RA, BASE
3527 //| test PCd, FRAME_TYPE
3528 //| jnz >3
3529 //| movzx RBd, PC_RA
3530 //| neg RB
3531 //| lea BASE, [BASE+RB*8-16] // base = base - (RB+2)*8
3532 //| jmp ->vm_call_dispatch // Resolve again for tailcall.
3533 //|3:
3534 //| mov RB, PC
3535 //| and RB, -8
3536 //| sub BASE, RB
3537 //| jmp ->vm_call_dispatch // Resolve again for tailcall.
3538 //|
3539 //|5: // Grow stack for fallback handler.
3540 //| mov CARG2d, LUA_MINSTACK
3541 //| mov CARG1, L:RB
3542 //| call extern lj_state_growstack // (lua_State *L, int n)
3543 //| mov BASE, L:RB->base
3544 //| xor RDd, RDd // Simulate a return 0.
3545 //| jmp <1 // Dumb retry (goes through ff first).
3546 //|
3547 //|->fff_gcstep: // Call GC step function.
3548 //| // BASE = new base, RD = nargs+1
3549 //| pop RB // Must keep stack at same level.
3550 //| mov TMP1, RB // Save return address
3551 //| mov L:RB, SAVE_L
3552 //| mov SAVE_PC, PC // Redundant (but a defined value).
3553 //| mov L:RB->base, BASE
3554 //| lea RD, [BASE+NARGS:RD*8-8]
3555 //| mov CARG1, L:RB
3556 //| mov L:RB->top, RD
3557 //| call extern lj_gc_step // (lua_State *L)
3558 //| mov BASE, L:RB->base
3559 //| mov RD, L:RB->top
3560 dasm_put(Dst, 7681, Dt7(->pc), FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base));
3561#line 2208 "vm_x64.dasc"
3562 //| sub RD, BASE
3563 //| shr RDd, 3
3564 //| add NARGS:RDd, 1
3565 //| mov RB, TMP1
3566 //| push RB // Restore return address.
3567 //| ret
3568 //|
3569 //|//-----------------------------------------------------------------------
3570 //|//-- Special dispatch targets -------------------------------------------
3571 //|//-----------------------------------------------------------------------
3572 //|
3573 //|->vm_record: // Dispatch target for recording phase.
3574 //|.if JIT
3575 //| movzx RDd, byte [DISPATCH+DISPATCH_GL(hookmask)]
3576 //| test RDL, HOOK_VMEVENT // No recording while in vmevent.
3577 //| jnz >5
3578 //| // Decrement the hookcount for consistency, but always do the call.
3579 //| test RDL, HOOK_ACTIVE
3580 //| jnz >1
3581 //| test RDL, LUA_MASKLINE|LUA_MASKCOUNT
3582 //| jz >1
3583 //| dec dword [DISPATCH+DISPATCH_GL(hookcount)]
3584 //| jmp >1
3585 //|.endif
3586 //|
3587 //|->vm_rethook: // Dispatch target for return hooks.
3588 //| movzx RDd, byte [DISPATCH+DISPATCH_GL(hookmask)]
3589 //| test RDL, HOOK_ACTIVE // Hook already active?
3590 //| jnz >5
3591 //| jmp >1
3592 dasm_put(Dst, 7830, Dt1(->top), DISPATCH_GL(hookmask), HOOK_VMEVENT, HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), DISPATCH_GL(hookmask), HOOK_ACTIVE);
3593#line 2238 "vm_x64.dasc"
3594 //|
3595 //|->vm_inshook: // Dispatch target for instr/line hooks.
3596 //| movzx RDd, byte [DISPATCH+DISPATCH_GL(hookmask)]
3597 //| test RDL, HOOK_ACTIVE // Hook already active?
3598 //| jnz >5
3599 //|
3600 //| test RDL, LUA_MASKLINE|LUA_MASKCOUNT
3601 //| jz >5
3602 //| dec dword [DISPATCH+DISPATCH_GL(hookcount)]
3603 //| jz >1
3604 //| test RDL, LUA_MASKLINE
3605 //| jz >5
3606 //|1:
3607 //| mov L:RB, SAVE_L
3608 //| mov L:RB->base, BASE
3609 //| mov CARG2, PC // Caveat: CARG2 == BASE
3610 //| mov CARG1, L:RB
3611 //| // SAVE_PC must hold the _previous_ PC. The callee updates it with PC.
3612 //| call extern lj_dispatch_ins // (lua_State *L, const BCIns *pc)
3613 //|3:
3614 //| mov BASE, L:RB->base
3615 dasm_put(Dst, 7897, DISPATCH_GL(hookmask), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), LUA_MASKLINE, Dt1(->base));
3616#line 2259 "vm_x64.dasc"
3617 //|4:
3618 //| movzx RAd, PC_RA
3619 //|5:
3620 //| movzx OP, PC_OP
3621 //| movzx RDd, PC_RD
3622 //| jmp aword [DISPATCH+OP*8+GG_DISP2STATIC] // Re-dispatch to static ins.
3623 //|
3624 //|->cont_hook: // Continue from hook yield.
3625 //| add PC, 4
3626 //| mov RA, [RB-40]
3627 //| mov MULTRES, RAd // Restore MULTRES for *M ins.
3628 //| jmp <4
3629 //|
3630 //|->vm_hotloop: // Hot loop counter underflow.
3631 //|.if JIT
3632 //| mov LFUNC:RB, [BASE-16] // Same as curr_topL(L).
3633 //| cleartp LFUNC:RB
3634 //| mov RB, LFUNC:RB->pc
3635 //| movzx RDd, byte [RB+PC2PROTO(framesize)]
3636 //| lea RD, [BASE+RD*8]
3637 //| mov L:RB, SAVE_L
3638 //| mov L:RB->base, BASE
3639 //| mov L:RB->top, RD
3640 //| mov CARG2, PC
3641 //| lea CARG1, [DISPATCH+GG_DISP2J]
3642 //| mov aword [DISPATCH+DISPATCH_J(L)], L:RB
3643 //| mov SAVE_PC, PC
3644 //| call extern lj_trace_hot // (jit_State *J, const BCIns *pc)
3645 //| jmp <3
3646 //|.endif
3647 //|
3648 //|->vm_callhook: // Dispatch target for call hooks.
3649 //| mov SAVE_PC, PC
3650 //|.if JIT
3651 //| jmp >1
3652 //|.endif
3653 //|
3654 //|->vm_hotcall: // Hot call counter underflow.
3655 //|.if JIT
3656 //| mov SAVE_PC, PC
3657 dasm_put(Dst, 7960, Dt1(->base), GG_DISP2STATIC, Dt7(->pc), PC2PROTO(framesize), Dt1(->base), Dt1(->top), GG_DISP2J, DISPATCH_J(L));
3658#line 2299 "vm_x64.dasc"
3659 //| or PC, 1 // Marker for hot call.
3660 //|1:
3661 //|.endif
3662 //| lea RD, [BASE+NARGS:RD*8-8]
3663 //| mov L:RB, SAVE_L
3664 //| mov L:RB->base, BASE
3665 //| mov L:RB->top, RD
3666 //| mov CARG2, PC
3667 //| mov CARG1, L:RB
3668 //| call extern lj_dispatch_call // (lua_State *L, const BCIns *pc)
3669 //| // ASMFunction returned in eax/rax (RD).
3670 //| mov SAVE_PC, 0 // Invalidate for subsequent line hook.
3671 //|.if JIT
3672 //| and PC, -2
3673 //|.endif
3674 //| mov BASE, L:RB->base
3675 //| mov RA, RD
3676 //| mov RD, L:RB->top
3677 //| sub RD, BASE
3678 //| mov RB, RA
3679 //| movzx RAd, PC_RA
3680 //| shr RDd, 3
3681 //| add NARGS:RDd, 1
3682 //| jmp RB
3683 //|
3684 //|->cont_stitch: // Trace stitching.
3685 //|.if JIT
3686 //| // BASE = base, RC = result, RB = mbase
3687 //| mov TRACE:ITYPE, [RB-40] // Save previous trace.
3688 //| cleartp TRACE:ITYPE
3689 //| mov TMPRd, MULTRES
3690 //| movzx RAd, PC_RA
3691 //| lea RA, [BASE+RA*8] // Call base.
3692 //| sub TMPRd, 1
3693 //| jz >2
3694 //|1: // Move results down.
3695 //| mov RB, [RC]
3696 //| mov [RA], RB
3697 //| add RC, 8
3698 //| add RA, 8
3699 //| sub TMPRd, 1
3700 //| jnz <1
3701 //|2:
3702 //| movzx RCd, PC_RA
3703 //| movzx RBd, PC_RB
3704 //| add RC, RB
3705 //| lea RC, [BASE+RC*8-8]
3706 //|3:
3707 //| cmp RC, RA
3708 //| ja >9 // More results wanted?
3709 //|
3710 //| test TRACE:ITYPE, TRACE:ITYPE
3711 //| jz ->cont_nop
3712 //| movzx RBd, word TRACE:ITYPE->traceno
3713 //| movzx RDd, word TRACE:ITYPE->link
3714 //| cmp RDd, RBd
3715 dasm_put(Dst, 8087, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), DtD(->traceno), DtD(->link));
3716#line 2355 "vm_x64.dasc"
3717 //| je ->cont_nop // Blacklisted.
3718 //| test RDd, RDd
3719 //| jne =>BC_JLOOP // Jump to stitched trace.
3720 //|
3721 //| // Stitch a new trace to the previous trace.
3722 //| mov [DISPATCH+DISPATCH_J(exitno)], RB
3723 //| mov L:RB, SAVE_L
3724 //| mov L:RB->base, BASE
3725 //| mov CARG2, PC
3726 //| lea CARG1, [DISPATCH+GG_DISP2J]
3727 //| mov aword [DISPATCH+DISPATCH_J(L)], L:RB
3728 //| call extern lj_dispatch_stitch // (jit_State *J, const BCIns *pc)
3729 //| mov BASE, L:RB->base
3730 //| jmp ->cont_nop
3731 //|
3732 //|9: // Fill up results with nil.
3733 //| mov aword [RA], LJ_TNIL
3734 //| add RA, 8
3735 //| jmp <3
3736 //|.endif
3737 //|
3738 //|->vm_profhook: // Dispatch target for profiler hook.
3739 dasm_put(Dst, 8283, BC_JLOOP, DISPATCH_J(exitno), Dt1(->base), GG_DISP2J, DISPATCH_J(L), Dt1(->base), LJ_TNIL);
3740#line 2377 "vm_x64.dasc"
3741#if LJ_HASPROFILE
3742 //| mov L:RB, SAVE_L
3743 //| mov L:RB->base, BASE
3744 //| mov CARG2, PC // Caveat: CARG2 == BASE
3745 //| mov CARG1, L:RB
3746 //| call extern lj_dispatch_profile // (lua_State *L, const BCIns *pc)
3747 //| mov BASE, L:RB->base
3748 //| // HOOK_PROFILE is off again, so re-dispatch to dynamic instruction.
3749 //| sub PC, 4
3750 //| jmp ->cont_nop
3751 dasm_put(Dst, 8347, Dt1(->base), Dt1(->base));
3752#line 2387 "vm_x64.dasc"
3753#endif
3754 //|
3755 //|//-----------------------------------------------------------------------
3756 //|//-- Trace exit handler -------------------------------------------------
3757 //|//-----------------------------------------------------------------------
3758 //|
3759 //|// Called from an exit stub with the exit number on the stack.
3760 //|// The 16 bit exit number is stored with two (sign-extended) push imm8.
3761 //|->vm_exit_handler:
3762 //|.if JIT
3763 //| push r13; push r12
3764 //| push r11; push r10; push r9; push r8
3765 //| push rdi; push rsi; push rbp; lea rbp, [rsp+88]; push rbp
3766 //| push rbx; push rdx; push rcx; push rax
3767 //| movzx RCd, byte [rbp-8] // Reconstruct exit number.
3768 //| mov RCH, byte [rbp-16]
3769 //| mov [rbp-8], r15; mov [rbp-16], r14
3770 //| // DISPATCH is preserved on-trace in LJ_GC64 mode.
3771 //| mov RAd, [DISPATCH+DISPATCH_GL(vmstate)] // Get trace number.
3772 //| set_vmstate EXIT
3773 //| mov [DISPATCH+DISPATCH_J(exitno)], RCd
3774 //| mov [DISPATCH+DISPATCH_J(parent)], RAd
3775 //|.if X64WIN
3776 //| sub rsp, 16*8+4*8 // Room for SSE regs + save area.
3777 //|.else
3778 //| sub rsp, 16*8 // Room for SSE regs.
3779 //|.endif
3780 //| add rbp, -128
3781 //| movsd qword [rbp-8], xmm15; movsd qword [rbp-16], xmm14
3782 //| movsd qword [rbp-24], xmm13; movsd qword [rbp-32], xmm12
3783 //| movsd qword [rbp-40], xmm11; movsd qword [rbp-48], xmm10
3784 //| movsd qword [rbp-56], xmm9; movsd qword [rbp-64], xmm8
3785 //| movsd qword [rbp-72], xmm7; movsd qword [rbp-80], xmm6
3786 //| movsd qword [rbp-88], xmm5; movsd qword [rbp-96], xmm4
3787 //| movsd qword [rbp-104], xmm3; movsd qword [rbp-112], xmm2
3788 //| movsd qword [rbp-120], xmm1; movsd qword [rbp-128], xmm0
3789 //| // Caveat: RB is rbp.
3790 //| mov L:RB, [DISPATCH+DISPATCH_GL(cur_L)]
3791 //| mov BASE, [DISPATCH+DISPATCH_GL(jit_base)]
3792 //| mov aword [DISPATCH+DISPATCH_J(L)], L:RB
3793 //| mov L:RB->base, BASE
3794 //|.if X64WIN
3795 //| lea CARG2, [rsp+4*8]
3796 //|.else
3797 //| mov CARG2, rsp
3798 //|.endif
3799 //| lea CARG1, [DISPATCH+GG_DISP2J]
3800 //| mov qword [DISPATCH+DISPATCH_GL(jit_base)], 0
3801 //| call extern lj_trace_exit // (jit_State *J, ExitState *ex)
3802 //| // MULTRES or negated error code returned in eax (RD).
3803 //| mov RA, L:RB->cframe
3804 //| and RA, CFRAME_RAWMASK
3805 //| mov [RA+CFRAME_OFS_L], L:RB // Set SAVE_L (on-trace resume/yield).
3806 //| mov BASE, L:RB->base
3807 //| mov PC, [RA+CFRAME_OFS_PC] // Get SAVE_PC.
3808 //| jmp >1
3809 //|.endif
3810 //|->vm_exit_interp:
3811 //| // RD = MULTRES or negated error code, BASE, PC and DISPATCH set.
3812 //|.if JIT
3813 //| // Restore additional callee-save registers only used in compiled code.
3814 //|.if X64WIN
3815 //| lea RA, [rsp+10*16+4*8]
3816 //|1:
3817 //| movdqa xmm15, [RA-10*16]
3818 //| movdqa xmm14, [RA-9*16]
3819 //| movdqa xmm13, [RA-8*16]
3820 //| movdqa xmm12, [RA-7*16]
3821 //| movdqa xmm11, [RA-6*16]
3822 //| movdqa xmm10, [RA-5*16]
3823 //| movdqa xmm9, [RA-4*16]
3824 //| movdqa xmm8, [RA-3*16]
3825 //| movdqa xmm7, [RA-2*16]
3826 //| mov rsp, RA // Reposition stack to C frame.
3827 //| movdqa xmm6, [RA-1*16]
3828 //| mov r15, CSAVE_1
3829 //| mov r14, CSAVE_2
3830 //| mov r13, CSAVE_3
3831 //| mov r12, CSAVE_4
3832 //|.else
3833 //| lea RA, [rsp+16]
3834 dasm_put(Dst, 8381, DISPATCH_GL(vmstate), DISPATCH_GL(vmstate), ~LJ_VMST_EXIT, DISPATCH_J(exitno), DISPATCH_J(parent), 16*8, DISPATCH_GL(cur_L), DISPATCH_GL(jit_base), DISPATCH_J(L), Dt1(->base), GG_DISP2J, DISPATCH_GL(jit_base), Dt1(->cframe), CFRAME_RAWMASK, CFRAME_OFS_L, Dt1(->base), CFRAME_OFS_PC);
3835#line 2468 "vm_x64.dasc"
3836 //|1:
3837 //| mov r13, [RA-8]
3838 //| mov r12, [RA]
3839 //| mov rsp, RA // Reposition stack to C frame.
3840 //|.endif
3841 //| test RDd, RDd; js >9 // Check for error from exit.
3842 //| mov L:RB, SAVE_L
3843 //| mov MULTRES, RDd
3844 //| mov LFUNC:KBASE, [BASE-16]
3845 //| cleartp LFUNC:KBASE
3846 //| mov KBASE, LFUNC:KBASE->pc
3847 //| mov KBASE, [KBASE+PC2PROTO(k)]
3848 //| mov L:RB->base, BASE
3849 //| mov qword [DISPATCH+DISPATCH_GL(jit_base)], 0
3850 //| set_vmstate INTERP
3851 //| // Modified copy of ins_next which handles function header dispatch, too.
3852 //| mov RCd, [PC]
3853 //| movzx RAd, RCH
3854 //| movzx OP, RCL
3855 //| add PC, 4
3856 //| shr RCd, 16
3857 //| cmp OP, BC_FUNCF // Function header?
3858 //| jb >3
3859 //| cmp OP, BC_FUNCC+2 // Fast function?
3860 //| jae >4
3861 //|2:
3862 //| mov RCd, MULTRES // RC/RD holds nres+1.
3863 //|3:
3864 //| jmp aword [DISPATCH+OP*8]
3865 //|
3866 //|4: // Check frame below fast function.
3867 //| mov RC, [BASE-8]
3868 //| test RCd, FRAME_TYPE
3869 //| jnz <2 // Trace stitching continuation?
3870 dasm_put(Dst, 8621, Dt7(->pc), PC2PROTO(k), Dt1(->base), DISPATCH_GL(jit_base), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, BC_FUNCF, BC_FUNCC+2, FRAME_TYPE);
3871#line 2502 "vm_x64.dasc"
3872 //| // Otherwise set KBASE for Lua function below fast function.
3873 //| movzx RCd, byte [RC-3]
3874 //| neg RC
3875 //| mov LFUNC:KBASE, [BASE+RC*8-32]
3876 //| cleartp LFUNC:KBASE
3877 //| mov KBASE, LFUNC:KBASE->pc
3878 //| mov KBASE, [KBASE+PC2PROTO(k)]
3879 //| jmp <2
3880 //|
3881 //|9: // Rethrow error from the right C frame.
3882 //| mov CARG2d, RDd
3883 //| mov CARG1, L:RB
3884 //| neg CARG2d
3885 //| call extern lj_err_trace // (lua_State *L, int errcode)
3886 //|.endif
3887 //|
3888 //|//-----------------------------------------------------------------------
3889 //|//-- Math helper functions ----------------------------------------------
3890 //|//-----------------------------------------------------------------------
3891 //|
3892 //|// FP value rounding. Called by math.floor/math.ceil fast functions
3893 //|// and from JIT code. arg/ret is xmm0. xmm0-xmm3 and RD (eax) modified.
3894 //|.macro vm_round, name, mode, cond
3895 //|->name:
3896 //|->name .. _sse:
3897 //| sseconst_abs xmm2, RD
3898 //| sseconst_2p52 xmm3, RD
3899 //| movaps xmm1, xmm0
3900 //| andpd xmm1, xmm2 // |x|
3901 //| ucomisd xmm3, xmm1 // No truncation if 2^52 <= |x|.
3902 //| jbe >1
3903 //| andnpd xmm2, xmm0 // Isolate sign bit.
3904 //|.if mode == 2 // trunc(x)?
3905 //| movaps xmm0, xmm1
3906 //| addsd xmm1, xmm3 // (|x| + 2^52) - 2^52
3907 //| subsd xmm1, xmm3
3908 //| sseconst_1 xmm3, RD
3909 //| cmpsd xmm0, xmm1, 1 // |x| < result?
3910 //| andpd xmm0, xmm3
3911 //| subsd xmm1, xmm0 // If yes, subtract -1.
3912 //| orpd xmm1, xmm2 // Merge sign bit back in.
3913 //|.else
3914 //| addsd xmm1, xmm3 // (|x| + 2^52) - 2^52
3915 //| subsd xmm1, xmm3
3916 //| orpd xmm1, xmm2 // Merge sign bit back in.
3917 //| .if mode == 1 // ceil(x)?
3918 //| sseconst_m1 xmm2, RD // Must subtract -1 to preserve -0.
3919 //| cmpsd xmm0, xmm1, 6 // x > result?
3920 //| .else // floor(x)?
3921 //| sseconst_1 xmm2, RD
3922 //| cmpsd xmm0, xmm1, 1 // x < result?
3923 //| .endif
3924 //| andpd xmm0, xmm2
3925 //| subsd xmm1, xmm0 // If yes, subtract +-1.
3926 //|.endif
3927 //| movaps xmm0, xmm1
3928 //|1:
3929 //| ret
3930 //|.endmacro
3931 //|
3932 //| vm_round vm_floor, 0, 1
3933 //| vm_round vm_ceil, 1, JIT
3934 dasm_put(Dst, 8746, Dt7(->pc), PC2PROTO(k), (unsigned int)(U64x(7fffffff,ffffffff)), (unsigned int)((U64x(7fffffff,ffffffff))>>32), (unsigned int)(U64x(43300000,00000000)), (unsigned int)((U64x(43300000,00000000))>>32), (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32), (unsigned int)(U64x(7fffffff,ffffffff)), (unsigned int)((U64x(7fffffff,ffffffff))>>32));
3935#line 2564 "vm_x64.dasc"
3936 //| vm_round vm_trunc, 2, JIT
3937 //|
3938 //|// FP modulo x%y. Called by BC_MOD* and vm_arith.
3939 //|->vm_mod:
3940 //|// Args in xmm0/xmm1, return value in xmm0.
3941 //|// Caveat: xmm0-xmm5 and RC (eax) modified!
3942 //| movaps xmm5, xmm0
3943 dasm_put(Dst, 8894, (unsigned int)(U64x(43300000,00000000)), (unsigned int)((U64x(43300000,00000000))>>32), (unsigned int)(U64x(bff00000,00000000)), (unsigned int)((U64x(bff00000,00000000))>>32), (unsigned int)(U64x(7fffffff,ffffffff)), (unsigned int)((U64x(7fffffff,ffffffff))>>32), (unsigned int)(U64x(43300000,00000000)), (unsigned int)((U64x(43300000,00000000))>>32), (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32));
3944#line 2571 "vm_x64.dasc"
3945 //| divsd xmm0, xmm1
3946 //| sseconst_abs xmm2, RD
3947 //| sseconst_2p52 xmm3, RD
3948 //| movaps xmm4, xmm0
3949 //| andpd xmm4, xmm2 // |x/y|
3950 //| ucomisd xmm3, xmm4 // No truncation if 2^52 <= |x/y|.
3951 //| jbe >1
3952 //| andnpd xmm2, xmm0 // Isolate sign bit.
3953 //| addsd xmm4, xmm3 // (|x/y| + 2^52) - 2^52
3954 //| subsd xmm4, xmm3
3955 //| orpd xmm4, xmm2 // Merge sign bit back in.
3956 //| sseconst_1 xmm2, RD
3957 //| cmpsd xmm0, xmm4, 1 // x/y < result?
3958 //| andpd xmm0, xmm2
3959 //| subsd xmm4, xmm0 // If yes, subtract 1.0.
3960 //| movaps xmm0, xmm5
3961 //| mulsd xmm1, xmm4
3962 //| subsd xmm0, xmm1
3963 //| ret
3964 //|1:
3965 //| mulsd xmm1, xmm0
3966 //| movaps xmm0, xmm5
3967 //| subsd xmm0, xmm1
3968 //| ret
3969 //|
3970 //|// Args in xmm0/eax. Ret in xmm0. xmm0-xmm1 and eax modified.
3971 //|->vm_powi_sse:
3972 //| cmp eax, 1; jle >6 // i<=1?
3973 //| // Now 1 < (unsigned)i <= 0x80000000.
3974 //|1: // Handle leading zeros.
3975 //| test eax, 1; jnz >2
3976 //| mulsd xmm0, xmm0
3977 //| shr eax, 1
3978 //| jmp <1
3979 //|2:
3980 //| shr eax, 1; jz >5
3981 //| movaps xmm1, xmm0
3982 dasm_put(Dst, 9062, (unsigned int)(U64x(7fffffff,ffffffff)), (unsigned int)((U64x(7fffffff,ffffffff))>>32), (unsigned int)(U64x(43300000,00000000)), (unsigned int)((U64x(43300000,00000000))>>32), (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32));
3983#line 2608 "vm_x64.dasc"
3984 //|3: // Handle trailing bits.
3985 //| mulsd xmm0, xmm0
3986 //| shr eax, 1; jz >4
3987 //| jnc <3
3988 //| mulsd xmm1, xmm0
3989 //| jmp <3
3990 //|4:
3991 //| mulsd xmm0, xmm1
3992 //|5:
3993 //| ret
3994 //|6:
3995 //| je <5 // x^1 ==> x
3996 //| jb >7 // x^0 ==> 1
3997 //| neg eax
3998 //| call <1
3999 //| sseconst_1 xmm1, RD
4000 //| divsd xmm1, xmm0
4001 //| movaps xmm0, xmm1
4002 //| ret
4003 //|7:
4004 //| sseconst_1 xmm0, RD
4005 dasm_put(Dst, 9216, (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32), (unsigned int)(U64x(3ff00000,00000000)), (unsigned int)((U64x(3ff00000,00000000))>>32));
4006#line 2629 "vm_x64.dasc"
4007 //| ret
4008 //|
4009 //|//-----------------------------------------------------------------------
4010 //|//-- Miscellaneous functions --------------------------------------------
4011 //|//-----------------------------------------------------------------------
4012 //|
4013 //|// int lj_vm_cpuid(uint32_t f, uint32_t res[4])
4014 //|->vm_cpuid:
4015 //| mov eax, CARG1d
4016 //| .if X64WIN; push rsi; mov rsi, CARG2; .endif
4017 //| push rbx
4018 //| xor ecx, ecx
4019 //| cpuid
4020 //| mov [rsi], eax
4021 //| mov [rsi+4], ebx
4022 //| mov [rsi+8], ecx
4023 //| mov [rsi+12], edx
4024 //| pop rbx
4025 //| .if X64WIN; pop rsi; .endif
4026 //| ret
4027 //|
4028 //|//-----------------------------------------------------------------------
4029 //|//-- Assertions ---------------------------------------------------------
4030 //|//-----------------------------------------------------------------------
4031 //|
4032 //|->assert_bad_for_arg_type:
4033 dasm_put(Dst, 9296);
4034#line 2655 "vm_x64.dasc"
4035#ifdef LUA_USE_ASSERT
4036 //| int3
4037 dasm_put(Dst, 9328);
4038#line 2657 "vm_x64.dasc"
4039#endif
4040 //| int3
4041 //|
4042 //|//-----------------------------------------------------------------------
4043 //|//-- FFI helper functions -----------------------------------------------
4044 //|//-----------------------------------------------------------------------
4045 //|
4046 //|// Handler for callback functions. Callback slot number in ah/al.
4047 //|->vm_ffi_callback:
4048 //|.if FFI
4049 //|.type CTSTATE, CTState, PC
4050#define DtF(_V) (int)(ptrdiff_t)&(((CTState *)0)_V)
4051#line 2668 "vm_x64.dasc"
4052 //| saveregs_ // ebp/rbp already saved. ebp now holds global_State *.
4053 //| lea DISPATCH, [ebp+GG_G2DISP]
4054 //| mov CTSTATE, GL:ebp->ctype_state
4055 //| movzx eax, ax
4056 //| mov CTSTATE->cb.slot, eax
4057 //| mov CTSTATE->cb.gpr[0], CARG1
4058 //| mov CTSTATE->cb.gpr[1], CARG2
4059 //| mov CTSTATE->cb.gpr[2], CARG3
4060 //| mov CTSTATE->cb.gpr[3], CARG4
4061 //| movsd qword CTSTATE->cb.fpr[0], xmm0
4062 //| movsd qword CTSTATE->cb.fpr[1], xmm1
4063 //| movsd qword CTSTATE->cb.fpr[2], xmm2
4064 //| movsd qword CTSTATE->cb.fpr[3], xmm3
4065 //|.if X64WIN
4066 //| lea rax, [rsp+CFRAME_SIZE+4*8]
4067 //|.else
4068 //| lea rax, [rsp+CFRAME_SIZE]
4069 //| mov CTSTATE->cb.gpr[4], CARG5
4070 //| mov CTSTATE->cb.gpr[5], CARG6
4071 //| movsd qword CTSTATE->cb.fpr[4], xmm4
4072 //| movsd qword CTSTATE->cb.fpr[5], xmm5
4073 //| movsd qword CTSTATE->cb.fpr[6], xmm6
4074 //| movsd qword CTSTATE->cb.fpr[7], xmm7
4075 //|.endif
4076 //| mov CTSTATE->cb.stack, rax
4077 dasm_put(Dst, 9330, GG_G2DISP, Dt2(->ctype_state), DtF(->cb.slot), DtF(->cb.gpr[0]), DtF(->cb.gpr[1]), DtF(->cb.gpr[2]), DtF(->cb.gpr[3]), DtF(->cb.fpr[0]), DtF(->cb.fpr[1]), DtF(->cb.fpr[2]), DtF(->cb.fpr[3]), CFRAME_SIZE, DtF(->cb.gpr[4]), DtF(->cb.gpr[5]), DtF(->cb.fpr[4]), DtF(->cb.fpr[5]), DtF(->cb.fpr[6]), DtF(->cb.fpr[7]));
4078#line 2693 "vm_x64.dasc"
4079 //| mov CARG2, rsp
4080 //| mov SAVE_PC, CTSTATE // Any value outside of bytecode is ok.
4081 //| mov CARG1, CTSTATE
4082 //| call extern lj_ccallback_enter // (CTState *cts, void *cf)
4083 //| // lua_State * returned in eax (RD).
4084 //| set_vmstate INTERP
4085 //| mov BASE, L:RD->base
4086 //| mov RD, L:RD->top
4087 //| sub RD, BASE
4088 //| mov LFUNC:RB, [BASE-16]
4089 //| cleartp LFUNC:RB
4090 //| shr RD, 3
4091 //| add RD, 1
4092 //| ins_callt
4093 //|.endif
4094 //|
4095 //|->cont_ffi_callback: // Return from FFI callback.
4096 //|.if FFI
4097 //| mov L:RA, SAVE_L
4098 //| mov CTSTATE, [DISPATCH+DISPATCH_GL(ctype_state)]
4099 //| mov aword CTSTATE->L, L:RA
4100 //| mov L:RA->base, BASE
4101 //| mov L:RA->top, RB
4102 //| mov CARG1, CTSTATE
4103 //| mov CARG2, RC
4104 //| call extern lj_ccallback_leave // (CTState *cts, TValue *o)
4105 //| mov rax, CTSTATE->cb.gpr[0]
4106 //| movsd xmm0, qword CTSTATE->cb.fpr[0]
4107 //| jmp ->vm_leave_unw
4108 //|.endif
4109 //|
4110 //|->vm_ffi_call: // Call C function via FFI.
4111 //| // Caveat: needs special frame unwinding, see below.
4112 //|.if FFI
4113 //| .type CCSTATE, CCallState, rbx
4114#define Dt10(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
4115#line 2728 "vm_x64.dasc"
4116 //| push rbp; mov rbp, rsp; push rbx; mov CCSTATE, CARG1
4117 //|
4118 //| // Readjust stack.
4119 //| mov eax, CCSTATE->spadj
4120 //| sub rsp, rax
4121 //|
4122 //| // Copy stack slots.
4123 //| movzx ecx, byte CCSTATE->nsp
4124 //| sub ecx, 1
4125 //| js >2
4126 //|1:
4127 //| mov rax, [CCSTATE+rcx*8+offsetof(CCallState, stack)]
4128 dasm_put(Dst, 9436, DtF(->cb.stack), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top), Dt7(->pc), DISPATCH_GL(ctype_state), DtF(->L), Dt1(->base), Dt1(->top), DtF(->cb.gpr[0]), DtF(->cb.fpr[0]), Dt10(->spadj), Dt10(->nsp));
4129#line 2740 "vm_x64.dasc"
4130 //| mov [rsp+rcx*8+CCALL_SPS_EXTRA*8], rax
4131 //| sub ecx, 1
4132 //| jns <1
4133 //|2:
4134 //|
4135 //| movzx eax, byte CCSTATE->nfpr
4136 //| mov CARG1, CCSTATE->gpr[0]
4137 //| mov CARG2, CCSTATE->gpr[1]
4138 //| mov CARG3, CCSTATE->gpr[2]
4139 //| mov CARG4, CCSTATE->gpr[3]
4140 //|.if not X64WIN
4141 //| mov CARG5, CCSTATE->gpr[4]
4142 //| mov CARG6, CCSTATE->gpr[5]
4143 //|.endif
4144 //| test eax, eax; jz >5
4145 //| movaps xmm0, CCSTATE->fpr[0]
4146 //| movaps xmm1, CCSTATE->fpr[1]
4147 //| movaps xmm2, CCSTATE->fpr[2]
4148 //| movaps xmm3, CCSTATE->fpr[3]
4149 //|.if not X64WIN
4150 //| cmp eax, 4; jbe >5
4151 //| movaps xmm4, CCSTATE->fpr[4]
4152 dasm_put(Dst, 9595, offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, Dt10(->nfpr), Dt10(->gpr[0]), Dt10(->gpr[1]), Dt10(->gpr[2]), Dt10(->gpr[3]), Dt10(->gpr[4]), Dt10(->gpr[5]), Dt10(->fpr[0]), Dt10(->fpr[1]), Dt10(->fpr[2]), Dt10(->fpr[3]));
4153#line 2762 "vm_x64.dasc"
4154 //| movaps xmm5, CCSTATE->fpr[5]
4155 //| movaps xmm6, CCSTATE->fpr[6]
4156 //| movaps xmm7, CCSTATE->fpr[7]
4157 //|.endif
4158 //|5:
4159 //|
4160 //| call aword CCSTATE->func
4161 //|
4162 //| mov CCSTATE->gpr[0], rax
4163 //| movaps CCSTATE->fpr[0], xmm0
4164 //|.if not X64WIN
4165 //| mov CCSTATE->gpr[1], rdx
4166 //| movaps CCSTATE->fpr[1], xmm1
4167 //|.endif
4168 //|
4169 //| mov rbx, [rbp-8]; leave; ret
4170 //|.endif
4171 //|// Note: vm_ffi_call must be the last function in this object file!
4172 //|
4173 //|//-----------------------------------------------------------------------
4174 dasm_put(Dst, 9676, Dt10(->fpr[4]), Dt10(->fpr[5]), Dt10(->fpr[6]), Dt10(->fpr[7]), Dt10(->func), Dt10(->gpr[0]), Dt10(->fpr[0]), Dt10(->gpr[1]), Dt10(->fpr[1]));
4175#line 2782 "vm_x64.dasc"
4176}
4177
4178/* Generate the code for a single instruction. */
4179static void build_ins(BuildCtx *ctx, BCOp op, int defop)
4180{
4181 int vk = 0;
4182 //|// Note: aligning all instructions does not pay off.
4183 //|=>defop:
4184 dasm_put(Dst, 9722, defop);
4185#line 2790 "vm_x64.dasc"
4186
4187 switch (op) {
4188
4189 /* -- Comparison ops ---------------------------------------------------- */
4190
4191 /* Remember: all ops branch for a true comparison, fall through otherwise. */
4192
4193 //|.macro jmp_comp, lt, ge, le, gt, target
4194 //||switch (op) {
4195 //||case BC_ISLT:
4196 //| lt target
4197 //||break;
4198 //||case BC_ISGE:
4199 //| ge target
4200 //||break;
4201 //||case BC_ISLE:
4202 //| le target
4203 //||break;
4204 //||case BC_ISGT:
4205 //| gt target
4206 //||break;
4207 //||default: break; /* Shut up GCC. */
4208 //||}
4209 //|.endmacro
4210
4211 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
4212 //| // RA = src1, RD = src2, JMP with RD = target
4213 //| ins_AD
4214 //| mov ITYPE, [BASE+RA*8]
4215 //| mov RB, [BASE+RD*8]
4216 //| mov RA, ITYPE
4217 //| mov RD, RB
4218 //| sar ITYPE, 47
4219 //| sar RB, 47
4220 //|.if DUALNUM
4221 //| cmp ITYPEd, LJ_TISNUM; jne >7
4222 //| cmp RBd, LJ_TISNUM; jne >8
4223 //| add PC, 4
4224 //| cmp RAd, RDd
4225 //| jmp_comp jge, jl, jg, jle, >9
4226 //|6:
4227 //| movzx RDd, PC_RD
4228 //| branchPC RD
4229 //|9:
4230 //| ins_next
4231 //|
4232 //|7: // RA is not an integer.
4233 //| ja ->vmeta_comp
4234 //| // RA is a number.
4235 //| cmp RBd, LJ_TISNUM; jb >1; jne ->vmeta_comp
4236 //| // RA is a number, RD is an integer.
4237 //| cvtsi2sd xmm0, RDd
4238 //| jmp >2
4239 //|
4240 //|8: // RA is an integer, RD is not an integer.
4241 //| ja ->vmeta_comp
4242 //| // RA is an integer, RD is a number.
4243 //| cvtsi2sd xmm1, RAd
4244 //| movd xmm0, RD
4245 //| jmp >3
4246 //|.else
4247 //| cmp ITYPEd, LJ_TISNUM; jae ->vmeta_comp
4248 //| cmp RBd, LJ_TISNUM; jae ->vmeta_comp
4249 //|.endif
4250 //|1:
4251 //| movd xmm0, RD
4252 //|2:
4253 //| movd xmm1, RA
4254 //|3:
4255 //| add PC, 4
4256 //| ucomisd xmm0, xmm1
4257 //| // Unordered: all of ZF CF PF set, ordered: PF clear.
4258 //| // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't.
4259 //|.if DUALNUM
4260 //| jmp_comp jbe, ja, jb, jae, <9
4261 //| jmp <6
4262 //|.else
4263 //| jmp_comp jbe, ja, jb, jae, >1
4264 dasm_put(Dst, 9724, LJ_TISNUM, LJ_TISNUM);
4265 switch (op) {
4266 case BC_ISLT:
4267 dasm_put(Dst, 9790);
4268 break;
4269 case BC_ISGE:
4270 dasm_put(Dst, 9795);
4271 break;
4272 case BC_ISLE:
4273 dasm_put(Dst, 2922);
4274 break;
4275 case BC_ISGT:
4276 dasm_put(Dst, 9800);
4277 break;
4278 default: break; /* Shut up GCC. */
4279 }
4280#line 2868 "vm_x64.dasc"
4281 //| movzx RDd, PC_RD
4282 //| branchPC RD
4283 //|1:
4284 //| ins_next
4285 //|.endif
4286 dasm_put(Dst, 9805, -BCBIAS_J*4);
4287#line 2873 "vm_x64.dasc"
4288 break;
4289
4290 case BC_ISEQV: case BC_ISNEV:
4291 vk = op == BC_ISEQV;
4292 //| ins_AD // RA = src1, RD = src2, JMP with RD = target
4293 //| mov RB, [BASE+RD*8]
4294 //| mov ITYPE, [BASE+RA*8]
4295 //| add PC, 4
4296 //| mov RD, RB
4297 //| mov RA, ITYPE
4298 //| sar RB, 47
4299 //| sar ITYPE, 47
4300 //|.if DUALNUM
4301 //| cmp RBd, LJ_TISNUM; jne >7
4302 //| cmp ITYPEd, LJ_TISNUM; jne >8
4303 //| cmp RDd, RAd
4304 dasm_put(Dst, 9840);
4305#line 2889 "vm_x64.dasc"
4306 if (vk) {
4307 //| jne >9
4308 } else {
4309 //| je >9
4310 }
4311 //| movzx RDd, PC_RD
4312 //| branchPC RD
4313 //|9:
4314 //| ins_next
4315 //|
4316 //|7: // RD is not an integer.
4317 //| ja >5
4318 //| // RD is a number.
4319 //| movd xmm1, RD
4320 //| cmp ITYPEd, LJ_TISNUM; jb >1; jne >5
4321 //| // RD is a number, RA is an integer.
4322 //| cvtsi2sd xmm0, RAd
4323 //| jmp >2
4324 //|
4325 //|8: // RD is an integer, RA is not an integer.
4326 //| ja >5
4327 //| // RD is an integer, RA is a number.
4328 //| cvtsi2sd xmm1, RDd
4329 //| jmp >1
4330 //|
4331 //|.else
4332 //| cmp RBd, LJ_TISNUM; jae >5
4333 //| cmp ITYPEd, LJ_TISNUM; jae >5
4334 //| movd xmm1, RD
4335 //|.endif
4336 //|1:
4337 //| movd xmm0, RA
4338 //|2:
4339 //| ucomisd xmm0, xmm1
4340 //|4:
4341 dasm_put(Dst, 9869, LJ_TISNUM, LJ_TISNUM);
4342#line 2924 "vm_x64.dasc"
4343 iseqne_fp:
4344 if (vk) {
4345 //| jp >2 // Unordered means not equal.
4346 //| jne >2
4347 dasm_put(Dst, 9907);
4348#line 2928 "vm_x64.dasc"
4349 } else {
4350 //| jp >2 // Unordered means not equal.
4351 //| je >1
4352 dasm_put(Dst, 9916);
4353#line 2931 "vm_x64.dasc"
4354 }
4355 iseqne_end:
4356 if (vk) {
4357 //|1: // EQ: Branch to the target.
4358 //| movzx RDd, PC_RD
4359 //| branchPC RD
4360 //|2: // NE: Fallthrough to next instruction.
4361 //|.if not FFI
4362 //|3:
4363 //|.endif
4364 dasm_put(Dst, 9925, -BCBIAS_J*4);
4365#line 2941 "vm_x64.dasc"
4366 } else {
4367 //|.if not FFI
4368 //|3:
4369 //|.endif
4370 //|2: // NE: Branch to the target.
4371 //| movzx RDd, PC_RD
4372 //| branchPC RD
4373 //|1: // EQ: Fallthrough to next instruction.
4374 dasm_put(Dst, 9941, -BCBIAS_J*4);
4375#line 2949 "vm_x64.dasc"
4376 }
4377 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
4378 op == BC_ISEQN || op == BC_ISNEN)) {
4379 //| jmp <9
4380 dasm_put(Dst, 9957);
4381#line 2953 "vm_x64.dasc"
4382 } else {
4383 //| ins_next
4384 dasm_put(Dst, 9818);
4385#line 2955 "vm_x64.dasc"
4386 }
4387 //|
4388 if (op == BC_ISEQV || op == BC_ISNEV) {
4389 //|5: // Either or both types are not numbers.
4390 //|.if FFI
4391 //| cmp RBd, LJ_TCDATA; je ->vmeta_equal_cd
4392 //| cmp ITYPEd, LJ_TCDATA; je ->vmeta_equal_cd
4393 //|.endif
4394 //| cmp RA, RD
4395 //| je <1 // Same GCobjs or pvalues?
4396 //| cmp RBd, ITYPEd
4397 //| jne <2 // Not the same type?
4398 //| cmp RBd, LJ_TISTABUD
4399 //| ja <2 // Different objects and not table/ud?
4400 //|
4401 //| // Different tables or userdatas. Need to check __eq metamethod.
4402 //| // Field metatable must be at same offset for GCtab and GCudata!
4403 //| cleartp TAB:RA
4404 //| mov TAB:RB, TAB:RA->metatable
4405 //| test TAB:RB, TAB:RB
4406 //| jz <2 // No metatable?
4407 //| test byte TAB:RB->nomm, 1<<MM_eq
4408 //| jnz <2 // Or 'no __eq' flag set?
4409 dasm_put(Dst, 9962, LJ_TCDATA, LJ_TCDATA, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
4410 dasm_put(Dst, 10030);
4411#line 2978 "vm_x64.dasc"
4412 if (vk) {
4413 //| xor RBd, RBd // ne = 0
4414 dasm_put(Dst, 10035);
4415#line 2980 "vm_x64.dasc"
4416 } else {
4417 //| mov RBd, 1 // ne = 1
4418 dasm_put(Dst, 10039);
4419#line 2982 "vm_x64.dasc"
4420 }
4421 //| jmp ->vmeta_equal // Handle __eq metamethod.
4422 dasm_put(Dst, 10045);
4423#line 2984 "vm_x64.dasc"
4424 } else {
4425 //|.if FFI
4426 //|3:
4427 //| cmp ITYPEd, LJ_TCDATA
4428 dasm_put(Dst, 10050, LJ_TCDATA);
4429#line 2988 "vm_x64.dasc"
4430 if (LJ_DUALNUM && vk) {
4431 //| jne <9
4432 dasm_put(Dst, 10058);
4433#line 2990 "vm_x64.dasc"
4434 } else {
4435 //| jne <2
4436 dasm_put(Dst, 10030);
4437#line 2992 "vm_x64.dasc"
4438 }
4439 //| jmp ->vmeta_equal_cd
4440 //|.endif
4441 dasm_put(Dst, 10063);
4442#line 2995 "vm_x64.dasc"
4443 }
4444 break;
4445 case BC_ISEQS: case BC_ISNES:
4446 vk = op == BC_ISEQS;
4447 //| ins_AND // RA = src, RD = str const, JMP with RD = target
4448 //| mov RB, [BASE+RA*8]
4449 //| add PC, 4
4450 //| checkstr RB, >3
4451 //| cmp RB, [KBASE+RD*8]
4452 dasm_put(Dst, 10068, LJ_TSTR);
4453#line 3004 "vm_x64.dasc"
4454 iseqne_test:
4455 if (vk) {
4456 //| jne >2
4457 dasm_put(Dst, 9911);
4458#line 3007 "vm_x64.dasc"
4459 } else {
4460 //| je >1
4461 dasm_put(Dst, 4083);
4462#line 3009 "vm_x64.dasc"
4463 }
4464 goto iseqne_end;
4465 case BC_ISEQN: case BC_ISNEN:
4466 vk = op == BC_ISEQN;
4467 //| ins_AD // RA = src, RD = num const, JMP with RD = target
4468 //| mov RB, [BASE+RA*8]
4469 //| add PC, 4
4470 //|.if DUALNUM
4471 //| checkint RB, >7
4472 //| mov RD, [KBASE+RD*8]
4473 //| checkint RD, >8
4474 //| cmp RBd, RDd
4475 dasm_put(Dst, 10112);
4476#line 3021 "vm_x64.dasc"
4477 if (vk) {
4478 //| jne >9
4479 } else {
4480 //| je >9
4481 }
4482 //| movzx RDd, PC_RD
4483 //| branchPC RD
4484 //|9:
4485 //| ins_next
4486 //|
4487 //|7: // RA is not an integer.
4488 //| ja >3
4489 //| // RA is a number.
4490 //| mov RD, [KBASE+RD*8]
4491 //| checkint RD, >1
4492 //| // RA is a number, RD is an integer.
4493 //| cvtsi2sd xmm0, RDd
4494 //| jmp >2
4495 //|
4496 //|8: // RA is an integer, RD is a number.
4497 //| cvtsi2sd xmm0, RBd
4498 //| movd xmm1, RD
4499 //| ucomisd xmm0, xmm1
4500 //| jmp >4
4501 //|1:
4502 //| movd xmm0, RD
4503 //|.else
4504 //| checknum RB, >3
4505 //|1:
4506 //| movsd xmm0, qword [KBASE+RD*8]
4507 //|.endif
4508 //|2:
4509 //| ucomisd xmm0, qword [BASE+RA*8]
4510 //|4:
4511 dasm_put(Dst, 10121, LJ_TISNUM);
4512#line 3055 "vm_x64.dasc"
4513 goto iseqne_fp;
4514 case BC_ISEQP: case BC_ISNEP:
4515 vk = op == BC_ISEQP;
4516 //| ins_AND // RA = src, RD = primitive type (~), JMP with RD = target
4517 //| mov RB, [BASE+RA*8]
4518 //| sar RB, 47
4519 //| add PC, 4
4520 //| cmp RBd, RDd
4521 dasm_put(Dst, 10158);
4522#line 3063 "vm_x64.dasc"
4523 if (!LJ_HASFFI) goto iseqne_test;
4524 if (vk) {
4525 //| jne >3
4526 //| movzx RDd, PC_RD
4527 //| branchPC RD
4528 //|2:
4529 //| ins_next
4530 //|3:
4531 //| cmp RBd, LJ_TCDATA; jne <2
4532 //| jmp ->vmeta_equal_cd
4533 dasm_put(Dst, 10178, -BCBIAS_J*4, LJ_TCDATA);
4534#line 3073 "vm_x64.dasc"
4535 } else {
4536 //| je >2
4537 //| cmp RBd, LJ_TCDATA; je ->vmeta_equal_cd
4538 //| movzx RDd, PC_RD
4539 //| branchPC RD
4540 //|2:
4541 //| ins_next
4542 dasm_put(Dst, 10231, LJ_TCDATA, -BCBIAS_J*4);
4543#line 3080 "vm_x64.dasc"
4544 }
4545 break;
4546
4547 /* -- Unary test and copy ops ------------------------------------------- */
4548
4549 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
4550 //| ins_AD // RA = dst or unused, RD = src, JMP with RD = target
4551 //| mov ITYPE, [BASE+RD*8]
4552 //| add PC, 4
4553 dasm_put(Dst, 10278);
4554#line 3089 "vm_x64.dasc"
4555 if (op == BC_ISTC || op == BC_ISFC) {
4556 //| mov RB, ITYPE
4557 dasm_put(Dst, 10287);
4558#line 3091 "vm_x64.dasc"
4559 }
4560 //| sar ITYPE, 47
4561 //| cmp ITYPEd, LJ_TISTRUECOND
4562 dasm_put(Dst, 4479, LJ_TISTRUECOND);
4563#line 3094 "vm_x64.dasc"
4564 if (op == BC_IST || op == BC_ISTC) {
4565 //| jae >1
4566 dasm_put(Dst, 9800);
4567#line 3096 "vm_x64.dasc"
4568 } else {
4569 //| jb >1
4570 dasm_put(Dst, 2922);
4571#line 3098 "vm_x64.dasc"
4572 }
4573 if (op == BC_ISTC || op == BC_ISFC) {
4574 //| mov [BASE+RA*8], RB
4575 dasm_put(Dst, 10291);
4576#line 3101 "vm_x64.dasc"
4577 }
4578 //| movzx RDd, PC_RD
4579 //| branchPC RD
4580 //|1: // Fallthrough to the next instruction.
4581 //| ins_next
4582 dasm_put(Dst, 9805, -BCBIAS_J*4);
4583#line 3106 "vm_x64.dasc"
4584 break;
4585
4586 case BC_ISTYPE:
4587 //| ins_AD // RA = src, RD = -type
4588 //| mov RB, [BASE+RA*8]
4589 //| sar RB, 47
4590 //| add RBd, RDd
4591 //| jne ->vmeta_istype
4592 //| ins_next
4593 dasm_put(Dst, 10296);
4594#line 3115 "vm_x64.dasc"
4595 break;
4596 case BC_ISNUM:
4597 //| ins_AD // RA = src, RD = -(TISNUM-1)
4598 //| checknumtp [BASE+RA*8], ->vmeta_istype
4599 //| ins_next
4600 dasm_put(Dst, 10333, LJ_TISNUM);
4601#line 3120 "vm_x64.dasc"
4602 break;
4603
4604 /* -- Unary ops --------------------------------------------------------- */
4605
4606 case BC_MOV:
4607 //| ins_AD // RA = dst, RD = src
4608 //| mov RB, [BASE+RD*8]
4609 //| mov [BASE+RA*8], RB
4610 //| ins_next_
4611 dasm_put(Dst, 10373);
4612#line 3129 "vm_x64.dasc"
4613 break;
4614 case BC_NOT:
4615 //| ins_AD // RA = dst, RD = src
4616 //| mov RB, [BASE+RD*8]
4617 //| sar RB, 47
4618 //| mov RCd, 2
4619 //| cmp RB, LJ_TISTRUECOND
4620 //| sbb RCd, 0
4621 //| shl RC, 47
4622 //| not RC
4623 //| mov [BASE+RA*8], RC
4624 //| ins_next
4625 dasm_put(Dst, 10403, LJ_TISTRUECOND);
4626#line 3141 "vm_x64.dasc"
4627 break;
4628 case BC_UNM:
4629 //| ins_AD // RA = dst, RD = src
4630 //| mov RB, [BASE+RD*8]
4631 //|.if DUALNUM
4632 //| checkint RB, >5
4633 //| neg RBd
4634 //| jo >4
4635 //| setint RB
4636 //|9:
4637 //| mov [BASE+RA*8], RB
4638 //| ins_next
4639 //|4:
4640 //| mov64 RB, U64x(41e00000,00000000) // 2^31.
4641 //| jmp <9
4642 //|5:
4643 //| ja ->vmeta_unm
4644 //|.else
4645 //| checknum RB, ->vmeta_unm
4646 //|.endif
4647 //| mov64 RD, U64x(80000000,00000000)
4648 //| xor RB, RD
4649 //|.if DUALNUM
4650 //| jmp <9
4651 //|.else
4652 //| mov [BASE+RA*8], RB
4653 //| ins_next
4654 //|.endif
4655 dasm_put(Dst, 10459, LJ_TISNUM, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
4656#line 3169 "vm_x64.dasc"
4657 break;
4658 case BC_LEN:
4659 //| ins_AD // RA = dst, RD = src
4660 //| mov RD, [BASE+RD*8]
4661 //| checkstr RD, >2
4662 //|.if DUALNUM
4663 //| mov RDd, dword STR:RD->len
4664 //|1:
4665 //| setint RD
4666 //| mov [BASE+RA*8], RD
4667 //|.else
4668 //| xorps xmm0, xmm0
4669 //| cvtsi2sd xmm0, dword STR:RD->len
4670 //|1:
4671 //| movsd qword [BASE+RA*8], xmm0
4672 //|.endif
4673 //| ins_next
4674 //|2:
4675 //| cmp ITYPEd, LJ_TTAB; jne ->vmeta_len
4676 //| mov TAB:CARG1, TAB:RD
4677 dasm_put(Dst, 10514, LJ_TSTR, Dt5(->len), LJ_TTAB);
4678#line 3189 "vm_x64.dasc"
4679#if LJ_52
4680 //| mov TAB:RB, TAB:RD->metatable
4681 //| cmp TAB:RB, 0
4682 //| jnz >9
4683 //|3:
4684 dasm_put(Dst, 10596, Dt6(->metatable));
4685#line 3194 "vm_x64.dasc"
4686#endif
4687 //|->BC_LEN_Z:
4688 //| mov RB, BASE // Save BASE.
4689 //| call extern lj_tab_len // (GCtab *t)
4690 //| // Length of table returned in eax (RD).
4691 //|.if DUALNUM
4692 //| // Nothing to do.
4693 //|.else
4694 //| cvtsi2sd xmm0, RDd
4695 //|.endif
4696 //| mov BASE, RB // Restore BASE.
4697 //| movzx RAd, PC_RA
4698 //| jmp <1
4699 dasm_put(Dst, 10612);
4700#line 3207 "vm_x64.dasc"
4701#if LJ_52
4702 //|9: // Check for __len.
4703 //| test byte TAB:RB->nomm, 1<<MM_len
4704 //| jnz <3
4705 //| jmp ->vmeta_len // 'no __len' flag NOT set: check.
4706 dasm_put(Dst, 10640, Dt6(->nomm), 1<<MM_len);
4707#line 3212 "vm_x64.dasc"
4708#endif
4709 break;
4710
4711 /* -- Binary ops -------------------------------------------------------- */
4712
4713 //|.macro ins_arithpre, sseins, ssereg
4714 //| ins_ABC
4715 //||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4716 //||switch (vk) {
4717 //||case 0:
4718 //| checknumtp [BASE+RB*8], ->vmeta_arith_vn
4719 //| .if DUALNUM
4720 //| checknumtp [KBASE+RC*8], ->vmeta_arith_vn
4721 //| .endif
4722 //| movsd xmm0, qword [BASE+RB*8]
4723 //| sseins ssereg, qword [KBASE+RC*8]
4724 //|| break;
4725 //||case 1:
4726 //| checknumtp [BASE+RB*8], ->vmeta_arith_nv
4727 //| .if DUALNUM
4728 //| checknumtp [KBASE+RC*8], ->vmeta_arith_nv
4729 //| .endif
4730 //| movsd xmm0, qword [KBASE+RC*8]
4731 //| sseins ssereg, qword [BASE+RB*8]
4732 //|| break;
4733 //||default:
4734 //| checknumtp [BASE+RB*8], ->vmeta_arith_vv
4735 //| checknumtp [BASE+RC*8], ->vmeta_arith_vv
4736 //| movsd xmm0, qword [BASE+RB*8]
4737 //| sseins ssereg, qword [BASE+RC*8]
4738 //|| break;
4739 //||}
4740 //|.endmacro
4741 //|
4742 //|.macro ins_arithdn, intins
4743 //| ins_ABC
4744 //||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4745 //||switch (vk) {
4746 //||case 0:
4747 //| mov RB, [BASE+RB*8]
4748 //| mov RC, [KBASE+RC*8]
4749 //| checkint RB, ->vmeta_arith_vno
4750 //| checkint RC, ->vmeta_arith_vno
4751 //| intins RBd, RCd; jo ->vmeta_arith_vno
4752 //|| break;
4753 //||case 1:
4754 //| mov RB, [BASE+RB*8]
4755 //| mov RC, [KBASE+RC*8]
4756 //| checkint RB, ->vmeta_arith_nvo
4757 //| checkint RC, ->vmeta_arith_nvo
4758 //| intins RCd, RBd; jo ->vmeta_arith_nvo
4759 //|| break;
4760 //||default:
4761 //| mov RB, [BASE+RB*8]
4762 //| mov RC, [BASE+RC*8]
4763 //| checkint RB, ->vmeta_arith_vvo
4764 //| checkint RC, ->vmeta_arith_vvo
4765 //| intins RBd, RCd; jo ->vmeta_arith_vvo
4766 //|| break;
4767 //||}
4768 //||if (vk == 1) {
4769 //| setint RC
4770 //| mov [BASE+RA*8], RC
4771 //||} else {
4772 //| setint RB
4773 //| mov [BASE+RA*8], RB
4774 //||}
4775 //| ins_next
4776 //|.endmacro
4777 //|
4778 //|.macro ins_arithpost
4779 //| movsd qword [BASE+RA*8], xmm0
4780 //|.endmacro
4781 //|
4782 //|.macro ins_arith, sseins
4783 //| ins_arithpre sseins, xmm0
4784 //| ins_arithpost
4785 //| ins_next
4786 //|.endmacro
4787 //|
4788 //|.macro ins_arith, intins, sseins
4789 //|.if DUALNUM
4790 //| ins_arithdn intins
4791 //|.else
4792 //| ins_arith, sseins
4793 //|.endif
4794 //|.endmacro
4795
4796 //| // RA = dst, RB = src1 or num const, RC = src2 or num const
4797 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
4798 //| ins_arith add, addsd
4799 dasm_put(Dst, 10656);
4800 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4801 switch (vk) {
4802 case 0:
4803 dasm_put(Dst, 10664, LJ_TISNUM);
4804 break;
4805 case 1:
4806 dasm_put(Dst, 10698, LJ_TISNUM);
4807 break;
4808 default:
4809 dasm_put(Dst, 10732, LJ_TISNUM, LJ_TISNUM);
4810 break;
4811 }
4812 dasm_put(Dst, 10783);
4813#line 3303 "vm_x64.dasc"
4814 break;
4815 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
4816 //| ins_arith sub, subsd
4817 dasm_put(Dst, 10656);
4818 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4819 switch (vk) {
4820 case 0:
4821 dasm_put(Dst, 10811, LJ_TISNUM);
4822 break;
4823 case 1:
4824 dasm_put(Dst, 10845, LJ_TISNUM);
4825 break;
4826 default:
4827 dasm_put(Dst, 10879, LJ_TISNUM, LJ_TISNUM);
4828 break;
4829 }
4830 dasm_put(Dst, 10783);
4831#line 3306 "vm_x64.dasc"
4832 break;
4833 case BC_MULVN: case BC_MULNV: case BC_MULVV:
4834 //| ins_arith imul, mulsd
4835 dasm_put(Dst, 10656);
4836 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4837 switch (vk) {
4838 case 0:
4839 dasm_put(Dst, 10930, LJ_TISNUM);
4840 break;
4841 case 1:
4842 dasm_put(Dst, 10964, LJ_TISNUM);
4843 break;
4844 default:
4845 dasm_put(Dst, 10998, LJ_TISNUM, LJ_TISNUM);
4846 break;
4847 }
4848 dasm_put(Dst, 10783);
4849#line 3309 "vm_x64.dasc"
4850 break;
4851 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
4852 //| ins_arith divsd
4853 dasm_put(Dst, 10656);
4854 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4855 switch (vk) {
4856 case 0:
4857 dasm_put(Dst, 11049, LJ_TISNUM);
4858 break;
4859 case 1:
4860 dasm_put(Dst, 11083, LJ_TISNUM);
4861 break;
4862 default:
4863 dasm_put(Dst, 11117, LJ_TISNUM, LJ_TISNUM);
4864 break;
4865 }
4866 dasm_put(Dst, 10783);
4867#line 3312 "vm_x64.dasc"
4868 break;
4869 case BC_MODVN:
4870 //| ins_arithpre movsd, xmm1
4871 dasm_put(Dst, 10656);
4872 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4873 switch (vk) {
4874 case 0:
4875 dasm_put(Dst, 11168, LJ_TISNUM);
4876 break;
4877 case 1:
4878 dasm_put(Dst, 11202, LJ_TISNUM);
4879 break;
4880 default:
4881 dasm_put(Dst, 11236, LJ_TISNUM, LJ_TISNUM);
4882 break;
4883 }
4884#line 3315 "vm_x64.dasc"
4885 //|->BC_MODVN_Z:
4886 //| call ->vm_mod
4887 //| ins_arithpost
4888 //| ins_next
4889 dasm_put(Dst, 11287);
4890#line 3319 "vm_x64.dasc"
4891 break;
4892 case BC_MODNV: case BC_MODVV:
4893 //| ins_arithpre movsd, xmm1
4894 dasm_put(Dst, 10656);
4895 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4896 switch (vk) {
4897 case 0:
4898 dasm_put(Dst, 11168, LJ_TISNUM);
4899 break;
4900 case 1:
4901 dasm_put(Dst, 11202, LJ_TISNUM);
4902 break;
4903 default:
4904 dasm_put(Dst, 11236, LJ_TISNUM, LJ_TISNUM);
4905 break;
4906 }
4907#line 3322 "vm_x64.dasc"
4908 //| jmp ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway.
4909 dasm_put(Dst, 11320);
4910#line 3323 "vm_x64.dasc"
4911 break;
4912 case BC_POW:
4913 //| ins_arithpre movsd, xmm1
4914 dasm_put(Dst, 10656);
4915 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
4916 switch (vk) {
4917 case 0:
4918 dasm_put(Dst, 11168, LJ_TISNUM);
4919 break;
4920 case 1:
4921 dasm_put(Dst, 11202, LJ_TISNUM);
4922 break;
4923 default:
4924 dasm_put(Dst, 11236, LJ_TISNUM, LJ_TISNUM);
4925 break;
4926 }
4927#line 3326 "vm_x64.dasc"
4928 //| mov RB, BASE
4929 //| call extern pow
4930 //| movzx RAd, PC_RA
4931 //| mov BASE, RB
4932 //| ins_arithpost
4933 //| ins_next
4934 dasm_put(Dst, 11325);
4935#line 3332 "vm_x64.dasc"
4936 break;
4937
4938 case BC_CAT:
4939 //| ins_ABC // RA = dst, RB = src_start, RC = src_end
4940 //| mov L:CARG1, SAVE_L
4941 //| mov L:CARG1->base, BASE
4942 //| lea CARG2, [BASE+RC*8]
4943 //| mov CARG3d, RCd
4944 //| sub CARG3d, RBd
4945 //|->BC_CAT_Z:
4946 //| mov L:RB, L:CARG1
4947 //| mov SAVE_PC, PC
4948 //| call extern lj_meta_cat // (lua_State *L, TValue *top, int left)
4949 //| // NULL (finished) or TValue * (metamethod) returned in eax (RC).
4950 //| mov BASE, L:RB->base
4951 //| test RC, RC
4952 //| jnz ->vmeta_binop
4953 //| movzx RBd, PC_RB // Copy result to Stk[RA] from Stk[RB].
4954 //| movzx RAd, PC_RA
4955 //| mov RC, [BASE+RB*8]
4956 //| mov [BASE+RA*8], RC
4957 //| ins_next
4958 dasm_put(Dst, 11369, Dt1(->base), Dt1(->base));
4959#line 3354 "vm_x64.dasc"
4960 break;
4961
4962 /* -- Constant ops ------------------------------------------------------ */
4963
4964 case BC_KSTR:
4965 //| ins_AND // RA = dst, RD = str const (~)
4966 //| mov RD, [KBASE+RD*8]
4967 //| settp RD, LJ_TSTR
4968 //| mov [BASE+RA*8], RD
4969 //| ins_next
4970 dasm_put(Dst, 11461, (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32));
4971#line 3364 "vm_x64.dasc"
4972 break;
4973 case BC_KCDATA:
4974 //|.if FFI
4975 //| ins_AND // RA = dst, RD = cdata const (~)
4976 //| mov RD, [KBASE+RD*8]
4977 //| settp RD, LJ_TCDATA
4978 //| mov [BASE+RA*8], RD
4979 //| ins_next
4980 //|.endif
4981 dasm_put(Dst, 11461, (unsigned int)(((uint64_t)LJ_TCDATA<<47)), (unsigned int)((((uint64_t)LJ_TCDATA<<47))>>32));
4982#line 3373 "vm_x64.dasc"
4983 break;
4984 case BC_KSHORT:
4985 //| ins_AD // RA = dst, RD = signed int16 literal
4986 //|.if DUALNUM
4987 //| movsx RDd, RDW
4988 //| setint RD
4989 //| mov [BASE+RA*8], RD
4990 //|.else
4991 //| movsx RDd, RDW // Sign-extend literal.
4992 //| cvtsi2sd xmm0, RDd
4993 //| movsd qword [BASE+RA*8], xmm0
4994 //|.endif
4995 //| ins_next
4996 dasm_put(Dst, 11502);
4997#line 3386 "vm_x64.dasc"
4998 break;
4999 case BC_KNUM:
5000 //| ins_AD // RA = dst, RD = num const
5001 //| movsd xmm0, qword [KBASE+RD*8]
5002 //| movsd qword [BASE+RA*8], xmm0
5003 //| ins_next
5004 dasm_put(Dst, 11538);
5005#line 3392 "vm_x64.dasc"
5006 break;
5007 case BC_KPRI:
5008 //| ins_AD // RA = dst, RD = primitive type (~)
5009 //| shl RD, 47
5010 //| not RD
5011 //| mov [BASE+RA*8], RD
5012 //| ins_next
5013 dasm_put(Dst, 10425);
5014#line 3399 "vm_x64.dasc"
5015 break;
5016 case BC_KNIL:
5017 //| ins_AD // RA = dst_start, RD = dst_end
5018 //| lea RA, [BASE+RA*8+8]
5019 //| lea RD, [BASE+RD*8]
5020 //| mov RB, LJ_TNIL
5021 //| mov [RA-8], RB // Sets minimum 2 slots.
5022 //|1:
5023 //| mov [RA], RB
5024 //| add RA, 8
5025 //| cmp RA, RD
5026 //| jbe <1
5027 //| ins_next
5028 dasm_put(Dst, 11573, LJ_TNIL);
5029#line 3412 "vm_x64.dasc"
5030 break;
5031
5032 /* -- Upvalue and function ops ------------------------------------------ */
5033
5034 case BC_UGET:
5035 //| ins_AD // RA = dst, RD = upvalue #
5036 //| mov LFUNC:RB, [BASE-16]
5037 //| cleartp LFUNC:RB
5038 //| mov UPVAL:RB, [LFUNC:RB+RD*8+offsetof(GCfuncL, uvptr)]
5039 //| mov RB, UPVAL:RB->v
5040 //| mov RD, [RB]
5041 //| mov [BASE+RA*8], RD
5042 //| ins_next
5043 dasm_put(Dst, 11629, offsetof(GCfuncL, uvptr), DtA(->v));
5044#line 3425 "vm_x64.dasc"
5045 break;
5046 case BC_USETV:
5047#define TV2MARKOFS \
5048 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
5049 //| ins_AD // RA = upvalue #, RD = src
5050 //| mov LFUNC:RB, [BASE-16]
5051 //| cleartp LFUNC:RB
5052 //| mov UPVAL:RB, [LFUNC:RB+RA*8+offsetof(GCfuncL, uvptr)]
5053 //| cmp byte UPVAL:RB->closed, 0
5054 //| mov RB, UPVAL:RB->v
5055 //| mov RA, [BASE+RD*8]
5056 //| mov [RB], RA
5057 //| jz >1
5058 //| // Check barrier for closed upvalue.
5059 //| test byte [RB+TV2MARKOFS], LJ_GC_BLACK // isblack(uv)
5060 //| jnz >2
5061 //|1:
5062 //| ins_next
5063 //|
5064 //|2: // Upvalue is black. Check if new value is collectable and white.
5065 //| mov RD, RA
5066 //| sar RD, 47
5067 //| sub RDd, LJ_TISGCV
5068 //| cmp RDd, LJ_TNUMX - LJ_TISGCV // tvisgcv(v)
5069 //| jbe <1
5070 //| cleartp GCOBJ:RA
5071 //| test byte GCOBJ:RA->gch.marked, LJ_GC_WHITES // iswhite(v)
5072 //| jz <1
5073 //| // Crossed a write barrier. Move the barrier forward.
5074 //|.if not X64WIN
5075 //| mov CARG2, RB
5076 dasm_put(Dst, 11683, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TNUMX - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES);
5077#line 3456 "vm_x64.dasc"
5078 //| mov RB, BASE // Save BASE.
5079 //|.else
5080 //| xchg CARG2, RB // Save BASE (CARG2 == BASE).
5081 //|.endif
5082 //| lea GL:CARG1, [DISPATCH+GG_DISP2G]
5083 //| call extern lj_gc_barrieruv // (global_State *g, TValue *tv)
5084 //| mov BASE, RB // Restore BASE.
5085 //| jmp <1
5086 dasm_put(Dst, 11795, GG_DISP2G);
5087#line 3464 "vm_x64.dasc"
5088 break;
5089#undef TV2MARKOFS
5090 case BC_USETS:
5091 //| ins_AND // RA = upvalue #, RD = str const (~)
5092 //| mov LFUNC:RB, [BASE-16]
5093 //| cleartp LFUNC:RB
5094 //| mov UPVAL:RB, [LFUNC:RB+RA*8+offsetof(GCfuncL, uvptr)]
5095 //| mov STR:RA, [KBASE+RD*8]
5096 //| mov RD, UPVAL:RB->v
5097 //| settp STR:ITYPE, STR:RA, LJ_TSTR
5098 //| mov [RD], STR:ITYPE
5099 //| test byte UPVAL:RB->marked, LJ_GC_BLACK // isblack(uv)
5100 //| jnz >2
5101 //|1:
5102 //| ins_next
5103 //|
5104 //|2: // Check if string is white and ensure upvalue is closed.
5105 //| test byte GCOBJ:RA->gch.marked, LJ_GC_WHITES // iswhite(str)
5106 //| jz <1
5107 //| cmp byte UPVAL:RB->closed, 0
5108 //| jz <1
5109 //| // Crossed a write barrier. Move the barrier forward.
5110 //| mov RB, BASE // Save BASE (CARG2 == BASE).
5111 //| mov CARG2, RD
5112 //| lea GL:CARG1, [DISPATCH+GG_DISP2G]
5113 //| call extern lj_gc_barrieruv // (global_State *g, TValue *tv)
5114 //| mov BASE, RB // Restore BASE.
5115 //| jmp <1
5116 dasm_put(Dst, 11819, offsetof(GCfuncL, uvptr), DtA(->v), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
5117#line 3492 "vm_x64.dasc"
5118 break;
5119 case BC_USETN:
5120 //| ins_AD // RA = upvalue #, RD = num const
5121 //| mov LFUNC:RB, [BASE-16]
5122 //| cleartp LFUNC:RB
5123 //| movsd xmm0, qword [KBASE+RD*8]
5124 //| mov UPVAL:RB, [LFUNC:RB+RA*8+offsetof(GCfuncL, uvptr)]
5125 //| mov RA, UPVAL:RB->v
5126 //| movsd qword [RA], xmm0
5127 //| ins_next
5128 dasm_put(Dst, 11935, offsetof(GCfuncL, uvptr), DtA(->v));
5129#line 3502 "vm_x64.dasc"
5130 break;
5131 case BC_USETP:
5132 //| ins_AD // RA = upvalue #, RD = primitive type (~)
5133 //| mov LFUNC:RB, [BASE-16]
5134 //| cleartp LFUNC:RB
5135 //| mov UPVAL:RB, [LFUNC:RB+RA*8+offsetof(GCfuncL, uvptr)]
5136 //| shl RD, 47
5137 //| not RD
5138 //| mov RA, UPVAL:RB->v
5139 //| mov [RA], RD
5140 //| ins_next
5141 dasm_put(Dst, 11993, offsetof(GCfuncL, uvptr), DtA(->v));
5142#line 3513 "vm_x64.dasc"
5143 break;
5144 case BC_UCLO:
5145 //| ins_AD // RA = level, RD = target
5146 //| branchPC RD // Do this first to free RD.
5147 //| mov L:RB, SAVE_L
5148 //| cmp aword L:RB->openupval, 0
5149 //| je >1
5150 //| mov L:RB->base, BASE
5151 //| lea CARG2, [BASE+RA*8] // Caveat: CARG2 == BASE
5152 //| mov L:CARG1, L:RB // Caveat: CARG1 == RA
5153 //| call extern lj_func_closeuv // (lua_State *L, TValue *level)
5154 //| mov BASE, L:RB->base
5155 //|1:
5156 //| ins_next
5157 dasm_put(Dst, 12050, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
5158#line 3527 "vm_x64.dasc"
5159 break;
5160
5161 case BC_FNEW:
5162 //| ins_AND // RA = dst, RD = proto const (~) (holding function prototype)
5163 //| mov L:RB, SAVE_L
5164 //| mov L:RB->base, BASE // Caveat: CARG2/CARG3 may be BASE.
5165 //| mov CARG3, [BASE-16]
5166 //| cleartp CARG3
5167 //| mov CARG2, [KBASE+RD*8] // Fetch GCproto *.
5168 //| mov CARG1, L:RB
5169 //| mov SAVE_PC, PC
5170 //| // (lua_State *L, GCproto *pt, GCfuncL *parent)
5171 //| call extern lj_func_newL_gc
5172 //| // GCfuncL * returned in eax (RC).
5173 //| mov BASE, L:RB->base
5174 //| movzx RAd, PC_RA
5175 //| settp LFUNC:RC, LJ_TFUNC
5176 //| mov [BASE+RA*8], LFUNC:RC
5177 //| ins_next
5178 dasm_put(Dst, 12114, Dt1(->base), Dt1(->base), (unsigned int)(((uint64_t)LJ_TFUNC<<47)), (unsigned int)((((uint64_t)LJ_TFUNC<<47))>>32));
5179#line 3546 "vm_x64.dasc"
5180 break;
5181
5182 /* -- Table ops --------------------------------------------------------- */
5183
5184 case BC_TNEW:
5185 //| ins_AD // RA = dst, RD = hbits|asize
5186 //| mov L:RB, SAVE_L
5187 //| mov L:RB->base, BASE
5188 //| mov RA, [DISPATCH+DISPATCH_GL(gc.total)]
5189 //| cmp RA, [DISPATCH+DISPATCH_GL(gc.threshold)]
5190 //| mov SAVE_PC, PC
5191 //| jae >5
5192 //|1:
5193 //| mov CARG3d, RDd
5194 //| and RDd, 0x7ff
5195 //| shr CARG3d, 11
5196 //| cmp RDd, 0x7ff
5197 //| je >3
5198 //|2:
5199 //| mov L:CARG1, L:RB
5200 //| mov CARG2d, RDd
5201 //| call extern lj_tab_new // (lua_State *L, int32_t asize, uint32_t hbits)
5202 //| // Table * returned in eax (RC).
5203 //| mov BASE, L:RB->base
5204 //| movzx RAd, PC_RA
5205 //| settp TAB:RC, LJ_TTAB
5206 //| mov [BASE+RA*8], TAB:RC
5207 //| ins_next
5208 //|3: // Turn 0x7ff into 0x801.
5209 //| mov RDd, 0x801
5210 //| jmp <2
5211 //|5:
5212 //| mov L:CARG1, L:RB
5213 //| call extern lj_gc_step_fixtop // (lua_State *L)
5214 //| movzx RDd, PC_RD
5215 //| jmp <1
5216 dasm_put(Dst, 12200, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), (unsigned int)(((uint64_t)LJ_TTAB<<47)), (unsigned int)((((uint64_t)LJ_TTAB<<47))>>32));
5217#line 3582 "vm_x64.dasc"
5218 break;
5219 case BC_TDUP:
5220 //| ins_AND // RA = dst, RD = table const (~) (holding template table)
5221 //| mov L:RB, SAVE_L
5222 //| mov RA, [DISPATCH+DISPATCH_GL(gc.total)]
5223 //| mov SAVE_PC, PC
5224 //| cmp RA, [DISPATCH+DISPATCH_GL(gc.threshold)]
5225 //| mov L:RB->base, BASE
5226 //| jae >3
5227 //|2:
5228 //| mov TAB:CARG2, [KBASE+RD*8] // Caveat: CARG2 == BASE
5229 //| mov L:CARG1, L:RB // Caveat: CARG1 == RA
5230 //| call extern lj_tab_dup // (lua_State *L, Table *kt)
5231 //| // Table * returned in eax (RC).
5232 //| mov BASE, L:RB->base
5233 //| movzx RAd, PC_RA
5234 //| settp TAB:RC, LJ_TTAB
5235 //| mov [BASE+RA*8], TAB:RC
5236 //| ins_next
5237 //|3:
5238 //| mov L:CARG1, L:RB
5239 //| call extern lj_gc_step_fixtop // (lua_State *L)
5240 //| movzx RDd, PC_RD // Need to reload RD.
5241 //| not RD
5242 //| jmp <2
5243 dasm_put(Dst, 12334, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), (unsigned int)(((uint64_t)LJ_TTAB<<47)), (unsigned int)((((uint64_t)LJ_TTAB<<47))>>32));
5244#line 3607 "vm_x64.dasc"
5245 break;
5246
5247 case BC_GGET:
5248 //| ins_AND // RA = dst, RD = str const (~)
5249 //| mov LFUNC:RB, [BASE-16]
5250 //| cleartp LFUNC:RB
5251 //| mov TAB:RB, LFUNC:RB->env
5252 //| mov STR:RC, [KBASE+RD*8]
5253 //| jmp ->BC_TGETS_Z
5254 dasm_put(Dst, 12443, Dt7(->env));
5255#line 3616 "vm_x64.dasc"
5256 break;
5257 case BC_GSET:
5258 //| ins_AND // RA = src, RD = str const (~)
5259 //| mov LFUNC:RB, [BASE-16]
5260 //| cleartp LFUNC:RB
5261 //| mov TAB:RB, LFUNC:RB->env
5262 //| mov STR:RC, [KBASE+RD*8]
5263 //| jmp ->BC_TSETS_Z
5264 dasm_put(Dst, 12474, Dt7(->env));
5265#line 3624 "vm_x64.dasc"
5266 break;
5267
5268 case BC_TGETV:
5269 //| ins_ABC // RA = dst, RB = table, RC = key
5270 //| mov TAB:RB, [BASE+RB*8]
5271 //| mov RC, [BASE+RC*8]
5272 //| checktab TAB:RB, ->vmeta_tgetv
5273 //|
5274 //| // Integer key?
5275 //|.if DUALNUM
5276 //| checkint RC, >5
5277 //|.else
5278 //| // Convert number to int and back and compare.
5279 //| checknum RC, >5
5280 //| movd xmm0, RC
5281 //| cvttsd2si RCd, xmm0
5282 //| cvtsi2sd xmm1, RCd
5283 //| ucomisd xmm0, xmm1
5284 //| jne ->vmeta_tgetv // Generic numeric key? Use fallback.
5285 //|.endif
5286 //| cmp RCd, TAB:RB->asize // Takes care of unordered, too.
5287 //| jae ->vmeta_tgetv // Not in array part? Use fallback.
5288 //| shl RCd, 3
5289 //| add RC, TAB:RB->array
5290 //| // Get array slot.
5291 //| mov ITYPE, [RC]
5292 //| cmp ITYPE, LJ_TNIL // Avoid overwriting RB in fastpath.
5293 //| je >2
5294 //|1:
5295 //| mov [BASE+RA*8], ITYPE
5296 //| ins_next
5297 //|
5298 //|2: // Check for __index if table value is nil.
5299 //| mov TAB:TMPR, TAB:RB->metatable
5300 //| test TAB:TMPR, TAB:TMPR
5301 //| jz <1
5302 //| test byte TAB:TMPR->nomm, 1<<MM_index
5303 dasm_put(Dst, 12505, LJ_TTAB, LJ_TISNUM, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable));
5304#line 3661 "vm_x64.dasc"
5305 //| jz ->vmeta_tgetv // 'no __index' flag NOT set: check.
5306 //| jmp <1
5307 //|
5308 //|5: // String key?
5309 //| cmp ITYPEd, LJ_TSTR; jne ->vmeta_tgetv
5310 //| cleartp STR:RC
5311 //| jmp ->BC_TGETS_Z
5312 dasm_put(Dst, 12655, Dt6(->nomm), 1<<MM_index, LJ_TSTR);
5313#line 3668 "vm_x64.dasc"
5314 break;
5315 case BC_TGETS:
5316 //| ins_ABC // RA = dst, RB = table, RC = str const (~)
5317 //| mov TAB:RB, [BASE+RB*8]
5318 //| not RC
5319 //| mov STR:RC, [KBASE+RC*8]
5320 //| checktab TAB:RB, ->vmeta_tgets
5321 //|->BC_TGETS_Z: // RB = GCtab *, RC = GCstr *
5322 //| mov TMPRd, TAB:RB->hmask
5323 //| and TMPRd, STR:RC->sid
5324 //| imul TMPRd, #NODE
5325 //| add NODE:TMPR, TAB:RB->node
5326 //| settp ITYPE, STR:RC, LJ_TSTR
5327 //|1:
5328 //| cmp NODE:TMPR->key, ITYPE
5329 //| jne >4
5330 //| // Get node value.
5331 //| mov ITYPE, NODE:TMPR->val
5332 //| cmp ITYPE, LJ_TNIL
5333 //| je >5 // Key found, but nil value?
5334 //|2:
5335 //| mov [BASE+RA*8], ITYPE
5336 dasm_put(Dst, 12693, LJ_TTAB, Dt6(->hmask), Dt5(->sid), sizeof(Node), Dt6(->node), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), DtB(->key), DtB(->val), LJ_TNIL);
5337#line 3690 "vm_x64.dasc"
5338 //| ins_next
5339 //|
5340 //|4: // Follow hash chain.
5341 //| mov NODE:TMPR, NODE:TMPR->next
5342 //| test NODE:TMPR, NODE:TMPR
5343 //| jnz <1
5344 //| // End of hash chain: key not found, nil result.
5345 //| mov ITYPE, LJ_TNIL
5346 //|
5347 //|5: // Check for __index if table value is nil.
5348 //| mov TAB:TMPR, TAB:RB->metatable
5349 //| test TAB:TMPR, TAB:TMPR
5350 //| jz <2 // No metatable: done.
5351 //| test byte TAB:TMPR->nomm, 1<<MM_index
5352 //| jnz <2 // 'no __index' flag set: done.
5353 //| jmp ->vmeta_tgets // Caveat: preserve STR:RC.
5354 dasm_put(Dst, 12791, DtB(->next), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5355#line 3706 "vm_x64.dasc"
5356 break;
5357 case BC_TGETB:
5358 //| ins_ABC // RA = dst, RB = table, RC = byte literal
5359 //| mov TAB:RB, [BASE+RB*8]
5360 //| checktab TAB:RB, ->vmeta_tgetb
5361 //| cmp RCd, TAB:RB->asize
5362 //| jae ->vmeta_tgetb
5363 //| shl RCd, 3
5364 //| add RC, TAB:RB->array
5365 //| // Get array slot.
5366 //| mov ITYPE, [RC]
5367 //| cmp ITYPE, LJ_TNIL
5368 //| je >2
5369 //|1:
5370 //| mov [BASE+RA*8], ITYPE
5371 //| ins_next
5372 //|
5373 //|2: // Check for __index if table value is nil.
5374 //| mov TAB:TMPR, TAB:RB->metatable
5375 //| test TAB:TMPR, TAB:TMPR
5376 //| jz <1
5377 //| test byte TAB:TMPR->nomm, 1<<MM_index
5378 //| jz ->vmeta_tgetb // 'no __index' flag NOT set: check.
5379 //| jmp <1
5380 dasm_put(Dst, 12861, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5381 dasm_put(Dst, 10635);
5382#line 3730 "vm_x64.dasc"
5383 break;
5384 case BC_TGETR:
5385 //| ins_ABC // RA = dst, RB = table, RC = key
5386 //| mov TAB:RB, [BASE+RB*8]
5387 //| cleartp TAB:RB
5388 //|.if DUALNUM
5389 //| mov RCd, dword [BASE+RC*8]
5390 //|.else
5391 //| cvttsd2si RCd, qword [BASE+RC*8]
5392 //|.endif
5393 //| cmp RCd, TAB:RB->asize
5394 //| jae ->vmeta_tgetr // Not in array part? Use fallback.
5395 //| shl RCd, 3
5396 //| add RC, TAB:RB->array
5397 //| // Get array slot.
5398 //|->BC_TGETR_Z:
5399 //| mov ITYPE, [RC]
5400 //|->BC_TGETR2_Z:
5401 //| mov [BASE+RA*8], ITYPE
5402 //| ins_next
5403 dasm_put(Dst, 12977, Dt6(->asize), Dt6(->array));
5404#line 3750 "vm_x64.dasc"
5405 break;
5406
5407 case BC_TSETV:
5408 //| ins_ABC // RA = src, RB = table, RC = key
5409 //| mov TAB:RB, [BASE+RB*8]
5410 //| mov RC, [BASE+RC*8]
5411 //| checktab TAB:RB, ->vmeta_tsetv
5412 //|
5413 //| // Integer key?
5414 //|.if DUALNUM
5415 //| checkint RC, >5
5416 //|.else
5417 //| // Convert number to int and back and compare.
5418 //| checknum RC, >5
5419 //| movd xmm0, RC
5420 //| cvttsd2si RCd, xmm0
5421 //| cvtsi2sd xmm1, RCd
5422 //| ucomisd xmm0, xmm1
5423 //| jne ->vmeta_tsetv // Generic numeric key? Use fallback.
5424 //|.endif
5425 //| cmp RCd, TAB:RB->asize // Takes care of unordered, too.
5426 //| jae ->vmeta_tsetv
5427 //| shl RCd, 3
5428 //| add RC, TAB:RB->array
5429 //| cmp aword [RC], LJ_TNIL
5430 //| je >3 // Previous value is nil?
5431 //|1:
5432 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
5433 //| jnz >7
5434 //|2: // Set array slot.
5435 //| mov RB, [BASE+RA*8]
5436 dasm_put(Dst, 13051, LJ_TTAB, LJ_TISNUM, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK);
5437#line 3781 "vm_x64.dasc"
5438 //| mov [RC], RB
5439 //| ins_next
5440 //|
5441 //|3: // Check for __newindex if previous value is nil.
5442 //| mov TAB:TMPR, TAB:RB->metatable
5443 //| test TAB:TMPR, TAB:TMPR
5444 //| jz <1
5445 //| test byte TAB:TMPR->nomm, 1<<MM_newindex
5446 //| jz ->vmeta_tsetv // 'no __newindex' flag NOT set: check.
5447 //| jmp <1
5448 //|
5449 //|5: // String key?
5450 //| cmp ITYPEd, LJ_TSTR; jne ->vmeta_tsetv
5451 //| cleartp STR:RC
5452 //| jmp ->BC_TSETS_Z
5453 //|
5454 //|7: // Possible table write barrier for the value. Skip valiswhite check.
5455 //| barrierback TAB:RB, TMPR
5456 dasm_put(Dst, 13170, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK);
5457#line 3799 "vm_x64.dasc"
5458 //| jmp <2
5459 dasm_put(Dst, 13255, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
5460#line 3800 "vm_x64.dasc"
5461 break;
5462 case BC_TSETS:
5463 //| ins_ABC // RA = src, RB = table, RC = str const (~)
5464 //| mov TAB:RB, [BASE+RB*8]
5465 //| not RC
5466 //| mov STR:RC, [KBASE+RC*8]
5467 //| checktab TAB:RB, ->vmeta_tsets
5468 //|->BC_TSETS_Z: // RB = GCtab *, RC = GCstr *
5469 //| mov TMPRd, TAB:RB->hmask
5470 //| and TMPRd, STR:RC->sid
5471 //| imul TMPRd, #NODE
5472 //| mov byte TAB:RB->nomm, 0 // Clear metamethod cache.
5473 //| add NODE:TMPR, TAB:RB->node
5474 //| settp ITYPE, STR:RC, LJ_TSTR
5475 //|1:
5476 //| cmp NODE:TMPR->key, ITYPE
5477 //| jne >5
5478 //| // Ok, key found. Assumes: offsetof(Node, val) == 0
5479 //| cmp aword [TMPR], LJ_TNIL
5480 //| je >4 // Previous value is nil?
5481 //|2:
5482 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
5483 dasm_put(Dst, 13272, LJ_TTAB, Dt6(->hmask), Dt5(->sid), sizeof(Node), Dt6(->nomm), Dt6(->node), (unsigned int)(((uint64_t)LJ_TSTR<<47)), (unsigned int)((((uint64_t)LJ_TSTR<<47))>>32), DtB(->key), LJ_TNIL);
5484#line 3822 "vm_x64.dasc"
5485 //| jnz >7
5486 //|3: // Set node value.
5487 //| mov ITYPE, [BASE+RA*8]
5488 //| mov [TMPR], ITYPE
5489 //| ins_next
5490 //|
5491 //|4: // Check for __newindex if previous value is nil.
5492 //| mov TAB:ITYPE, TAB:RB->metatable
5493 //| test TAB:ITYPE, TAB:ITYPE
5494 //| jz <2
5495 //| test byte TAB:ITYPE->nomm, 1<<MM_newindex
5496 //| jz ->vmeta_tsets // 'no __newindex' flag NOT set: check.
5497 //| jmp <2
5498 //|
5499 //|5: // Follow hash chain.
5500 //| mov NODE:TMPR, NODE:TMPR->next
5501 //| test NODE:TMPR, NODE:TMPR
5502 //| jnz <1
5503 //| // End of hash chain: key not found, add a new one.
5504 //|
5505 //| // But check for __newindex first.
5506 //| mov TAB:TMPR, TAB:RB->metatable
5507 dasm_put(Dst, 13369, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
5508#line 3844 "vm_x64.dasc"
5509 //| test TAB:TMPR, TAB:TMPR
5510 //| jz >6 // No metatable: continue.
5511 //| test byte TAB:TMPR->nomm, 1<<MM_newindex
5512 //| jz ->vmeta_tsets // 'no __newindex' flag NOT set: check.
5513 //|6:
5514 //| mov TMP1, ITYPE
5515 //| mov L:CARG1, SAVE_L
5516 //| mov L:CARG1->base, BASE
5517 //| lea CARG3, TMP1
5518 //| mov CARG2, TAB:RB
5519 //| mov SAVE_PC, PC
5520 //| call extern lj_tab_newkey // (lua_State *L, GCtab *t, TValue *k)
5521 //| // Handles write barrier for the new key. TValue * returned in eax (RC).
5522 //| mov L:CARG1, SAVE_L
5523 //| mov BASE, L:CARG1->base
5524 //| mov TMPR, rax
5525 //| movzx RAd, PC_RA
5526 //| jmp <2 // Must check write barrier for value.
5527 //|
5528 //|7: // Possible table write barrier for the value. Skip valiswhite check.
5529 //| barrierback TAB:RB, ITYPE
5530 //| jmp <3
5531 dasm_put(Dst, 13449, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
5532#line 3866 "vm_x64.dasc"
5533 break;
5534 case BC_TSETB:
5535 //| ins_ABC // RA = src, RB = table, RC = byte literal
5536 //| mov TAB:RB, [BASE+RB*8]
5537 //| checktab TAB:RB, ->vmeta_tsetb
5538 //| cmp RCd, TAB:RB->asize
5539 //| jae ->vmeta_tsetb
5540 //| shl RCd, 3
5541 //| add RC, TAB:RB->array
5542 //| cmp aword [RC], LJ_TNIL
5543 //| je >3 // Previous value is nil?
5544 //|1:
5545 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
5546 //| jnz >7
5547 //|2: // Set array slot.
5548 //| mov ITYPE, [BASE+RA*8]
5549 //| mov [RC], ITYPE
5550 //| ins_next
5551 //|
5552 //|3: // Check for __newindex if previous value is nil.
5553 //| mov TAB:TMPR, TAB:RB->metatable
5554 //| test TAB:TMPR, TAB:TMPR
5555 //| jz <1
5556 //| test byte TAB:TMPR->nomm, 1<<MM_newindex
5557 dasm_put(Dst, 13546, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
5558#line 3890 "vm_x64.dasc"
5559 //| jz ->vmeta_tsetb // 'no __newindex' flag NOT set: check.
5560 //| jmp <1
5561 //|
5562 //|7: // Possible table write barrier for the value. Skip valiswhite check.
5563 //| barrierback TAB:RB, TMPR
5564 //| jmp <2
5565 dasm_put(Dst, 13662, Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
5566#line 3896 "vm_x64.dasc"
5567 break;
5568 case BC_TSETR:
5569 //| ins_ABC // RA = src, RB = table, RC = key
5570 //| mov TAB:RB, [BASE+RB*8]
5571 //| cleartp TAB:RB
5572 //|.if DUALNUM
5573 //| mov RC, [BASE+RC*8]
5574 //|.else
5575 //| cvttsd2si RCd, qword [BASE+RC*8]
5576 //|.endif
5577 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
5578 //| jnz >7
5579 //|2:
5580 //| cmp RCd, TAB:RB->asize
5581 //| jae ->vmeta_tsetr
5582 //| shl RCd, 3
5583 //| add RC, TAB:RB->array
5584 //| // Set array slot.
5585 //|->BC_TSETR_Z:
5586 //| mov ITYPE, [BASE+RA*8]
5587 //| mov [RC], ITYPE
5588 //| ins_next
5589 //|
5590 //|7: // Possible table write barrier for the value. Skip valiswhite check.
5591 //| barrierback TAB:RB, TMPR
5592 //| jmp <2
5593 dasm_put(Dst, 13699, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
5594#line 3922 "vm_x64.dasc"
5595 break;
5596
5597 case BC_TSETM:
5598 //| ins_AD // RA = base (table at base-1), RD = num const (start index)
5599 //|1:
5600 //| mov TMPRd, dword [KBASE+RD*8] // Integer constant is in lo-word.
5601 //| lea RA, [BASE+RA*8]
5602 //| mov TAB:RB, [RA-8] // Guaranteed to be a table.
5603 //| cleartp TAB:RB
5604 //| test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
5605 //| jnz >7
5606 //|2:
5607 //| mov RDd, MULTRES
5608 //| sub RDd, 1
5609 //| jz >4 // Nothing to copy?
5610 //| add RDd, TMPRd // Compute needed size.
5611 //| cmp RDd, TAB:RB->asize
5612 //| ja >5 // Doesn't fit into array part?
5613 //| sub RDd, TMPRd
5614 //| shl TMPRd, 3
5615 //| add TMPR, TAB:RB->array
5616 //|3: // Copy result slots to table.
5617 //| mov RB, [RA]
5618 //| add RA, 8
5619 //| mov [TMPR], RB
5620 //| add TMPR, 8
5621 //| sub RDd, 1
5622 //| jnz <3
5623 //|4:
5624 //| ins_next
5625 //|
5626 //|5: // Need to resize array part.
5627 //| mov L:CARG1, SAVE_L
5628 //| mov L:CARG1->base, BASE // Caveat: CARG2/CARG3 may be BASE.
5629 //| mov CARG2, TAB:RB
5630 //| mov CARG3d, RDd
5631 //| mov L:RB, L:CARG1
5632 //| mov SAVE_PC, PC
5633 //| call extern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize)
5634 //| mov BASE, L:RB->base
5635 //| movzx RAd, PC_RA // Restore RA.
5636 dasm_put(Dst, 13804, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
5637#line 3963 "vm_x64.dasc"
5638 //| movzx RDd, PC_RD // Restore RD.
5639 //| jmp <1 // Retry.
5640 //|
5641 //|7: // Possible table write barrier for any value. Skip valiswhite check.
5642 //| barrierback TAB:RB, RD
5643 //| jmp <2
5644 dasm_put(Dst, 13951, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
5645#line 3969 "vm_x64.dasc"
5646 break;
5647
5648 /* -- Calls and vararg handling ----------------------------------------- */
5649
5650 case BC_CALL: case BC_CALLM:
5651 //| ins_A_C // RA = base, (RB = nresults+1,) RC = nargs+1 | extra_nargs
5652 dasm_put(Dst, 10660);
5653#line 3975 "vm_x64.dasc"
5654 if (op == BC_CALLM) {
5655 //| add NARGS:RDd, MULTRES
5656 dasm_put(Dst, 13988);
5657#line 3977 "vm_x64.dasc"
5658 }
5659 //| mov LFUNC:RB, [BASE+RA*8]
5660 //| checkfunc LFUNC:RB, ->vmeta_call_ra
5661 //| lea BASE, [BASE+RA*8+16]
5662 //| ins_call
5663 dasm_put(Dst, 13992, LJ_TFUNC, Dt7(->pc));
5664#line 3982 "vm_x64.dasc"
5665 break;
5666
5667 case BC_CALLMT:
5668 //| ins_AD // RA = base, RD = extra_nargs
5669 //| add NARGS:RDd, MULTRES
5670 //| // Fall through. Assumes BC_CALLT follows and ins_AD is a no-op.
5671 dasm_put(Dst, 13988);
5672#line 3988 "vm_x64.dasc"
5673 break;
5674 case BC_CALLT:
5675 //| ins_AD // RA = base, RD = nargs+1
5676 //| lea RA, [BASE+RA*8+16]
5677 //| mov KBASE, BASE // Use KBASE for move + vmeta_call hint.
5678 //| mov LFUNC:RB, [RA-16]
5679 //| checktp_nc LFUNC:RB, LJ_TFUNC, ->vmeta_call
5680 //|->BC_CALLT_Z:
5681 //| mov PC, [BASE-8]
5682 //| test PCd, FRAME_TYPE
5683 //| jnz >7
5684 //|1:
5685 //| mov [BASE-16], LFUNC:RB // Copy func+tag down, reloaded below.
5686 //| mov MULTRES, NARGS:RDd
5687 //| sub NARGS:RDd, 1
5688 //| jz >3
5689 //|2: // Move args down.
5690 //| mov RB, [RA]
5691 //| add RA, 8
5692 //| mov [KBASE], RB
5693 //| add KBASE, 8
5694 //| sub NARGS:RDd, 1
5695 //| jnz <2
5696 //|
5697 //| mov LFUNC:RB, [BASE-16]
5698 //|3:
5699 //| cleartp LFUNC:RB
5700 //| mov NARGS:RDd, MULTRES
5701 //| cmp byte LFUNC:RB->ffid, 1 // (> FF_C) Calling a fast function?
5702 //| ja >5
5703 //|4:
5704 //| ins_callt
5705 dasm_put(Dst, 14057, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
5706#line 4020 "vm_x64.dasc"
5707 //|
5708 //|5: // Tailcall to a fast function.
5709 //| test PCd, FRAME_TYPE // Lua frame below?
5710 //| jnz <4
5711 //| movzx RAd, PC_RA
5712 //| neg RA
5713 //| mov LFUNC:KBASE, [BASE+RA*8-32] // Need to prepare KBASE.
5714 //| cleartp LFUNC:KBASE
5715 //| mov KBASE, LFUNC:KBASE->pc
5716 //| mov KBASE, [KBASE+PC2PROTO(k)]
5717 //| jmp <4
5718 //|
5719 //|7: // Tailcall from a vararg function.
5720 //| sub PC, FRAME_VARG
5721 //| test PCd, FRAME_TYPEP
5722 //| jnz >8 // Vararg frame below?
5723 //| sub BASE, PC // Need to relocate BASE/KBASE down.
5724 //| mov KBASE, BASE
5725 //| mov PC, [BASE-8]
5726 //| jmp <1
5727 //|8:
5728 //| add PCd, FRAME_VARG
5729 //| jmp <1
5730 dasm_put(Dst, 14177, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
5731#line 4043 "vm_x64.dasc"
5732 break;
5733
5734 case BC_ITERC:
5735 //| ins_A // RA = base, (RB = nresults+1,) RC = nargs+1 (2+1)
5736 //| lea RA, [BASE+RA*8+16] // fb = base+2
5737 //| mov RB, [RA-32] // Copy state. fb[0] = fb[-4].
5738 //| mov RC, [RA-24] // Copy control var. fb[1] = fb[-3].
5739 //| mov [RA], RB
5740 //| mov [RA+8], RC
5741 //| mov LFUNC:RB, [RA-40] // Copy callable. fb[-2] = fb[-5]
5742 //| mov [RA-16], LFUNC:RB
5743 //| mov NARGS:RDd, 2+1 // Handle like a regular 2-arg call.
5744 //| checkfunc LFUNC:RB, ->vmeta_call
5745 //| mov BASE, RA
5746 //| ins_call
5747 dasm_put(Dst, 14281, 2+1, LJ_TFUNC, Dt7(->pc));
5748#line 4058 "vm_x64.dasc"
5749 break;
5750
5751 case BC_ITERN:
5752 //| ins_A // RA = base, (RB = nresults+1, RC = nargs+1 (2+1))
5753 //|.if JIT
5754 //| // NYI: add hotloop, record BC_ITERN.
5755 //|.endif
5756 //| mov TAB:RB, [BASE+RA*8-16]
5757 //| cleartp TAB:RB
5758 //| mov RCd, [BASE+RA*8-8] // Get index from control var.
5759 //| mov TMPRd, TAB:RB->asize
5760 //| add PC, 4
5761 //| mov ITYPE, TAB:RB->array
5762 //|1: // Traverse array part.
5763 //| cmp RCd, TMPRd; jae >5 // Index points after array part?
5764 //| cmp aword [ITYPE+RC*8], LJ_TNIL; je >4
5765 //|.if not DUALNUM
5766 //| cvtsi2sd xmm0, RCd
5767 //|.endif
5768 //| // Copy array slot to returned value.
5769 //| mov RB, [ITYPE+RC*8]
5770 //| mov [BASE+RA*8+8], RB
5771 //| // Return array index as a numeric key.
5772 //|.if DUALNUM
5773 //| setint ITYPE, RC
5774 //| mov [BASE+RA*8], ITYPE
5775 //|.else
5776 //| movsd qword [BASE+RA*8], xmm0
5777 //|.endif
5778 //| add RCd, 1
5779 //| mov [BASE+RA*8-8], RCd // Update control var.
5780 //|2:
5781 //| movzx RDd, PC_RD // Get target from ITERL.
5782 //| branchPC RD
5783 //|3:
5784 //| ins_next
5785 //|
5786 //|4: // Skip holes in array part.
5787 //| add RCd, 1
5788 //| jmp <1
5789 //|
5790 //|5: // Traverse hash part.
5791 //| sub RCd, TMPRd
5792 //|6:
5793 //| cmp RCd, TAB:RB->hmask; ja <3 // End of iteration? Branch to ITERL+1.
5794 //| imul ITYPEd, RCd, #NODE
5795 dasm_put(Dst, 14371, Dt6(->asize), Dt6(->array), LJ_TNIL, -BCBIAS_J*4, Dt6(->hmask));
5796#line 4104 "vm_x64.dasc"
5797 //| add NODE:ITYPE, TAB:RB->node
5798 //| cmp aword NODE:ITYPE->val, LJ_TNIL; je >7
5799 //| lea TMPRd, [RCd+TMPRd+1]
5800 //| // Copy key and value from hash slot.
5801 //| mov RB, NODE:ITYPE->key
5802 //| mov RC, NODE:ITYPE->val
5803 //| mov [BASE+RA*8], RB
5804 //| mov [BASE+RA*8+8], RC
5805 //| mov [BASE+RA*8-8], TMPRd
5806 //| jmp <2
5807 //|
5808 //|7: // Skip holes in hash part.
5809 //| add RCd, 1
5810 //| jmp <6
5811 dasm_put(Dst, 14510, sizeof(Node), Dt6(->node), DtB(->val), LJ_TNIL, DtB(->key), DtB(->val));
5812#line 4118 "vm_x64.dasc"
5813 break;
5814
5815 case BC_ISNEXT:
5816 //| ins_AD // RA = base, RD = target (points to ITERN)
5817 //| mov CFUNC:RB, [BASE+RA*8-24]
5818 //| checkfunc CFUNC:RB, >5
5819 //| checktptp [BASE+RA*8-16], LJ_TTAB, >5
5820 //| cmp aword [BASE+RA*8-8], LJ_TNIL; jne >5
5821 //| cmp byte CFUNC:RB->ffid, FF_next_N; jne >5
5822 //| branchPC RD
5823 //| mov64 TMPR, U64x(fffe7fff, 00000000)
5824 //| mov [BASE+RA*8-8], TMPR // Initialize control var.
5825 //|1:
5826 //| ins_next
5827 //|5: // Despecialize bytecode if any of the checks fail.
5828 //| mov PC_OP, BC_JMP
5829 //| branchPC RD
5830 dasm_put(Dst, 14569, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, (unsigned int)(U64x(fffe7fff, 00000000)), (unsigned int)((U64x(fffe7fff, 00000000))>>32), BC_JMP);
5831#line 4135 "vm_x64.dasc"
5832 //| mov byte [PC], BC_ITERC
5833 //| jmp <1
5834 dasm_put(Dst, 14688, -BCBIAS_J*4, BC_ITERC);
5835#line 4137 "vm_x64.dasc"
5836 break;
5837
5838 case BC_VARG:
5839 //| ins_ABC // RA = base, RB = nresults+1, RC = numparams
5840 //| lea TMPR, [BASE+RC*8+(16+FRAME_VARG)]
5841 //| lea RA, [BASE+RA*8]
5842 //| sub TMPR, [BASE-8]
5843 //| // Note: TMPR may now be even _above_ BASE if nargs was < numparams.
5844 //| test RB, RB
5845 //| jz >5 // Copy all varargs?
5846 //| lea RB, [RA+RB*8-8]
5847 //| cmp TMPR, BASE // No vararg slots?
5848 //| jnb >2
5849 //|1: // Copy vararg slots to destination slots.
5850 //| mov RC, [TMPR-16]
5851 //| add TMPR, 8
5852 //| mov [RA], RC
5853 //| add RA, 8
5854 //| cmp RA, RB // All destination slots filled?
5855 //| jnb >3
5856 //| cmp TMPR, BASE // No more vararg slots?
5857 //| jb <1
5858 //|2: // Fill up remainder with nil.
5859 //| mov aword [RA], LJ_TNIL
5860 //| add RA, 8
5861 //| cmp RA, RB
5862 //| jb <2
5863 //|3:
5864 //| ins_next
5865 //|
5866 //|5: // Copy all varargs.
5867 //| mov MULTRES, 1 // MULTRES = 0+1
5868 //| mov RC, BASE
5869 //| sub RC, TMPR
5870 //| jbe <3 // No vararg slots?
5871 //| mov RBd, RCd
5872 //| shr RBd, 3
5873 //| add RBd, 1
5874 //| mov MULTRES, RBd // MULTRES = #varargs+1
5875 //| mov L:RB, SAVE_L
5876 //| add RC, RA
5877 //| cmp RC, L:RB->maxstack
5878 //| ja >7 // Need to grow stack?
5879 dasm_put(Dst, 14702, (16+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
5880#line 4180 "vm_x64.dasc"
5881 //|6: // Copy all vararg slots.
5882 //| mov RC, [TMPR-16]
5883 //| add TMPR, 8
5884 //| mov [RA], RC
5885 //| add RA, 8
5886 //| cmp TMPR, BASE // No more vararg slots?
5887 //| jb <6
5888 //| jmp <3
5889 //|
5890 //|7: // Grow stack for varargs.
5891 //| mov L:RB->base, BASE
5892 //| mov L:RB->top, RA
5893 //| mov SAVE_PC, PC
5894 //| sub TMPR, BASE // Need delta, because BASE may change.
5895 //| mov TMP1hi, TMPRd
5896 //| mov CARG2d, MULTRES
5897 //| sub CARG2d, 1
5898 //| mov CARG1, L:RB
5899 //| call extern lj_state_growstack // (lua_State *L, int n)
5900 //| mov BASE, L:RB->base
5901 //| movsxd TMPR, TMP1hi
5902 //| mov RA, L:RB->top
5903 //| add TMPR, BASE
5904 //| jmp <6
5905 dasm_put(Dst, 14864, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
5906#line 4204 "vm_x64.dasc"
5907 break;
5908
5909 /* -- Returns ----------------------------------------------------------- */
5910
5911 case BC_RETM:
5912 //| ins_AD // RA = results, RD = extra_nresults
5913 //| add RDd, MULTRES // MULTRES >=1, so RD >=1.
5914 //| // Fall through. Assumes BC_RET follows and ins_AD is a no-op.
5915 dasm_put(Dst, 13988);
5916#line 4212 "vm_x64.dasc"
5917 break;
5918
5919 case BC_RET: case BC_RET0: case BC_RET1:
5920 //| ins_AD // RA = results, RD = nresults+1
5921 if (op != BC_RET0) {
5922 //| shl RAd, 3
5923 dasm_put(Dst, 14956);
5924#line 4218 "vm_x64.dasc"
5925 }
5926 //|1:
5927 //| mov PC, [BASE-8]
5928 //| mov MULTRES, RDd // Save nresults+1.
5929 //| test PCd, FRAME_TYPE // Check frame type marker.
5930 //| jnz >7 // Not returning to a fixarg Lua func?
5931 dasm_put(Dst, 14960, FRAME_TYPE);
5932#line 4224 "vm_x64.dasc"
5933 switch (op) {
5934 case BC_RET:
5935 //|->BC_RET_Z:
5936 //| mov KBASE, BASE // Use KBASE for result move.
5937 //| sub RDd, 1
5938 //| jz >3
5939 //|2: // Move results down.
5940 //| mov RB, [KBASE+RA]
5941 //| mov [KBASE-16], RB
5942 //| add KBASE, 8
5943 //| sub RDd, 1
5944 //| jnz <2
5945 //|3:
5946 //| mov RDd, MULTRES // Note: MULTRES may be >255.
5947 //| movzx RBd, PC_RB // So cannot compare with RDL!
5948 //|5:
5949 //| cmp RBd, RDd // More results expected?
5950 //| ja >6
5951 dasm_put(Dst, 14979);
5952#line 4242 "vm_x64.dasc"
5953 break;
5954 case BC_RET1:
5955 //| mov RB, [BASE+RA]
5956 //| mov [BASE-16], RB
5957 dasm_put(Dst, 15032);
5958#line 4246 "vm_x64.dasc"
5959 /* fallthrough */
5960 case BC_RET0:
5961 //|5:
5962 //| cmp PC_RB, RDL // More results expected?
5963 //| ja >6
5964 dasm_put(Dst, 15042);
5965#line 4251 "vm_x64.dasc"
5966 default:
5967 break;
5968 }
5969 //| movzx RAd, PC_RA
5970 //| neg RA
5971 //| lea BASE, [BASE+RA*8-16] // base = base - (RA+2)*8
5972 //| mov LFUNC:KBASE, [BASE-16]
5973 //| cleartp LFUNC:KBASE
5974 //| mov KBASE, LFUNC:KBASE->pc
5975 //| mov KBASE, [KBASE+PC2PROTO(k)]
5976 //| ins_next
5977 //|
5978 //|6: // Fill up results with nil.
5979 dasm_put(Dst, 15053, Dt7(->pc), PC2PROTO(k));
5980#line 4264 "vm_x64.dasc"
5981 if (op == BC_RET) {
5982 //| mov aword [KBASE-16], LJ_TNIL // Note: relies on shifted base.
5983 //| add KBASE, 8
5984 dasm_put(Dst, 15114, LJ_TNIL);
5985#line 4267 "vm_x64.dasc"
5986 } else {
5987 //| mov aword [BASE+RD*8-24], LJ_TNIL
5988 dasm_put(Dst, 15125, LJ_TNIL);
5989#line 4269 "vm_x64.dasc"
5990 }
5991 //| add RD, 1
5992 //| jmp <5
5993 //|
5994 //|7: // Non-standard return case.
5995 //| lea RB, [PC-FRAME_VARG]
5996 //| test RBd, FRAME_TYPEP
5997 //| jnz ->vm_return
5998 //| // Return from vararg function: relocate BASE down and RA up.
5999 //| sub BASE, RB
6000 dasm_put(Dst, 15132, -FRAME_VARG, FRAME_TYPEP);
6001#line 4279 "vm_x64.dasc"
6002 if (op != BC_RET0) {
6003 //| add RA, RB
6004 dasm_put(Dst, 15159);
6005#line 4281 "vm_x64.dasc"
6006 }
6007 //| jmp <1
6008 dasm_put(Dst, 10635);
6009#line 4283 "vm_x64.dasc"
6010 break;
6011
6012 /* -- Loops and branches ------------------------------------------------ */
6013
6014 //|.define FOR_IDX, [RA]
6015 //|.define FOR_STOP, [RA+8]
6016 //|.define FOR_STEP, [RA+16]
6017 //|.define FOR_EXT, [RA+24]
6018
6019 case BC_FORL:
6020 //|.if JIT
6021 //| hotloop RBd
6022 //|.endif
6023 //| // Fall through. Assumes BC_IFORL follows and ins_AJ is a no-op.
6024 dasm_put(Dst, 15164, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
6025#line 4297 "vm_x64.dasc"
6026 break;
6027
6028 case BC_JFORI:
6029 case BC_JFORL:
6030#if !LJ_HASJIT
6031 break;
6032#endif
6033 case BC_FORI:
6034 case BC_IFORL:
6035 vk = (op == BC_IFORL || op == BC_JFORL);
6036 //| ins_AJ // RA = base, RD = target (after end of loop or start of loop)
6037 //| lea RA, [BASE+RA*8]
6038 dasm_put(Dst, 15185);
6039#line 4309 "vm_x64.dasc"
6040 if (LJ_DUALNUM) {
6041 //| mov RB, FOR_IDX
6042 //| checkint RB, >9
6043 //| mov TMPR, FOR_STOP
6044 dasm_put(Dst, 15190, LJ_TISNUM);
6045#line 4313 "vm_x64.dasc"
6046 if (!vk) {
6047 //| checkint TMPR, ->vmeta_for
6048 //| mov ITYPE, FOR_STEP
6049 //| test ITYPEd, ITYPEd; js >5
6050 //| sar ITYPE, 47;
6051 //| cmp ITYPEd, LJ_TISNUM; jne ->vmeta_for
6052 dasm_put(Dst, 15216, LJ_TISNUM, LJ_TISNUM);
6053#line 4319 "vm_x64.dasc"
6054 } else {
6055#ifdef LUA_USE_ASSERT
6056 //| checkinttp FOR_STOP, ->assert_bad_for_arg_type
6057 //| checkinttp FOR_STEP, ->assert_bad_for_arg_type
6058 dasm_put(Dst, 15259, LJ_TISNUM, LJ_TISNUM);
6059#line 4323 "vm_x64.dasc"
6060#endif
6061 //| mov ITYPE, FOR_STEP
6062 //| test ITYPEd, ITYPEd; js >5
6063 //| add RBd, ITYPEd; jo >1
6064 //| setint RB
6065 //| mov FOR_IDX, RB
6066 dasm_put(Dst, 15296, (unsigned int)(((uint64_t)LJ_TISNUM<<47)), (unsigned int)((((uint64_t)LJ_TISNUM<<47))>>32));
6067#line 4329 "vm_x64.dasc"
6068 }
6069 //| cmp RBd, TMPRd
6070 //| mov FOR_EXT, RB
6071 dasm_put(Dst, 15325);
6072#line 4332 "vm_x64.dasc"
6073 if (op == BC_FORI) {
6074 //| jle >7
6075 //|1:
6076 //|6:
6077 //| branchPC RD
6078 dasm_put(Dst, 15333, -BCBIAS_J*4);
6079#line 4337 "vm_x64.dasc"
6080 } else if (op == BC_JFORI) {
6081 //| branchPC RD
6082 //| movzx RDd, PC_RD
6083 //| jle =>BC_JLOOP
6084 //|1:
6085 //|6:
6086 dasm_put(Dst, 15348, -BCBIAS_J*4, BC_JLOOP);
6087#line 4343 "vm_x64.dasc"
6088 } else if (op == BC_IFORL) {
6089 //| jg >7
6090 //|6:
6091 //| branchPC RD
6092 //|1:
6093 dasm_put(Dst, 15367, -BCBIAS_J*4);
6094#line 4348 "vm_x64.dasc"
6095 } else {
6096 //| jle =>BC_JLOOP
6097 //|1:
6098 //|6:
6099 dasm_put(Dst, 15359, BC_JLOOP);
6100#line 4352 "vm_x64.dasc"
6101 }
6102 //|7:
6103 //| ins_next
6104 //|
6105 //|5: // Invert check for negative step.
6106 dasm_put(Dst, 15382);
6107#line 4357 "vm_x64.dasc"
6108 if (!vk) {
6109 //| sar ITYPE, 47;
6110 //| cmp ITYPEd, LJ_TISNUM; jne ->vmeta_for
6111 dasm_put(Dst, 15244, LJ_TISNUM);
6112#line 4360 "vm_x64.dasc"
6113 } else {
6114 //| add RBd, ITYPEd; jo <1
6115 //| setint RB
6116 //| mov FOR_IDX, RB
6117 dasm_put(Dst, 15408, (unsigned int)(((uint64_t)LJ_TISNUM<<47)), (unsigned int)((((uint64_t)LJ_TISNUM<<47))>>32));
6118#line 4364 "vm_x64.dasc"
6119 }
6120 //| cmp RBd, TMPRd
6121 //| mov FOR_EXT, RB
6122 dasm_put(Dst, 15325);
6123#line 4367 "vm_x64.dasc"
6124 if (op == BC_FORI) {
6125 //| jge <7
6126 dasm_put(Dst, 15426);
6127#line 4369 "vm_x64.dasc"
6128 } else if (op == BC_JFORI) {
6129 //| branchPC RD
6130 //| movzx RDd, PC_RD
6131 //| jge =>BC_JLOOP
6132 dasm_put(Dst, 15431, -BCBIAS_J*4, BC_JLOOP);
6133#line 4373 "vm_x64.dasc"
6134 } else if (op == BC_IFORL) {
6135 //| jl <7
6136 dasm_put(Dst, 15446);
6137#line 4375 "vm_x64.dasc"
6138 } else {
6139 //| jge =>BC_JLOOP
6140 dasm_put(Dst, 15442, BC_JLOOP);
6141#line 4377 "vm_x64.dasc"
6142 }
6143 //| jmp <6
6144 //|9: // Fallback to FP variant.
6145 dasm_put(Dst, 15451);
6146#line 4380 "vm_x64.dasc"
6147 if (!vk) {
6148 //| jae ->vmeta_for
6149 dasm_put(Dst, 15458);
6150#line 4382 "vm_x64.dasc"
6151 }
6152 } else if (!vk) {
6153 //| checknumtp FOR_IDX, ->vmeta_for
6154 dasm_put(Dst, 15463, LJ_TISNUM);
6155#line 4385 "vm_x64.dasc"
6156 }
6157 if (!vk) {
6158 //| checknumtp FOR_STOP, ->vmeta_for
6159 dasm_put(Dst, 15481, LJ_TISNUM);
6160#line 4388 "vm_x64.dasc"
6161 } else {
6162#ifdef LUA_USE_ASSERT
6163 //| checknumtp FOR_STOP, ->assert_bad_for_arg_type
6164 //| checknumtp FOR_STEP, ->assert_bad_for_arg_type
6165 dasm_put(Dst, 15500, LJ_TISNUM, LJ_TISNUM);
6166#line 4392 "vm_x64.dasc"
6167#endif
6168 }
6169 //| mov RB, FOR_STEP
6170 dasm_put(Dst, 15537);
6171#line 4395 "vm_x64.dasc"
6172 if (!vk) {
6173 //| checknum RB, ->vmeta_for
6174 dasm_put(Dst, 15542, LJ_TISNUM);
6175#line 4397 "vm_x64.dasc"
6176 }
6177 //| movsd xmm0, qword FOR_IDX
6178 //| movsd xmm1, qword FOR_STOP
6179 dasm_put(Dst, 15561);
6180#line 4400 "vm_x64.dasc"
6181 if (vk) {
6182 //| addsd xmm0, qword FOR_STEP
6183 //| movsd qword FOR_IDX, xmm0
6184 //| test RB, RB; js >3
6185 dasm_put(Dst, 15573);
6186#line 4404 "vm_x64.dasc"
6187 } else {
6188 //| jl >3
6189 dasm_put(Dst, 15593);
6190#line 4406 "vm_x64.dasc"
6191 }
6192 //| ucomisd xmm1, xmm0
6193 //|1:
6194 //| movsd qword FOR_EXT, xmm0
6195 dasm_put(Dst, 15598);
6196#line 4410 "vm_x64.dasc"
6197 if (op == BC_FORI) {
6198 //|.if DUALNUM
6199 //| jnb <7
6200 //|.else
6201 //| jnb >2
6202 //| branchPC RD
6203 //|.endif
6204 dasm_put(Dst, 15611, -BCBIAS_J*4);
6205#line 4417 "vm_x64.dasc"
6206 } else if (op == BC_JFORI) {
6207 //| branchPC RD
6208 //| movzx RDd, PC_RD
6209 //| jnb =>BC_JLOOP
6210 dasm_put(Dst, 15622, -BCBIAS_J*4, BC_JLOOP);
6211#line 4421 "vm_x64.dasc"
6212 } else if (op == BC_IFORL) {
6213 //|.if DUALNUM
6214 //| jb <7
6215 //|.else
6216 //| jb >2
6217 //| branchPC RD
6218 //|.endif
6219 dasm_put(Dst, 15637, -BCBIAS_J*4);
6220#line 4428 "vm_x64.dasc"
6221 } else {
6222 //| jnb =>BC_JLOOP
6223 dasm_put(Dst, 15633, BC_JLOOP);
6224#line 4430 "vm_x64.dasc"
6225 }
6226 //|.if DUALNUM
6227 //| jmp <6
6228 //|.else
6229 //|2:
6230 //| ins_next
6231 //|.endif
6232 //|
6233 //|3: // Invert comparison if step is negative.
6234 //| ucomisd xmm0, xmm1
6235 //| jmp <1
6236 dasm_put(Dst, 15648);
6237#line 4441 "vm_x64.dasc"
6238 break;
6239
6240 case BC_ITERL:
6241 //|.if JIT
6242 //| hotloop RBd
6243 //|.endif
6244 //| // Fall through. Assumes BC_IITERL follows and ins_AJ is a no-op.
6245 dasm_put(Dst, 15164, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
6246#line 4448 "vm_x64.dasc"
6247 break;
6248
6249 case BC_JITERL:
6250#if !LJ_HASJIT
6251 break;
6252#endif
6253 case BC_IITERL:
6254 //| ins_AJ // RA = base, RD = target
6255 //| lea RA, [BASE+RA*8]
6256 //| mov RB, [RA]
6257 //| cmp RB, LJ_TNIL; je >1 // Stop if iterator returned nil.
6258 dasm_put(Dst, 15682, LJ_TNIL);
6259#line 4459 "vm_x64.dasc"
6260 if (op == BC_JITERL) {
6261 //| mov [RA-8], RB
6262 //| jmp =>BC_JLOOP
6263 dasm_put(Dst, 15699, BC_JLOOP);
6264#line 4462 "vm_x64.dasc"
6265 } else {
6266 //| branchPC RD // Otherwise save control var + branch.
6267 //| mov [RA-8], RB
6268 dasm_put(Dst, 15708, -BCBIAS_J*4);
6269#line 4465 "vm_x64.dasc"
6270 }
6271 //|1:
6272 //| ins_next
6273 dasm_put(Dst, 9816);
6274#line 4468 "vm_x64.dasc"
6275 break;
6276
6277 case BC_LOOP:
6278 //| ins_A // RA = base, RD = target (loop extent)
6279 //| // Note: RA/RD is only used by trace recorder to determine scope/extent
6280 //| // This opcode does NOT jump, it's only purpose is to detect a hot loop.
6281 //|.if JIT
6282 //| hotloop RBd
6283 //|.endif
6284 //| // Fall through. Assumes BC_ILOOP follows and ins_A is a no-op.
6285 dasm_put(Dst, 15164, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
6286#line 4478 "vm_x64.dasc"
6287 break;
6288
6289 case BC_ILOOP:
6290 //| ins_A // RA = base, RD = target (loop extent)
6291 //| ins_next
6292 dasm_put(Dst, 9818);
6293#line 4483 "vm_x64.dasc"
6294 break;
6295
6296 case BC_JLOOP:
6297 //|.if JIT
6298 //| ins_AD // RA = base (ignored), RD = traceno
6299 //| mov RA, [DISPATCH+DISPATCH_J(trace)]
6300 //| mov TRACE:RD, [RA+RD*8]
6301 //| mov RD, TRACE:RD->mcode
6302 //| mov L:RB, SAVE_L
6303 //| mov [DISPATCH+DISPATCH_GL(jit_base)], BASE
6304 //| mov [DISPATCH+DISPATCH_GL(tmpbuf.L)], L:RB
6305 //| // Save additional callee-save registers only used in compiled code.
6306 //|.if X64WIN
6307 //| mov CSAVE_4, r12
6308 //| mov CSAVE_3, r13
6309 //| mov CSAVE_2, r14
6310 //| mov CSAVE_1, r15
6311 //| mov RA, rsp
6312 //| sub rsp, 10*16+4*8
6313 //| movdqa [RA-1*16], xmm6
6314 //| movdqa [RA-2*16], xmm7
6315 //| movdqa [RA-3*16], xmm8
6316 //| movdqa [RA-4*16], xmm9
6317 //| movdqa [RA-5*16], xmm10
6318 //| movdqa [RA-6*16], xmm11
6319 //| movdqa [RA-7*16], xmm12
6320 //| movdqa [RA-8*16], xmm13
6321 //| movdqa [RA-9*16], xmm14
6322 //| movdqa [RA-10*16], xmm15
6323 //|.else
6324 //| sub rsp, 16
6325 //| mov [rsp+16], r12
6326 //| mov [rsp+8], r13
6327 //|.endif
6328 //| jmp RD
6329 //|.endif
6330 dasm_put(Dst, 15720, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(tmpbuf.L));
6331#line 4519 "vm_x64.dasc"
6332 break;
6333
6334 case BC_JMP:
6335 //| ins_AJ // RA = unused, RD = target
6336 //| branchPC RD
6337 //| ins_next
6338 dasm_put(Dst, 15764, -BCBIAS_J*4);
6339#line 4525 "vm_x64.dasc"
6340 break;
6341
6342 /* -- Function headers -------------------------------------------------- */
6343
6344 /*
6345 ** Reminder: A function may be called with func/args above L->maxstack,
6346 ** i.e. occupying EXTRA_STACK slots. And vmeta_call may add one extra slot,
6347 ** too. This means all FUNC* ops (including fast functions) must check
6348 ** for stack overflow _before_ adding more slots!
6349 */
6350
6351 case BC_FUNCF:
6352 //|.if JIT
6353 //| hotcall RBd
6354 //|.endif
6355 dasm_put(Dst, 15792, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
6356#line 4540 "vm_x64.dasc"
6357 case BC_FUNCV: /* NYI: compiled vararg functions. */
6358 //| // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow and ins_AD is a no-op.
6359 break;
6360
6361 case BC_JFUNCF:
6362#if !LJ_HASJIT
6363 break;
6364#endif
6365 case BC_IFUNCF:
6366 //| ins_AD // BASE = new base, RA = framesize, RD = nargs+1
6367 //| mov KBASE, [PC-4+PC2PROTO(k)]
6368 //| mov L:RB, SAVE_L
6369 //| lea RA, [BASE+RA*8] // Top of frame.
6370 //| cmp RA, L:RB->maxstack
6371 //| ja ->vm_growstack_f
6372 //| movzx RAd, byte [PC-4+PC2PROTO(numparams)]
6373 //| cmp NARGS:RDd, RAd // Check for missing parameters.
6374 //| jbe >3
6375 //|2:
6376 dasm_put(Dst, 15813, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
6377#line 4559 "vm_x64.dasc"
6378 if (op == BC_JFUNCF) {
6379 //| movzx RDd, PC_RD
6380 //| jmp =>BC_JLOOP
6381 dasm_put(Dst, 15847, BC_JLOOP);
6382#line 4562 "vm_x64.dasc"
6383 } else {
6384 //| ins_next
6385 dasm_put(Dst, 9818);
6386#line 4564 "vm_x64.dasc"
6387 }
6388 //|
6389 //|3: // Clear missing parameters.
6390 //| mov aword [BASE+NARGS:RD*8-8], LJ_TNIL
6391 //| add NARGS:RDd, 1
6392 //| cmp NARGS:RDd, RAd
6393 //| jbe <3
6394 //| jmp <2
6395 dasm_put(Dst, 15856, LJ_TNIL);
6396#line 4572 "vm_x64.dasc"
6397 break;
6398
6399 case BC_JFUNCV:
6400#if !LJ_HASJIT
6401 break;
6402#endif
6403 //| int3 // NYI: compiled vararg functions
6404 dasm_put(Dst, 9328);
6405#line 4579 "vm_x64.dasc"
6406 break; /* NYI: compiled vararg functions. */
6407
6408 case BC_IFUNCV:
6409 //| ins_AD // BASE = new base, RA = framesize, RD = nargs+1
6410 //| lea RBd, [NARGS:RD*8+FRAME_VARG+8]
6411 //| lea RD, [BASE+NARGS:RD*8+8]
6412 //| mov LFUNC:KBASE, [BASE-16]
6413 //| mov [RD-8], RB // Store delta + FRAME_VARG.
6414 //| mov [RD-16], LFUNC:KBASE // Store copy of LFUNC.
6415 //| mov L:RB, SAVE_L
6416 //| lea RA, [RD+RA*8]
6417 //| cmp RA, L:RB->maxstack
6418 //| ja ->vm_growstack_v // Need to grow stack.
6419 //| mov RA, BASE
6420 //| mov BASE, RD
6421 //| movzx RBd, byte [PC-4+PC2PROTO(numparams)]
6422 //| test RBd, RBd
6423 //| jz >2
6424 //| add RA, 8
6425 //|1: // Copy fixarg slots up to new frame.
6426 //| add RA, 8
6427 //| cmp RA, BASE
6428 //| jnb >3 // Less args than parameters?
6429 //| mov KBASE, [RA-16]
6430 //| mov [RD], KBASE
6431 //| add RD, 8
6432 //| mov aword [RA-16], LJ_TNIL // Clear old fixarg slot (help the GC).
6433 //| sub RBd, 1
6434 //| jnz <1
6435 //|2:
6436 dasm_put(Dst, 15879, FRAME_VARG+8, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
6437#line 4609 "vm_x64.dasc"
6438 if (op == BC_JFUNCV) {
6439 //| movzx RDd, PC_RD
6440 //| jmp =>BC_JLOOP
6441 dasm_put(Dst, 15847, BC_JLOOP);
6442#line 4612 "vm_x64.dasc"
6443 } else {
6444 //| mov KBASE, [PC-4+PC2PROTO(k)]
6445 //| ins_next
6446 dasm_put(Dst, 15983, -4+PC2PROTO(k));
6447#line 4615 "vm_x64.dasc"
6448 }
6449 //|
6450 //|3: // Clear missing parameters.
6451 //| mov aword [RD], LJ_TNIL
6452 //| add RD, 8
6453 //| sub RBd, 1
6454 //| jnz <3
6455 //| jmp <2
6456 dasm_put(Dst, 16009, LJ_TNIL);
6457#line 4623 "vm_x64.dasc"
6458 break;
6459
6460 case BC_FUNCC:
6461 case BC_FUNCCW:
6462 //| ins_AD // BASE = new base, RA = ins RA|RD (unused), RD = nargs+1
6463 //| mov CFUNC:RB, [BASE-16]
6464 //| cleartp CFUNC:RB
6465 //| mov KBASE, CFUNC:RB->f
6466 //| mov L:RB, SAVE_L
6467 //| lea RD, [BASE+NARGS:RD*8-8]
6468 //| mov L:RB->base, BASE
6469 //| lea RA, [RD+8*LUA_MINSTACK]
6470 //| cmp RA, L:RB->maxstack
6471 //| mov L:RB->top, RD
6472 dasm_put(Dst, 16032, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
6473#line 4637 "vm_x64.dasc"
6474 if (op == BC_FUNCC) {
6475 //| mov CARG1, L:RB // Caveat: CARG1 may be RA.
6476 dasm_put(Dst, 16078);
6477#line 4639 "vm_x64.dasc"
6478 } else {
6479 //| mov CARG2, KBASE
6480 //| mov CARG1, L:RB // Caveat: CARG1 may be RA.
6481 dasm_put(Dst, 16083);
6482#line 4642 "vm_x64.dasc"
6483 }
6484 //| ja ->vm_growstack_c // Need to grow stack.
6485 //| set_vmstate C
6486 dasm_put(Dst, 16092, DISPATCH_GL(vmstate), ~LJ_VMST_C);
6487#line 4645 "vm_x64.dasc"
6488 if (op == BC_FUNCC) {
6489 //| call KBASE // (lua_State *L)
6490 dasm_put(Dst, 16102);
6491#line 4647 "vm_x64.dasc"
6492 } else {
6493 //| // (lua_State *L, lua_CFunction f)
6494 //| call aword [DISPATCH+DISPATCH_GL(wrapf)]
6495 dasm_put(Dst, 16107, DISPATCH_GL(wrapf));
6496#line 4650 "vm_x64.dasc"
6497 }
6498 //| // nresults returned in eax (RD).
6499 //| mov BASE, L:RB->base
6500 //| mov [DISPATCH+DISPATCH_GL(cur_L)], L:RB
6501 //| set_vmstate INTERP
6502 //| lea RA, [BASE+RD*8]
6503 //| neg RA
6504 //| add RA, L:RB->top // RA = (L->top-(L->base+nresults))*8
6505 //| mov PC, [BASE-8] // Fetch PC of caller.
6506 //| jmp ->vm_returnc
6507 dasm_put(Dst, 16113, Dt1(->base), DISPATCH_GL(cur_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->top));
6508#line 4660 "vm_x64.dasc"
6509 break;
6510
6511 /* ---------------------------------------------------------------------- */
6512
6513 default:
6514 fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]);
6515 exit(2);
6516 break;
6517 }
6518}
6519
6520static int build_backend(BuildCtx *ctx)
6521{
6522 int op;
6523 dasm_growpc(Dst, BC__MAX);
6524 build_subroutines(ctx);
6525 //|.code_op
6526 dasm_put(Dst, 16148);
6527#line 4677 "vm_x64.dasc"
6528 for (op = 0; op < BC__MAX; op++)
6529 build_ins(ctx, (BCOp)op, op);
6530 return BC__MAX;
6531}
6532
6533/* Emit pseudo frame-info for all assembler functions. */
6534static void emit_asm_debug(BuildCtx *ctx)
6535{
6536 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
6537 switch (ctx->mode) {
6538 case BUILD_elfasm:
6539 fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n");
6540 fprintf(ctx->fp,
6541 ".Lframe0:\n"
6542 "\t.long .LECIE0-.LSCIE0\n"
6543 ".LSCIE0:\n"
6544 "\t.long 0xffffffff\n"
6545 "\t.byte 0x1\n"
6546 "\t.string \"\"\n"
6547 "\t.uleb128 0x1\n"
6548 "\t.sleb128 -8\n"
6549 "\t.byte 0x10\n"
6550 "\t.byte 0xc\n\t.uleb128 0x7\n\t.uleb128 8\n"
6551 "\t.byte 0x80+0x10\n\t.uleb128 0x1\n"
6552 "\t.align 8\n"
6553 ".LECIE0:\n\n");
6554 fprintf(ctx->fp,
6555 ".LSFDE0:\n"
6556 "\t.long .LEFDE0-.LASFDE0\n"
6557 ".LASFDE0:\n"
6558 "\t.long .Lframe0\n"
6559 "\t.quad .Lbegin\n"
6560 "\t.quad %d\n"
6561 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
6562 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6563 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6564 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
6565 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
6566#if LJ_NO_UNWIND
6567 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
6568 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
6569#endif
6570 "\t.align 8\n"
6571 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
6572#if LJ_HASFFI
6573 fprintf(ctx->fp,
6574 ".LSFDE1:\n"
6575 "\t.long .LEFDE1-.LASFDE1\n"
6576 ".LASFDE1:\n"
6577 "\t.long .Lframe0\n"
6578 "\t.quad lj_vm_ffi_call\n"
6579 "\t.quad %d\n"
6580 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
6581 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6582 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
6583 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6584 "\t.align 8\n"
6585 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
6586#endif
6587#if !LJ_NO_UNWIND
6588#if LJ_TARGET_SOLARIS
6589 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
6590#else
6591 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
6592#endif
6593 fprintf(ctx->fp,
6594 ".Lframe1:\n"
6595 "\t.long .LECIE1-.LSCIE1\n"
6596 ".LSCIE1:\n"
6597 "\t.long 0\n"
6598 "\t.byte 0x1\n"
6599 "\t.string \"zPR\"\n"
6600 "\t.uleb128 0x1\n"
6601 "\t.sleb128 -8\n"
6602 "\t.byte 0x10\n"
6603 "\t.uleb128 6\n" /* augmentation length */
6604 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6605 "\t.long lj_err_unwind_dwarf-.\n"
6606 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6607 "\t.byte 0xc\n\t.uleb128 0x7\n\t.uleb128 8\n"
6608 "\t.byte 0x80+0x10\n\t.uleb128 0x1\n"
6609 "\t.align 8\n"
6610 ".LECIE1:\n\n");
6611 fprintf(ctx->fp,
6612 ".LSFDE2:\n"
6613 "\t.long .LEFDE2-.LASFDE2\n"
6614 ".LASFDE2:\n"
6615 "\t.long .LASFDE2-.Lframe1\n"
6616 "\t.long .Lbegin-.\n"
6617 "\t.long %d\n"
6618 "\t.uleb128 0\n" /* augmentation length */
6619 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
6620 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6621 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6622 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
6623 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
6624 "\t.align 8\n"
6625 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
6626#if LJ_HASFFI
6627 fprintf(ctx->fp,
6628 ".Lframe2:\n"
6629 "\t.long .LECIE2-.LSCIE2\n"
6630 ".LSCIE2:\n"
6631 "\t.long 0\n"
6632 "\t.byte 0x1\n"
6633 "\t.string \"zR\"\n"
6634 "\t.uleb128 0x1\n"
6635 "\t.sleb128 -8\n"
6636 "\t.byte 0x10\n"
6637 "\t.uleb128 1\n" /* augmentation length */
6638 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6639 "\t.byte 0xc\n\t.uleb128 0x7\n\t.uleb128 8\n"
6640 "\t.byte 0x80+0x10\n\t.uleb128 0x1\n"
6641 "\t.align 8\n"
6642 ".LECIE2:\n\n");
6643 fprintf(ctx->fp,
6644 ".LSFDE3:\n"
6645 "\t.long .LEFDE3-.LASFDE3\n"
6646 ".LASFDE3:\n"
6647 "\t.long .LASFDE3-.Lframe2\n"
6648 "\t.long lj_vm_ffi_call-.\n"
6649 "\t.long %d\n"
6650 "\t.uleb128 0\n" /* augmentation length */
6651 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
6652 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6653 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
6654 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6655 "\t.align 8\n"
6656 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
6657#endif
6658#endif
6659 break;
6660#if !LJ_NO_UNWIND
6661 /* Mental note: never let Apple design an assembler.
6662 ** Or a linker. Or a plastic case. But I digress.
6663 */
6664 case BUILD_machasm: {
6665#if LJ_HASFFI
6666 int fcsize = 0;
6667#endif
6668 int i;
6669 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
6670 fprintf(ctx->fp,
6671 "EH_frame1:\n"
6672 "\t.set L$set$x,LECIEX-LSCIEX\n"
6673 "\t.long L$set$x\n"
6674 "LSCIEX:\n"
6675 "\t.long 0\n"
6676 "\t.byte 0x1\n"
6677 "\t.ascii \"zPR\\0\"\n"
6678 "\t.byte 0x1\n"
6679 "\t.byte 128-8\n"
6680 "\t.byte 0x10\n"
6681 "\t.byte 6\n" /* augmentation length */
6682 "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */
6683 "\t.long _lj_err_unwind_dwarf+4@GOTPCREL\n"
6684 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6685 "\t.byte 0xc\n\t.byte 0x7\n\t.byte 8\n"
6686 "\t.byte 0x80+0x10\n\t.byte 0x1\n"
6687 "\t.align 3\n"
6688 "LECIEX:\n\n");
6689 for (i = 0; i < ctx->nsym; i++) {
6690 const char *name = ctx->sym[i].name;
6691 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
6692 if (size == 0) continue;
6693#if LJ_HASFFI
6694 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
6695#endif
6696 fprintf(ctx->fp,
6697 "%s.eh:\n"
6698 "LSFDE%d:\n"
6699 "\t.set L$set$%d,LEFDE%d-LASFDE%d\n"
6700 "\t.long L$set$%d\n"
6701 "LASFDE%d:\n"
6702 "\t.long LASFDE%d-EH_frame1\n"
6703 "\t.long %s-.\n"
6704 "\t.long %d\n"
6705 "\t.byte 0\n" /* augmentation length */
6706 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
6707 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
6708 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
6709 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
6710 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
6711 "\t.align 3\n"
6712 "LEFDE%d:\n\n",
6713 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
6714 }
6715#if LJ_HASFFI
6716 if (fcsize) {
6717 fprintf(ctx->fp,
6718 "EH_frame2:\n"
6719 "\t.set L$set$y,LECIEY-LSCIEY\n"
6720 "\t.long L$set$y\n"
6721 "LSCIEY:\n"
6722 "\t.long 0\n"
6723 "\t.byte 0x1\n"
6724 "\t.ascii \"zR\\0\"\n"
6725 "\t.byte 0x1\n"
6726 "\t.byte 128-8\n"
6727 "\t.byte 0x10\n"
6728 "\t.byte 1\n" /* augmentation length */
6729 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6730 "\t.byte 0xc\n\t.byte 0x7\n\t.byte 8\n"
6731 "\t.byte 0x80+0x10\n\t.byte 0x1\n"
6732 "\t.align 3\n"
6733 "LECIEY:\n\n");
6734 fprintf(ctx->fp,
6735 "_lj_vm_ffi_call.eh:\n"
6736 "LSFDEY:\n"
6737 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
6738 "\t.long L$set$yy\n"
6739 "LASFDEY:\n"
6740 "\t.long LASFDEY-EH_frame2\n"
6741 "\t.long _lj_vm_ffi_call-.\n"
6742 "\t.long %d\n"
6743 "\t.byte 0\n" /* augmentation length */
6744 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
6745 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
6746 "\t.byte 0xd\n\t.byte 0x6\n" /* def_cfa_register rbp */
6747 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
6748 "\t.align 3\n"
6749 "LEFDEY:\n\n", fcsize);
6750 }
6751#endif
6752 fprintf(ctx->fp, ".subsections_via_symbols\n");
6753 }
6754 break;
6755#endif
6756 default: /* Difficult for other modes. */
6757 break;
6758 }
6759}
6760
6761