DEADSOFTWARE

Добавлены локальные объявления
[dsw-obn.git] / generator.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdarg.h>
4 #include <ctype.h>
5 #include <string.h>
6 #include <assert.h>
7
8 #include "oberon.h"
9 #include "generator.h"
10
11 static void printcontext(oberon_context_t * ctx, char * s)
12 {
13 /*
14 gen_context_t * gen_context = ctx -> gen_context;
15 gcc_jit_context * gcc_context = gen_context -> gcc_context;
16 gcc_jit_block * gcc_block = gen_context -> gcc_block;
17
18 printf("%s:\n", s);
19 printf(" ctx = %p:\n", ctx);
20 printf(" gctx = %p:\n", gctx);
21 printf(" context = %p:\n", context);
22 printf(" block = %p:\n", block);
23 */
24 }
25
26 // =======================================================================
27 // ALLOC
28 // =======================================================================
29
30 static void
31 oberon_generator_open_block(gen_context_t * gen_context, gcc_jit_block * gcc_block)
32 {
33 gen_block_t * block = malloc(sizeof *block);
34 memset(block, 0, sizeof *block);
35
36 block -> gcc_block = gcc_block;
37 block -> up = gen_context -> block;
38
39 gen_context -> block = block;
40 }
41
42 static void
43 oberon_generator_close_block(gen_context_t * gen_context)
44 {
45 gen_context -> block = gen_context -> block -> up;
46 }
47
48 void
49 oberon_generator_init_context(oberon_context_t * ctx)
50 {
51 gen_context_t * gen_context = malloc(sizeof *gen_context);
52 memset(gen_context, 0, sizeof *gen_context);
53
54 gcc_jit_context * gcc_context;
55 gcc_context = gcc_jit_context_acquire();
56
57 ctx -> gen_context = gen_context;
58 gen_context -> gcc_context = gcc_context;
59
60 printcontext(ctx, "oberon_generator_init_context");
61 }
62
63 void
64 oberon_generator_destroy_context(oberon_context_t * ctx)
65 {
66 printcontext(ctx, "oberon_generator_destroy_context");
67
68 gen_context_t * gen_context = ctx -> gen_context;
69 gcc_jit_context * gcc_context = gen_context -> gcc_context;
70
71 gcc_jit_context_release(gcc_context);
72 }
73
74 void
75 oberon_generator_init_type(oberon_context_t * ctx, oberon_type_t * type)
76 {
77 gen_type_t * gen_type = malloc(sizeof *gen_type);
78 memset(gen_type, 0, sizeof *gen_type);
79 type -> gen_type = gen_type;
80
81 gen_context_t * gen_context = ctx -> gen_context;
82 gcc_jit_context * gcc_context = gen_context -> gcc_context;
83
84 gcc_jit_type * gcc_type = NULL;
85 gcc_jit_struct * gcc_struct = NULL;
86 if(type -> class == OBERON_TYPE_VOID)
87 {
88 gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_VOID);
89 }
90 else if(type -> class == OBERON_TYPE_INTEGER)
91 {
92 gcc_type = gcc_jit_context_get_int_type(gcc_context, type -> size, 1);
93 }
94 else if(type -> class == OBERON_TYPE_BOOLEAN)
95 {
96 gcc_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_BOOL);
97 }
98 else if(type -> class == OBERON_TYPE_ARRAY)
99 {
100 gen_type_t * gen_base = type -> base -> gen_type;
101 gcc_jit_type * gcc_base = gen_base -> gcc_type;
102 gcc_type = gcc_jit_context_new_array_type(gcc_context, NULL, gcc_base, type -> size);
103 }
104 else if(type -> class == OBERON_TYPE_RECORD)
105 {
106 gcc_struct = gcc_jit_context_new_opaque_struct(gcc_context, NULL, "");
107 gcc_type = gcc_jit_struct_as_type(gcc_struct);
108 }
109 else if(type -> class == OBERON_TYPE_POINTER)
110 {
111 gen_type_t * gen_base = type -> base -> gen_type;
112 gcc_jit_type * gcc_base = gen_base -> gcc_type;
113 gcc_type = gcc_jit_type_get_pointer(gcc_base);
114 }
115 else if(type -> class == OBERON_TYPE_PROCEDURE)
116 {
117 int num_params = type -> num_decl;
118 gcc_jit_type * params[num_params];
119 oberon_object_t * o = type -> decl;
120 for(int i = 0; i < num_params; i++)
121 {
122 gen_type_t * gen_type = o -> type -> gen_type;
123 params[i] = gen_type -> gcc_type;
124 o = o -> next;
125 }
126
127 gen_type_t * base = type -> base -> gen_type;
128 gcc_jit_type * result_type = base -> gcc_type;
129
130 gcc_type = gcc_jit_context_new_function_ptr_type(
131 gcc_context, NULL, result_type, num_params, params, 0
132 );
133 }
134 else
135 {
136 oberon_error(ctx, "oberon_generator_init_type: invalid type class %i", type -> class);
137 }
138
139 assert(gcc_type);
140 gen_type -> gcc_type = gcc_type;
141 gen_type -> gcc_struct = gcc_struct;
142 }
143
144 void
145 oberon_generator_init_record(oberon_context_t * ctx, oberon_type_t * type)
146 {
147 assert(type -> class == OBERON_TYPE_RECORD);
148
149 gen_type_t * gen_type = type -> gen_type;
150 gcc_jit_struct * gcc_struct = gen_type -> gcc_struct;
151
152 // TODO type exstension
153
154 int num_fields = type -> num_decl;
155 gcc_jit_field * fields[num_fields];
156 oberon_object_t * o = type -> decl;
157 for(int i = 0; i < num_fields; i++)
158 {
159 assert(o -> class == OBERON_CLASS_FIELD);
160 gen_var_t * var = o -> gen_var;
161 fields[i] = var -> gcc_field;
162 o = o -> next;
163 }
164
165 gcc_jit_struct_set_fields (gcc_struct, NULL, num_fields, fields);
166
167 //gcc_struct = gcc_jit_context_new_struct_type(gcc_context, NULL, "", num_fields, fields);
168 }
169
170 void
171 oberon_generator_init_var(oberon_context_t * ctx, oberon_object_t * var)
172 {
173 gen_context_t * gen_context = ctx -> gen_context;
174 gen_type_t * gen_type = var -> type -> gen_type;
175
176 gen_var_t * gen_var = malloc(sizeof *gen_var);
177 memset(gen_var, 0, sizeof *gen_var);
178 var -> gen_var = gen_var;
179
180 gcc_jit_context * gcc_context = gen_context -> gcc_context;
181 gcc_jit_type * gcc_type = gen_type -> gcc_type;
182 const char * name = var -> name;
183
184 gcc_jit_lvalue * gcc_lvalue = NULL;
185 gcc_jit_param * gcc_param = NULL;
186 gcc_jit_field * gcc_field = NULL;
187 if(var -> class == OBERON_CLASS_VAR)
188 {
189 if(var -> local)
190 {
191 gen_proc_t * gen_func = var -> parent -> gen_proc;
192 gcc_jit_function * func = gen_func -> gcc_func;
193
194 gcc_lvalue = gcc_jit_function_new_local(func, NULL, gcc_type, name);
195 }
196 else
197 {
198 gcc_lvalue = gcc_jit_context_new_global(
199 gcc_context, NULL, GCC_JIT_GLOBAL_INTERNAL, gcc_type, name
200 );
201 }
202 }
203 else if(var -> class == OBERON_CLASS_PARAM)
204 {
205 gcc_param = gcc_jit_context_new_param(gcc_context, NULL, gcc_type, name);
206 gcc_lvalue = gcc_jit_param_as_lvalue(gcc_param);
207 }
208 else if(var -> class == OBERON_CLASS_VAR_PARAM)
209 {
210 gcc_type = gcc_jit_type_get_pointer(gcc_type);
211 gcc_param = gcc_jit_context_new_param(gcc_context, NULL, gcc_type, name);
212 gcc_lvalue = gcc_jit_param_as_lvalue(gcc_param);
213 }
214 else if(var -> class == OBERON_CLASS_FIELD)
215 {
216 gcc_field = gcc_jit_context_new_field(gcc_context, NULL, gcc_type, name);
217 }
218 else
219 {
220 oberon_error(ctx, "oberon_generator_init_var: invalid class %i", var -> class);
221 }
222
223 gen_var -> gcc_lvalue = gcc_lvalue;
224 gen_var -> gcc_param = gcc_param;
225 gen_var -> gcc_field = gcc_field;
226 }
227
228 void
229 oberon_generator_init_proc(oberon_context_t * ctx, oberon_object_t * proc)
230 {
231 if(proc -> local)
232 {
233 oberon_error(ctx, "generator: local procedures not supported");
234 }
235
236 gen_context_t * gen_context = ctx -> gen_context;
237 gcc_jit_context * gcc_context = gen_context -> gcc_context;
238
239 gen_proc_t * gen_proc = malloc(sizeof *gen_proc);
240 memset(gen_proc, 0, sizeof *gen_proc);
241 proc -> gen_proc = gen_proc;
242
243 const char * name = proc -> name;
244 gen_type_t * gen_result_type = proc -> type -> base -> gen_type;
245 gcc_jit_type * result_type = gen_result_type -> gcc_type;
246
247 /* Строим список параметров */
248 int num_param = proc -> type -> num_decl;
249 oberon_object_t * o = proc -> type -> decl;
250 gcc_jit_param * params[num_param];
251 for(int i = 0; i < num_param; i++)
252 {
253 gen_var_t * param_var = o -> gen_var;
254 params[i] = param_var -> gcc_param;
255 o = o -> next;
256 }
257
258 gcc_jit_function * gcc_func;
259 gcc_func = gcc_jit_context_new_function(
260 gcc_context, NULL, GCC_JIT_FUNCTION_EXPORTED, result_type, name, num_param, params, 0
261 );
262
263 gen_proc -> gcc_func = gcc_func;
264 }
265
266 // =======================================================================
267 // GENERATOR
268 // =======================================================================
269
270 static gcc_jit_rvalue * rvalue_from_item(oberon_context_t * ctx, oberon_item_t * item);
271 static gcc_jit_rvalue * rvalue_from_expr(oberon_context_t * ctx, oberon_expr_t * expr);
272
273 void
274 oberon_generate_begin_module(oberon_context_t * ctx)
275 {
276 printcontext(ctx, "oberon_generate_begin_module");
277
278 gen_context_t * gen_context = ctx -> gen_context;
279 gcc_jit_context * gcc_context = gen_context -> gcc_context;
280
281 gcc_jit_type * void_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_VOID);
282 gcc_jit_function * func = gcc_jit_context_new_function(
283 gcc_context, NULL, GCC_JIT_FUNCTION_EXPORTED, void_type, "BEGIN", 0, NULL, 0
284 );
285 gcc_jit_block * gcc_block = gcc_jit_function_new_block(func, NULL);
286
287 oberon_generator_open_block(gen_context, gcc_block);
288 }
289
290 void
291 oberon_generate_end_module(oberon_context_t * ctx)
292 {
293 printcontext(ctx, "oberon_generate_end_module");
294
295 gen_context_t * gen_context = ctx -> gen_context;
296 gcc_jit_block * gcc_block = gen_context -> block -> gcc_block;
297
298 gcc_jit_block_end_with_void_return(gcc_block, NULL);
299
300 oberon_generator_close_block(gen_context);
301 }
302
303 void
304 oberon_generate_begin_proc(oberon_context_t * ctx, oberon_object_t * proc)
305 {
306 gen_context_t * gen_context = ctx -> gen_context;
307 gen_proc_t * gen_proc = proc -> gen_proc;
308
309 gcc_jit_function * func = gen_proc -> gcc_func;
310 gcc_jit_block * gcc_block = gcc_jit_function_new_block(func, NULL);
311
312 oberon_generator_open_block(gen_context, gcc_block);
313 }
314
315 void
316 oberon_generate_call_proc(oberon_context_t * ctx, oberon_expr_t * desig)
317 {
318 gen_context_t * gen_context = ctx -> gen_context;
319 gen_block_t * gen_block = gen_context -> block;
320 gcc_jit_block * block = gen_block -> gcc_block;
321
322 gcc_jit_rvalue * return_value;
323 return_value = rvalue_from_expr(ctx, desig);
324 gcc_jit_block_add_eval(block, NULL, return_value);
325 }
326
327 void
328 oberon_generate_end_proc(oberon_context_t * ctx)
329 {
330 gen_context_t * gen_context = ctx -> gen_context;
331 oberon_generator_close_block(gen_context);
332 }
333
334 void
335 oberon_generate_return(oberon_context_t * ctx, oberon_expr_t * expr)
336 {
337 gen_context_t * gen_context = ctx -> gen_context;
338 gen_block_t * gen_block = gen_context -> block;
339 gcc_jit_block * gcc_block = gen_block -> gcc_block;
340
341 if(expr == NULL)
342 {
343 gcc_jit_block_end_with_void_return(gcc_block, NULL);
344 }
345 else
346 {
347 gcc_jit_rvalue * r = rvalue_from_expr(ctx, expr);
348 gcc_jit_block_end_with_return(gcc_block, NULL, r);
349 }
350 }
351
352 static gcc_jit_lvalue *
353 lvalue_from_item(oberon_context_t * ctx, oberon_item_t * item)
354 {
355 gen_context_t * gen_context = ctx -> gen_context;
356 gcc_jit_context * gcc_context = gen_context -> gcc_context;
357
358 gcc_jit_lvalue * left;
359
360 if(item -> mode == MODE_VAR)
361 {
362 gen_var_t * gen_var = item -> var -> gen_var;
363 left = gen_var -> gcc_lvalue;
364 if(item -> var -> class == OBERON_CLASS_VAR_PARAM)
365 {
366 gcc_jit_rvalue * r = gcc_jit_lvalue_as_rvalue(left);
367 left = gcc_jit_rvalue_dereference(r, NULL);
368 }
369 }
370 else if(item -> mode == MODE_INDEX)
371 {
372 assert(item -> num_args == 1);
373 gcc_jit_rvalue * parent = rvalue_from_item(ctx, item -> parent);
374 gcc_jit_rvalue * index = rvalue_from_expr(ctx, item -> args);
375 left = gcc_jit_context_new_array_access(gcc_context, NULL, parent, index);
376 }
377 else if(item -> mode == MODE_FIELD)
378 {
379 printf("lvalue_from_item: %s\n", item -> var -> name);
380 gen_var_t * gen_var = item -> var -> gen_var;
381 gcc_jit_field * gcc_field = gen_var -> gcc_field;
382
383 gcc_jit_lvalue * parent = lvalue_from_item(ctx, item -> parent);
384 left = gcc_jit_lvalue_access_field(parent, NULL, gcc_field);
385 }
386 else if(item -> mode == MODE_DEREF)
387 {
388 gcc_jit_rvalue * parent = rvalue_from_item(ctx, item -> parent);
389 left = gcc_jit_rvalue_dereference(parent, NULL);
390 }
391 else
392 {
393 oberon_error(ctx, "invalid lvalue expression");
394 }
395
396 return left;
397 }
398
399 static gcc_jit_lvalue *
400 lvalue_from_expr(oberon_context_t *ctx, oberon_expr_t * expr)
401 {
402 gcc_jit_lvalue * left;
403 oberon_item_t * item;
404
405 if(expr -> is_item)
406 {
407 item = (oberon_item_t *) expr;
408 left = lvalue_from_item(ctx, item);
409 }
410 else
411 {
412 oberon_error(ctx, "invalid lvalue expression");
413 }
414
415 return left;
416 }
417
418 static gcc_jit_rvalue *
419 rvalue_from_item(oberon_context_t * ctx, oberon_item_t * item)
420 {
421 gen_context_t * gen_context = ctx -> gen_context;
422 gcc_jit_context * gcc_context = gen_context -> gcc_context;
423
424 gcc_jit_rvalue * right;
425 if(item -> mode == MODE_VAR)
426 {
427 gcc_jit_lvalue * left = lvalue_from_item(ctx, item);
428 right = gcc_jit_lvalue_as_rvalue(left);
429 }
430 else if(item -> mode == MODE_INTEGER)
431 {
432 gcc_jit_type * int_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_INT);
433 right = gcc_jit_context_new_rvalue_from_int(gcc_context, int_type, item -> integer);
434 }
435 else if(item -> mode == MODE_BOOLEAN)
436 {
437 gcc_jit_type * bool_type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_BOOL);
438 if(item -> boolean)
439 {
440 right = gcc_jit_context_one(gcc_context, bool_type);
441 }
442 else
443 {
444 right = gcc_jit_context_zero(gcc_context, bool_type);
445 }
446 }
447 else if(item -> mode == MODE_CALL)
448 {
449 assert(item -> var -> class == OBERON_CLASS_PROC);
450
451 oberon_type_t * signature = item -> var -> type;
452 gen_proc_t * gen_proc = item -> var -> gen_proc;
453
454 int num_args = item -> num_args;
455 gcc_jit_rvalue *args[num_args];
456
457 oberon_expr_t * expr = item -> args;
458 oberon_object_t * arg_param = signature -> decl;
459 for(int i = 0; i < num_args; i++)
460 {
461 if(arg_param -> class == OBERON_CLASS_VAR_PARAM)
462 {
463 gcc_jit_lvalue * left = lvalue_from_expr(ctx, expr);
464 args[i] = gcc_jit_lvalue_get_address(left, NULL);
465 }
466 else
467 {
468 args[i] = rvalue_from_expr(ctx, expr);
469 }
470 expr = expr -> next;
471 arg_param = arg_param -> next;
472 }
473
474 gcc_jit_function * func = gen_proc -> gcc_func;
475 right = gcc_jit_context_new_call(
476 gcc_context, NULL, func, num_args, args
477 );
478 }
479 else if(item -> mode == MODE_INDEX)
480 {
481 gcc_jit_lvalue * left = lvalue_from_item(ctx, item);
482 right = gcc_jit_lvalue_as_rvalue(left);
483 }
484 else if(item -> mode == MODE_FIELD)
485 {
486 gen_var_t * gen_var = item -> var -> gen_var;
487 gcc_jit_field * gcc_field = gen_var -> gcc_field;
488
489 gcc_jit_rvalue * parent = rvalue_from_item(ctx, item -> parent);
490 right = gcc_jit_rvalue_access_field(parent, NULL, gcc_field);
491 }
492 else if(item -> mode == MODE_DEREF)
493 {
494 gcc_jit_lvalue * left = lvalue_from_item(ctx, item);
495 right = gcc_jit_lvalue_as_rvalue(left);
496 }
497 else if(item -> mode == MODE_NIL)
498 {
499 gcc_jit_type * type = gcc_jit_context_get_type(gcc_context, GCC_JIT_TYPE_VOID_PTR);
500 right = gcc_jit_context_null(gcc_context, type);
501 }
502 else
503 {
504 oberon_error(ctx, "rvalue_from_item: invalid mode %i", item -> mode);
505 }
506
507 return right;
508 }
509
510 struct {
511 int type; // 0 - unary, 1 - binary, 2 - comp
512 union {
513 enum gcc_jit_unary_op unary_op;
514 enum gcc_jit_binary_op binary_op;
515 enum gcc_jit_comparison comp_op;
516 };
517 } op_table[] = {
518 { 0, .unary_op = GCC_JIT_UNARY_OP_LOGICAL_NEGATE },
519 { 0, .unary_op = GCC_JIT_UNARY_OP_MINUS },
520
521 { 1, .binary_op = GCC_JIT_BINARY_OP_PLUS },
522 { 1, .binary_op = GCC_JIT_BINARY_OP_MINUS },
523 { 1, .binary_op = GCC_JIT_BINARY_OP_MULT },
524 { 1, .binary_op = GCC_JIT_BINARY_OP_DIVIDE },
525 { 1, .binary_op = GCC_JIT_BINARY_OP_MODULO },
526 { 1, .binary_op = GCC_JIT_BINARY_OP_LOGICAL_AND },
527 { 1, .binary_op = GCC_JIT_BINARY_OP_LOGICAL_OR },
528
529 { 2, .comp_op = GCC_JIT_COMPARISON_EQ },
530 { 2, .comp_op = GCC_JIT_COMPARISON_NE },
531 { 2, .comp_op = GCC_JIT_COMPARISON_LT },
532 { 2, .comp_op = GCC_JIT_COMPARISON_LE },
533 { 2, .comp_op = GCC_JIT_COMPARISON_GT },
534 { 2, .comp_op = GCC_JIT_COMPARISON_GE }
535 };
536
537 static gcc_jit_rvalue *
538 rvalue_from_operator(oberon_context_t * ctx, oberon_oper_t * operator)
539 {
540 gcc_jit_rvalue * right;
541
542 gen_context_t * gen_context = ctx -> gen_context;
543 gen_type_t * gen_type = operator -> result -> gen_type;
544 gcc_jit_context * gcc_context = gen_context -> gcc_context;
545 gcc_jit_type * result_type = gen_type -> gcc_type;
546
547 int expr_type = op_table[operator -> op].type;
548 if(expr_type == 0)
549 {
550 enum gcc_jit_unary_op op = op_table[operator -> op].unary_op;
551 gcc_jit_rvalue * l = rvalue_from_expr(ctx, operator -> left);
552 right = gcc_jit_context_new_unary_op(gcc_context, NULL, op, result_type, l);
553 }
554 else if(expr_type == 1)
555 {
556 enum gcc_jit_unary_op op = op_table[operator -> op].binary_op;
557 gcc_jit_rvalue * l = rvalue_from_expr(ctx, operator -> left);
558 gcc_jit_rvalue * r = rvalue_from_expr(ctx, operator -> right);
559 right = gcc_jit_context_new_binary_op(gcc_context, NULL, op, result_type, l, r);
560 }
561 else if(expr_type == 2)
562 {
563 enum gcc_jit_comparison op = op_table[operator -> op].comp_op;
564 gcc_jit_rvalue * l = rvalue_from_expr(ctx, operator -> left);
565 gcc_jit_rvalue * r = rvalue_from_expr(ctx, operator -> right);
566 right = gcc_jit_context_new_comparison(gcc_context, NULL, op, l, r);
567 }
568 else
569 {
570 oberon_error(ctx, "rvalue_from_operator: wat");
571 }
572
573 return right;
574 }
575
576 static gcc_jit_rvalue *
577 rvalue_from_expr(oberon_context_t * ctx, oberon_expr_t * expr)
578 {
579 gcc_jit_rvalue * right;
580
581 if(expr -> is_item)
582 {
583 oberon_item_t * item = (oberon_item_t *) expr;
584 right = rvalue_from_item(ctx, item);
585 }
586 else
587 {
588 oberon_oper_t * operator = (oberon_oper_t *) expr;
589 right = rvalue_from_operator(ctx, operator);
590 }
591
592 return right;
593 }
594
595 void
596 oberon_generate_assign(oberon_context_t * ctx, oberon_expr_t * src, oberon_expr_t * dst)
597 {
598 gcc_jit_lvalue * left;
599 left = lvalue_from_expr(ctx, dst);
600
601 gcc_jit_rvalue * right;
602 right = rvalue_from_expr(ctx, src);
603
604 if(src -> is_item)
605 {
606 if(src -> item.mode == MODE_NIL)
607 {
608 gen_context_t * gen_context = ctx -> gen_context;
609 gcc_jit_context * gcc_context = gen_context -> gcc_context;
610 gen_type_t * gen_type = dst -> result -> gen_type;
611 gcc_jit_type * cast_to_type = gen_type -> gcc_type;
612 right = gcc_jit_context_new_cast(gcc_context, NULL, right, cast_to_type);
613 }
614 }
615
616 gen_context_t * gen_context = ctx -> gen_context;
617 gen_block_t * gen_block = gen_context -> block;
618 gcc_jit_block * gcc_block = gen_block -> gcc_block;
619 gcc_jit_block_add_assignment(gcc_block, NULL, left, right);
620 }
621
622 void
623 oberon_generate_code(oberon_context_t * ctx)
624 {
625 gen_context_t * gen_context = ctx -> gen_context;
626 gcc_jit_context * gcc_context = gen_context -> gcc_context;
627
628 gcc_jit_result * gcc_result;
629 gcc_result = gcc_jit_context_compile(gcc_context);
630
631 gen_context -> gcc_result = gcc_result;
632 ctx -> mod -> begin = gcc_jit_result_get_code(gcc_result, "BEGIN");
633 }
634
635 void
636 oberon_generator_dump(oberon_context_t * ctx, char * path)
637 {
638 gen_context_t * gen_context = ctx -> gen_context;
639 gcc_jit_context * gcc_context = gen_context -> gcc_context;
640 gcc_jit_context_dump_to_file(gcc_context, path, 0);
641 }