Unbreak the JIT after conversion of md_asm_adjust to use vec<>
[official-gcc.git] / gcc / jit / ChangeLog
blob279377c2580a1a5a670f812286dba3065b89bc5e
1 2015-05-12  David Malcolm  <dmalcolm@redhat.com>
3         * jit-builtins.c: Include vec.h before target.h.
5 2015-04-27  Jim Wilson  <jim.wilson@linaro.org>
7         * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
8         files.
10 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
12         PR jit/65691
13         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
14         and paste error in description of gccjit::context::one.
15         * docs/topics/expressions.rst (Simple expressions): Likewise in
16         description of gcc_jit_context_one.
17         * docs/_build/texinfo/libgccjit.texi: Regenerate.
19 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
21         * jit-recording.c (dump::write): Also check vasprintf return value.
22         (recording::context::add_error_va): Ditto.
23         (recording::string::from_printf): Ditto.
25 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
27         * docs/internals/index.rst (Packaging notes): New section.
28         * docs/_build/texinfo/libgccjit.texi: Regenerate.
30 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
32         * docs/cp/intro/tutorial03.rst: Add missing arguments to
33         gccjit::block::end_with_conditional call.  Add on_true/on_false
34         comments.  Tweak the wording.
35         * docs/intro/tutorial03.rst: Add missing arguments to
36         gcc_jit_block_end_with_conditional call.  Add some clarifying
37         comments.
38         * docs/topics/compilation.rst: Tweak the wording to avoid an
39         ambiguous use of "this".
40         * docs/topics/contexts.rst: Fix a typo.
41         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
42         a stray backtick.
43         * docs/_build/texinfo/libgccjit.texi: Regenerate.
45 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
47         PR libgomp/64625
48         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
49         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
50         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
51         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
52         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
53         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
55 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
57         PR jit/64257
58         * docs/conf.py (html_theme): Change from 'pyramid'
59         to 'sphinxdoc'.
61 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
63         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
64         typo.
65         * docs/_build/texinfo/libgccjit.texi: Regenerate.
67 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
69         * jit-logging.h (gcc::jit::log_user::log): Make const.
70         * jit-recording.c (gcc::jit::recording::context::set_str_option):
71         Log the new value of the option.
72         (gcc::jit::recording::context::set_int_option): Likewise.
73         (gcc::jit::recording::context::set_bool_option): Likewise.
74         (gcc::jit::recording::context::compile): Log the value of all
75         options.
76         (gcc::jit::recording::context::compile_to_file): Likewise.
77         (gcc::jit::recording::context::log_all_options): New function.
78         (gcc::jit::recording::context::log_str_option): New function.
79         (gcc::jit::recording::context::log_int_option): New function.
80         (gcc::jit::recording::context::log_bool_option): New function.
81         * jit-recording.h (gcc::jit::recording::context::log_all_options):
82         New function.
83         (gcc::jit::recording::context::log_str_option): New function.
84         (gcc::jit::recording::context::log_int_option): New function.
85         (gcc::jit::recording::context::log_bool_option): New function.
86         * docs/internals/test-hello-world.exe.log.txt: Update for above
87         changes.
88         * docs/_build/texinfo/libgccjit.texi: Regenerate.
90 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
92         PR jit/64810
93         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
94         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
95         * jit-playback.c: Include gcc.h.
96         (gcc::jit::playback::context::compile): Move mutex acquisition
97         to before the call to make_fake_args.
98         (append_arg_from_driver): New function.
99         (gcc::jit::playback::context::make_fake_args): On the first call,
100         call into driver_get_configure_time_options to get configure-time
101         default options and cache them.  Add them to the args for
102         toplev::main.
103         * jit-spec.c: New source file.
104         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
105         above changes.
106         * docs/_build/texinfo/libgccjit.texi: Regenerate.
108 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
110         PR jit/64810
111         * dummy-frontend.c (jit_langhook_type_for_mode): Support
112         TYPE_MODE (long_long_integer_type_node).
114 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
116         * docs/internals/test-hello-world.exe.log.txt: Add example version
117         lines.
118         * docs/_build/texinfo/libgccjit.texi: Regenerate.
119         * jit-common.h (gcc::jit::dump::get_file): New accessor.
120         * jit-logging.c: Include toplev.h.
121         (gcc::jit::logger::logger): Log the GCC version.
122         * jit-recording.c: Include toplev.h.
123         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
124         GCC version.
126 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
128         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
129         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
130         error buffer is only valid until the next call to the context.
131         * docs/_build/texinfo/libgccjit.texi: Regenerate.
132         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
133         comment to omit mention of compiling.
134         (gcc_jit_context_get_last_error): The error buffer is only valid
135         until the next call to the context.
137 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
139         PR jit/64708
140         * config-lang.in (compilers): Drop "libgccjit.so".
142 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
144         PR jit/64721
145         * jit-playback.c (gcc::jit::playback::context::compile): Construct
146         toplev instances with init_signals=false.
148 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
150         * docs/cp/topics/results.rst: Rename to...
151         * docs/cp/topics/compilation.rst: ...this, and add section on
152         ahead-of-time compilation.
153         * docs/cp/topics/index.rst: Update for renaming of results.rst
154         to compilation.rst.
155         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
156         script.
157         * docs/examples/tut05-bf.c: New file, implementing a compiler
158         for "brainf".
159         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
160         changes to logger output.
161         * docs/intro/index.rst: Add tutorial05.rst
162         * docs/intro/tutorial05.rst: New file.
163         * docs/topics/results.rst: Rename to...
164         * docs/topics/compilation.rst: ...this, and add section on
165         ahead-of-time compilation.
166         * docs/topics/index.rst: Update for renaming of results.rst to
167         compilation.rst.
168         * docs/_build/texinfo/libgccjit.texi: Regenerate.
169         * jit-playback.c (gcc::jit::playback::context::compile): Convert
170         return type from result * to void.  Move the code to convert to
171         dso and dlopen the result to a new pure virtual "postprocess"
172         method.
173         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
174         function.
175         (gcc::jit::playback::compile_to_memory::postprocess): New
176         function, based on playback::context::compile.
177         (gcc::jit::playback::compile_to_file::compile_to_file): New
178         function.
179         (gcc::jit::playback::compile_to_file::postprocess): New function.
180         (gcc::jit::playback::compile_to_file::copy_file): New function.
181         (gcc::jit::playback::context::convert_to_dso): Move internals
182         to...
183         (gcc::jit::playback::context::invoke_driver): New method.  Add
184         "-shared" and "-c" options to driver's argv as needed.
185         * jit-playback.h: Include "timevar.h".
186         (gcc::jit::playback::context::compile): Convert return type from
187         result * to void.
188         (gcc::jit::playback::context::postprocess): New pure virtual
189         function, making this an abstract base class.
190         (gcc::jit::playback::context::get_tempdir): New accessor.
191         (gcc::jit::playback::context::invoke_driver): New function.
192         (class gcc::jit::playback::compile_to_memory): New subclass of
193         playback::context.
194         (class gcc::jit::playback::compile_to_file): Likewise.
195         * jit-recording.c (gcc::jit::recording::context::compile): Use a
196         playback::compile_to_memory, and extract its result.
197         (gcc::jit::recording::context::compile_to_file): New function.
198         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
199         New function.
200         * libgccjit++.h (gccjit::context::compile_to_file): New method.
201         * libgccjit.c (gcc_jit_context_compile): Update log message to
202         clarify that this is an in-memory compile.
203         (gcc_jit_context_compile_to_file): New function.
204         * libgccjit.h (gcc_jit_context): Clarify that you can compile
205         a context more than once, and that you can compile to a file
206         as well as to memory.
207         (gcc_jit_result): Clarify that this is the result of an
208         in-memory compilation.
209         (gcc_jit_context_compile): Clarify that you can compile, and that
210         this is an in-memory compilation.
211         (enum gcc_jit_output_kind): New enum.
212         (gcc_jit_context_compile_to_file): New function.
213         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
214         of compilation.
215         * libgccjit.map (gcc_jit_context_compile_to_file): New API
216         entrypoint.
217         * notes.txt: Update to show the playback::context::postprocess
218         virtual function.
220 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
222         * jit-recording.c
223         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
224         Add missing format string.
226 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
228         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
229         (check_jit_parallelize): Set this to an arbitrary value (10).
231 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
233         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
234         last argument.
235         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
236         undef afterwards.
237         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
238         Likewise.
240 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
242         Update copyright years in docs/.
244 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
246         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
247         lvalue and the rvalue are of compatible type.
249 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
251         * docs/cp/topics/contexts.rst (Debugging): Add
252         gccjit::context::dump_reproducer_to_file.
253         * docs/internals/index.rst (Design notes): New section,
254         discussing input validation and
255         gcc_jit_context_dump_reproducer_to_file.
256         * docs/topics/contexts.rst (Debugging): Add
257         gcc_jit_context_dump_reproducer_to_file.
258         * docs/_build/texinfo/libgccjit.texi: Regenerate.
259         * jit-common.h (gcc::jit::dump::get_context): New accessor.
260         * jit-recording.c: Include "hash-map.h".
261         Within namespace ::gcc::jit...
262         (dump::write): Flush each line.
263         (dump::make_location): Pass false for new param "created_by_user".
264         (class allocator): New class.
265         (allocator::~allocator): New function.
266         (allocator::xstrdup_printf): New function.
267         (allocator::xstrdup_printf_va): New function.
268         (class reproducer): New subclass of dump.
269         (reproducer::reproducer): New function.
270         (reproducer::write_params): New function.
271         (reproducer::write_args): New function.
272         (reproducer::make_identifier): New function.
273         (reproducer::make_tmp_identifier): New function.
274         (reproducer::get_identifier): New pair of functions.
275         (reproducer::get_identifier_as_rvalue): New function.
276         (reproducer::get_identifier_as_lvalue): New function.
277         (reproducer::get_identifier_as_type): New function.
278         (reproducer::xstrdup_printf): New function.
279         (recording::context::context): Initialize m_toplevel_ctxt.
280         (recording::context::new_location): Add param created_by_user.
281         (str_option_reproducer_strings): New table of strings.
282         (int_option_reproducer_strings): Likewise.
283         (bool_option_reproducer_strings): Likewise.
284         (get_type_enum_strings): Likewise.
285         (names_of_function_kinds): Likewise.
286         (global_kind_reproducer_strings): Likewise.
287         (unary_op_reproducer_strings): Likewise.
288         (binary_op_reproducer_strings): Likewise.
289         (comparison_reproducer_strings): Likewise.
290         Within namespace ::gcc::jit::recording::...
291         (context::dump_reproducer_to_file): New function.
292         (string::write_reproducer): Likewise.
293         (location::write_reproducer): Likewise.
294         (type::access_as_type): Likewise.
295         (memento_of_get_type::write_reproducer): Likewise.
296         (memento_of_get_pointer::write_reproducer): Likewise.
297         (memento_of_get_const::write_reproducer): Likewise.
298         (memento_of_get_volatile::write_reproducer): Likewise.
299         (array_type::write_reproducer): Likewise.
300         (function_type::write_reproducer): Likewise.
301         (function_type::write_deferred_reproducer): Likewise.
302         (field::write_reproducer): Likewise.
303         (struct_::access_as_type): Likewise.
304         (struct_::write_reproducer): Likewise.
305         (union_::write_reproducer): Likewise.
306         (fields::write_reproducer): Likewise.
307         (rvalue::access_as_rvalue): Likewise.
308         (lvalue::access_as_rvalue): Likewise.
309         (lvalue::access_as_lvalue): Likewise.
310         (param::access_as_rvalue): Likewise.
311         (param::access_as_lvalue): Likewise.
312         (param::write_reproducer): Likewise.
313         (function::write_reproducer): Likewise.
314         (block::write_reproducer): Likewise.
315         (global::write_reproducer): Likewise.
316         (memento_of_new_rvalue_from_const <int>::write_reproducer):
317         Likewise.
318         (memento_of_new_rvalue_from_const <long>::write_reproducer):
319         Likewise.
320         (memento_of_new_rvalue_from_const <double>::write_reproducer):
321         Likewise.
322         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
323         Likewise.
324         (memento_of_new_string_literal::write_reproducer): Likewise.
325         (unary_op::write_reproducer): Likewise.
326         (binary_op::write_reproducer): Likewise.
327         (comparison::write_reproducer): Likewise.
328         (cast::write_reproducer): Likewise.
329         (call::write_reproducer): Likewise.
330         (call_through_ptr::write_reproducer): Likewise.
331         (array_access::write_reproducer): Likewise.
332         (access_field_of_lvalue::write_reproducer): Likewise.
333         (access_field_rvalue::write_reproducer): Likewise.
334         (dereference_field_rvalue::write_reproducer): Likewise.
335         (dereference_rvalue::write_reproducer): Likewise.
336         (get_address_of_lvalue::write_reproducer): Likewise.
337         (local::write_reproducer): Likewise.
338         (eval::write_reproducer): Likewise.
339         (assignment::write_reproducer): Likewise.
340         (assignment_op::write_reproducer): Likewise.
341         (comment::write_reproducer): Likewise.
342         (conditional::write_reproducer): Likewise.
343         (jump::write_reproducer): Likewise.
344         (return_::write_reproducer): Likewise.
345         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
346         Within namespace ::gcc::jit::recording::...
347         (context::new_location): Add "created_by_user" param.
348         (context::dump_reproducer_to_file): New method.
349         (context::m_toplevel_ctxt): New field.
350         (memento::write_reproducer): New pure virtual function.
351         (memento::dyn_cast_location): New virtual function.
352         (string::write_reproducer):
353         (location::location): Add "created_by_user" param.
354         (location::dyn_cast_location): New function.
355         (location::created_by_user): New accessor.
356         (location::write_reproducer): New function.
357         (location::m_created_by_user): New field.
358         (type::access_as_type): New virtual function.
359         (location::write_reproducer): Likewise.
360         (type::access_as_type): Likewise.
361         (memento_of_get_type::write_reproducer): Likewise.
362         (memento_of_get_pointer::write_reproducer): Likewise.
363         (memento_of_get_const::write_reproducer): Likewise.
364         (memento_of_get_volatile::write_reproducer): Likewise.
365         (array_type::write_reproducer): Likewise.
366         (function_type::write_reproducer): Likewise.
367         (function_type::write_deferred_reproducer): Likewise.
368         (field::write_reproducer): Likewise.
369         (struct_::access_as_type): Likewise.
370         (struct_::write_reproducer): Likewise.
371         (union_::write_reproducer): Likewise.
372         (union_::m_fields): Remove stray unused field.
373         (fields::length): New accessor.
374         (fields::get_field): New accessor.
375         (fields::write_reproducer): New function.
376         (rvalue::access_as_rvalue): Likewise.
377         (lvalue::access_as_rvalue): Likewise.
378         (lvalue::access_as_lvalue): Likewise.
379         (param::access_as_rvalue): Likewise.
380         (param::access_as_lvalue): Likewise.
381         (param::write_reproducer): Likewise.
382         (function::write_reproducer): Likewise.
383         (block::write_reproducer): Likewise.
384         (global::write_reproducer): Likewise.
385         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
386         Likewise.
387         (memento_of_new_string_literal::write_reproducer): Likewise.
388         (unary_op::write_reproducer): Likewise.
389         (binary_op::write_reproducer): Likewise.
390         (comparison::write_reproducer): Likewise.
391         (cast::write_reproducer): Likewise.
392         (call::write_reproducer): Likewise.
393         (call_through_ptr::write_reproducer): Likewise.
394         (array_access::write_reproducer): Likewise.
395         (access_field_of_lvalue::write_reproducer): Likewise.
396         (access_field_rvalue::write_reproducer): Likewise.
397         (dereference_field_rvalue::write_reproducer): Likewise.
398         (dereference_rvalue::write_reproducer): Likewise.
399         (get_address_of_lvalue::write_reproducer): Likewise.
400         (local::write_reproducer): Likewise.
401         (eval::write_reproducer): Likewise.
402         (assignment::write_reproducer): Likewise.
403         (assignment_op::write_reproducer): Likewise.
404         (comment::write_reproducer): Likewise.
405         (conditional::write_reproducer): Likewise.
406         (jump::write_reproducer): Likewise.
407         (return_::write_reproducer): Likewise.
408         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
409         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
410         param "created_by_user".
411         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
412         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
413         entrypoint.
414         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
415         entrypoint.
417 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
419         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
420         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
421         ctor.
422         (gcc::jit::rvalue_usage_validator::visit): New function.
423         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
424         function.
425         (gcc::jit::recording::rvalue::set_scope): New function.
426         (gcc::jit::recording::function::function): Call set_scope on each
427         param, issuing errors for any params that already have a function.
428         (gcc::jit::recording::block::add_eval): Return the new statement;
429         update the comment given that some error-checking now happens after
430         this returns.
431         (gcc::jit::recording::block::add_assignment): Likewise.
432         (gcc::jit::recording::block::add_assignment_op): Likewise.
433         (gcc::jit::recording::block::add_comment): Likewise.
434         (gcc::jit::recording::block::end_with_conditional): Likewise.
435         (gcc::jit::recording::block::end_with_jump): Likewise.
436         (gcc::jit::recording::block::end_with_return): Likewise.
437         (gcc::jit::recording::block::validate): Add a comment.
438         (gcc::jit::recording::unary_op::visit_children): New function.
439         (gcc::jit::recording::binary_op::visit_children): New function.
440         (gcc::jit::recording::comparison::visit_children): New function.
441         (gcc::jit::recording::cast::visit_children): New function.
442         (gcc::jit::recording::call::visit_children): New function.
443         (gcc::jit::recording::call_through_ptr::visit_children): New function.
444         (gcc::jit::recording::array_access::visit_children): New function.
445         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
446         function.
447         (gcc::jit::recording::access_field_rvalue::visit_children): New
448         function.
449         (gcc::jit::recording::dereference_field_rvalue::visit_children):
450         New function.
451         (gcc::jit::recording::dereference_rvalue::visit_children): New
452         function.
453         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
454         function.
455         * jit-recording.h: Within namespace gcc::jit::recording...
456         (class rvalue_visitor): New.
457         (rvalue::rvalue): Initialize m_scope.
458         (rvalue::get_loc): New accessor.
459         (rvalue::verify_valid_within_stmt): New function.
460         (rvalue::visit_children): New pure virtual function.
461         (rvalue::set_scope): New function.
462         (rvalue::get_scope): New function.
463         (rvalue::dyn_cast_param): New function.
464         (rvalue::m_scope): New field.
465         (param::visit_children): New empty function.
466         (param::dyn_cast_param): New function.
467         (function::get_loc): New function.
468         (block::add_eval): Return the new statement.
469         (block::add_assignment): Likewise.
470         (block::add_assignment_op): Likewise.
471         (block::add_comment): Likewise.
472         (block::end_with_conditional): Likewise.
473         (block::end_with_jump): Likewise.
474         (block::end_with_return): Likewise.
475         (global::visit_children): New function.
476         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
477         New function.
478         (memento_of_new_string_literal::visit_children): New function.
479         (unary_op::visit_children): New function.
480         (binary_op::visit_children): New function.
481         (comparison::visit_children): New function.
482         (cast::visit_children): New function.
483         (call::visit_children): New function.
484         (call_through_ptr::visit_children): New function.
485         (array_access::visit_children): New function.
486         (access_field_of_lvalue::visit_children): New function.
487         (access_field_rvalue::visit_children): New function.
488         (dereference_field_rvalue::visit_children): New function.
489         (dereference_rvalue::visit_children): New function.
490         (get_address_of_lvalue::visit_children): New function.
491         (local::local): Call set_scope.
492         (local::visit_children): New function.
493         (statement::get_block): Make public.
494         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
495         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
496         (gcc_jit_context_new_function): Verify that each param has
497         not yet been used for creating another function.
498         (gcc_jit_block_add_eval): After creating the stmt, verify
499         that the rvalue expression tree is valid to use within it.
500         (gcc_jit_block_add_assignment): Likewise for the lvalue and
501         rvalue expression trees.
502         (gcc_jit_block_add_assignment_op): Likewise.
503         (gcc_jit_block_end_with_conditional): Likewise for the boolval
504         expression tree.
505         (gcc_jit_block_end_with_return): Likewise for the rvalue
506         expression tree.
507         (gcc_jit_block_end_with_void_return): Remove return of "void",
508         now that block::end_with_return is now non-void.
510 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
512         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
513         Add missing fclose on error-handling path.
515 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
517         * docs/cp/topics/expressions.rst (Global variables): Add
518         enum gcc_jit_global_kind param to gccjit::context::new_global.
519         * docs/topics/expressions.rst (Global variables): Likewise.
520         Document the new enum.
521         * docs/topics/results.rst (Compilation results): Document
522         globals-handling.
523         * docs/_build/texinfo/libgccjit.texi: Regenerate.
524         * dummy-frontend.c (jit_langhook_write_globals): Call into the
525         playback context's write_global_decls_1 and write_global_decls_2
526         before and after calling symtab->finalize_compilation_unit ().
527         * jit-playback.c: Include "debug.h".
528         (gcc::jit::playback::context::new_global): Add "kind" param and
529         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
530         underlying VAR_DECL.  Call varpool_node::get_create on the
531         VAR_DECL, and add it to m_globals.
532         (gcc::jit::playback::context::write_global_decls_1): New function.
533         (gcc::jit::playback::context::write_global_decls_2): New function.
534         * jit-playback.h (gcc::jit::playback::context::context): Call
535         create on m_globals.
536         (gcc::jit::playback::context::new_global): Add "kind" param.
537         (gcc::jit::playback::context::write_global_decls_1): New function.
538         (gcc::jit::playback::context::write_global_decls_2): New function.
539         (gcc::jit::playback::context::m_globals): New field.
540         * jit-recording.c (gcc::jit::recording::context::context):
541         Initialize m_globals.
542         (gcc::jit::recording::context::new_global): Add param "kind".
543         Add the new global to m_globals.
544         (gcc::jit::recording::context::dump_to_file): Dump the globals.
545         (gcc::jit::recording::global::replay_into): Add field m_kind.
546         (gcc::jit::recording::global::write_to_dump): New override.
547         * jit-recording.h (gcc::jit::recording::context::new_global): Add
548         param "kind".
549         (gcc::jit::recording::context::m_globals): New field.
550         (gcc::jit::recording::global::global): Add param kind.
551         (gcc::jit::recording::global::write_to_dump): New override.
552         (gcc::jit::recording::global::m_kind): New field.
553         * jit-result.c (gcc::jit::result::get_global): New function.
554         * jit-result.h (gcc::jit::result::get_global): New function.
555         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
556         * libgccjit.c (gcc_jit_context_new_global): Likewise.
557         (gcc_jit_result_get_global): New API entrypoint.
558         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
559         (enum gcc_jit_global_kind): New enum.
560         (gcc_jit_context_new_global): API change: add "kind" param.
561         * libgccjit.map (gcc_jit_result_get_global): New symbol.
563 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
565         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
566         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
567         earlier.
568         * jit-builtins.c: Remove redundant includes of "opts.h" and
569         "tree.h".
570         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
571         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
572         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
573         "statistics.h", "vec.h", "double-int.h", "real.h",
574         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
575         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
576         earlier.
577         * jit-recording.c: Remove redundant includes of "opts.h" and
578         "tree.h".
580 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
582         * docs/cp/topics/expressions.rst (Simple expressions): Use
583         ":c:type:" for C types.  Document new overload of
584         gcc::jit::context::new_rvalue.
585         * docs/topics/expressions.rst (Simple expressions): Use
586         ":c:type:" for C types.  Document new entrypoint
587         gcc_jit_context_new_rvalue_from_long.
588         * docs/_build/texinfo/libgccjit.texi: Regenerate.
589         * jit-playback.c: Within namespace gcc::jit::playback...
590         (context::new_rvalue_from_int): Eliminate in favor of...
591         (context::new_rvalue_from_const <int>): ...this.
592         (context::new_rvalue_from_double): Eliminate in favor of...
593         (context::new_rvalue_from_const <double>): ...this.
594         (context::new_rvalue_from_const <long>): New.
595         (context::new_rvalue_from_ptr): Eliminate in favor of...
596         (context::new_rvalue_from_const <void *>): ...this.
597         * jit-playback.h: Within namespace gcc::jit::playback...
598         (context::new_rvalue_from_int): Eliminate in favor of...
599         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
600         (context::new_rvalue_from_double): Likewise.
601         (context::new_rvalue_from_ptr): Likewise.
602         * jit-recording.c: Within namespace gcc::jit::recording...
603         (context::new_rvalue_from_int): Eliminate.
604         (context::new_rvalue_from_double): Likewise.
605         (context::new_rvalue_from_ptr): Likewise.
606         (class memento_of_new_rvalue_from_const <int>):
607         Add explicit specialization.
608         (class memento_of_new_rvalue_from_const <long>):
609         Likewise.
610         (class memento_of_new_rvalue_from_const <double>):
611         Likewise.
612         (class memento_of_new_rvalue_from_const <void *>):
613         Likewise.
614         (memento_of_new_rvalue_from_int::replay_into):
615         Generalize into...
616         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
617         ...this...
618         (memento_of_new_rvalue_from_double::replay_into):
619         ...allowing this...
620         (memento_of_new_rvalue_from_ptr::replay_into):
621         ...and this to be deleted.
622         (memento_of_new_rvalue_from_int::make_debug_string):
623         Convert to...
624         (memento_of_new_rvalue_from_const <int>::make_debug_string):
625         ...this.
626         (memento_of_new_rvalue_from_double::make_debug_string):
627         Convert to...
628         (memento_of_new_rvalue_from_const <double>::make_debug_string):
629         ...this.
630         (memento_of_new_rvalue_from_ptr::make_debug_string)
631         Convert to...
632         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
633         ...this.
634         (memento_of_new_rvalue_from_const <long>::make_debug_string):
635         New function.
636         * jit-recording.h: Within namespace gcc::jit::recording...
637         (context::new_rvalue_from_int): Eliminate.
638         (context::new_rvalue_from_double): Likewise.
639         (context::new_rvalue_from_ptr): Likewise, all in favor of...
640         (context::new_rvalue_from_const <HOST_TYPE>): New family of
641         methods.
642         (class memento_of_new_rvalue_from_int): Eliminate.
643         (class memento_of_new_rvalue_from_double): Likewise.
644         (class memento_of_new_rvalue_from_ptr): Likewise.
645         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
646         of rvalue subclasses.
647         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
648         "long".
649         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
650         rewriting of recording::context::new_rvalue_from_int to
651         recording::context::new_rvalue_from_const <int>.
652         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
653         (gcc_jit_context_new_rvalue_from_double): Update for
654         rewriting of recording::context::new_rvalue_from_double to
655         recording::context::new_rvalue_from_const <double>.
656         (gcc_jit_context_new_rvalue_from_ptr): Update for
657         rewriting of recording::context::new_rvalue_from_ptr to
658         recording::context::new_rvalue_from_const <void *>.
659         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
660         entrypoint.
661         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
663 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
665         PR jit/64206
666         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
667         shows tempdir creation/cleanup.
668         * docs/_build/texinfo/libgccjit.texi: Regenerate.
669         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
670         to the list of subclasses in the comment.
671         * jit-playback.c (gcc::jit::playback::context::context): Add a
672         comment clarifying when the tempdir gets cleaned up.
673         (gcc::jit::playback::context::compile): Pass the context's logger,
674         if any, to the tempdir.
675         (gcc::jit::playback::context::dlopen_built_dso): When creating the
676         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
677         over ownership of the tempdir to it.
678         * jit-result.c: Include "jit-tempdir.h".
679         (gcc::jit::result::result): Add tempdir param, saving it as
680         m_tempdir.
681         (gcc::jit::result::~result): Delete m_tempdir.
682         * jit-result.h (gcc::jit::result::result): Add tempdir param.
683         (gcc::jit::result::m_tempdir): New field.
684         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
685         add JIT_LOG_SCOPE.
686         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
687         and log m_path_template and m_path_tempdir.
688         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
689         entry/exit, and log the unlink and rmdir calls.
690         * jit-tempdir.h: Include "jit-logging.h".
691         (class gcc::jit::tempdir): Make this be a subclass of log_user.
692         (gcc::jit::tempdir::tempdir): Add logger param.
693         * notes.txt: Update to show the two possible places where the
694         tempdir can be cleaned up.
696 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
698         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
699         comment.
701 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
703         * docs/topics/contexts.rst (Error-handling): Document new
704         entrypoint gcc_jit_context_get_last_error.
705         * docs/_build/texinfo/libgccjit.texi: Regenerate.
706         * jit-recording.c (gcc::jit::recording::context::context):
707         Initialize new fields "m_last_error_str" and
708         "m_owns_last_error_str".
709         (gcc::jit::recording::context::~context): Clean up
710         m_last_error_str, if needed.
711         (gcc::jit::recording::context::add_error_va): Update
712         m_last_error_str and m_owns_last_error_str, freeing the old
713         value if appropriate.
714         (gcc::jit::recording::context::get_last_error): New function.
715         * jit-recording.h (gcc::jit::recording::context::get_last_error):
716         New function.
717         (gcc::jit::recording::context): New fields m_last_error_str and
718         m_owns_last_error_str.
719         * libgccjit.c (gcc_jit_context_get_last_error): New function.
720         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
721         * libgccjit.map (gcc_jit_context_get_last_error): New function.
723 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
725         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
726         * docs/internals/index.rst (Overview of code structure): Mention
727         gcc_jit_context_set_logfile, and embed the example logfile.
728         * docs/internals/test-hello-world.exe.log.txt: New file: example
729         of a logfile.
730         * docs/topics/contexts.rst (Debugging): Add documentation
731         for gcc_jit_context_set_logfile.
732         * docs/_build/texinfo/libgccjit.texi: Regenerate.
733         * dummy-frontend.c: Include "jit-logging.h".
734         (jit_langhook_init): Assert that there is an active playback
735         context.  If it has a logger, log entry/exit to this function.
736         (jit_langhook_write_globals): Likewise.
737         * jit-common.h (gcc::jit::logger): New forward declaration.
738         * jit-logging.c: New file.
739         * jit-logging.h: New file.
740         * jit-playback.c: Include "jit-logging.h".
741         (gcc::jit::playback::context::context): Initialize the log_user
742         base class from the recording context's logger (if any).  Use
743         JIT_LOG_SCOPE to log entry/exit from the function body.
744         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
745         log entry/exit from the function body.
746         (gcc::jit::playback::build_stmt_list): Likewise.
747         (gcc::jit::playback::function::postprocess): Likewise.
748         (gcc::jit::playback::context::compile): Likewise.  Log the
749         entry/exit to toplev::main and toplev::finalize.  Log the
750         fake argv passed to toplev::main.
751         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
752         log entry/exit from the function body.
753         (gcc::jit::playback::context::release_mutex): Likewise.
754         (gcc::jit::playback::context::make_fake_args): Likewise.
755         (gcc::jit::playback::context::extract_any_requested_dumps):
756         Likewise.
757         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
758         log the arguments that the driver is invoked with.
759         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
760         the logger to the result object.
761         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
762         log entry/exit from the function body.
763         (gcc::jit::playback::context::dump_generated_code): Likewise.
764         (gcc::jit::playback::context::handle_locations): Likewise.
765         * jit-playback.h (gcc::jit::playback::context): Make this be
766         a subclass of gcc::jit::log_user.
767         * jit-recording.c: Include "jit-logging.h".
768         (gcc::jit::recording::context::context: Initialize the logger to
769         NULL for root contexts, or to the parent's logger for child
770         contexts.
771         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
772         log entry/exit from the function body.
773         (gcc::jit::recording::context::replay_into): Likewise.
774         (gcc::jit::recording::context::disassociate_from_playback):
775         Likewise.
776         (gcc::jit::recording::context::compile): Likewise.
777         (recording::context::add_error_va): Likewise.  Also, log the
778         error.
779         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
780         log entry/exit from the function body.
781         * jit-recording.h: Include "jit-logging.h".
782         (gcc::jit::recording::context): Make this be a subclass of
783         gcc::jit::log_user.
784         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
785         (gcc::jit::result::result): Add logger param, recording it.
786         Use JIT_LOG_SCOPE to log entry/exit from the function body.
787         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
788         log entry/exit from the function body.
789         (gcc::jit::result::get_code): Likewise.
790         * jit-result.h (gcc::jit::result): Make this be a subclass of
791         gcc::jit::log_user.
792         (gcc::jit::result::result): Add logger parameter.
793         * libgccjit++.h (gccjit::context::set_logfile): New function.
794         * libgccjit.c: Include "jit-logging.h".
795         (gcc_jit_context_acquire): Log the context.
796         (gcc_jit_context_release): Use JIT_LOG_FUNC to
797         log entry/exit from the function body, and log the context.
798         (gcc_jit_context_new_child_context): Likewise, logging both
799         contexts.
800         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
801         log entry/exit from the function body.
802         (gcc_jit_context_get_type): Likewise.
803         (gcc_jit_context_get_int_type): Likewise.
804         (gcc_jit_context_new_array_type): Likewise.
805         (gcc_jit_context_new_field): Likewise.
806         (gcc_jit_context_new_struct_type): Likewise.
807         (gcc_jit_context_new_opaque_struct): Likewise.
808         (gcc_jit_struct_set_fields): Likewise.
809         (gcc_jit_context_new_union_type): Likewise.
810         (gcc_jit_context_new_function_ptr_type): Likewise.
811         (gcc_jit_context_new_param): Likewise.
812         (gcc_jit_context_new_function): Likewise.
813         (gcc_jit_context_get_builtin_function): Likewise.
814         (gcc_jit_function_get_param): Likewise.
815         (gcc_jit_function_dump_to_dot): Likewise.
816         (gcc_jit_function_new_block): Likewise.
817         (gcc_jit_context_new_global): Likewise.
818         (gcc_jit_context_new_rvalue_from_int): Likewise.
819         (gcc_jit_context_zero): Likewise.
820         (gcc_jit_context_one): Likewise.
821         (gcc_jit_context_new_rvalue_from_double): Likewise.
822         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
823         (gcc_jit_context_null): Likewise.
824         (gcc_jit_context_new_string_literal): Likewise.
825         (gcc_jit_context_new_unary_op): Likewise.
826         (gcc_jit_context_new_binary_op): Likewise.
827         (gcc_jit_context_new_comparison): Likewise.
828         (gcc_jit_context_new_call): Likewise.
829         (gcc_jit_context_new_call_through_ptr): Likewise.
830         (gcc_jit_context_new_cast): Likewise.
831         (gcc_jit_context_new_array_access): Likewise.
832         (gcc_jit_lvalue_access_field): Likewise.
833         (gcc_jit_rvalue_access_field): Likewise.
834         (gcc_jit_rvalue_dereference_field): Likewise.
835         (gcc_jit_rvalue_dereference): Likewise.
836         (gcc_jit_lvalue_get_address): Likewise.
837         (gcc_jit_function_new_local): Likewise.
838         (gcc_jit_block_add_eval): Likewise.
839         (gcc_jit_block_add_assignment): Likewise.
840         (gcc_jit_block_add_assignment_op): Likewise.
841         (gcc_jit_block_end_with_conditional): Likewise.
842         (gcc_jit_block_add_comment): Likewise.
843         (gcc_jit_block_end_with_jump): Likewise.
844         (gcc_jit_block_end_with_return): Likewise.
845         (gcc_jit_block_end_with_void_return): Likewise.
846         (gcc_jit_context_set_str_option): Likewise.
847         (gcc_jit_context_set_int_option): Likewise.
848         (gcc_jit_context_set_bool_option): Likewise.
849         (gcc_jit_context_enable_dump): Likewise.
850         (gcc_jit_context_compile): Likewise.  Also log the context,
851         and the result.
852         (gcc_jit_context_dump_to_file): Likewise.
853         (gcc_jit_context_set_logfile): New function.
854         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
855         log entry/exit from the function body.
856         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
857         and the ptr to be returned.
858         (gcc_jit_result_release): Likewise.  Also log the result.
859         * libgccjit.h: Include <stdio.h>, since we need FILE *.
860         (gcc_jit_context_set_logfile): New declaration.
861         * libgccjit.map (gcc_jit_context_set_logfile): New.
863 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
865         * jit-recording.h (gcc::jit::recording::type::is_void): New
866         virtual function.
867         (gcc::jit::recording::memento_of_get_type::is_void): New
868         function, overriding default implementation.
869         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
870         the underlying type is not "void".
872 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
874         * docs/topics/expressions.rst (Unary Operations): Add
875         GCC_JIT_UNARY_OP_ABS.
876         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
877         Likewise.
878         * jit-recording.c (unary_op_strings): Likewise.
879         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
880         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
881         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
882         * docs/_build/texinfo/libgccjit.texi: Regenerate.
884 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
886         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
887         typo in comment.
889 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
891         * TODO.rst (Test suite): Remove item about running C++ testcases.
892         * docs/internals/index.rst (Working on the JIT library): Add
893         "c++" to the enabled languages in the suggested "configure"
894         invocation, and add a description of why this is necessary.
895         * docs/_build/texinfo/libgccjit.texi: Regenerate.
897 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
899         * docs/internals/index.rst: Update to reflect that built
900         testcases are now test-foo.c.exe, rather than test-foo.exe.
901         * docs/_build/texinfo/libgccjit.texi: Regenerate.
903 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
905         Update copyright years.
907 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
909         * jit-playback.c (gcc::jit::playback::context::build_cast): In
910         case BOOLEAN_TYPE, don't assume that the source expression is
911         of type "int".
913 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
915         * jit-recording.c (gcc::jit::recording::context::context): When
916         copying string options from a parent context, take a copy of the
917         underlying buffers, rather than simply copying the pointer.
919 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
921         * jit-recording.c (gcc::jit::recording::context::set_str_option):
922         Handle NULL.
924 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
926         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
927         Document new function.
928         * docs/_build/texinfo/libgccjit.texi: Regenerate.
930 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
932         Minor interface cleanups of libgccjit
933         * jit-playback.c (convert_to_dso): Use auto_vec instead
934         of automatic array to build up command line.
935         * jit-recording.c (recording::context::set_str_option):
936         Make copy of the string.
937         (recording::context::~context): Free string options.
938         * jit-recording.h (recording::context): Adjust type
939         of m_str_options member.
940         * libgccjit.h: Adjust comment about
941         gcc_jit_context_set_str_option parameter being used after
942         the call.
943         Update comment now that all interfaces are copy strings
944         if necessary.
945         * libgccjit++.h (gccjit::context): Add set_str_option
946         member function.
948 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
950         * docs/cp/index.rst: New file.
951         * docs/cp/intro/index.rst: New file.
952         * docs/cp/intro/tutorial01.rst: New file.
953         * docs/cp/intro/tutorial02.rst: New file.
954         * docs/cp/intro/tutorial03.rst: New file.
955         * docs/cp/intro/tutorial04.rst: New file.
956         * docs/cp/topics/contexts.rst: New file.
957         * docs/cp/topics/expressions.rst: New file.
958         * docs/cp/topics/functions.rst: New file.
959         * docs/cp/topics/index.rst: New file.
960         * docs/cp/topics/locations.rst: New file.
961         * docs/cp/topics/objects.rst: New file.
962         * docs/cp/topics/results.rst: New file.
963         * docs/cp/topics/types.rst: New file.
964         * docs/examples/tut01-hello-world.cc: New file.
965         * docs/examples/tut02-square.c: Fix missing newline in output.
966         * docs/examples/tut02-square.cc: New file.
967         * docs/examples/tut03-sum-of-squares.cc: New file.
968         * docs/examples/tut04-toyvm/toyvm.cc: New file.
969         * docs/index.rst: Move summary to above the table of contents.
970         Add text about the C vs C++ APIs.
971         * docs/topics/contexts.rst: Fix a typo.
973         * docs/_build/texinfo/libgccjit.texi: Regenerate.
974         * docs/_build/texinfo/factorial1.png: New file.
975         * docs/_build/texinfo/sum-of-squares1.png: New file.
977 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
979         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
980         logic for determine "funcname" to new function...
981         (get_function_name): ...here, adding logic to skip any leading
982         path from the filename.
983         (toyvm_function_parse): Use the filename for fn_filename, rather
984         than "name", so that the debugger can locate the source .toy
985         file.
986         (toyvm_function_parse): Don't fclose a NULL FILE *.
988 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
990         PR jit/63854
991         * docs/internals/index.rst (Running under valgrind): New
992         subsection.
993         (docs/_build/texinfo/libgccjit.texi): Regenerate.
995 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
997         PR jit/64206
998         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
999         * jit-common.h (gcc::jit::tempdir): New forward decl.
1000         * jit-playback.c: Include jit-tempdir.h.
1001         (gcc::jit::playback::context::context): Initialize m_tempdir.
1002         (gcc::jit::playback::context::~context): Move tempdir
1003         cleanup to new file jit-tempdir.c
1004         (make_tempdir_path_template): Move to new file jit-tempdir.c.
1005         (gcc::jit::playback::context::compile): Move tempdir creation
1006         to new tempdir object in new file jit-tempdir.c.
1007         (gcc::jit::playback::context::make_fake_args): Get path from
1008         tempdir object rather than from member data.
1009         (gcc::jit::playback::context::convert_to_dso): Likewise.
1010         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1011         (gcc::jit::playback::context::dump_generated_code): Likewise.
1012         (gcc::jit::playback::context::get_path_c_file): New function.
1013         (gcc::jit::playback::context::get_path_s_file): New function.
1014         (gcc::jit::playback::context::get_path_so_file): New function.
1015         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1016         New function.
1017         (gcc::jit::playback::context::get_path_s_file): New function.
1018         (gcc::jit::playback::context::get_path_so_file): New function.
1019         (gcc::jit::playback::context): Move fields "m_path_template",
1020         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1021         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1022         * jit-tempdir.c: New file.
1023         * jit-tempdir.h: New file.
1025 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1027         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1028         mutex here, immediately before using toplev, and release it here, on
1029         each exit path after acquisition.
1030         (jit_mutex): Move this variable here, from jit-recording.c.
1031         (gcc::jit::playback::context::acquire_mutex): New function, based on
1032         code in jit-recording.c.
1033         (gcc::jit::playback::context::release_mutex): Likewise.
1034         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1035         function.
1036         (gcc::jit::playback::context::release_mutex): New function.
1037         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1038         (gcc::jit::recording::context::compile): Move mutex-handling from
1039         here into jit-playback.c's gcc::jit::playback::context::compile.
1040         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1041         and RELEASE_MUTEX.
1043 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1045         * jit-playback.c (gcc::jit::playback::context::compile): Move the
1046         dlopen code into...
1047         (gcc::jit::playback::context::dlopen_built_dso): ...this new
1048         function.
1049         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1050         New function.
1052 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1054         PR jit/64166
1055         * docs/topics/contexts.rst (Debugging): Add description of
1056         gcc_jit_context_enable_dump.
1057         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1058         * jit-playback.c: Include context.h.
1059         (class auto_argvec): New class.
1060         (auto_argvec::~auto_argvec): New function.
1061         (gcc::jit::playback::context::compile): Convert fake_args to be
1062         an auto_argvec, so that it can contain dynamically-allocated
1063         strings.   Construct a vec of all requested dumps, and pass it to
1064         make_fake_args.  Extract requested dumps between the calls to
1065         toplev::main and toplev::finalize.
1066         (gcc::jit::playback::context::make_fake_args): Convert param
1067         "argvec" to be a vec <char *>, and gain a "requested_dumps"
1068         param.  Convert to dynamically-allocated arg strings by converting
1069         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1070         for args that are already a copy.  Add args for all requested dumps.
1071         (gcc::jit::playback::context::extract_any_requested_dumps): New
1072         function.
1073         (gcc::jit::playback::context::read_dump_file): New function.
1074         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1075         Convert param "argvec" to be a vec <char *>, and gain a
1076         "requested_dumps" param.
1077         (gcc::jit::playback::context::extract_any_requested_dumps): New
1078         function.
1079         (gcc::jit::playback::context::read_dump_file): New function.
1080         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1081         function.
1082         (gcc::jit::recording::context::get_all_requested_dumps): New
1083         function.
1084         * jit-recording.h (gcc::jit::recording::requested_dump): New
1085         struct.
1086         (gcc::jit::recording::context::enable_dump): New function.
1087         (gcc::jit::recording::context::get_all_requested_dumps): New
1088         function.
1089         (gcc::jit::recording::context::m_requested_dumps): New field.
1090         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1091         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1092         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1094 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1096         * libgccjit++.h: Indent the forward declarations of the classes to
1097         show the inheritance hierarchy.
1099 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1101         * notes.txt: Show the beginning and ending of
1102         recording::context::compile vs playback::context::compile.  Show
1103         the creation and unlinking of the tempdir.  Show toplev::finalize.
1104         Move "RELEASE MUTEX" to the correct location.  Show
1105         gcc_jit_result_release, and indicate where the
1106         dlopen/dlsym/dlclose occur.
1108 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1110         * docs/examples/tut02-square.c (main): Release the context
1111         earlier, to show that this is possible.  Update error-handling
1112         to avoid a double-release of the context, and to avoid
1113         releasing a NULL result.
1114         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1115         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1116         * docs/topics/results.rst (gcc_jit_result): Mention that this
1117         controls the lifetimes of machine code functions.
1118         (gcc_jit_result_get_code): Spell out the requirements for this
1119         to succeed, and the lifetime of the result.
1120         (gcc_jit_result_release): Mention that this invalidates any code
1121         that was obtained from the result.
1122         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1124 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1126         PR jit/64018
1127         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1128         Add description of error-handling, taken in part from...
1129         * docs/topics/contexts.rst (Error-handling): Expand, and move some
1130         content to tutorial02.rst.
1131         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1133 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1135         PR jit/64020
1136         * docs/topics/types.rst (Standard types) Add new enum values to
1137         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1138         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1139         Widen the left-hand column so that
1140         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1141         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1143         * jit-builtins.c: Include stringpool.h and jit-playback.h.
1144         Move everything out of the gcc::jit::recording namespace into
1145         just gcc::jit.
1146         (struct builtin_data): Add fields "fnclass", "attr", and
1147         "implicit_p".
1148         (DEF_BUILTIN): Update macro so populate the new fields.
1149         (builtins_manager::builtins_manager): Update for move out of
1150         recording namespace.  Initialize the m_attributes array.
1151         (builtins_manager::get_builtin_function): Likewise.
1152         (builtins_manager::get_builtin_function_by_id): New function.
1153         (builtins_manager::make_builtin_function): Update for move out of
1154         recording namespace.  Add fix for PR jit/64020 by detecting
1155         specific builtin ids and having them ensure that builtins for
1156         other ids are created as necessary.
1157         (builtins_manager::get_type): Update for move out of recording
1158         namespace.
1159         (builtins_manager::make_type): Likewise.  Add some missing
1160         #undefs.
1161         (builtins_manager::make_primitive_type): Update for move out of
1162         recording namespace.  Implement the three BT_COMPLEX_ cases and
1163         BT_DOUBLE_PTR.
1164         (builtins_manager::make_fn_type): Update for move out of recording
1165         namespace.
1166         (builtins_manager::make_ptr_type): Likewise.
1167         (builtins_manager::finish_playback): New function.
1168         (builtins_manager::get_class): New function.
1169         (builtins_manager::implicit_p): New function.
1170         (builtins_manager::get_attrs_tree): Two new functions.
1171         (builtins_manager::make_attrs_tree): New function.
1173         * jit-builtins.h: Move everything out of the gcc::jit::recording
1174         namespace into just gcc::jit.
1175         (enum built_in_attribute): New.
1176         (builtins_manager::builtins_manager): Update decl for namespace
1177         change.
1178         (builtins_manager::get_builtin_function): Likewise.
1179         (builtins_manager::get_class): New.
1180         (builtins_manager::implicit_p): New.
1181         (builtins_manager::get_attrs_tree): Two new functions.
1182         (builtins_manager::make_attrs_tree): New function.
1183         (builtins_manager::finish_playback): New.
1184         (builtins_manager::get_builtin_function_by_id): New.
1185         (builtins_manager::make_builtin_function): Update decl for
1186         namespace change.
1187         (builtins_manager::get_type): Likewise.
1188         (builtins_manager::make_type): Likewise.
1189         (builtins_manager::make_primitive_type): Likewise.
1190         (builtins_manager::make_fn_type): Likewise.
1191         (builtins_manager::make_ptr_type): Likewise.
1192         (builtins_manager): Likewise for fields.  Add new field
1193         "m_attributes".
1195         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1196         (builtins_manager): Update forward decl to reflect namespace
1197         change.
1199         * jit-playback.c: Include attribs.h and jit-builtins.h.
1200         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1201         for the new COMPLEX_ types.
1202         (gcc::jit::playback::context::new_function): If creating a
1203         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1204         and call set_builtin_decl.
1205         (gcc::jit::playback::context::replay): If we have a
1206         builtins_manager, call its finish_playback method when we're done.
1208         * jit-playback.h:
1209         (gcc::jit::playback::context::get_builtins_manager): New function.
1211         * jit-recording.c
1212         (gcc::jit::recording::context::get_builtins_manager): New function.
1213         (gcc::jit::recording::get_builtin_function): Use
1214         get_builtins_manager, in case we're a child context.
1215         (gcc::jit::recording::memento_of_get_type::dereference): Add the
1216         COMPLEX_ types.
1217         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1218         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1219         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1220         (get_type_strings): Likewise.
1222         * jit-recording.h
1223         (gcc::jit::recording::context::get_builtins_manager): New.
1225         * libgccjit.h (enum gcc_jit_types): Add
1226         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1227         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1229 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1231         * jit-builtins.c
1232         (gcc::jit::recording::builtins_manager::get_builtin_function):
1233         Check for NULL return from make_builtin_function.
1234         (gcc::jit::recording::builtins_manager::make_builtin_function):
1235         Check for NULL return from get_type.
1237 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1239         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1240         creation code into...
1241         (gcc::jit::playback::context::convert_to_dso): New function.
1242         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1243         New function.
1245 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1247         * jit-playback.c (gcc::jit::playback::context::compile): Use an
1248         auto_vec<const char *> rather than a const char *[20] for the
1249         top-level argv, and move the logic to build it to...
1250         (gcc::jit::playback::context::make_fake_args): New function.
1251         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1252         New function.
1254 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1256         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1257         * jit-playback.c: Include new header jit-result.h.
1258         (gcc::jit::result::result): Move to new file jit-result.c.
1259         (gcc::jit::result::~result): Likewise.
1260         (gcc::jit::playback::result): Likewise.
1261         * jit-recording.h (class gcc::jit::result): Move to new
1262         header jit-result.h.
1263         * jit-result.c: New file, to contain...
1264         (gcc::jit::result::result): Move here from jit-playback.c,
1265         removing erroneous "playback" namespace from comment.
1266         (gcc::jit::result::~result): Likewise.
1267         (gcc::jit::playback::result): Likewise.
1268         * jit-result.h: New file, to contain...
1269         (class gcc::jit::result): Move from jit-recording.h.
1270         * libgccjit.c: Include jit-result.h.
1271         (gcc_jit_result_get_code): Update comment to reflect move
1272         of implementation.
1273         (gcc_jit_result_release): Likewise.
1275 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1277         PR jit/63854
1278         * docs/examples/tut04-toyvm/toyvm.c
1279         (toyvm_compiled_function): New typedef.
1280         (toyvm_compiled_func) Rename to...
1281         (toyvm_compiled_code) ...this.
1282         (struct toyvm_compiled_function): New struct.
1283         (toyvm_function_compile): Return a toyvm_compiled_function *
1284         rather than a toyvm_compiled_func, so that the caller can fully
1285         clean things up.  Free "funcname".
1286         (test_script): Update for change to toyvm_function_compile.
1287         Clean up the toyvm_compiled_function.
1288         (main): Likewise.
1289         (docs/intro/tutorial04.rst): Update to reflect the above changes,
1290         and to better spell out the lifetime of the compiled code.
1292 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1294         PR jit/63854
1295         * jit-builtins.c
1296         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1297         context's new_function_type method, rather than directly creating
1298         a function_type instance.
1299         * jit-recording.c
1300         (gcc::jit::recording::context::new_function_type): New method,
1301         adapted from part of...
1302         (gcc::jit::recording::context::new_function_ptr_type): ...this.
1303         Update to call new_function_type.
1304         * jit-recording.h
1305         (gcc::jit::recording::context::new_function_type): New method.
1307 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1309         PR jit/63969
1310         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1312 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1314         PR jit/63854
1315         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1316         Convert param from const vec<playback::field *> & to
1317         const auto_vec<playback::field *> *.
1318         (gcc::jit::playback::context::new_function_type): Convert param
1319         "param_types" from vec<type *> * to const auto_vec<type *> *.
1320         (gcc::jit::playback::context::new_function): Convert param
1321         "params" from vec<param *> * to const auto_vec<param *> *.
1322         (gcc::jit::playback::context::build_call): Convert param "args"
1323         from vec<rvalue *> to const auto_vec<rvalue *> *.
1324         (gcc::jit::playback::context::new_call): Likewise.
1325         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1326         (wrapper_finalizer): New function.
1327         (gcc::jit::playback::wrapper::operator new): Call the finalizer
1328         variant of ggc_internal_cleared_alloc, supplying
1329         wrapper_finalizer.
1330         (gcc::jit::playback::function::finalizer): New.
1331         (gcc::jit::playback::block::finalizer): New.
1332         (gcc::jit::playback::source_file::finalizer): New.
1333         (gcc::jit::playback::source_line::finalizer): New.
1335         * jit-playback.h
1336         (gcc::jit::playback::context::new_function_type): Convert param
1337         "param_types" from vec<type *> * to const auto_vec<type *> *.
1338         (gcc::jit::playback::context::new_function): Convert param
1339         "params" from vec<param *> * to const auto_vec<param *> *.
1340         (gcc::jit::playback::context::new_call): Convert param
1341         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1342         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1343         (gcc::jit::playback::context::build_call): Likewise.
1344         (gcc::jit::playback::context): Convert fields "m_functions",
1345         "m_source_files", "m_cached_locations" from vec to auto_vec.
1346         (gcc::jit::playback::wrapper::finalizer): New virtual function.
1347         (gcc::jit::playback::compound_type::set_fields): Convert param fro
1348         const vec<playback::field *> & to
1349         const auto_vec<playback::field *> *.
1350         (gcc::jit::playback::function::finalizer): New.
1351         (gcc::jit::playback::block::finalizer): New.
1352         (gcc::jit::playback::source_file::finalizer): New.
1353         (gcc::jit::playback::source_line::finalizer): New.
1355         * jit-recording.c
1356         (gcc::jit::recording::function_type::replay_into): Convert local
1357         from a vec into an auto_vec.
1358         (gcc::jit::recording::fields::replay_into): Likewise.
1359         (gcc::jit::recording::function::replay_into): Likewise.
1360         (gcc::jit::recording::call::replay_into): Likewise.
1361         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1363         * jit-recording.h (gcc::jit::recording::context): Convert fields
1364         "m_mementos", "m_compound_types", "m_functions" from vec<> to
1365         auto_vec <>.
1366         (gcc::jit::recording::function_type::get_param_types): Convert
1367         return type from vec<type *> to const vec<type *> &.
1368         (gcc::jit::recording::function_type): Convert field
1369         "m_param_types" from a vec<> to an auto_vec<>.
1370         (gcc::jit::recording::fields): Likewise for field "m_fields".
1371         (gcc::jit::recording::function::get_params): Convert return type
1372         from vec <param *> to const vec<param *> &.
1373         (gcc::jit::recording::function): Convert fields "m_params",
1374         "m_locals", "m_blocks" from vec<> to auto_vec<>.
1375         (gcc::jit::recording::block): Likewise for field "m_statements".
1376         vec<> to auto_vec<>.
1377         (gcc::jit::recording::call): Likewise for field "m_args".
1378         (gcc::jit::recording::call_through_ptr): Likewise.
1380 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1382         PR jit/63854
1383         * jit-recording.c (recording::function::validate): Convert
1384         "worklist" from vec<> to autovec<> to fix a leak.
1386 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
1388         * ChangeLog.jit: New.
1389         * ChangeLog: New.
1390         * Make-lang.in: New.
1391         * TODO.rst: New.
1392         * config-lang.in: New.
1393         * docs/Makefile: New.
1394         * docs/_build/texinfo/Makefile: New.
1395         * docs/_build/texinfo/factorial.png: New.
1396         * docs/_build/texinfo/libgccjit.texi: New.
1397         * docs/_build/texinfo/sum-of-squares.png: New.
1398         * docs/conf.py: New.
1399         * docs/examples/tut01-hello-world.c: New.
1400         * docs/examples/tut02-square.c: New.
1401         * docs/examples/tut03-sum-of-squares.c: New.
1402         * docs/examples/tut04-toyvm/Makefile: New.
1403         * docs/examples/tut04-toyvm/factorial.toy: New.
1404         * docs/examples/tut04-toyvm/fibonacci.toy: New.
1405         * docs/examples/tut04-toyvm/toyvm.c: New.
1406         * docs/index.rst: New.
1407         * docs/internals/index.rst: New.
1408         * docs/intro/factorial.png: New.
1409         * docs/intro/index.rst: New.
1410         * docs/intro/sum-of-squares.png: New.
1411         * docs/intro/tutorial01.rst: New.
1412         * docs/intro/tutorial02.rst: New.
1413         * docs/intro/tutorial03.rst: New.
1414         * docs/intro/tutorial04.rst: New.
1415         * docs/topics/contexts.rst: New.
1416         * docs/topics/expressions.rst: New.
1417         * docs/topics/functions.rst: New.
1418         * docs/topics/index.rst: New.
1419         * docs/topics/locations.rst: New.
1420         * docs/topics/objects.rst: New.
1421         * docs/topics/results.rst: New.
1422         * docs/topics/types.rst: New.
1423         * dummy-frontend.c: New.
1424         * jit-builtins.c: New.
1425         * jit-builtins.h: New.
1426         * jit-common.h: New.
1427         * jit-playback.c: New.
1428         * jit-playback.h: New.
1429         * jit-recording.c: New.
1430         * jit-recording.h: New.
1431         * libgccjit++.h: New.
1432         * libgccjit.c: New.
1433         * libgccjit.h: New.
1434         * libgccjit.map: New.
1435         * notes.txt: New.
1437 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
1439         * Initial creation
1441 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1443 Copying and distribution of this file, with or without modification,
1444 are permitted in any medium without royalty provided the copyright
1445 notice and this notice are preserved.