1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
|
2015-01-12 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::read_dump_file):
Add missing fclose on error-handling path.
2015-01-12 David Malcolm <dmalcolm@redhat.com>
* docs/cp/topics/expressions.rst (Global variables): Add
enum gcc_jit_global_kind param to gccjit::context::new_global.
* docs/topics/expressions.rst (Global variables): Likewise.
Document the new enum.
* docs/topics/results.rst (Compilation results): Document
globals-handling.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* dummy-frontend.c (jit_langhook_write_globals): Call into the
playback context's write_global_decls_1 and write_global_decls_2
before and after calling symtab->finalize_compilation_unit ().
* jit-playback.c: Include "debug.h".
(gcc::jit::playback::context::new_global): Add "kind" param and
use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
underlying VAR_DECL. Call varpool_node::get_create on the
VAR_DECL, and add it to m_globals.
(gcc::jit::playback::context::write_global_decls_1): New function.
(gcc::jit::playback::context::write_global_decls_2): New function.
* jit-playback.h (gcc::jit::playback::context::context): Call
create on m_globals.
(gcc::jit::playback::context::new_global): Add "kind" param.
(gcc::jit::playback::context::write_global_decls_1): New function.
(gcc::jit::playback::context::write_global_decls_2): New function.
(gcc::jit::playback::context::m_globals): New field.
* jit-recording.c (gcc::jit::recording::context::context):
Initialize m_globals.
(gcc::jit::recording::context::new_global): Add param "kind".
Add the new global to m_globals.
(gcc::jit::recording::context::dump_to_file): Dump the globals.
(gcc::jit::recording::global::replay_into): Add field m_kind.
(gcc::jit::recording::global::write_to_dump): New override.
* jit-recording.h (gcc::jit::recording::context::new_global): Add
param "kind".
(gcc::jit::recording::context::m_globals): New field.
(gcc::jit::recording::global::global): Add param kind.
(gcc::jit::recording::global::write_to_dump): New override.
(gcc::jit::recording::global::m_kind): New field.
* jit-result.c (gcc::jit::result::get_global): New function.
* jit-result.h (gcc::jit::result::get_global): New function.
* libgccjit++.h (gccjit::context::new_global): Add "kind" param.
* libgccjit.c (gcc_jit_context_new_global): Likewise.
(gcc_jit_result_get_global): New API entrypoint.
* libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
(enum gcc_jit_global_kind): New enum.
(gcc_jit_context_new_global): API change: add "kind" param.
* libgccjit.map (gcc_jit_result_get_global): New symbol.
2015-01-09 David Malcolm <dmalcolm@redhat.com>
* dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
"symtab.h", "inchash.h". Move include of "hash-set.h" much
earlier.
* jit-builtins.c: Remove redundant includes of "opts.h" and
"tree.h".
* jit-common.h: Include "hash-set.h", "input.h", "vec.h",
"double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
* jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
"statistics.h", "vec.h", "double-int.h", "real.h",
"fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
"inchash.h", "fold-const.h". Move include of "hash-set.h" to
earlier.
* jit-recording.c: Remove redundant includes of "opts.h" and
"tree.h".
2015-01-09 David Malcolm <dmalcolm@redhat.com>
* docs/cp/topics/expressions.rst (Simple expressions): Use
":c:type:" for C types. Document new overload of
gcc::jit::context::new_rvalue.
* docs/topics/expressions.rst (Simple expressions): Use
":c:type:" for C types. Document new entrypoint
gcc_jit_context_new_rvalue_from_long.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-playback.c: Within namespace gcc::jit::playback...
(context::new_rvalue_from_int): Eliminate in favor of...
(context::new_rvalue_from_const <int>): ...this.
(context::new_rvalue_from_double): Eliminate in favor of...
(context::new_rvalue_from_const <double>): ...this.
(context::new_rvalue_from_const <long>): New.
(context::new_rvalue_from_ptr): Eliminate in favor of...
(context::new_rvalue_from_const <void *>): ...this.
* jit-playback.h: Within namespace gcc::jit::playback...
(context::new_rvalue_from_int): Eliminate in favor of...
(context::new_rvalue_from_const <HOST_TYPE>): ...this.
(context::new_rvalue_from_double): Likewise.
(context::new_rvalue_from_ptr): Likewise.
* jit-recording.c: Within namespace gcc::jit::recording...
(context::new_rvalue_from_int): Eliminate.
(context::new_rvalue_from_double): Likewise.
(context::new_rvalue_from_ptr): Likewise.
(class memento_of_new_rvalue_from_const <int>):
Add explicit specialization.
(class memento_of_new_rvalue_from_const <long>):
Likewise.
(class memento_of_new_rvalue_from_const <double>):
Likewise.
(class memento_of_new_rvalue_from_const <void *>):
Likewise.
(memento_of_new_rvalue_from_int::replay_into):
Generalize into...
(memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
...this...
(memento_of_new_rvalue_from_double::replay_into):
...allowing this...
(memento_of_new_rvalue_from_ptr::replay_into):
...and this to be deleted.
(memento_of_new_rvalue_from_int::make_debug_string):
Convert to...
(memento_of_new_rvalue_from_const <int>::make_debug_string):
...this.
(memento_of_new_rvalue_from_double::make_debug_string):
Convert to...
(memento_of_new_rvalue_from_const <double>::make_debug_string):
...this.
(memento_of_new_rvalue_from_ptr::make_debug_string)
Convert to...
(memento_of_new_rvalue_from_const <void *>::make_debug_string):
...this.
(memento_of_new_rvalue_from_const <long>::make_debug_string):
New function.
* jit-recording.h: Within namespace gcc::jit::recording...
(context::new_rvalue_from_int): Eliminate.
(context::new_rvalue_from_double): Likewise.
(context::new_rvalue_from_ptr): Likewise, all in favor of...
(context::new_rvalue_from_const <HOST_TYPE>): New family of
methods.
(class memento_of_new_rvalue_from_int): Eliminate.
(class memento_of_new_rvalue_from_double): Likewise.
(class memento_of_new_rvalue_from_ptr): Likewise.
(class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
of rvalue subclasses.
* libgccjit++.h (gccjit::context::new_rvalue): New overload, for
"long".
* libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
rewriting of recording::context::new_rvalue_from_int to
recording::context::new_rvalue_from_const <int>.
(gcc_jit_context_new_rvalue_from_long): New API entrypoint.
(gcc_jit_context_new_rvalue_from_double): Update for
rewriting of recording::context::new_rvalue_from_double to
recording::context::new_rvalue_from_const <double>.
(gcc_jit_context_new_rvalue_from_ptr): Update for
rewriting of recording::context::new_rvalue_from_ptr to
recording::context::new_rvalue_from_const <void *>.
* libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
entrypoint.
* libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
2015-01-09 David Malcolm <dmalcolm@redhat.com>
PR jit/64206
* docs/internals/test-hello-world.exe.log.txt: Update, the log now
shows tempdir creation/cleanup.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
to the list of subclasses in the comment.
* jit-playback.c (gcc::jit::playback::context::context): Add a
comment clarifying when the tempdir gets cleaned up.
(gcc::jit::playback::context::compile): Pass the context's logger,
if any, to the tempdir.
(gcc::jit::playback::context::dlopen_built_dso): When creating the
gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
over ownership of the tempdir to it.
* jit-result.c: Include "jit-tempdir.h".
(gcc::jit::result::result): Add tempdir param, saving it as
m_tempdir.
(gcc::jit::result::~result): Delete m_tempdir.
* jit-result.h (gcc::jit::result::result): Add tempdir param.
(gcc::jit::result::m_tempdir): New field.
* jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
add JIT_LOG_SCOPE.
(gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
and log m_path_template and m_path_tempdir.
(gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
entry/exit, and log the unlink and rmdir calls.
* jit-tempdir.h: Include "jit-logging.h".
(class gcc::jit::tempdir): Make this be a subclass of log_user.
(gcc::jit::tempdir::tempdir): Add logger param.
* notes.txt: Update to show the two possible places where the
tempdir can be cleaned up.
2015-01-08 David Malcolm <dmalcolm@redhat.com>
* libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
comment.
2015-01-08 David Malcolm <dmalcolm@redhat.com>
* docs/topics/contexts.rst (Error-handling): Document new
entrypoint gcc_jit_context_get_last_error.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-recording.c (gcc::jit::recording::context::context):
Initialize new fields "m_last_error_str" and
"m_owns_last_error_str".
(gcc::jit::recording::context::~context): Clean up
m_last_error_str, if needed.
(gcc::jit::recording::context::add_error_va): Update
m_last_error_str and m_owns_last_error_str, freeing the old
value if appropriate.
(gcc::jit::recording::context::get_last_error): New function.
* jit-recording.h (gcc::jit::recording::context::get_last_error):
New function.
(gcc::jit::recording::context): New fields m_last_error_str and
m_owns_last_error_str.
* libgccjit.c (gcc_jit_context_get_last_error): New function.
* libgccjit.h (gcc_jit_context_get_last_error): New declaration.
* libgccjit.map (gcc_jit_context_get_last_error): New function.
2015-01-08 David Malcolm <dmalcolm@redhat.com>
* Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
* docs/internals/index.rst (Overview of code structure): Mention
gcc_jit_context_set_logfile, and embed the example logfile.
* docs/internals/test-hello-world.exe.log.txt: New file: example
of a logfile.
* docs/topics/contexts.rst (Debugging): Add documentation
for gcc_jit_context_set_logfile.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* dummy-frontend.c: Include "jit-logging.h".
(jit_langhook_init): Assert that there is an active playback
context. If it has a logger, log entry/exit to this function.
(jit_langhook_write_globals): Likewise.
* jit-common.h (gcc::jit::logger): New forward declaration.
* jit-logging.c: New file.
* jit-logging.h: New file.
* jit-playback.c: Include "jit-logging.h".
(gcc::jit::playback::context::context): Initialize the log_user
base class from the recording context's logger (if any). Use
JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::build_stmt_list): Likewise.
(gcc::jit::playback::function::postprocess): Likewise.
(gcc::jit::playback::context::compile): Likewise. Log the
entry/exit to toplev::main and toplev::finalize. Log the
fake argv passed to toplev::main.
(gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::release_mutex): Likewise.
(gcc::jit::playback::context::make_fake_args): Likewise.
(gcc::jit::playback::context::extract_any_requested_dumps):
Likewise.
(gcc::jit::playback::context::convert_to_dso): Likewise. Also,
log the arguments that the driver is invoked with.
(gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
the logger to the result object.
(gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::dump_generated_code): Likewise.
(gcc::jit::playback::context::handle_locations): Likewise.
* jit-playback.h (gcc::jit::playback::context): Make this be
a subclass of gcc::jit::log_user.
* jit-recording.c: Include "jit-logging.h".
(gcc::jit::recording::context::context: Initialize the logger to
NULL for root contexts, or to the parent's logger for child
contexts.
(gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::recording::context::replay_into): Likewise.
(gcc::jit::recording::context::disassociate_from_playback):
Likewise.
(gcc::jit::recording::context::compile): Likewise.
(recording::context::add_error_va): Likewise. Also, log the
error.
(gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
* jit-recording.h: Include "jit-logging.h".
(gcc::jit::recording::context): Make this be a subclass of
gcc::jit::log_user.
* jit-result.c: Include "jit-common.h" and "jit-logging.h".
(gcc::jit::result::result): Add logger param, recording it.
Use JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::result::get_code): Likewise.
* jit-result.h (gcc::jit::result): Make this be a subclass of
gcc::jit::log_user.
(gcc::jit::result::result): Add logger parameter.
* libgccjit++.h (gccjit::context::set_logfile): New function.
* libgccjit.c: Include "jit-logging.h".
(gcc_jit_context_acquire): Log the context.
(gcc_jit_context_release): Use JIT_LOG_FUNC to
log entry/exit from the function body, and log the context.
(gcc_jit_context_new_child_context): Likewise, logging both
contexts.
(gcc_jit_context_new_location): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_context_get_type): Likewise.
(gcc_jit_context_get_int_type): Likewise.
(gcc_jit_context_new_array_type): Likewise.
(gcc_jit_context_new_field): Likewise.
(gcc_jit_context_new_struct_type): Likewise.
(gcc_jit_context_new_opaque_struct): Likewise.
(gcc_jit_struct_set_fields): Likewise.
(gcc_jit_context_new_union_type): Likewise.
(gcc_jit_context_new_function_ptr_type): Likewise.
(gcc_jit_context_new_param): Likewise.
(gcc_jit_context_new_function): Likewise.
(gcc_jit_context_get_builtin_function): Likewise.
(gcc_jit_function_get_param): Likewise.
(gcc_jit_function_dump_to_dot): Likewise.
(gcc_jit_function_new_block): Likewise.
(gcc_jit_context_new_global): Likewise.
(gcc_jit_context_new_rvalue_from_int): Likewise.
(gcc_jit_context_zero): Likewise.
(gcc_jit_context_one): Likewise.
(gcc_jit_context_new_rvalue_from_double): Likewise.
(gcc_jit_context_new_rvalue_from_ptr): Likewise.
(gcc_jit_context_null): Likewise.
(gcc_jit_context_new_string_literal): Likewise.
(gcc_jit_context_new_unary_op): Likewise.
(gcc_jit_context_new_binary_op): Likewise.
(gcc_jit_context_new_comparison): Likewise.
(gcc_jit_context_new_call): Likewise.
(gcc_jit_context_new_call_through_ptr): Likewise.
(gcc_jit_context_new_cast): Likewise.
(gcc_jit_context_new_array_access): Likewise.
(gcc_jit_lvalue_access_field): Likewise.
(gcc_jit_rvalue_access_field): Likewise.
(gcc_jit_rvalue_dereference_field): Likewise.
(gcc_jit_rvalue_dereference): Likewise.
(gcc_jit_lvalue_get_address): Likewise.
(gcc_jit_function_new_local): Likewise.
(gcc_jit_block_add_eval): Likewise.
(gcc_jit_block_add_assignment): Likewise.
(gcc_jit_block_add_assignment_op): Likewise.
(gcc_jit_block_end_with_conditional): Likewise.
(gcc_jit_block_add_comment): Likewise.
(gcc_jit_block_end_with_jump): Likewise.
(gcc_jit_block_end_with_return): Likewise.
(gcc_jit_block_end_with_void_return): Likewise.
(gcc_jit_context_set_str_option): Likewise.
(gcc_jit_context_set_int_option): Likewise.
(gcc_jit_context_set_bool_option): Likewise.
(gcc_jit_context_enable_dump): Likewise.
(gcc_jit_context_compile): Likewise. Also log the context,
and the result.
(gcc_jit_context_dump_to_file): Likewise.
(gcc_jit_context_set_logfile): New function.
(gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_result_get_code): Likewise. Also log the fnname)
and the ptr to be returned.
(gcc_jit_result_release): Likewise. Also log the result.
* libgccjit.h: Include <stdio.h>, since we need FILE *.
(gcc_jit_context_set_logfile): New declaration.
* libgccjit.map (gcc_jit_context_set_logfile): New.
2015-01-07 David Malcolm <dmalcolm@redhat.com>
* jit-recording.h (gcc::jit::recording::type::is_void): New
virtual function.
(gcc::jit::recording::memento_of_get_type::is_void): New
function, overriding default implementation.
* libgccjit.c (gcc_jit_rvalue_dereference): Verify that
the underlying type is not "void".
2015-01-07 David Malcolm <dmalcolm@redhat.com>
* docs/topics/expressions.rst (Unary Operations): Add
GCC_JIT_UNARY_OP_ABS.
* jit-playback.c (gcc::jit::playback::context::new_unary_op):
Likewise.
* jit-recording.c (unary_op_strings): Likewise.
* libgccjit.c (gcc_jit_context_new_unary_op): Update checking
of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
* libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2015-01-07 David Malcolm <dmalcolm@redhat.com>
* jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
typo in comment.
2015-01-07 David Malcolm <dmalcolm@redhat.com>
* TODO.rst (Test suite): Remove item about running C++ testcases.
* docs/internals/index.rst (Working on the JIT library): Add
"c++" to the enabled languages in the suggested "configure"
invocation, and add a description of why this is necessary.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2015-01-07 David Malcolm <dmalcolm@redhat.com>
* docs/internals/index.rst: Update to reflect that built
testcases are now test-foo.c.exe, rather than test-foo.exe.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2015-01-05 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
2014-12-19 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::build_cast): In
case BOOLEAN_TYPE, don't assume that the source expression is
of type "int".
2014-12-19 David Malcolm <dmalcolm@redhat.com>
* jit-recording.c (gcc::jit::recording::context::context): When
copying string options from a parent context, take a copy of the
underlying buffers, rather than simply copying the pointer.
2014-12-19 David Malcolm <dmalcolm@redhat.com>
* jit-recording.c (gcc::jit::recording::context::set_str_option):
Handle NULL.
2014-12-11 David Malcolm <dmalcolm@redhat.com>
* docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
Document new function.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2014-12-10 Ulrich Drepper <drepper@gmail.com>
Minor interface cleanups of libgccjit
* jit-playback.c (convert_to_dso): Use auto_vec instead
of automatic array to build up command line.
* jit-recording.c (recording::context::set_str_option):
Make copy of the string.
(recording::context::~context): Free string options.
* jit-recording.h (recording::context): Adjust type
of m_str_options member.
* libgccjit.h: Adjust comment about
gcc_jit_context_set_str_option parameter being used after
the call.
Update comment now that all interfaces are copy strings
if necessary.
* libgccjit++.h (gccjit::context): Add set_str_option
member function.
2014-12-10 David Malcolm <dmalcolm@redhat.com>
* docs/cp/index.rst: New file.
* docs/cp/intro/index.rst: New file.
* docs/cp/intro/tutorial01.rst: New file.
* docs/cp/intro/tutorial02.rst: New file.
* docs/cp/intro/tutorial03.rst: New file.
* docs/cp/intro/tutorial04.rst: New file.
* docs/cp/topics/contexts.rst: New file.
* docs/cp/topics/expressions.rst: New file.
* docs/cp/topics/functions.rst: New file.
* docs/cp/topics/index.rst: New file.
* docs/cp/topics/locations.rst: New file.
* docs/cp/topics/objects.rst: New file.
* docs/cp/topics/results.rst: New file.
* docs/cp/topics/types.rst: New file.
* docs/examples/tut01-hello-world.cc: New file.
* docs/examples/tut02-square.c: Fix missing newline in output.
* docs/examples/tut02-square.cc: New file.
* docs/examples/tut03-sum-of-squares.cc: New file.
* docs/examples/tut04-toyvm/toyvm.cc: New file.
* docs/index.rst: Move summary to above the table of contents.
Add text about the C vs C++ APIs.
* docs/topics/contexts.rst: Fix a typo.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* docs/_build/texinfo/factorial1.png: New file.
* docs/_build/texinfo/sum-of-squares1.png: New file.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
* docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
logic for determine "funcname" to new function...
(get_function_name): ...here, adding logic to skip any leading
path from the filename.
(toyvm_function_parse): Use the filename for fn_filename, rather
than "name", so that the debugger can locate the source .toy
file.
(toyvm_function_parse): Don't fclose a NULL FILE *.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* docs/internals/index.rst (Running under valgrind): New
subsection.
(docs/_build/texinfo/libgccjit.texi): Regenerate.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
PR jit/64206
* Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
* jit-common.h (gcc::jit::tempdir): New forward decl.
* jit-playback.c: Include jit-tempdir.h.
(gcc::jit::playback::context::context): Initialize m_tempdir.
(gcc::jit::playback::context::~context): Move tempdir
cleanup to new file jit-tempdir.c
(make_tempdir_path_template): Move to new file jit-tempdir.c.
(gcc::jit::playback::context::compile): Move tempdir creation
to new tempdir object in new file jit-tempdir.c.
(gcc::jit::playback::context::make_fake_args): Get path from
tempdir object rather than from member data.
(gcc::jit::playback::context::convert_to_dso): Likewise.
(gcc::jit::playback::context::dlopen_built_dso): Likewise.
(gcc::jit::playback::context::dump_generated_code): Likewise.
(gcc::jit::playback::context::get_path_c_file): New function.
(gcc::jit::playback::context::get_path_s_file): New function.
(gcc::jit::playback::context::get_path_so_file): New function.
* jit-playback.h (gcc::jit::playback::context::get_path_c_file):
New function.
(gcc::jit::playback::context::get_path_s_file): New function.
(gcc::jit::playback::context::get_path_so_file): New function.
(gcc::jit::playback::context): Move fields "m_path_template",
"m_path_tempdir", "m_path_c_file", "m_path_s_file",
"m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
* jit-tempdir.c: New file.
* jit-tempdir.h: New file.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::compile): Acquire the
mutex here, immediately before using toplev, and release it here, on
each exit path after acquisition.
(jit_mutex): Move this variable here, from jit-recording.c.
(gcc::jit::playback::context::acquire_mutex): New function, based on
code in jit-recording.c.
(gcc::jit::playback::context::release_mutex): Likewise.
* jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
function.
(gcc::jit::playback::context::release_mutex): New function.
* jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
(gcc::jit::recording::context::compile): Move mutex-handling from
here into jit-playback.c's gcc::jit::playback::context::compile.
* notes.txt: Update to show the new locations of ACQUIRE_MUTEX
and RELEASE_MUTEX.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::compile): Move the
dlopen code into...
(gcc::jit::playback::context::dlopen_built_dso): ...this new
function.
* jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
New function.
2014-12-09 David Malcolm <dmalcolm@redhat.com>
PR jit/64166
* docs/topics/contexts.rst (Debugging): Add description of
gcc_jit_context_enable_dump.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-playback.c: Include context.h.
(class auto_argvec): New class.
(auto_argvec::~auto_argvec): New function.
(gcc::jit::playback::context::compile): Convert fake_args to be
an auto_argvec, so that it can contain dynamically-allocated
strings. Construct a vec of all requested dumps, and pass it to
make_fake_args. Extract requested dumps between the calls to
toplev::main and toplev::finalize.
(gcc::jit::playback::context::make_fake_args): Convert param
"argvec" to be a vec <char *>, and gain a "requested_dumps"
param. Convert to dynamically-allocated arg strings by converting
ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
for args that are already a copy. Add args for all requested dumps.
(gcc::jit::playback::context::extract_any_requested_dumps): New
function.
(gcc::jit::playback::context::read_dump_file): New function.
* jit-playback.h (gcc::jit::playback::context::make_fake_args):
Convert param "argvec" to be a vec <char *>, and gain a
"requested_dumps" param.
(gcc::jit::playback::context::extract_any_requested_dumps): New
function.
(gcc::jit::playback::context::read_dump_file): New function.
* jit-recording.c (gcc::jit::recording::context::enable_dump): New
function.
(gcc::jit::recording::context::get_all_requested_dumps): New
function.
* jit-recording.h (gcc::jit::recording::requested_dump): New
struct.
(gcc::jit::recording::context::enable_dump): New function.
(gcc::jit::recording::context::get_all_requested_dumps): New
function.
(gcc::jit::recording::context::m_requested_dumps): New field.
* libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
* libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
* libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
2014-12-08 David Malcolm <dmalcolm@redhat.com>
* libgccjit++.h: Indent the forward declarations of the classes to
show the inheritance hierarchy.
2014-12-08 David Malcolm <dmalcolm@redhat.com>
* notes.txt: Show the beginning and ending of
recording::context::compile vs playback::context::compile. Show
the creation and unlinking of the tempdir. Show toplev::finalize.
Move "RELEASE MUTEX" to the correct location. Show
gcc_jit_result_release, and indicate where the
dlopen/dlsym/dlclose occur.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
* docs/examples/tut02-square.c (main): Release the context
earlier, to show that this is possible. Update error-handling
to avoid a double-release of the context, and to avoid
releasing a NULL result.
* docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
* docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
* docs/topics/results.rst (gcc_jit_result): Mention that this
controls the lifetimes of machine code functions.
(gcc_jit_result_get_code): Spell out the requirements for this
to succeed, and the lifetime of the result.
(gcc_jit_result_release): Mention that this invalidates any code
that was obtained from the result.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
PR jit/64018
* docs/intro/tutorial02.rst: Spell out lifetime of generated code.
Add description of error-handling, taken in part from...
* docs/topics/contexts.rst (Error-handling): Expand, and move some
content to tutorial02.rst.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
PR jit/64020
* docs/topics/types.rst (Standard types) Add new enum values to
the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
Widen the left-hand column so that
GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-builtins.c: Include stringpool.h and jit-playback.h.
Move everything out of the gcc::jit::recording namespace into
just gcc::jit.
(struct builtin_data): Add fields "fnclass", "attr", and
"implicit_p".
(DEF_BUILTIN): Update macro so populate the new fields.
(builtins_manager::builtins_manager): Update for move out of
recording namespace. Initialize the m_attributes array.
(builtins_manager::get_builtin_function): Likewise.
(builtins_manager::get_builtin_function_by_id): New function.
(builtins_manager::make_builtin_function): Update for move out of
recording namespace. Add fix for PR jit/64020 by detecting
specific builtin ids and having them ensure that builtins for
other ids are created as necessary.
(builtins_manager::get_type): Update for move out of recording
namespace.
(builtins_manager::make_type): Likewise. Add some missing
#undefs.
(builtins_manager::make_primitive_type): Update for move out of
recording namespace. Implement the three BT_COMPLEX_ cases and
BT_DOUBLE_PTR.
(builtins_manager::make_fn_type): Update for move out of recording
namespace.
(builtins_manager::make_ptr_type): Likewise.
(builtins_manager::finish_playback): New function.
(builtins_manager::get_class): New function.
(builtins_manager::implicit_p): New function.
(builtins_manager::get_attrs_tree): Two new functions.
(builtins_manager::make_attrs_tree): New function.
* jit-builtins.h: Move everything out of the gcc::jit::recording
namespace into just gcc::jit.
(enum built_in_attribute): New.
(builtins_manager::builtins_manager): Update decl for namespace
change.
(builtins_manager::get_builtin_function): Likewise.
(builtins_manager::get_class): New.
(builtins_manager::implicit_p): New.
(builtins_manager::get_attrs_tree): Two new functions.
(builtins_manager::make_attrs_tree): New function.
(builtins_manager::finish_playback): New.
(builtins_manager::get_builtin_function_by_id): New.
(builtins_manager::make_builtin_function): Update decl for
namespace change.
(builtins_manager::get_type): Likewise.
(builtins_manager::make_type): Likewise.
(builtins_manager::make_primitive_type): Likewise.
(builtins_manager::make_fn_type): Likewise.
(builtins_manager::make_ptr_type): Likewise.
(builtins_manager): Likewise for fields. Add new field
"m_attributes".
* jit-common.h (NUM_GCC_JIT_TYPES): Update.
(builtins_manager): Update forward decl to reflect namespace
change.
* jit-playback.c: Include attribs.h and jit-builtins.h.
(gcc::jit::playback::context::get_tree_node_for_type): Add cases
for the new COMPLEX_ types.
(gcc::jit::playback::context::new_function): If creating a
builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
and call set_builtin_decl.
(gcc::jit::playback::context::replay): If we have a
builtins_manager, call its finish_playback method when we're done.
* jit-playback.h:
(gcc::jit::playback::context::get_builtins_manager): New function.
* jit-recording.c
(gcc::jit::recording::context::get_builtins_manager): New function.
(gcc::jit::recording::get_builtin_function): Use
get_builtins_manager, in case we're a child context.
(gcc::jit::recording::memento_of_get_type::dereference): Add the
COMPLEX_ types.
(gcc::jit::recording::memento_of_get_type::is_int): Likewise.
(gcc::jit::recording::memento_of_get_type::is_float): Likewise.
(gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
(get_type_strings): Likewise.
* jit-recording.h
(gcc::jit::recording::context::get_builtins_manager): New.
* libgccjit.h (enum gcc_jit_types): Add
GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
* jit-builtins.c
(gcc::jit::recording::builtins_manager::get_builtin_function):
Check for NULL return from make_builtin_function.
(gcc::jit::recording::builtins_manager::make_builtin_function):
Check for NULL return from get_type.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::compile): Move DSO
creation code into...
(gcc::jit::playback::context::convert_to_dso): New function.
* jit-playback.h (gcc::jit::playback::context::convert_to_dso):
New function.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
* jit-playback.c (gcc::jit::playback::context::compile): Use an
auto_vec<const char *> rather than a const char *[20] for the
top-level argv, and move the logic to build it to...
(gcc::jit::playback::context::make_fake_args): New function.
* jit-playback.h (gcc::jit::playback::context::make_fake_args):
New function.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
* Make-lang.in (jit_OBJS): Add jit/jit-result.o.
* jit-playback.c: Include new header jit-result.h.
(gcc::jit::result::result): Move to new file jit-result.c.
(gcc::jit::result::~result): Likewise.
(gcc::jit::playback::result): Likewise.
* jit-recording.h (class gcc::jit::result): Move to new
header jit-result.h.
* jit-result.c: New file, to contain...
(gcc::jit::result::result): Move here from jit-playback.c,
removing erroneous "playback" namespace from comment.
(gcc::jit::result::~result): Likewise.
(gcc::jit::playback::result): Likewise.
* jit-result.h: New file, to contain...
(class gcc::jit::result): Move from jit-recording.h.
* libgccjit.c: Include jit-result.h.
(gcc_jit_result_get_code): Update comment to reflect move
of implementation.
(gcc_jit_result_release): Likewise.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* docs/examples/tut04-toyvm/toyvm.c
(toyvm_compiled_function): New typedef.
(toyvm_compiled_func) Rename to...
(toyvm_compiled_code) ...this.
(struct toyvm_compiled_function): New struct.
(toyvm_function_compile): Return a toyvm_compiled_function *
rather than a toyvm_compiled_func, so that the caller can fully
clean things up. Free "funcname".
(test_script): Update for change to toyvm_function_compile.
Clean up the toyvm_compiled_function.
(main): Likewise.
(docs/intro/tutorial04.rst): Update to reflect the above changes,
and to better spell out the lifetime of the compiled code.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* jit-builtins.c
(gcc::jit::recording::builtins_manager::make_fn_type): Call the
context's new_function_type method, rather than directly creating
a function_type instance.
* jit-recording.c
(gcc::jit::recording::context::new_function_type): New method,
adapted from part of...
(gcc::jit::recording::context::new_function_ptr_type): ...this.
Update to call new_function_type.
* jit-recording.h
(gcc::jit::recording::context::new_function_type): New method.
2014-12-01 David Malcolm <dmalcolm@redhat.com>
PR jit/63969
* jit-playback.c: Ensure that ctxt_progname is non-NULL.
2014-11-19 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* jit-playback.c (gcc::jit::playback::compound_type::set_fields):
Convert param from const vec<playback::field *> & to
const auto_vec<playback::field *> *.
(gcc::jit::playback::context::new_function_type): Convert param
"param_types" from vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::build_call): Convert param "args"
from vec<rvalue *> to const auto_vec<rvalue *> *.
(gcc::jit::playback::context::new_call): Likewise.
(gcc::jit::playback::context::new_call_through_ptr): Likewise.
(wrapper_finalizer): New function.
(gcc::jit::playback::wrapper::operator new): Call the finalizer
variant of ggc_internal_cleared_alloc, supplying
wrapper_finalizer.
(gcc::jit::playback::function::finalizer): New.
(gcc::jit::playback::block::finalizer): New.
(gcc::jit::playback::source_file::finalizer): New.
(gcc::jit::playback::source_line::finalizer): New.
* jit-playback.h
(gcc::jit::playback::context::new_function_type): Convert param
"param_types" from vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::new_call): Convert param
"args" from vec<rvalue *> to const auto_vec<rvalue *> *.
(gcc::jit::playback::context::new_call_through_ptr): Likewise.
(gcc::jit::playback::context::build_call): Likewise.
(gcc::jit::playback::context): Convert fields "m_functions",
"m_source_files", "m_cached_locations" from vec to auto_vec.
(gcc::jit::playback::wrapper::finalizer): New virtual function.
(gcc::jit::playback::compound_type::set_fields): Convert param fro
const vec<playback::field *> & to
const auto_vec<playback::field *> *.
(gcc::jit::playback::function::finalizer): New.
(gcc::jit::playback::block::finalizer): New.
(gcc::jit::playback::source_file::finalizer): New.
(gcc::jit::playback::source_line::finalizer): New.
* jit-recording.c
(gcc::jit::recording::function_type::replay_into): Convert local
from a vec into an auto_vec.
(gcc::jit::recording::fields::replay_into): Likewise.
(gcc::jit::recording::function::replay_into): Likewise.
(gcc::jit::recording::call::replay_into): Likewise.
(gcc::jit::recording::call_through_ptr::replay_into): Likewise.
* jit-recording.h (gcc::jit::recording::context): Convert fields
"m_mementos", "m_compound_types", "m_functions" from vec<> to
auto_vec <>.
(gcc::jit::recording::function_type::get_param_types): Convert
return type from vec<type *> to const vec<type *> &.
(gcc::jit::recording::function_type): Convert field
"m_param_types" from a vec<> to an auto_vec<>.
(gcc::jit::recording::fields): Likewise for field "m_fields".
(gcc::jit::recording::function::get_params): Convert return type
from vec <param *> to const vec<param *> &.
(gcc::jit::recording::function): Convert fields "m_params",
"m_locals", "m_blocks" from vec<> to auto_vec<>.
(gcc::jit::recording::block): Likewise for field "m_statements".
vec<> to auto_vec<>.
(gcc::jit::recording::call): Likewise for field "m_args".
(gcc::jit::recording::call_through_ptr): Likewise.
2014-11-19 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* jit-recording.c (recording::function::validate): Convert
"worklist" from vec<> to autovec<> to fix a leak.
2014-11-11 David Malcolm <dmalcolm@redhat.com>
* ChangeLog.jit: New.
* ChangeLog: New.
* Make-lang.in: New.
* TODO.rst: New.
* config-lang.in: New.
* docs/Makefile: New.
* docs/_build/texinfo/Makefile: New.
* docs/_build/texinfo/factorial.png: New.
* docs/_build/texinfo/libgccjit.texi: New.
* docs/_build/texinfo/sum-of-squares.png: New.
* docs/conf.py: New.
* docs/examples/tut01-hello-world.c: New.
* docs/examples/tut02-square.c: New.
* docs/examples/tut03-sum-of-squares.c: New.
* docs/examples/tut04-toyvm/Makefile: New.
* docs/examples/tut04-toyvm/factorial.toy: New.
* docs/examples/tut04-toyvm/fibonacci.toy: New.
* docs/examples/tut04-toyvm/toyvm.c: New.
* docs/index.rst: New.
* docs/internals/index.rst: New.
* docs/intro/factorial.png: New.
* docs/intro/index.rst: New.
* docs/intro/sum-of-squares.png: New.
* docs/intro/tutorial01.rst: New.
* docs/intro/tutorial02.rst: New.
* docs/intro/tutorial03.rst: New.
* docs/intro/tutorial04.rst: New.
* docs/topics/contexts.rst: New.
* docs/topics/expressions.rst: New.
* docs/topics/functions.rst: New.
* docs/topics/index.rst: New.
* docs/topics/locations.rst: New.
* docs/topics/objects.rst: New.
* docs/topics/results.rst: New.
* docs/topics/types.rst: New.
* dummy-frontend.c: New.
* jit-builtins.c: New.
* jit-builtins.h: New.
* jit-common.h: New.
* jit-playback.c: New.
* jit-playback.h: New.
* jit-recording.c: New.
* jit-recording.h: New.
* libgccjit++.h: New.
* libgccjit.c: New.
* libgccjit.h: New.
* libgccjit.map: New.
* notes.txt: New.
2013-07-26 David Malcolm <dmalcolm@redhat.com>
* Initial creation
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
|