Update ChangeLog and version files for release
[official-gcc.git] / gcc / jit / ChangeLog
blobd179f948bc8f4bb9df77e678d696e0818a764d1d
1 2015-07-16  Release Manager
3         * GCC 5.2.0 released.
5 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
7         Backport from mainline r225248
8         2015-07-01  David Malcolm  <dmalcolm@redhat.com>
10         PR jit/66700
11         * jit-playback.c (jit_mark_addressable): New function.
12         (gcc::jit::playback::lvalue::get_address): Call
13         jit_mark_addressable on the underlying tree.
15 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
17         Backport from mainline r225246
18         2015-07-01  David Malcolm  <dmalcolm@redhat.com>
20         * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
21         documentation.
22         * docs/_build/texinfo/libgccjit.texi: Regenerate.
24 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
26         Backport from mainline r225245
27         2015-07-01  David Malcolm  <dmalcolm@redhat.com>
29         * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
30         Clarify lack of lifetime requirements on (const char *) parameter.
31         * docs/topics/expressions.rst
32         (gcc_jit_context_new_string_literal): Likewise.
33         (gcc_jit_context_new_global): Likewise.
34         * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
35         (gcc_jit_context_new_function): Likewise.
36         (gcc_jit_function_new_block): Likewise.
37         (gcc_jit_block_add_comment): Likewise.
38         * docs/topics/locations.rst (gcc_jit_context_new_location):
39         Likewise.
40         * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
41         (gcc_jit_context_new_struct_type): Likewise.
42         * docs/_build/texinfo/libgccjit.texi: Regenerate.
44 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
46         Backport from mainline r225207
47         2015-06-30  David Malcolm  <dmalcolm@redhat.com>
49         * docs/cp/topics/functions.rst (Blocks): Add switch statements to
50         list of ways to terminate a block.
51         (gccjit::block::end_with_switch): Add function description.
52         (gccjit::case_): Add class.
53         (gccjit::context::new_case): Add function description.
54         * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
55         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
56         * docs/topics/functions.rst (Blocks): Add switch statements to
57         list of ways to terminate a block.
58         (gcc_jit_block_end_with_switch): Add function description.
59         (gcc_jit_case): Add type.
60         (gcc_jit_context_new_case): Add function description.
61         (gcc_jit_case_as_object): Add function description.
62         * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
63         * docs/_build/texinfo/libgccjit.texi: Regenerate.
64         * jit-common.h (gcc::jit::recording::case_): Add forward decl.
65         (gcc::jit::playback::case_): Add forward decl.
66         * jit-playback.c (add_case): New function.
67         (gcc::jit::playback::block::add_switch): New function.
68         * jit-playback.h (gcc::jit::playback::case_): New struct.
69         (gcc::jit::playback::block::get_function): New method.
70         (gcc::jit::playback::block::add_switch): New method.
71         * jit-recording.c: Within namespace gcc::jit...
72         (recording::context::new_case): New method.
73         (recording::function::validate): Update for change to
74         get_successor_blocks.
75         (recording::block::end_with_switch): New method.
76         (recording::block::get_successor_blocks): Update to support an
77         arbitrary number of successor blocks.
78         (recording::block::dump_edges_to_dot): Likewise.
79         (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
80         (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
81         (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
82         (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
83         (recording::statement::get_successor_blocks): Update to support an
84         arbitrary number of successor blocks.
85         (recording::conditional::get_successor_blocks): Likewise.
86         (recording::jump::get_successor_blocks): Likewise.
87         (recording::return_::get_successor_blocks): Likewise.
88         (recording::case_::write_reproducer): New.
89         (recording::case_::make_debug_string): New.
90         (recording::switch_::switch_): New.
91         (recording::switch_::replay_into): New.
92         (recording::switch_::get_successor_blocks): New.
93         (recording::switch_::make_debug_string): New.
94         (recording::switch_::write_reproducer): New.
95         * jit-recording.h: Within namespace gcc::jit::recording...
96         (context::new_case): New.
97         (rvalue::is_constant): New.
98         (rvalue::get_wide_int): New.
99         (block::end_with_switch): New.
100         (block::get_successor_blocks): Update to support an arbitrary
101         number of successor blocks.
102         (memento_of_new_rvalue_from_const::is_constant): New.
103         (memento_of_new_rvalue_from_const::get_wide_int): New.
104         (statement::get_successor_blocks): Update to support an arbitrary
105         number of successor blocks.
106         (conditional::get_successor_blocks): Likewise.
107         (jump::get_successor_blocks): Likewise.
108         (return_::get_successor_blocks): Likewise.
109         (case_): New subclass of memento.
110         (switch_): New subclass of statement.
111         * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
112         (gccjit::context::new_case): New method.
113         (gccjit::block::end_with_switch): New method.
114         (gccjit::case_::case): New ctors.
115         (gccjit::case_::get_inner_case): New method.
116         * libgccjit.c: Include "typed-splay-tree.h"
117         (struct gcc_jit_case): New.
118         (gcc_jit_context_new_case): New function.
119         (gcc_jit_case_as_object): New function.
120         (valid_dest_for_switch): New function.
121         (valid_case_for_switch): New function.
122         (class api_call_validator): New class.
123         (class case_range_validator): New class.
124         (case_range_validator::case_range_validator): New.
125         (case_range_validator::validate): New.
126         (case_range_validator::case_compare): New.
127         (case_range_validator::get_wide_int): new.
128         (gcc_jit_block_end_with_switch): New.
129         * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
130         (gcc_jit_case): New typedef.
131         (gcc_jit_context_new_case): New function.
132         (gcc_jit_case_as_object): New function.
133         (gcc_jit_block_end_with_switch): New function.
134         (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
135         * libgccjit.map: Add gcc_jit_block_end_with_switch,
136         gcc_jit_case_as_object and gcc_jit_context_new_case.
138 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
140         Backport from mainline r225206
141         2015-06-30  David Malcolm  <dmalcolm@redhat.com>
143         PR jit/66546
144         * docs/cp/topics/contexts.rst
145         (gccjit::context::set_bool_allow_unreachable_blocks): New.
146         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
147         * docs/topics/contexts.rst (Options): Add notes discussing the
148         transition from enums to entrypoints for new options.
149         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
150         * docs/_build/texinfo/libgccjit.texi: Regenerate.
151         * jit-common.h (gcc::jit::inner_bool_option): New enum.
152         * jit-recording.c: Within namespace gcc::jit...
153         (recording::context::context): Handle m_inner_bool_options.
154         (recording::context::set_inner_bool_option): New.
155         (inner_bool_option_reproducer_strings): New.
156         (recording::context::log_all_options): Log the "inner" bool
157         options.
158         (recording::context::log_inner_bool_option): New.
159         (recording::context::dump_reproducer_to_file): Write initializers
160         for "inner" bool options.
161         (recording::function::validate): Don't check for block
162         reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
163         * jit-recording.h: Within namespace gcc::jit...
164         (recording::context::set_inner_bool_option): New.
165         (recording::context::get_inner_bool_option): New.
166         (recording::context::log_inner_bool_option): New.
167         (recording::context::m_inner_bool_options): New.
168         * libgccjit++.h
169         (gccjit::context::set_bool_allow_unreachable_blocks): New.
170         * libgccjit.c
171         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
172         * libgccjit.h: Add note about options present in the
173         initial release of libgccjit.
174         (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
175         entrypoint.
176         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
177         New macro.
178         * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
179         (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
180         entrypoint.
182 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
184         Backport from mainline r225205
185         2015-06-30  David Malcolm  <dmalcolm@redhat.com>
187         PR jit/66628
188         * docs/cp/topics/contexts.rst (Additional command-line options):
189         New section.
190         * docs/topics/compatibility.rst: New file.
191         * docs/topics/contexts.rst (Additional command-line options): New
192         section.
193         * docs/topics/index.rst: Add compatibility.rst.
194         * docs/_build/texinfo/libgccjit.texi: Regenerate.
195         * jit-playback.c (make_fake_args): Add call to
196         append_command_line_options.
197         * jit-recording.c: Within namespace gcc::jit...
198         (recording::context::~context): Free the optnames within
199         m_command_line_options.
200         (recording::context::set_bool_option): Likewise.
201         (recording::context::add_command_line_option): New method.
202         (recording::context::append_command_line_options): New method.
203         (recording::context::dump_reproducer_to_file): Add command-line
204         options.
205         * jit-recording.h: Within namespace gcc::jit...
206         (recording::context::add_command_line_option): New method.
207         (recording::context::append_command_line_options): New method.
208         (recording::context::m_command_line_options): New field.
209         * libgccjit++.h (gccjit::context::add_command_line_option): New
210         method.
211         * libgccjit.c (gcc_jit_context_add_command_line_option): New API
212         entrypoint.
213         * libgccjit.h (gcc_jit_context_add_command_line_option): New API
214         entrypoint.
215         (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
216         macro.
217         * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
218         LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
220 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
222         Backport from mainline r225204
223         2015-06-30  David Malcolm  <dmalcolm@redhat.com>
225         * jit-recording.c
226         (gcc::jit::recording::context::dump_reproducer_to_file):
227         Add pragma to generated reproducers to disable -Wunused-variable.
228         Fix handling of NULL string options.
230 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
232         Backport from mainline r225203
233         2015-06-30  David Malcolm  <dmalcolm@redhat.com>
235         * docs/cp/topics/expressions.rst: Remove stray semicolon.
236         * docs/cp/topics/functions.rst: Remove stray backslash.
237         * docs/_build/texinfo/libgccjit.texi: Regenerate.
239 2015-06-29  David Malcolm  <dmalcolm@redhat.com>
241         Backport from mainline r224565
242         2015-06-17  David Malcolm  <dmalcolm@redhat.com>
244         * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
245         is for the correct struct.
246         (gcc_jit_rvalue_access_field): Likewise.
248 2015-06-29  David Malcolm  <dmalcolm@redhat.com>
250         Backport from mainline r224531
251         2015-06-16  David Malcolm  <dmalcolm@redhat.com>
253         PR jit/66539
254         * jit-recording.c: Within namespace gcc::jit::recording::
255         (rvalue::get_debug_string_parens): New function.
256         (binary_op::make_debug_string): Update to mimic C precedence
257         rules.
258         (binary_op_precedence): New array.
259         (binary_op::get_precedence): New function.
260         (comparison::make_debug_string): Update to mimic C precedence
261         rules.
262         (comparison_precedence): New array.
263         (comparison::get_precedence): New function.
264         (cast::make_debug_string): Update to mimic C precedence rules.
265         (call::make_debug_string): Likewise.
266         (call_through_ptr::make_debug_string): Likewise.
267         (array_access::make_debug_string): Likewise.
268         (access_field_of_lvalue::make_debug_string): Likewise.
269         (access_field_rvalue::make_debug_string): Likewise.
270         (dereference_field_rvalue::make_debug_string): Likewise.
271         (dereference_rvalue::make_debug_string): Likewise.
272         (get_address_of_lvalue::make_debug_string): Likewise.
273         * jit-recording.h: Within namespace gcc::jit::recording::
274         (precedence): New enum.
275         (rvalue::rvalue): Initialize field "m_parenthesized_string".
276         (rvalue::get_debug_string_parens): New method.
277         (rvalue::get_precedence): New pure virtual function.
278         (rvalue::m_parenthesized_string): New field.
279         (param::get_precedence): New function.
280         (global::get_precedence): New function.
281         (memento_of_new_rvalue_from_const::get_precedence): New function.
282         (memento_of_new_string_literal::get_precedence): New function.
283         (unary_op::get_precedence): New function.
284         (binary_op::get_precedence): New function.
285         (comparison::get_precedence): New function.
286         (cast::get_precedence): New function.
287         (call::get_precedence): New function.
288         (call_through_ptr::get_precedence): New function.
289         (array_access::get_precedence): New function.
290         (access_field_of_lvalue::get_precedence): New function.
291         (access_field_rvalue::get_precedence): New function.
292         (dereference_field_rvalue::get_precedence): New function.
293         (dereference_rvalue::get_precedence): New function.
294         (get_address_of_lvalue::get_precedence): New function.
295         (local::get_precedence): New function.
297 2015-06-09  Matthias Klose  <doko@ubuntu.com>
299         * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
301 2015-04-22  Release Manager
303         * GCC 5.1.0 released.
305 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
307         PR jit/65691
308         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
309         and paste error in description of gccjit::context::one.
310         * docs/topics/expressions.rst (Simple expressions): Likewise in
311         description of gcc_jit_context_one.
312         * docs/_build/texinfo/libgccjit.texi: Regenerate.
314 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
316         * jit-recording.c (dump::write): Also check vasprintf return value.
317         (recording::context::add_error_va): Ditto.
318         (recording::string::from_printf): Ditto.
320 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
322         * docs/internals/index.rst (Packaging notes): New section.
323         * docs/_build/texinfo/libgccjit.texi: Regenerate.
325 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
327         * docs/cp/intro/tutorial03.rst: Add missing arguments to
328         gccjit::block::end_with_conditional call.  Add on_true/on_false
329         comments.  Tweak the wording.
330         * docs/intro/tutorial03.rst: Add missing arguments to
331         gcc_jit_block_end_with_conditional call.  Add some clarifying
332         comments.
333         * docs/topics/compilation.rst: Tweak the wording to avoid an
334         ambiguous use of "this".
335         * docs/topics/contexts.rst: Fix a typo.
336         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
337         a stray backtick.
338         * docs/_build/texinfo/libgccjit.texi: Regenerate.
340 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
342         PR libgomp/64625
343         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
344         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
345         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
346         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
347         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
348         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
350 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
352         PR jit/64257
353         * docs/conf.py (html_theme): Change from 'pyramid'
354         to 'sphinxdoc'.
356 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
358         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
359         typo.
360         * docs/_build/texinfo/libgccjit.texi: Regenerate.
362 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
364         * jit-logging.h (gcc::jit::log_user::log): Make const.
365         * jit-recording.c (gcc::jit::recording::context::set_str_option):
366         Log the new value of the option.
367         (gcc::jit::recording::context::set_int_option): Likewise.
368         (gcc::jit::recording::context::set_bool_option): Likewise.
369         (gcc::jit::recording::context::compile): Log the value of all
370         options.
371         (gcc::jit::recording::context::compile_to_file): Likewise.
372         (gcc::jit::recording::context::log_all_options): New function.
373         (gcc::jit::recording::context::log_str_option): New function.
374         (gcc::jit::recording::context::log_int_option): New function.
375         (gcc::jit::recording::context::log_bool_option): New function.
376         * jit-recording.h (gcc::jit::recording::context::log_all_options):
377         New function.
378         (gcc::jit::recording::context::log_str_option): New function.
379         (gcc::jit::recording::context::log_int_option): New function.
380         (gcc::jit::recording::context::log_bool_option): New function.
381         * docs/internals/test-hello-world.exe.log.txt: Update for above
382         changes.
383         * docs/_build/texinfo/libgccjit.texi: Regenerate.
385 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
387         PR jit/64810
388         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
389         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
390         * jit-playback.c: Include gcc.h.
391         (gcc::jit::playback::context::compile): Move mutex acquisition
392         to before the call to make_fake_args.
393         (append_arg_from_driver): New function.
394         (gcc::jit::playback::context::make_fake_args): On the first call,
395         call into driver_get_configure_time_options to get configure-time
396         default options and cache them.  Add them to the args for
397         toplev::main.
398         * jit-spec.c: New source file.
399         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
400         above changes.
401         * docs/_build/texinfo/libgccjit.texi: Regenerate.
403 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
405         PR jit/64810
406         * dummy-frontend.c (jit_langhook_type_for_mode): Support
407         TYPE_MODE (long_long_integer_type_node).
409 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
411         * docs/internals/test-hello-world.exe.log.txt: Add example version
412         lines.
413         * docs/_build/texinfo/libgccjit.texi: Regenerate.
414         * jit-common.h (gcc::jit::dump::get_file): New accessor.
415         * jit-logging.c: Include toplev.h.
416         (gcc::jit::logger::logger): Log the GCC version.
417         * jit-recording.c: Include toplev.h.
418         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
419         GCC version.
421 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
423         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
424         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
425         error buffer is only valid until the next call to the context.
426         * docs/_build/texinfo/libgccjit.texi: Regenerate.
427         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
428         comment to omit mention of compiling.
429         (gcc_jit_context_get_last_error): The error buffer is only valid
430         until the next call to the context.
432 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
434         PR jit/64708
435         * config-lang.in (compilers): Drop "libgccjit.so".
437 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
439         PR jit/64721
440         * jit-playback.c (gcc::jit::playback::context::compile): Construct
441         toplev instances with init_signals=false.
443 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
445         * docs/cp/topics/results.rst: Rename to...
446         * docs/cp/topics/compilation.rst: ...this, and add section on
447         ahead-of-time compilation.
448         * docs/cp/topics/index.rst: Update for renaming of results.rst
449         to compilation.rst.
450         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
451         script.
452         * docs/examples/tut05-bf.c: New file, implementing a compiler
453         for "brainf".
454         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
455         changes to logger output.
456         * docs/intro/index.rst: Add tutorial05.rst
457         * docs/intro/tutorial05.rst: New file.
458         * docs/topics/results.rst: Rename to...
459         * docs/topics/compilation.rst: ...this, and add section on
460         ahead-of-time compilation.
461         * docs/topics/index.rst: Update for renaming of results.rst to
462         compilation.rst.
463         * docs/_build/texinfo/libgccjit.texi: Regenerate.
464         * jit-playback.c (gcc::jit::playback::context::compile): Convert
465         return type from result * to void.  Move the code to convert to
466         dso and dlopen the result to a new pure virtual "postprocess"
467         method.
468         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
469         function.
470         (gcc::jit::playback::compile_to_memory::postprocess): New
471         function, based on playback::context::compile.
472         (gcc::jit::playback::compile_to_file::compile_to_file): New
473         function.
474         (gcc::jit::playback::compile_to_file::postprocess): New function.
475         (gcc::jit::playback::compile_to_file::copy_file): New function.
476         (gcc::jit::playback::context::convert_to_dso): Move internals
477         to...
478         (gcc::jit::playback::context::invoke_driver): New method.  Add
479         "-shared" and "-c" options to driver's argv as needed.
480         * jit-playback.h: Include "timevar.h".
481         (gcc::jit::playback::context::compile): Convert return type from
482         result * to void.
483         (gcc::jit::playback::context::postprocess): New pure virtual
484         function, making this an abstract base class.
485         (gcc::jit::playback::context::get_tempdir): New accessor.
486         (gcc::jit::playback::context::invoke_driver): New function.
487         (class gcc::jit::playback::compile_to_memory): New subclass of
488         playback::context.
489         (class gcc::jit::playback::compile_to_file): Likewise.
490         * jit-recording.c (gcc::jit::recording::context::compile): Use a
491         playback::compile_to_memory, and extract its result.
492         (gcc::jit::recording::context::compile_to_file): New function.
493         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
494         New function.
495         * libgccjit++.h (gccjit::context::compile_to_file): New method.
496         * libgccjit.c (gcc_jit_context_compile): Update log message to
497         clarify that this is an in-memory compile.
498         (gcc_jit_context_compile_to_file): New function.
499         * libgccjit.h (gcc_jit_context): Clarify that you can compile
500         a context more than once, and that you can compile to a file
501         as well as to memory.
502         (gcc_jit_result): Clarify that this is the result of an
503         in-memory compilation.
504         (gcc_jit_context_compile): Clarify that you can compile, and that
505         this is an in-memory compilation.
506         (enum gcc_jit_output_kind): New enum.
507         (gcc_jit_context_compile_to_file): New function.
508         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
509         of compilation.
510         * libgccjit.map (gcc_jit_context_compile_to_file): New API
511         entrypoint.
512         * notes.txt: Update to show the playback::context::postprocess
513         virtual function.
515 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
517         * jit-recording.c
518         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
519         Add missing format string.
521 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
523         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
524         (check_jit_parallelize): Set this to an arbitrary value (10).
526 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
528         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
529         last argument.
530         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
531         undef afterwards.
532         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
533         Likewise.
535 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
537         Update copyright years in docs/.
539 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
541         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
542         lvalue and the rvalue are of compatible type.
544 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
546         * docs/cp/topics/contexts.rst (Debugging): Add
547         gccjit::context::dump_reproducer_to_file.
548         * docs/internals/index.rst (Design notes): New section,
549         discussing input validation and
550         gcc_jit_context_dump_reproducer_to_file.
551         * docs/topics/contexts.rst (Debugging): Add
552         gcc_jit_context_dump_reproducer_to_file.
553         * docs/_build/texinfo/libgccjit.texi: Regenerate.
554         * jit-common.h (gcc::jit::dump::get_context): New accessor.
555         * jit-recording.c: Include "hash-map.h".
556         Within namespace ::gcc::jit...
557         (dump::write): Flush each line.
558         (dump::make_location): Pass false for new param "created_by_user".
559         (class allocator): New class.
560         (allocator::~allocator): New function.
561         (allocator::xstrdup_printf): New function.
562         (allocator::xstrdup_printf_va): New function.
563         (class reproducer): New subclass of dump.
564         (reproducer::reproducer): New function.
565         (reproducer::write_params): New function.
566         (reproducer::write_args): New function.
567         (reproducer::make_identifier): New function.
568         (reproducer::make_tmp_identifier): New function.
569         (reproducer::get_identifier): New pair of functions.
570         (reproducer::get_identifier_as_rvalue): New function.
571         (reproducer::get_identifier_as_lvalue): New function.
572         (reproducer::get_identifier_as_type): New function.
573         (reproducer::xstrdup_printf): New function.
574         (recording::context::context): Initialize m_toplevel_ctxt.
575         (recording::context::new_location): Add param created_by_user.
576         (str_option_reproducer_strings): New table of strings.
577         (int_option_reproducer_strings): Likewise.
578         (bool_option_reproducer_strings): Likewise.
579         (get_type_enum_strings): Likewise.
580         (names_of_function_kinds): Likewise.
581         (global_kind_reproducer_strings): Likewise.
582         (unary_op_reproducer_strings): Likewise.
583         (binary_op_reproducer_strings): Likewise.
584         (comparison_reproducer_strings): Likewise.
585         Within namespace ::gcc::jit::recording::...
586         (context::dump_reproducer_to_file): New function.
587         (string::write_reproducer): Likewise.
588         (location::write_reproducer): Likewise.
589         (type::access_as_type): Likewise.
590         (memento_of_get_type::write_reproducer): Likewise.
591         (memento_of_get_pointer::write_reproducer): Likewise.
592         (memento_of_get_const::write_reproducer): Likewise.
593         (memento_of_get_volatile::write_reproducer): Likewise.
594         (array_type::write_reproducer): Likewise.
595         (function_type::write_reproducer): Likewise.
596         (function_type::write_deferred_reproducer): Likewise.
597         (field::write_reproducer): Likewise.
598         (struct_::access_as_type): Likewise.
599         (struct_::write_reproducer): Likewise.
600         (union_::write_reproducer): Likewise.
601         (fields::write_reproducer): Likewise.
602         (rvalue::access_as_rvalue): Likewise.
603         (lvalue::access_as_rvalue): Likewise.
604         (lvalue::access_as_lvalue): Likewise.
605         (param::access_as_rvalue): Likewise.
606         (param::access_as_lvalue): Likewise.
607         (param::write_reproducer): Likewise.
608         (function::write_reproducer): Likewise.
609         (block::write_reproducer): Likewise.
610         (global::write_reproducer): Likewise.
611         (memento_of_new_rvalue_from_const <int>::write_reproducer):
612         Likewise.
613         (memento_of_new_rvalue_from_const <long>::write_reproducer):
614         Likewise.
615         (memento_of_new_rvalue_from_const <double>::write_reproducer):
616         Likewise.
617         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
618         Likewise.
619         (memento_of_new_string_literal::write_reproducer): Likewise.
620         (unary_op::write_reproducer): Likewise.
621         (binary_op::write_reproducer): Likewise.
622         (comparison::write_reproducer): Likewise.
623         (cast::write_reproducer): Likewise.
624         (call::write_reproducer): Likewise.
625         (call_through_ptr::write_reproducer): Likewise.
626         (array_access::write_reproducer): Likewise.
627         (access_field_of_lvalue::write_reproducer): Likewise.
628         (access_field_rvalue::write_reproducer): Likewise.
629         (dereference_field_rvalue::write_reproducer): Likewise.
630         (dereference_rvalue::write_reproducer): Likewise.
631         (get_address_of_lvalue::write_reproducer): Likewise.
632         (local::write_reproducer): Likewise.
633         (eval::write_reproducer): Likewise.
634         (assignment::write_reproducer): Likewise.
635         (assignment_op::write_reproducer): Likewise.
636         (comment::write_reproducer): Likewise.
637         (conditional::write_reproducer): Likewise.
638         (jump::write_reproducer): Likewise.
639         (return_::write_reproducer): Likewise.
640         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
641         Within namespace ::gcc::jit::recording::...
642         (context::new_location): Add "created_by_user" param.
643         (context::dump_reproducer_to_file): New method.
644         (context::m_toplevel_ctxt): New field.
645         (memento::write_reproducer): New pure virtual function.
646         (memento::dyn_cast_location): New virtual function.
647         (string::write_reproducer):
648         (location::location): Add "created_by_user" param.
649         (location::dyn_cast_location): New function.
650         (location::created_by_user): New accessor.
651         (location::write_reproducer): New function.
652         (location::m_created_by_user): New field.
653         (type::access_as_type): New virtual function.
654         (location::write_reproducer): Likewise.
655         (type::access_as_type): Likewise.
656         (memento_of_get_type::write_reproducer): Likewise.
657         (memento_of_get_pointer::write_reproducer): Likewise.
658         (memento_of_get_const::write_reproducer): Likewise.
659         (memento_of_get_volatile::write_reproducer): Likewise.
660         (array_type::write_reproducer): Likewise.
661         (function_type::write_reproducer): Likewise.
662         (function_type::write_deferred_reproducer): Likewise.
663         (field::write_reproducer): Likewise.
664         (struct_::access_as_type): Likewise.
665         (struct_::write_reproducer): Likewise.
666         (union_::write_reproducer): Likewise.
667         (union_::m_fields): Remove stray unused field.
668         (fields::length): New accessor.
669         (fields::get_field): New accessor.
670         (fields::write_reproducer): New function.
671         (rvalue::access_as_rvalue): Likewise.
672         (lvalue::access_as_rvalue): Likewise.
673         (lvalue::access_as_lvalue): Likewise.
674         (param::access_as_rvalue): Likewise.
675         (param::access_as_lvalue): Likewise.
676         (param::write_reproducer): Likewise.
677         (function::write_reproducer): Likewise.
678         (block::write_reproducer): Likewise.
679         (global::write_reproducer): Likewise.
680         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
681         Likewise.
682         (memento_of_new_string_literal::write_reproducer): Likewise.
683         (unary_op::write_reproducer): Likewise.
684         (binary_op::write_reproducer): Likewise.
685         (comparison::write_reproducer): Likewise.
686         (cast::write_reproducer): Likewise.
687         (call::write_reproducer): Likewise.
688         (call_through_ptr::write_reproducer): Likewise.
689         (array_access::write_reproducer): Likewise.
690         (access_field_of_lvalue::write_reproducer): Likewise.
691         (access_field_rvalue::write_reproducer): Likewise.
692         (dereference_field_rvalue::write_reproducer): Likewise.
693         (dereference_rvalue::write_reproducer): Likewise.
694         (get_address_of_lvalue::write_reproducer): Likewise.
695         (local::write_reproducer): Likewise.
696         (eval::write_reproducer): Likewise.
697         (assignment::write_reproducer): Likewise.
698         (assignment_op::write_reproducer): Likewise.
699         (comment::write_reproducer): Likewise.
700         (conditional::write_reproducer): Likewise.
701         (jump::write_reproducer): Likewise.
702         (return_::write_reproducer): Likewise.
703         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
704         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
705         param "created_by_user".
706         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
707         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
708         entrypoint.
709         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
710         entrypoint.
712 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
714         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
715         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
716         ctor.
717         (gcc::jit::rvalue_usage_validator::visit): New function.
718         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
719         function.
720         (gcc::jit::recording::rvalue::set_scope): New function.
721         (gcc::jit::recording::function::function): Call set_scope on each
722         param, issuing errors for any params that already have a function.
723         (gcc::jit::recording::block::add_eval): Return the new statement;
724         update the comment given that some error-checking now happens after
725         this returns.
726         (gcc::jit::recording::block::add_assignment): Likewise.
727         (gcc::jit::recording::block::add_assignment_op): Likewise.
728         (gcc::jit::recording::block::add_comment): Likewise.
729         (gcc::jit::recording::block::end_with_conditional): Likewise.
730         (gcc::jit::recording::block::end_with_jump): Likewise.
731         (gcc::jit::recording::block::end_with_return): Likewise.
732         (gcc::jit::recording::block::validate): Add a comment.
733         (gcc::jit::recording::unary_op::visit_children): New function.
734         (gcc::jit::recording::binary_op::visit_children): New function.
735         (gcc::jit::recording::comparison::visit_children): New function.
736         (gcc::jit::recording::cast::visit_children): New function.
737         (gcc::jit::recording::call::visit_children): New function.
738         (gcc::jit::recording::call_through_ptr::visit_children): New function.
739         (gcc::jit::recording::array_access::visit_children): New function.
740         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
741         function.
742         (gcc::jit::recording::access_field_rvalue::visit_children): New
743         function.
744         (gcc::jit::recording::dereference_field_rvalue::visit_children):
745         New function.
746         (gcc::jit::recording::dereference_rvalue::visit_children): New
747         function.
748         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
749         function.
750         * jit-recording.h: Within namespace gcc::jit::recording...
751         (class rvalue_visitor): New.
752         (rvalue::rvalue): Initialize m_scope.
753         (rvalue::get_loc): New accessor.
754         (rvalue::verify_valid_within_stmt): New function.
755         (rvalue::visit_children): New pure virtual function.
756         (rvalue::set_scope): New function.
757         (rvalue::get_scope): New function.
758         (rvalue::dyn_cast_param): New function.
759         (rvalue::m_scope): New field.
760         (param::visit_children): New empty function.
761         (param::dyn_cast_param): New function.
762         (function::get_loc): New function.
763         (block::add_eval): Return the new statement.
764         (block::add_assignment): Likewise.
765         (block::add_assignment_op): Likewise.
766         (block::add_comment): Likewise.
767         (block::end_with_conditional): Likewise.
768         (block::end_with_jump): Likewise.
769         (block::end_with_return): Likewise.
770         (global::visit_children): New function.
771         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
772         New function.
773         (memento_of_new_string_literal::visit_children): New function.
774         (unary_op::visit_children): New function.
775         (binary_op::visit_children): New function.
776         (comparison::visit_children): New function.
777         (cast::visit_children): New function.
778         (call::visit_children): New function.
779         (call_through_ptr::visit_children): New function.
780         (array_access::visit_children): New function.
781         (access_field_of_lvalue::visit_children): New function.
782         (access_field_rvalue::visit_children): New function.
783         (dereference_field_rvalue::visit_children): New function.
784         (dereference_rvalue::visit_children): New function.
785         (get_address_of_lvalue::visit_children): New function.
786         (local::local): Call set_scope.
787         (local::visit_children): New function.
788         (statement::get_block): Make public.
789         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
790         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
791         (gcc_jit_context_new_function): Verify that each param has
792         not yet been used for creating another function.
793         (gcc_jit_block_add_eval): After creating the stmt, verify
794         that the rvalue expression tree is valid to use within it.
795         (gcc_jit_block_add_assignment): Likewise for the lvalue and
796         rvalue expression trees.
797         (gcc_jit_block_add_assignment_op): Likewise.
798         (gcc_jit_block_end_with_conditional): Likewise for the boolval
799         expression tree.
800         (gcc_jit_block_end_with_return): Likewise for the rvalue
801         expression tree.
802         (gcc_jit_block_end_with_void_return): Remove return of "void",
803         now that block::end_with_return is now non-void.
805 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
807         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
808         Add missing fclose on error-handling path.
810 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
812         * docs/cp/topics/expressions.rst (Global variables): Add
813         enum gcc_jit_global_kind param to gccjit::context::new_global.
814         * docs/topics/expressions.rst (Global variables): Likewise.
815         Document the new enum.
816         * docs/topics/results.rst (Compilation results): Document
817         globals-handling.
818         * docs/_build/texinfo/libgccjit.texi: Regenerate.
819         * dummy-frontend.c (jit_langhook_write_globals): Call into the
820         playback context's write_global_decls_1 and write_global_decls_2
821         before and after calling symtab->finalize_compilation_unit ().
822         * jit-playback.c: Include "debug.h".
823         (gcc::jit::playback::context::new_global): Add "kind" param and
824         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
825         underlying VAR_DECL.  Call varpool_node::get_create on the
826         VAR_DECL, and add it to m_globals.
827         (gcc::jit::playback::context::write_global_decls_1): New function.
828         (gcc::jit::playback::context::write_global_decls_2): New function.
829         * jit-playback.h (gcc::jit::playback::context::context): Call
830         create on m_globals.
831         (gcc::jit::playback::context::new_global): Add "kind" param.
832         (gcc::jit::playback::context::write_global_decls_1): New function.
833         (gcc::jit::playback::context::write_global_decls_2): New function.
834         (gcc::jit::playback::context::m_globals): New field.
835         * jit-recording.c (gcc::jit::recording::context::context):
836         Initialize m_globals.
837         (gcc::jit::recording::context::new_global): Add param "kind".
838         Add the new global to m_globals.
839         (gcc::jit::recording::context::dump_to_file): Dump the globals.
840         (gcc::jit::recording::global::replay_into): Add field m_kind.
841         (gcc::jit::recording::global::write_to_dump): New override.
842         * jit-recording.h (gcc::jit::recording::context::new_global): Add
843         param "kind".
844         (gcc::jit::recording::context::m_globals): New field.
845         (gcc::jit::recording::global::global): Add param kind.
846         (gcc::jit::recording::global::write_to_dump): New override.
847         (gcc::jit::recording::global::m_kind): New field.
848         * jit-result.c (gcc::jit::result::get_global): New function.
849         * jit-result.h (gcc::jit::result::get_global): New function.
850         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
851         * libgccjit.c (gcc_jit_context_new_global): Likewise.
852         (gcc_jit_result_get_global): New API entrypoint.
853         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
854         (enum gcc_jit_global_kind): New enum.
855         (gcc_jit_context_new_global): API change: add "kind" param.
856         * libgccjit.map (gcc_jit_result_get_global): New symbol.
858 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
860         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
861         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
862         earlier.
863         * jit-builtins.c: Remove redundant includes of "opts.h" and
864         "tree.h".
865         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
866         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
867         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
868         "statistics.h", "vec.h", "double-int.h", "real.h",
869         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
870         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
871         earlier.
872         * jit-recording.c: Remove redundant includes of "opts.h" and
873         "tree.h".
875 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
877         * docs/cp/topics/expressions.rst (Simple expressions): Use
878         ":c:type:" for C types.  Document new overload of
879         gcc::jit::context::new_rvalue.
880         * docs/topics/expressions.rst (Simple expressions): Use
881         ":c:type:" for C types.  Document new entrypoint
882         gcc_jit_context_new_rvalue_from_long.
883         * docs/_build/texinfo/libgccjit.texi: Regenerate.
884         * jit-playback.c: Within namespace gcc::jit::playback...
885         (context::new_rvalue_from_int): Eliminate in favor of...
886         (context::new_rvalue_from_const <int>): ...this.
887         (context::new_rvalue_from_double): Eliminate in favor of...
888         (context::new_rvalue_from_const <double>): ...this.
889         (context::new_rvalue_from_const <long>): New.
890         (context::new_rvalue_from_ptr): Eliminate in favor of...
891         (context::new_rvalue_from_const <void *>): ...this.
892         * jit-playback.h: Within namespace gcc::jit::playback...
893         (context::new_rvalue_from_int): Eliminate in favor of...
894         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
895         (context::new_rvalue_from_double): Likewise.
896         (context::new_rvalue_from_ptr): Likewise.
897         * jit-recording.c: Within namespace gcc::jit::recording...
898         (context::new_rvalue_from_int): Eliminate.
899         (context::new_rvalue_from_double): Likewise.
900         (context::new_rvalue_from_ptr): Likewise.
901         (class memento_of_new_rvalue_from_const <int>):
902         Add explicit specialization.
903         (class memento_of_new_rvalue_from_const <long>):
904         Likewise.
905         (class memento_of_new_rvalue_from_const <double>):
906         Likewise.
907         (class memento_of_new_rvalue_from_const <void *>):
908         Likewise.
909         (memento_of_new_rvalue_from_int::replay_into):
910         Generalize into...
911         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
912         ...this...
913         (memento_of_new_rvalue_from_double::replay_into):
914         ...allowing this...
915         (memento_of_new_rvalue_from_ptr::replay_into):
916         ...and this to be deleted.
917         (memento_of_new_rvalue_from_int::make_debug_string):
918         Convert to...
919         (memento_of_new_rvalue_from_const <int>::make_debug_string):
920         ...this.
921         (memento_of_new_rvalue_from_double::make_debug_string):
922         Convert to...
923         (memento_of_new_rvalue_from_const <double>::make_debug_string):
924         ...this.
925         (memento_of_new_rvalue_from_ptr::make_debug_string)
926         Convert to...
927         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
928         ...this.
929         (memento_of_new_rvalue_from_const <long>::make_debug_string):
930         New function.
931         * jit-recording.h: Within namespace gcc::jit::recording...
932         (context::new_rvalue_from_int): Eliminate.
933         (context::new_rvalue_from_double): Likewise.
934         (context::new_rvalue_from_ptr): Likewise, all in favor of...
935         (context::new_rvalue_from_const <HOST_TYPE>): New family of
936         methods.
937         (class memento_of_new_rvalue_from_int): Eliminate.
938         (class memento_of_new_rvalue_from_double): Likewise.
939         (class memento_of_new_rvalue_from_ptr): Likewise.
940         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
941         of rvalue subclasses.
942         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
943         "long".
944         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
945         rewriting of recording::context::new_rvalue_from_int to
946         recording::context::new_rvalue_from_const <int>.
947         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
948         (gcc_jit_context_new_rvalue_from_double): Update for
949         rewriting of recording::context::new_rvalue_from_double to
950         recording::context::new_rvalue_from_const <double>.
951         (gcc_jit_context_new_rvalue_from_ptr): Update for
952         rewriting of recording::context::new_rvalue_from_ptr to
953         recording::context::new_rvalue_from_const <void *>.
954         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
955         entrypoint.
956         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
958 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
960         PR jit/64206
961         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
962         shows tempdir creation/cleanup.
963         * docs/_build/texinfo/libgccjit.texi: Regenerate.
964         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
965         to the list of subclasses in the comment.
966         * jit-playback.c (gcc::jit::playback::context::context): Add a
967         comment clarifying when the tempdir gets cleaned up.
968         (gcc::jit::playback::context::compile): Pass the context's logger,
969         if any, to the tempdir.
970         (gcc::jit::playback::context::dlopen_built_dso): When creating the
971         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
972         over ownership of the tempdir to it.
973         * jit-result.c: Include "jit-tempdir.h".
974         (gcc::jit::result::result): Add tempdir param, saving it as
975         m_tempdir.
976         (gcc::jit::result::~result): Delete m_tempdir.
977         * jit-result.h (gcc::jit::result::result): Add tempdir param.
978         (gcc::jit::result::m_tempdir): New field.
979         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
980         add JIT_LOG_SCOPE.
981         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
982         and log m_path_template and m_path_tempdir.
983         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
984         entry/exit, and log the unlink and rmdir calls.
985         * jit-tempdir.h: Include "jit-logging.h".
986         (class gcc::jit::tempdir): Make this be a subclass of log_user.
987         (gcc::jit::tempdir::tempdir): Add logger param.
988         * notes.txt: Update to show the two possible places where the
989         tempdir can be cleaned up.
991 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
993         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
994         comment.
996 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
998         * docs/topics/contexts.rst (Error-handling): Document new
999         entrypoint gcc_jit_context_get_last_error.
1000         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1001         * jit-recording.c (gcc::jit::recording::context::context):
1002         Initialize new fields "m_last_error_str" and
1003         "m_owns_last_error_str".
1004         (gcc::jit::recording::context::~context): Clean up
1005         m_last_error_str, if needed.
1006         (gcc::jit::recording::context::add_error_va): Update
1007         m_last_error_str and m_owns_last_error_str, freeing the old
1008         value if appropriate.
1009         (gcc::jit::recording::context::get_last_error): New function.
1010         * jit-recording.h (gcc::jit::recording::context::get_last_error):
1011         New function.
1012         (gcc::jit::recording::context): New fields m_last_error_str and
1013         m_owns_last_error_str.
1014         * libgccjit.c (gcc_jit_context_get_last_error): New function.
1015         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1016         * libgccjit.map (gcc_jit_context_get_last_error): New function.
1018 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1020         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1021         * docs/internals/index.rst (Overview of code structure): Mention
1022         gcc_jit_context_set_logfile, and embed the example logfile.
1023         * docs/internals/test-hello-world.exe.log.txt: New file: example
1024         of a logfile.
1025         * docs/topics/contexts.rst (Debugging): Add documentation
1026         for gcc_jit_context_set_logfile.
1027         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1028         * dummy-frontend.c: Include "jit-logging.h".
1029         (jit_langhook_init): Assert that there is an active playback
1030         context.  If it has a logger, log entry/exit to this function.
1031         (jit_langhook_write_globals): Likewise.
1032         * jit-common.h (gcc::jit::logger): New forward declaration.
1033         * jit-logging.c: New file.
1034         * jit-logging.h: New file.
1035         * jit-playback.c: Include "jit-logging.h".
1036         (gcc::jit::playback::context::context): Initialize the log_user
1037         base class from the recording context's logger (if any).  Use
1038         JIT_LOG_SCOPE to log entry/exit from the function body.
1039         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1040         log entry/exit from the function body.
1041         (gcc::jit::playback::build_stmt_list): Likewise.
1042         (gcc::jit::playback::function::postprocess): Likewise.
1043         (gcc::jit::playback::context::compile): Likewise.  Log the
1044         entry/exit to toplev::main and toplev::finalize.  Log the
1045         fake argv passed to toplev::main.
1046         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1047         log entry/exit from the function body.
1048         (gcc::jit::playback::context::release_mutex): Likewise.
1049         (gcc::jit::playback::context::make_fake_args): Likewise.
1050         (gcc::jit::playback::context::extract_any_requested_dumps):
1051         Likewise.
1052         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1053         log the arguments that the driver is invoked with.
1054         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
1055         the logger to the result object.
1056         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1057         log entry/exit from the function body.
1058         (gcc::jit::playback::context::dump_generated_code): Likewise.
1059         (gcc::jit::playback::context::handle_locations): Likewise.
1060         * jit-playback.h (gcc::jit::playback::context): Make this be
1061         a subclass of gcc::jit::log_user.
1062         * jit-recording.c: Include "jit-logging.h".
1063         (gcc::jit::recording::context::context: Initialize the logger to
1064         NULL for root contexts, or to the parent's logger for child
1065         contexts.
1066         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1067         log entry/exit from the function body.
1068         (gcc::jit::recording::context::replay_into): Likewise.
1069         (gcc::jit::recording::context::disassociate_from_playback):
1070         Likewise.
1071         (gcc::jit::recording::context::compile): Likewise.
1072         (recording::context::add_error_va): Likewise.  Also, log the
1073         error.
1074         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1075         log entry/exit from the function body.
1076         * jit-recording.h: Include "jit-logging.h".
1077         (gcc::jit::recording::context): Make this be a subclass of
1078         gcc::jit::log_user.
1079         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1080         (gcc::jit::result::result): Add logger param, recording it.
1081         Use JIT_LOG_SCOPE to log entry/exit from the function body.
1082         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1083         log entry/exit from the function body.
1084         (gcc::jit::result::get_code): Likewise.
1085         * jit-result.h (gcc::jit::result): Make this be a subclass of
1086         gcc::jit::log_user.
1087         (gcc::jit::result::result): Add logger parameter.
1088         * libgccjit++.h (gccjit::context::set_logfile): New function.
1089         * libgccjit.c: Include "jit-logging.h".
1090         (gcc_jit_context_acquire): Log the context.
1091         (gcc_jit_context_release): Use JIT_LOG_FUNC to
1092         log entry/exit from the function body, and log the context.
1093         (gcc_jit_context_new_child_context): Likewise, logging both
1094         contexts.
1095         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1096         log entry/exit from the function body.
1097         (gcc_jit_context_get_type): Likewise.
1098         (gcc_jit_context_get_int_type): Likewise.
1099         (gcc_jit_context_new_array_type): Likewise.
1100         (gcc_jit_context_new_field): Likewise.
1101         (gcc_jit_context_new_struct_type): Likewise.
1102         (gcc_jit_context_new_opaque_struct): Likewise.
1103         (gcc_jit_struct_set_fields): Likewise.
1104         (gcc_jit_context_new_union_type): Likewise.
1105         (gcc_jit_context_new_function_ptr_type): Likewise.
1106         (gcc_jit_context_new_param): Likewise.
1107         (gcc_jit_context_new_function): Likewise.
1108         (gcc_jit_context_get_builtin_function): Likewise.
1109         (gcc_jit_function_get_param): Likewise.
1110         (gcc_jit_function_dump_to_dot): Likewise.
1111         (gcc_jit_function_new_block): Likewise.
1112         (gcc_jit_context_new_global): Likewise.
1113         (gcc_jit_context_new_rvalue_from_int): Likewise.
1114         (gcc_jit_context_zero): Likewise.
1115         (gcc_jit_context_one): Likewise.
1116         (gcc_jit_context_new_rvalue_from_double): Likewise.
1117         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1118         (gcc_jit_context_null): Likewise.
1119         (gcc_jit_context_new_string_literal): Likewise.
1120         (gcc_jit_context_new_unary_op): Likewise.
1121         (gcc_jit_context_new_binary_op): Likewise.
1122         (gcc_jit_context_new_comparison): Likewise.
1123         (gcc_jit_context_new_call): Likewise.
1124         (gcc_jit_context_new_call_through_ptr): Likewise.
1125         (gcc_jit_context_new_cast): Likewise.
1126         (gcc_jit_context_new_array_access): Likewise.
1127         (gcc_jit_lvalue_access_field): Likewise.
1128         (gcc_jit_rvalue_access_field): Likewise.
1129         (gcc_jit_rvalue_dereference_field): Likewise.
1130         (gcc_jit_rvalue_dereference): Likewise.
1131         (gcc_jit_lvalue_get_address): Likewise.
1132         (gcc_jit_function_new_local): Likewise.
1133         (gcc_jit_block_add_eval): Likewise.
1134         (gcc_jit_block_add_assignment): Likewise.
1135         (gcc_jit_block_add_assignment_op): Likewise.
1136         (gcc_jit_block_end_with_conditional): Likewise.
1137         (gcc_jit_block_add_comment): Likewise.
1138         (gcc_jit_block_end_with_jump): Likewise.
1139         (gcc_jit_block_end_with_return): Likewise.
1140         (gcc_jit_block_end_with_void_return): Likewise.
1141         (gcc_jit_context_set_str_option): Likewise.
1142         (gcc_jit_context_set_int_option): Likewise.
1143         (gcc_jit_context_set_bool_option): Likewise.
1144         (gcc_jit_context_enable_dump): Likewise.
1145         (gcc_jit_context_compile): Likewise.  Also log the context,
1146         and the result.
1147         (gcc_jit_context_dump_to_file): Likewise.
1148         (gcc_jit_context_set_logfile): New function.
1149         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1150         log entry/exit from the function body.
1151         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
1152         and the ptr to be returned.
1153         (gcc_jit_result_release): Likewise.  Also log the result.
1154         * libgccjit.h: Include <stdio.h>, since we need FILE *.
1155         (gcc_jit_context_set_logfile): New declaration.
1156         * libgccjit.map (gcc_jit_context_set_logfile): New.
1158 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1160         * jit-recording.h (gcc::jit::recording::type::is_void): New
1161         virtual function.
1162         (gcc::jit::recording::memento_of_get_type::is_void): New
1163         function, overriding default implementation.
1164         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1165         the underlying type is not "void".
1167 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1169         * docs/topics/expressions.rst (Unary Operations): Add
1170         GCC_JIT_UNARY_OP_ABS.
1171         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1172         Likewise.
1173         * jit-recording.c (unary_op_strings): Likewise.
1174         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1175         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1176         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1177         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1179 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1181         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1182         typo in comment.
1184 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1186         * TODO.rst (Test suite): Remove item about running C++ testcases.
1187         * docs/internals/index.rst (Working on the JIT library): Add
1188         "c++" to the enabled languages in the suggested "configure"
1189         invocation, and add a description of why this is necessary.
1190         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1192 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1194         * docs/internals/index.rst: Update to reflect that built
1195         testcases are now test-foo.c.exe, rather than test-foo.exe.
1196         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1198 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
1200         Update copyright years.
1202 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1204         * jit-playback.c (gcc::jit::playback::context::build_cast): In
1205         case BOOLEAN_TYPE, don't assume that the source expression is
1206         of type "int".
1208 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1210         * jit-recording.c (gcc::jit::recording::context::context): When
1211         copying string options from a parent context, take a copy of the
1212         underlying buffers, rather than simply copying the pointer.
1214 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1216         * jit-recording.c (gcc::jit::recording::context::set_str_option):
1217         Handle NULL.
1219 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
1221         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1222         Document new function.
1223         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1225 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
1227         Minor interface cleanups of libgccjit
1228         * jit-playback.c (convert_to_dso): Use auto_vec instead
1229         of automatic array to build up command line.
1230         * jit-recording.c (recording::context::set_str_option):
1231         Make copy of the string.
1232         (recording::context::~context): Free string options.
1233         * jit-recording.h (recording::context): Adjust type
1234         of m_str_options member.
1235         * libgccjit.h: Adjust comment about
1236         gcc_jit_context_set_str_option parameter being used after
1237         the call.
1238         Update comment now that all interfaces are copy strings
1239         if necessary.
1240         * libgccjit++.h (gccjit::context): Add set_str_option
1241         member function.
1243 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
1245         * docs/cp/index.rst: New file.
1246         * docs/cp/intro/index.rst: New file.
1247         * docs/cp/intro/tutorial01.rst: New file.
1248         * docs/cp/intro/tutorial02.rst: New file.
1249         * docs/cp/intro/tutorial03.rst: New file.
1250         * docs/cp/intro/tutorial04.rst: New file.
1251         * docs/cp/topics/contexts.rst: New file.
1252         * docs/cp/topics/expressions.rst: New file.
1253         * docs/cp/topics/functions.rst: New file.
1254         * docs/cp/topics/index.rst: New file.
1255         * docs/cp/topics/locations.rst: New file.
1256         * docs/cp/topics/objects.rst: New file.
1257         * docs/cp/topics/results.rst: New file.
1258         * docs/cp/topics/types.rst: New file.
1259         * docs/examples/tut01-hello-world.cc: New file.
1260         * docs/examples/tut02-square.c: Fix missing newline in output.
1261         * docs/examples/tut02-square.cc: New file.
1262         * docs/examples/tut03-sum-of-squares.cc: New file.
1263         * docs/examples/tut04-toyvm/toyvm.cc: New file.
1264         * docs/index.rst: Move summary to above the table of contents.
1265         Add text about the C vs C++ APIs.
1266         * docs/topics/contexts.rst: Fix a typo.
1268         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1269         * docs/_build/texinfo/factorial1.png: New file.
1270         * docs/_build/texinfo/sum-of-squares1.png: New file.
1272 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1274         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1275         logic for determine "funcname" to new function...
1276         (get_function_name): ...here, adding logic to skip any leading
1277         path from the filename.
1278         (toyvm_function_parse): Use the filename for fn_filename, rather
1279         than "name", so that the debugger can locate the source .toy
1280         file.
1281         (toyvm_function_parse): Don't fclose a NULL FILE *.
1283 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1285         PR jit/63854
1286         * docs/internals/index.rst (Running under valgrind): New
1287         subsection.
1288         (docs/_build/texinfo/libgccjit.texi): Regenerate.
1290 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1292         PR jit/64206
1293         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1294         * jit-common.h (gcc::jit::tempdir): New forward decl.
1295         * jit-playback.c: Include jit-tempdir.h.
1296         (gcc::jit::playback::context::context): Initialize m_tempdir.
1297         (gcc::jit::playback::context::~context): Move tempdir
1298         cleanup to new file jit-tempdir.c
1299         (make_tempdir_path_template): Move to new file jit-tempdir.c.
1300         (gcc::jit::playback::context::compile): Move tempdir creation
1301         to new tempdir object in new file jit-tempdir.c.
1302         (gcc::jit::playback::context::make_fake_args): Get path from
1303         tempdir object rather than from member data.
1304         (gcc::jit::playback::context::convert_to_dso): Likewise.
1305         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1306         (gcc::jit::playback::context::dump_generated_code): Likewise.
1307         (gcc::jit::playback::context::get_path_c_file): New function.
1308         (gcc::jit::playback::context::get_path_s_file): New function.
1309         (gcc::jit::playback::context::get_path_so_file): New function.
1310         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1311         New function.
1312         (gcc::jit::playback::context::get_path_s_file): New function.
1313         (gcc::jit::playback::context::get_path_so_file): New function.
1314         (gcc::jit::playback::context): Move fields "m_path_template",
1315         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1316         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1317         * jit-tempdir.c: New file.
1318         * jit-tempdir.h: New file.
1320 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1322         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1323         mutex here, immediately before using toplev, and release it here, on
1324         each exit path after acquisition.
1325         (jit_mutex): Move this variable here, from jit-recording.c.
1326         (gcc::jit::playback::context::acquire_mutex): New function, based on
1327         code in jit-recording.c.
1328         (gcc::jit::playback::context::release_mutex): Likewise.
1329         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1330         function.
1331         (gcc::jit::playback::context::release_mutex): New function.
1332         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1333         (gcc::jit::recording::context::compile): Move mutex-handling from
1334         here into jit-playback.c's gcc::jit::playback::context::compile.
1335         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1336         and RELEASE_MUTEX.
1338 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1340         * jit-playback.c (gcc::jit::playback::context::compile): Move the
1341         dlopen code into...
1342         (gcc::jit::playback::context::dlopen_built_dso): ...this new
1343         function.
1344         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1345         New function.
1347 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1349         PR jit/64166
1350         * docs/topics/contexts.rst (Debugging): Add description of
1351         gcc_jit_context_enable_dump.
1352         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1353         * jit-playback.c: Include context.h.
1354         (class auto_argvec): New class.
1355         (auto_argvec::~auto_argvec): New function.
1356         (gcc::jit::playback::context::compile): Convert fake_args to be
1357         an auto_argvec, so that it can contain dynamically-allocated
1358         strings.   Construct a vec of all requested dumps, and pass it to
1359         make_fake_args.  Extract requested dumps between the calls to
1360         toplev::main and toplev::finalize.
1361         (gcc::jit::playback::context::make_fake_args): Convert param
1362         "argvec" to be a vec <char *>, and gain a "requested_dumps"
1363         param.  Convert to dynamically-allocated arg strings by converting
1364         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1365         for args that are already a copy.  Add args for all requested dumps.
1366         (gcc::jit::playback::context::extract_any_requested_dumps): New
1367         function.
1368         (gcc::jit::playback::context::read_dump_file): New function.
1369         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1370         Convert param "argvec" to be a vec <char *>, and gain a
1371         "requested_dumps" param.
1372         (gcc::jit::playback::context::extract_any_requested_dumps): New
1373         function.
1374         (gcc::jit::playback::context::read_dump_file): New function.
1375         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1376         function.
1377         (gcc::jit::recording::context::get_all_requested_dumps): New
1378         function.
1379         * jit-recording.h (gcc::jit::recording::requested_dump): New
1380         struct.
1381         (gcc::jit::recording::context::enable_dump): New function.
1382         (gcc::jit::recording::context::get_all_requested_dumps): New
1383         function.
1384         (gcc::jit::recording::context::m_requested_dumps): New field.
1385         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1386         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1387         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1389 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1391         * libgccjit++.h: Indent the forward declarations of the classes to
1392         show the inheritance hierarchy.
1394 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1396         * notes.txt: Show the beginning and ending of
1397         recording::context::compile vs playback::context::compile.  Show
1398         the creation and unlinking of the tempdir.  Show toplev::finalize.
1399         Move "RELEASE MUTEX" to the correct location.  Show
1400         gcc_jit_result_release, and indicate where the
1401         dlopen/dlsym/dlclose occur.
1403 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1405         * docs/examples/tut02-square.c (main): Release the context
1406         earlier, to show that this is possible.  Update error-handling
1407         to avoid a double-release of the context, and to avoid
1408         releasing a NULL result.
1409         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1410         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1411         * docs/topics/results.rst (gcc_jit_result): Mention that this
1412         controls the lifetimes of machine code functions.
1413         (gcc_jit_result_get_code): Spell out the requirements for this
1414         to succeed, and the lifetime of the result.
1415         (gcc_jit_result_release): Mention that this invalidates any code
1416         that was obtained from the result.
1417         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1419 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1421         PR jit/64018
1422         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1423         Add description of error-handling, taken in part from...
1424         * docs/topics/contexts.rst (Error-handling): Expand, and move some
1425         content to tutorial02.rst.
1426         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1428 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1430         PR jit/64020
1431         * docs/topics/types.rst (Standard types) Add new enum values to
1432         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1433         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1434         Widen the left-hand column so that
1435         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1436         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1438         * jit-builtins.c: Include stringpool.h and jit-playback.h.
1439         Move everything out of the gcc::jit::recording namespace into
1440         just gcc::jit.
1441         (struct builtin_data): Add fields "fnclass", "attr", and
1442         "implicit_p".
1443         (DEF_BUILTIN): Update macro so populate the new fields.
1444         (builtins_manager::builtins_manager): Update for move out of
1445         recording namespace.  Initialize the m_attributes array.
1446         (builtins_manager::get_builtin_function): Likewise.
1447         (builtins_manager::get_builtin_function_by_id): New function.
1448         (builtins_manager::make_builtin_function): Update for move out of
1449         recording namespace.  Add fix for PR jit/64020 by detecting
1450         specific builtin ids and having them ensure that builtins for
1451         other ids are created as necessary.
1452         (builtins_manager::get_type): Update for move out of recording
1453         namespace.
1454         (builtins_manager::make_type): Likewise.  Add some missing
1455         #undefs.
1456         (builtins_manager::make_primitive_type): Update for move out of
1457         recording namespace.  Implement the three BT_COMPLEX_ cases and
1458         BT_DOUBLE_PTR.
1459         (builtins_manager::make_fn_type): Update for move out of recording
1460         namespace.
1461         (builtins_manager::make_ptr_type): Likewise.
1462         (builtins_manager::finish_playback): New function.
1463         (builtins_manager::get_class): New function.
1464         (builtins_manager::implicit_p): New function.
1465         (builtins_manager::get_attrs_tree): Two new functions.
1466         (builtins_manager::make_attrs_tree): New function.
1468         * jit-builtins.h: Move everything out of the gcc::jit::recording
1469         namespace into just gcc::jit.
1470         (enum built_in_attribute): New.
1471         (builtins_manager::builtins_manager): Update decl for namespace
1472         change.
1473         (builtins_manager::get_builtin_function): Likewise.
1474         (builtins_manager::get_class): New.
1475         (builtins_manager::implicit_p): New.
1476         (builtins_manager::get_attrs_tree): Two new functions.
1477         (builtins_manager::make_attrs_tree): New function.
1478         (builtins_manager::finish_playback): New.
1479         (builtins_manager::get_builtin_function_by_id): New.
1480         (builtins_manager::make_builtin_function): Update decl for
1481         namespace change.
1482         (builtins_manager::get_type): Likewise.
1483         (builtins_manager::make_type): Likewise.
1484         (builtins_manager::make_primitive_type): Likewise.
1485         (builtins_manager::make_fn_type): Likewise.
1486         (builtins_manager::make_ptr_type): Likewise.
1487         (builtins_manager): Likewise for fields.  Add new field
1488         "m_attributes".
1490         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1491         (builtins_manager): Update forward decl to reflect namespace
1492         change.
1494         * jit-playback.c: Include attribs.h and jit-builtins.h.
1495         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1496         for the new COMPLEX_ types.
1497         (gcc::jit::playback::context::new_function): If creating a
1498         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1499         and call set_builtin_decl.
1500         (gcc::jit::playback::context::replay): If we have a
1501         builtins_manager, call its finish_playback method when we're done.
1503         * jit-playback.h:
1504         (gcc::jit::playback::context::get_builtins_manager): New function.
1506         * jit-recording.c
1507         (gcc::jit::recording::context::get_builtins_manager): New function.
1508         (gcc::jit::recording::get_builtin_function): Use
1509         get_builtins_manager, in case we're a child context.
1510         (gcc::jit::recording::memento_of_get_type::dereference): Add the
1511         COMPLEX_ types.
1512         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1513         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1514         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1515         (get_type_strings): Likewise.
1517         * jit-recording.h
1518         (gcc::jit::recording::context::get_builtins_manager): New.
1520         * libgccjit.h (enum gcc_jit_types): Add
1521         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1522         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1524 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1526         * jit-builtins.c
1527         (gcc::jit::recording::builtins_manager::get_builtin_function):
1528         Check for NULL return from make_builtin_function.
1529         (gcc::jit::recording::builtins_manager::make_builtin_function):
1530         Check for NULL return from get_type.
1532 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1534         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1535         creation code into...
1536         (gcc::jit::playback::context::convert_to_dso): New function.
1537         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1538         New function.
1540 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1542         * jit-playback.c (gcc::jit::playback::context::compile): Use an
1543         auto_vec<const char *> rather than a const char *[20] for the
1544         top-level argv, and move the logic to build it to...
1545         (gcc::jit::playback::context::make_fake_args): New function.
1546         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1547         New function.
1549 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1551         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1552         * jit-playback.c: Include new header jit-result.h.
1553         (gcc::jit::result::result): Move to new file jit-result.c.
1554         (gcc::jit::result::~result): Likewise.
1555         (gcc::jit::playback::result): Likewise.
1556         * jit-recording.h (class gcc::jit::result): Move to new
1557         header jit-result.h.
1558         * jit-result.c: New file, to contain...
1559         (gcc::jit::result::result): Move here from jit-playback.c,
1560         removing erroneous "playback" namespace from comment.
1561         (gcc::jit::result::~result): Likewise.
1562         (gcc::jit::playback::result): Likewise.
1563         * jit-result.h: New file, to contain...
1564         (class gcc::jit::result): Move from jit-recording.h.
1565         * libgccjit.c: Include jit-result.h.
1566         (gcc_jit_result_get_code): Update comment to reflect move
1567         of implementation.
1568         (gcc_jit_result_release): Likewise.
1570 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1572         PR jit/63854
1573         * docs/examples/tut04-toyvm/toyvm.c
1574         (toyvm_compiled_function): New typedef.
1575         (toyvm_compiled_func) Rename to...
1576         (toyvm_compiled_code) ...this.
1577         (struct toyvm_compiled_function): New struct.
1578         (toyvm_function_compile): Return a toyvm_compiled_function *
1579         rather than a toyvm_compiled_func, so that the caller can fully
1580         clean things up.  Free "funcname".
1581         (test_script): Update for change to toyvm_function_compile.
1582         Clean up the toyvm_compiled_function.
1583         (main): Likewise.
1584         (docs/intro/tutorial04.rst): Update to reflect the above changes,
1585         and to better spell out the lifetime of the compiled code.
1587 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1589         PR jit/63854
1590         * jit-builtins.c
1591         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1592         context's new_function_type method, rather than directly creating
1593         a function_type instance.
1594         * jit-recording.c
1595         (gcc::jit::recording::context::new_function_type): New method,
1596         adapted from part of...
1597         (gcc::jit::recording::context::new_function_ptr_type): ...this.
1598         Update to call new_function_type.
1599         * jit-recording.h
1600         (gcc::jit::recording::context::new_function_type): New method.
1602 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1604         PR jit/63969
1605         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1607 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1609         PR jit/63854
1610         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1611         Convert param from const vec<playback::field *> & to
1612         const auto_vec<playback::field *> *.
1613         (gcc::jit::playback::context::new_function_type): Convert param
1614         "param_types" from vec<type *> * to const auto_vec<type *> *.
1615         (gcc::jit::playback::context::new_function): Convert param
1616         "params" from vec<param *> * to const auto_vec<param *> *.
1617         (gcc::jit::playback::context::build_call): Convert param "args"
1618         from vec<rvalue *> to const auto_vec<rvalue *> *.
1619         (gcc::jit::playback::context::new_call): Likewise.
1620         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1621         (wrapper_finalizer): New function.
1622         (gcc::jit::playback::wrapper::operator new): Call the finalizer
1623         variant of ggc_internal_cleared_alloc, supplying
1624         wrapper_finalizer.
1625         (gcc::jit::playback::function::finalizer): New.
1626         (gcc::jit::playback::block::finalizer): New.
1627         (gcc::jit::playback::source_file::finalizer): New.
1628         (gcc::jit::playback::source_line::finalizer): New.
1630         * jit-playback.h
1631         (gcc::jit::playback::context::new_function_type): Convert param
1632         "param_types" from vec<type *> * to const auto_vec<type *> *.
1633         (gcc::jit::playback::context::new_function): Convert param
1634         "params" from vec<param *> * to const auto_vec<param *> *.
1635         (gcc::jit::playback::context::new_call): Convert param
1636         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1637         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1638         (gcc::jit::playback::context::build_call): Likewise.
1639         (gcc::jit::playback::context): Convert fields "m_functions",
1640         "m_source_files", "m_cached_locations" from vec to auto_vec.
1641         (gcc::jit::playback::wrapper::finalizer): New virtual function.
1642         (gcc::jit::playback::compound_type::set_fields): Convert param fro
1643         const vec<playback::field *> & to
1644         const auto_vec<playback::field *> *.
1645         (gcc::jit::playback::function::finalizer): New.
1646         (gcc::jit::playback::block::finalizer): New.
1647         (gcc::jit::playback::source_file::finalizer): New.
1648         (gcc::jit::playback::source_line::finalizer): New.
1650         * jit-recording.c
1651         (gcc::jit::recording::function_type::replay_into): Convert local
1652         from a vec into an auto_vec.
1653         (gcc::jit::recording::fields::replay_into): Likewise.
1654         (gcc::jit::recording::function::replay_into): Likewise.
1655         (gcc::jit::recording::call::replay_into): Likewise.
1656         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1658         * jit-recording.h (gcc::jit::recording::context): Convert fields
1659         "m_mementos", "m_compound_types", "m_functions" from vec<> to
1660         auto_vec <>.
1661         (gcc::jit::recording::function_type::get_param_types): Convert
1662         return type from vec<type *> to const vec<type *> &.
1663         (gcc::jit::recording::function_type): Convert field
1664         "m_param_types" from a vec<> to an auto_vec<>.
1665         (gcc::jit::recording::fields): Likewise for field "m_fields".
1666         (gcc::jit::recording::function::get_params): Convert return type
1667         from vec <param *> to const vec<param *> &.
1668         (gcc::jit::recording::function): Convert fields "m_params",
1669         "m_locals", "m_blocks" from vec<> to auto_vec<>.
1670         (gcc::jit::recording::block): Likewise for field "m_statements".
1671         vec<> to auto_vec<>.
1672         (gcc::jit::recording::call): Likewise for field "m_args".
1673         (gcc::jit::recording::call_through_ptr): Likewise.
1675 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1677         PR jit/63854
1678         * jit-recording.c (recording::function::validate): Convert
1679         "worklist" from vec<> to autovec<> to fix a leak.
1681 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
1683         * ChangeLog.jit: New.
1684         * ChangeLog: New.
1685         * Make-lang.in: New.
1686         * TODO.rst: New.
1687         * config-lang.in: New.
1688         * docs/Makefile: New.
1689         * docs/_build/texinfo/Makefile: New.
1690         * docs/_build/texinfo/factorial.png: New.
1691         * docs/_build/texinfo/libgccjit.texi: New.
1692         * docs/_build/texinfo/sum-of-squares.png: New.
1693         * docs/conf.py: New.
1694         * docs/examples/tut01-hello-world.c: New.
1695         * docs/examples/tut02-square.c: New.
1696         * docs/examples/tut03-sum-of-squares.c: New.
1697         * docs/examples/tut04-toyvm/Makefile: New.
1698         * docs/examples/tut04-toyvm/factorial.toy: New.
1699         * docs/examples/tut04-toyvm/fibonacci.toy: New.
1700         * docs/examples/tut04-toyvm/toyvm.c: New.
1701         * docs/index.rst: New.
1702         * docs/internals/index.rst: New.
1703         * docs/intro/factorial.png: New.
1704         * docs/intro/index.rst: New.
1705         * docs/intro/sum-of-squares.png: New.
1706         * docs/intro/tutorial01.rst: New.
1707         * docs/intro/tutorial02.rst: New.
1708         * docs/intro/tutorial03.rst: New.
1709         * docs/intro/tutorial04.rst: New.
1710         * docs/topics/contexts.rst: New.
1711         * docs/topics/expressions.rst: New.
1712         * docs/topics/functions.rst: New.
1713         * docs/topics/index.rst: New.
1714         * docs/topics/locations.rst: New.
1715         * docs/topics/objects.rst: New.
1716         * docs/topics/results.rst: New.
1717         * docs/topics/types.rst: New.
1718         * dummy-frontend.c: New.
1719         * jit-builtins.c: New.
1720         * jit-builtins.h: New.
1721         * jit-common.h: New.
1722         * jit-playback.c: New.
1723         * jit-playback.h: New.
1724         * jit-recording.c: New.
1725         * jit-recording.h: New.
1726         * libgccjit++.h: New.
1727         * libgccjit.c: New.
1728         * libgccjit.h: New.
1729         * libgccjit.map: New.
1730         * notes.txt: New.
1732 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
1734         * Initial creation
1736 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1738 Copying and distribution of this file, with or without modification,
1739 are permitted in any medium without royalty provided the copyright
1740 notice and this notice are preserved.