@@ -67,7 +67,7 @@ emit_t *emit_bc_new(void) {
6767 return emit ;
6868}
6969
70- void emit_bc_set_max_num_labels (emit_t * emit , mp_uint_t max_num_labels ) {
70+ void emit_bc_set_max_num_labels (emit_t * emit , mp_uint_t max_num_labels ) {
7171 emit -> max_num_labels = max_num_labels ;
7272 emit -> label_offsets = m_new (mp_uint_t , emit -> max_num_labels );
7373}
@@ -77,7 +77,7 @@ void emit_bc_free(emit_t *emit) {
7777 m_del_obj (emit_t , emit );
7878}
7979
80- STATIC void emit_write_uint (emit_t * emit , byte * (* allocator )(emit_t * , int ), mp_uint_t val ) {
80+ STATIC void emit_write_uint (emit_t * emit , byte * (* allocator )(emit_t * , int ), mp_uint_t val ) {
8181 // We store each 7 bits in a separate byte, and that's how many bytes needed
8282 byte buf [BYTES_FOR_INT ];
8383 byte * p = buf + sizeof (buf );
@@ -86,15 +86,15 @@ STATIC void emit_write_uint(emit_t* emit, byte*(*allocator)(emit_t*, int), mp_ui
8686 * -- p = val & 0x7f ;
8787 val >>= 7 ;
8888 } while (val != 0 );
89- byte * c = allocator (emit , buf + sizeof (buf ) - p );
89+ byte * c = allocator (emit , buf + sizeof (buf ) - p );
9090 while (p != buf + sizeof (buf ) - 1 ) {
9191 * c ++ = * p ++ | 0x80 ;
9292 }
9393 * c = * p ;
9494}
9595
9696// all functions must go through this one to emit code info
97- STATIC byte * emit_get_cur_to_write_code_info (emit_t * emit , int num_bytes_to_write ) {
97+ STATIC byte * emit_get_cur_to_write_code_info (emit_t * emit , int num_bytes_to_write ) {
9898 //printf("emit %d\n", num_bytes_to_write);
9999 if (emit -> pass < MP_PASS_EMIT ) {
100100 emit -> code_info_offset += num_bytes_to_write ;
@@ -107,20 +107,20 @@ STATIC byte* emit_get_cur_to_write_code_info(emit_t* emit, int num_bytes_to_writ
107107 }
108108}
109109
110- STATIC void emit_align_code_info_to_machine_word (emit_t * emit ) {
110+ STATIC void emit_align_code_info_to_machine_word (emit_t * emit ) {
111111 emit -> code_info_offset = (emit -> code_info_offset + sizeof (mp_uint_t ) - 1 ) & (~(sizeof (mp_uint_t ) - 1 ));
112112}
113113
114- STATIC void emit_write_code_info_uint (emit_t * emit , mp_uint_t val ) {
114+ STATIC void emit_write_code_info_uint (emit_t * emit , mp_uint_t val ) {
115115 emit_write_uint (emit , emit_get_cur_to_write_code_info , val );
116116}
117117
118- STATIC void emit_write_code_info_qstr (emit_t * emit , qstr qst ) {
118+ STATIC void emit_write_code_info_qstr (emit_t * emit , qstr qst ) {
119119 emit_write_uint (emit , emit_get_cur_to_write_code_info , qst );
120120}
121121
122122#if MICROPY_ENABLE_SOURCE_LINE
123- STATIC void emit_write_code_info_bytes_lines (emit_t * emit , mp_uint_t bytes_to_skip , mp_uint_t lines_to_skip ) {
123+ STATIC void emit_write_code_info_bytes_lines (emit_t * emit , mp_uint_t bytes_to_skip , mp_uint_t lines_to_skip ) {
124124 assert (bytes_to_skip > 0 || lines_to_skip > 0 );
125125 //printf(" %d %d\n", bytes_to_skip, lines_to_skip);
126126 while (bytes_to_skip > 0 || lines_to_skip > 0 ) {
@@ -145,7 +145,7 @@ STATIC void emit_write_code_info_bytes_lines(emit_t* emit, mp_uint_t bytes_to_sk
145145#endif
146146
147147// all functions must go through this one to emit byte code
148- STATIC byte * emit_get_cur_to_write_bytecode (emit_t * emit , int num_bytes_to_write ) {
148+ STATIC byte * emit_get_cur_to_write_bytecode (emit_t * emit , int num_bytes_to_write ) {
149149 //printf("emit %d\n", num_bytes_to_write);
150150 if (emit -> pass < MP_PASS_EMIT ) {
151151 emit -> bytecode_offset += num_bytes_to_write ;
@@ -158,28 +158,28 @@ STATIC byte* emit_get_cur_to_write_bytecode(emit_t* emit, int num_bytes_to_write
158158 }
159159}
160160
161- STATIC void emit_align_bytecode_to_machine_word (emit_t * emit ) {
161+ STATIC void emit_align_bytecode_to_machine_word (emit_t * emit ) {
162162 emit -> bytecode_offset = (emit -> bytecode_offset + sizeof (mp_uint_t ) - 1 ) & (~(sizeof (mp_uint_t ) - 1 ));
163163}
164164
165- STATIC void emit_write_bytecode_byte (emit_t * emit , byte b1 ) {
166- byte * c = emit_get_cur_to_write_bytecode (emit , 1 );
165+ STATIC void emit_write_bytecode_byte (emit_t * emit , byte b1 ) {
166+ byte * c = emit_get_cur_to_write_bytecode (emit , 1 );
167167 c [0 ] = b1 ;
168168}
169169
170- STATIC void emit_write_bytecode_uint (emit_t * emit , mp_uint_t val ) {
170+ STATIC void emit_write_bytecode_uint (emit_t * emit , mp_uint_t val ) {
171171 emit_write_uint (emit , emit_get_cur_to_write_bytecode , val );
172172}
173173
174- STATIC void emit_write_bytecode_byte_byte (emit_t * emit , byte b1 , byte b2 ) {
174+ STATIC void emit_write_bytecode_byte_byte (emit_t * emit , byte b1 , byte b2 ) {
175175 assert ((b2 & (~0xff )) == 0 );
176- byte * c = emit_get_cur_to_write_bytecode (emit , 2 );
176+ byte * c = emit_get_cur_to_write_bytecode (emit , 2 );
177177 c [0 ] = b1 ;
178178 c [1 ] = b2 ;
179179}
180180
181181// Similar to emit_write_bytecode_uint(), just some extra handling to encode sign
182- STATIC void emit_write_bytecode_byte_int (emit_t * emit , byte b1 , mp_int_t num ) {
182+ STATIC void emit_write_bytecode_byte_int (emit_t * emit , byte b1 , mp_int_t num ) {
183183 emit_write_bytecode_byte (emit , b1 );
184184
185185 // We store each 7 bits in a separate byte, and that's how many bytes needed
@@ -198,27 +198,27 @@ STATIC void emit_write_bytecode_byte_int(emit_t* emit, byte b1, mp_int_t num) {
198198 * -- p = 0 ;
199199 }
200200
201- byte * c = emit_get_cur_to_write_bytecode (emit , buf + sizeof (buf ) - p );
201+ byte * c = emit_get_cur_to_write_bytecode (emit , buf + sizeof (buf ) - p );
202202 while (p != buf + sizeof (buf ) - 1 ) {
203203 * c ++ = * p ++ | 0x80 ;
204204 }
205205 * c = * p ;
206206}
207207
208- STATIC void emit_write_bytecode_byte_uint (emit_t * emit , byte b , mp_uint_t val ) {
208+ STATIC void emit_write_bytecode_byte_uint (emit_t * emit , byte b , mp_uint_t val ) {
209209 emit_write_bytecode_byte (emit , b );
210210 emit_write_uint (emit , emit_get_cur_to_write_bytecode , val );
211211}
212212
213- STATIC void emit_write_bytecode_prealigned_ptr (emit_t * emit , void * ptr ) {
213+ STATIC void emit_write_bytecode_prealigned_ptr (emit_t * emit , void * ptr ) {
214214 mp_uint_t * c = (mp_uint_t * )emit_get_cur_to_write_bytecode (emit , sizeof (mp_uint_t ));
215215 // Verify thar c is already uint-aligned
216216 assert (c == MP_ALIGN (c , sizeof (mp_uint_t )));
217217 * c = (mp_uint_t )ptr ;
218218}
219219
220220// aligns the pointer so it is friendly to GC
221- STATIC void emit_write_bytecode_byte_ptr (emit_t * emit , byte b , void * ptr ) {
221+ STATIC void emit_write_bytecode_byte_ptr (emit_t * emit , byte b , void * ptr ) {
222222 emit_write_bytecode_byte (emit , b );
223223 emit_align_bytecode_to_machine_word (emit );
224224 mp_uint_t * c = (mp_uint_t * )emit_get_cur_to_write_bytecode (emit , sizeof (mp_uint_t ));
@@ -228,19 +228,19 @@ STATIC void emit_write_bytecode_byte_ptr(emit_t* emit, byte b, void *ptr) {
228228}
229229
230230/* currently unused
231- STATIC void emit_write_bytecode_byte_uint_uint(emit_t* emit, byte b, mp_uint_t num1, mp_uint_t num2) {
231+ STATIC void emit_write_bytecode_byte_uint_uint(emit_t * emit, byte b, mp_uint_t num1, mp_uint_t num2) {
232232 emit_write_bytecode_byte(emit, b);
233233 emit_write_bytecode_byte_uint(emit, num1);
234234 emit_write_bytecode_byte_uint(emit, num2);
235235}
236236*/
237237
238- STATIC void emit_write_bytecode_byte_qstr (emit_t * emit , byte b , qstr qst ) {
238+ STATIC void emit_write_bytecode_byte_qstr (emit_t * emit , byte b , qstr qst ) {
239239 emit_write_bytecode_byte_uint (emit , b , qst );
240240}
241241
242242// unsigned labels are relative to ip following this instruction, stored as 16 bits
243- STATIC void emit_write_bytecode_byte_unsigned_label (emit_t * emit , byte b1 , mp_uint_t label ) {
243+ STATIC void emit_write_bytecode_byte_unsigned_label (emit_t * emit , byte b1 , mp_uint_t label ) {
244244 mp_uint_t bytecode_offset ;
245245 if (emit -> pass < MP_PASS_EMIT ) {
246246 bytecode_offset = 0 ;
@@ -254,14 +254,14 @@ STATIC void emit_write_bytecode_byte_unsigned_label(emit_t* emit, byte b1, mp_ui
254254}
255255
256256// signed labels are relative to ip following this instruction, stored as 16 bits, in excess
257- STATIC void emit_write_bytecode_byte_signed_label (emit_t * emit , byte b1 , mp_uint_t label ) {
257+ STATIC void emit_write_bytecode_byte_signed_label (emit_t * emit , byte b1 , mp_uint_t label ) {
258258 int bytecode_offset ;
259259 if (emit -> pass < MP_PASS_EMIT ) {
260260 bytecode_offset = 0 ;
261261 } else {
262262 bytecode_offset = emit -> label_offsets [label ] - emit -> bytecode_offset - 3 + 0x8000 ;
263263 }
264- byte * c = emit_get_cur_to_write_bytecode (emit , 3 );
264+ byte * c = emit_get_cur_to_write_bytecode (emit , 3 );
265265 c [0 ] = b1 ;
266266 c [1 ] = bytecode_offset ;
267267 c [2 ] = bytecode_offset >> 8 ;
0 commit comments