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