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