Parallelize the jit testsuite
[official-gcc.git] / gcc / jit / ChangeLog
blob51549216b244aa047b1c5a2cc4e740ac4c29196a
1 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
3         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
4         (check_jit_parallelize): Set this to an arbitrary value (10).
6 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
8         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
9         last argument.
10         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
11         undef afterwards.
12         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
13         Likewise.
15 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
17         Update copyright years in docs/.
19 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
21         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
22         lvalue and the rvalue are of compatible type.
24 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
26         * docs/cp/topics/contexts.rst (Debugging): Add
27         gccjit::context::dump_reproducer_to_file.
28         * docs/internals/index.rst (Design notes): New section,
29         discussing input validation and
30         gcc_jit_context_dump_reproducer_to_file.
31         * docs/topics/contexts.rst (Debugging): Add
32         gcc_jit_context_dump_reproducer_to_file.
33         * docs/_build/texinfo/libgccjit.texi: Regenerate.
34         * jit-common.h (gcc::jit::dump::get_context): New accessor.
35         * jit-recording.c: Include "hash-map.h".
36         Within namespace ::gcc::jit...
37         (dump::write): Flush each line.
38         (dump::make_location): Pass false for new param "created_by_user".
39         (class allocator): New class.
40         (allocator::~allocator): New function.
41         (allocator::xstrdup_printf): New function.
42         (allocator::xstrdup_printf_va): New function.
43         (class reproducer): New subclass of dump.
44         (reproducer::reproducer): New function.
45         (reproducer::write_params): New function.
46         (reproducer::write_args): New function.
47         (reproducer::make_identifier): New function.
48         (reproducer::make_tmp_identifier): New function.
49         (reproducer::get_identifier): New pair of functions.
50         (reproducer::get_identifier_as_rvalue): New function.
51         (reproducer::get_identifier_as_lvalue): New function.
52         (reproducer::get_identifier_as_type): New function.
53         (reproducer::xstrdup_printf): New function.
54         (recording::context::context): Initialize m_toplevel_ctxt.
55         (recording::context::new_location): Add param created_by_user.
56         (str_option_reproducer_strings): New table of strings.
57         (int_option_reproducer_strings): Likewise.
58         (bool_option_reproducer_strings): Likewise.
59         (get_type_enum_strings): Likewise.
60         (names_of_function_kinds): Likewise.
61         (global_kind_reproducer_strings): Likewise.
62         (unary_op_reproducer_strings): Likewise.
63         (binary_op_reproducer_strings): Likewise.
64         (comparison_reproducer_strings): Likewise.
65         Within namespace ::gcc::jit::recording::...
66         (context::dump_reproducer_to_file): New function.
67         (string::write_reproducer): Likewise.
68         (location::write_reproducer): Likewise.
69         (type::access_as_type): Likewise.
70         (memento_of_get_type::write_reproducer): Likewise.
71         (memento_of_get_pointer::write_reproducer): Likewise.
72         (memento_of_get_const::write_reproducer): Likewise.
73         (memento_of_get_volatile::write_reproducer): Likewise.
74         (array_type::write_reproducer): Likewise.
75         (function_type::write_reproducer): Likewise.
76         (function_type::write_deferred_reproducer): Likewise.
77         (field::write_reproducer): Likewise.
78         (struct_::access_as_type): Likewise.
79         (struct_::write_reproducer): Likewise.
80         (union_::write_reproducer): Likewise.
81         (fields::write_reproducer): Likewise.
82         (rvalue::access_as_rvalue): Likewise.
83         (lvalue::access_as_rvalue): Likewise.
84         (lvalue::access_as_lvalue): Likewise.
85         (param::access_as_rvalue): Likewise.
86         (param::access_as_lvalue): Likewise.
87         (param::write_reproducer): Likewise.
88         (function::write_reproducer): Likewise.
89         (block::write_reproducer): Likewise.
90         (global::write_reproducer): Likewise.
91         (memento_of_new_rvalue_from_const <int>::write_reproducer):
92         Likewise.
93         (memento_of_new_rvalue_from_const <long>::write_reproducer):
94         Likewise.
95         (memento_of_new_rvalue_from_const <double>::write_reproducer):
96         Likewise.
97         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
98         Likewise.
99         (memento_of_new_string_literal::write_reproducer): Likewise.
100         (unary_op::write_reproducer): Likewise.
101         (binary_op::write_reproducer): Likewise.
102         (comparison::write_reproducer): Likewise.
103         (cast::write_reproducer): Likewise.
104         (call::write_reproducer): Likewise.
105         (call_through_ptr::write_reproducer): Likewise.
106         (array_access::write_reproducer): Likewise.
107         (access_field_of_lvalue::write_reproducer): Likewise.
108         (access_field_rvalue::write_reproducer): Likewise.
109         (dereference_field_rvalue::write_reproducer): Likewise.
110         (dereference_rvalue::write_reproducer): Likewise.
111         (get_address_of_lvalue::write_reproducer): Likewise.
112         (local::write_reproducer): Likewise.
113         (eval::write_reproducer): Likewise.
114         (assignment::write_reproducer): Likewise.
115         (assignment_op::write_reproducer): Likewise.
116         (comment::write_reproducer): Likewise.
117         (conditional::write_reproducer): Likewise.
118         (jump::write_reproducer): Likewise.
119         (return_::write_reproducer): Likewise.
120         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
121         Within namespace ::gcc::jit::recording::...
122         (context::new_location): Add "created_by_user" param.
123         (context::dump_reproducer_to_file): New method.
124         (context::m_toplevel_ctxt): New field.
125         (memento::write_reproducer): New pure virtual function.
126         (memento::dyn_cast_location): New virtual function.
127         (string::write_reproducer):
128         (location::location): Add "created_by_user" param.
129         (location::dyn_cast_location): New function.
130         (location::created_by_user): New accessor.
131         (location::write_reproducer): New function.
132         (location::m_created_by_user): New field.
133         (type::access_as_type): New virtual function.
134         (location::write_reproducer): Likewise.
135         (type::access_as_type): Likewise.
136         (memento_of_get_type::write_reproducer): Likewise.
137         (memento_of_get_pointer::write_reproducer): Likewise.
138         (memento_of_get_const::write_reproducer): Likewise.
139         (memento_of_get_volatile::write_reproducer): Likewise.
140         (array_type::write_reproducer): Likewise.
141         (function_type::write_reproducer): Likewise.
142         (function_type::write_deferred_reproducer): Likewise.
143         (field::write_reproducer): Likewise.
144         (struct_::access_as_type): Likewise.
145         (struct_::write_reproducer): Likewise.
146         (union_::write_reproducer): Likewise.
147         (union_::m_fields): Remove stray unused field.
148         (fields::length): New accessor.
149         (fields::get_field): New accessor.
150         (fields::write_reproducer): New function.
151         (rvalue::access_as_rvalue): Likewise.
152         (lvalue::access_as_rvalue): Likewise.
153         (lvalue::access_as_lvalue): Likewise.
154         (param::access_as_rvalue): Likewise.
155         (param::access_as_lvalue): Likewise.
156         (param::write_reproducer): Likewise.
157         (function::write_reproducer): Likewise.
158         (block::write_reproducer): Likewise.
159         (global::write_reproducer): Likewise.
160         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
161         Likewise.
162         (memento_of_new_string_literal::write_reproducer): Likewise.
163         (unary_op::write_reproducer): Likewise.
164         (binary_op::write_reproducer): Likewise.
165         (comparison::write_reproducer): Likewise.
166         (cast::write_reproducer): Likewise.
167         (call::write_reproducer): Likewise.
168         (call_through_ptr::write_reproducer): Likewise.
169         (array_access::write_reproducer): Likewise.
170         (access_field_of_lvalue::write_reproducer): Likewise.
171         (access_field_rvalue::write_reproducer): Likewise.
172         (dereference_field_rvalue::write_reproducer): Likewise.
173         (dereference_rvalue::write_reproducer): Likewise.
174         (get_address_of_lvalue::write_reproducer): Likewise.
175         (local::write_reproducer): Likewise.
176         (eval::write_reproducer): Likewise.
177         (assignment::write_reproducer): Likewise.
178         (assignment_op::write_reproducer): Likewise.
179         (comment::write_reproducer): Likewise.
180         (conditional::write_reproducer): Likewise.
181         (jump::write_reproducer): Likewise.
182         (return_::write_reproducer): Likewise.
183         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
184         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
185         param "created_by_user".
186         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
187         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
188         entrypoint.
189         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
190         entrypoint.
192 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
194         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
195         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
196         ctor.
197         (gcc::jit::rvalue_usage_validator::visit): New function.
198         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
199         function.
200         (gcc::jit::recording::rvalue::set_scope): New function.
201         (gcc::jit::recording::function::function): Call set_scope on each
202         param, issuing errors for any params that already have a function.
203         (gcc::jit::recording::block::add_eval): Return the new statement;
204         update the comment given that some error-checking now happens after
205         this returns.
206         (gcc::jit::recording::block::add_assignment): Likewise.
207         (gcc::jit::recording::block::add_assignment_op): Likewise.
208         (gcc::jit::recording::block::add_comment): Likewise.
209         (gcc::jit::recording::block::end_with_conditional): Likewise.
210         (gcc::jit::recording::block::end_with_jump): Likewise.
211         (gcc::jit::recording::block::end_with_return): Likewise.
212         (gcc::jit::recording::block::validate): Add a comment.
213         (gcc::jit::recording::unary_op::visit_children): New function.
214         (gcc::jit::recording::binary_op::visit_children): New function.
215         (gcc::jit::recording::comparison::visit_children): New function.
216         (gcc::jit::recording::cast::visit_children): New function.
217         (gcc::jit::recording::call::visit_children): New function.
218         (gcc::jit::recording::call_through_ptr::visit_children): New function.
219         (gcc::jit::recording::array_access::visit_children): New function.
220         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
221         function.
222         (gcc::jit::recording::access_field_rvalue::visit_children): New
223         function.
224         (gcc::jit::recording::dereference_field_rvalue::visit_children):
225         New function.
226         (gcc::jit::recording::dereference_rvalue::visit_children): New
227         function.
228         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
229         function.
230         * jit-recording.h: Within namespace gcc::jit::recording...
231         (class rvalue_visitor): New.
232         (rvalue::rvalue): Initialize m_scope.
233         (rvalue::get_loc): New accessor.
234         (rvalue::verify_valid_within_stmt): New function.
235         (rvalue::visit_children): New pure virtual function.
236         (rvalue::set_scope): New function.
237         (rvalue::get_scope): New function.
238         (rvalue::dyn_cast_param): New function.
239         (rvalue::m_scope): New field.
240         (param::visit_children): New empty function.
241         (param::dyn_cast_param): New function.
242         (function::get_loc): New function.
243         (block::add_eval): Return the new statement.
244         (block::add_assignment): Likewise.
245         (block::add_assignment_op): Likewise.
246         (block::add_comment): Likewise.
247         (block::end_with_conditional): Likewise.
248         (block::end_with_jump): Likewise.
249         (block::end_with_return): Likewise.
250         (global::visit_children): New function.
251         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
252         New function.
253         (memento_of_new_string_literal::visit_children): New function.
254         (unary_op::visit_children): New function.
255         (binary_op::visit_children): New function.
256         (comparison::visit_children): New function.
257         (cast::visit_children): New function.
258         (call::visit_children): New function.
259         (call_through_ptr::visit_children): New function.
260         (array_access::visit_children): New function.
261         (access_field_of_lvalue::visit_children): New function.
262         (access_field_rvalue::visit_children): New function.
263         (dereference_field_rvalue::visit_children): New function.
264         (dereference_rvalue::visit_children): New function.
265         (get_address_of_lvalue::visit_children): New function.
266         (local::local): Call set_scope.
267         (local::visit_children): New function.
268         (statement::get_block): Make public.
269         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
270         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
271         (gcc_jit_context_new_function): Verify that each param has
272         not yet been used for creating another function.
273         (gcc_jit_block_add_eval): After creating the stmt, verify
274         that the rvalue expression tree is valid to use within it.
275         (gcc_jit_block_add_assignment): Likewise for the lvalue and
276         rvalue expression trees.
277         (gcc_jit_block_add_assignment_op): Likewise.
278         (gcc_jit_block_end_with_conditional): Likewise for the boolval
279         expression tree.
280         (gcc_jit_block_end_with_return): Likewise for the rvalue
281         expression tree.
282         (gcc_jit_block_end_with_void_return): Remove return of "void",
283         now that block::end_with_return is now non-void.
285 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
287         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
288         Add missing fclose on error-handling path.
290 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
292         * docs/cp/topics/expressions.rst (Global variables): Add
293         enum gcc_jit_global_kind param to gccjit::context::new_global.
294         * docs/topics/expressions.rst (Global variables): Likewise.
295         Document the new enum.
296         * docs/topics/results.rst (Compilation results): Document
297         globals-handling.
298         * docs/_build/texinfo/libgccjit.texi: Regenerate.
299         * dummy-frontend.c (jit_langhook_write_globals): Call into the
300         playback context's write_global_decls_1 and write_global_decls_2
301         before and after calling symtab->finalize_compilation_unit ().
302         * jit-playback.c: Include "debug.h".
303         (gcc::jit::playback::context::new_global): Add "kind" param and
304         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
305         underlying VAR_DECL.  Call varpool_node::get_create on the
306         VAR_DECL, and add it to m_globals.
307         (gcc::jit::playback::context::write_global_decls_1): New function.
308         (gcc::jit::playback::context::write_global_decls_2): New function.
309         * jit-playback.h (gcc::jit::playback::context::context): Call
310         create on m_globals.
311         (gcc::jit::playback::context::new_global): Add "kind" param.
312         (gcc::jit::playback::context::write_global_decls_1): New function.
313         (gcc::jit::playback::context::write_global_decls_2): New function.
314         (gcc::jit::playback::context::m_globals): New field.
315         * jit-recording.c (gcc::jit::recording::context::context):
316         Initialize m_globals.
317         (gcc::jit::recording::context::new_global): Add param "kind".
318         Add the new global to m_globals.
319         (gcc::jit::recording::context::dump_to_file): Dump the globals.
320         (gcc::jit::recording::global::replay_into): Add field m_kind.
321         (gcc::jit::recording::global::write_to_dump): New override.
322         * jit-recording.h (gcc::jit::recording::context::new_global): Add
323         param "kind".
324         (gcc::jit::recording::context::m_globals): New field.
325         (gcc::jit::recording::global::global): Add param kind.
326         (gcc::jit::recording::global::write_to_dump): New override.
327         (gcc::jit::recording::global::m_kind): New field.
328         * jit-result.c (gcc::jit::result::get_global): New function.
329         * jit-result.h (gcc::jit::result::get_global): New function.
330         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
331         * libgccjit.c (gcc_jit_context_new_global): Likewise.
332         (gcc_jit_result_get_global): New API entrypoint.
333         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
334         (enum gcc_jit_global_kind): New enum.
335         (gcc_jit_context_new_global): API change: add "kind" param.
336         * libgccjit.map (gcc_jit_result_get_global): New symbol.
338 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
340         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
341         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
342         earlier.
343         * jit-builtins.c: Remove redundant includes of "opts.h" and
344         "tree.h".
345         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
346         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
347         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
348         "statistics.h", "vec.h", "double-int.h", "real.h",
349         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
350         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
351         earlier.
352         * jit-recording.c: Remove redundant includes of "opts.h" and
353         "tree.h".
355 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
357         * docs/cp/topics/expressions.rst (Simple expressions): Use
358         ":c:type:" for C types.  Document new overload of
359         gcc::jit::context::new_rvalue.
360         * docs/topics/expressions.rst (Simple expressions): Use
361         ":c:type:" for C types.  Document new entrypoint
362         gcc_jit_context_new_rvalue_from_long.
363         * docs/_build/texinfo/libgccjit.texi: Regenerate.
364         * jit-playback.c: Within namespace gcc::jit::playback...
365         (context::new_rvalue_from_int): Eliminate in favor of...
366         (context::new_rvalue_from_const <int>): ...this.
367         (context::new_rvalue_from_double): Eliminate in favor of...
368         (context::new_rvalue_from_const <double>): ...this.
369         (context::new_rvalue_from_const <long>): New.
370         (context::new_rvalue_from_ptr): Eliminate in favor of...
371         (context::new_rvalue_from_const <void *>): ...this.
372         * jit-playback.h: Within namespace gcc::jit::playback...
373         (context::new_rvalue_from_int): Eliminate in favor of...
374         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
375         (context::new_rvalue_from_double): Likewise.
376         (context::new_rvalue_from_ptr): Likewise.
377         * jit-recording.c: Within namespace gcc::jit::recording...
378         (context::new_rvalue_from_int): Eliminate.
379         (context::new_rvalue_from_double): Likewise.
380         (context::new_rvalue_from_ptr): Likewise.
381         (class memento_of_new_rvalue_from_const <int>):
382         Add explicit specialization.
383         (class memento_of_new_rvalue_from_const <long>):
384         Likewise.
385         (class memento_of_new_rvalue_from_const <double>):
386         Likewise.
387         (class memento_of_new_rvalue_from_const <void *>):
388         Likewise.
389         (memento_of_new_rvalue_from_int::replay_into):
390         Generalize into...
391         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
392         ...this...
393         (memento_of_new_rvalue_from_double::replay_into):
394         ...allowing this...
395         (memento_of_new_rvalue_from_ptr::replay_into):
396         ...and this to be deleted.
397         (memento_of_new_rvalue_from_int::make_debug_string):
398         Convert to...
399         (memento_of_new_rvalue_from_const <int>::make_debug_string):
400         ...this.
401         (memento_of_new_rvalue_from_double::make_debug_string):
402         Convert to...
403         (memento_of_new_rvalue_from_const <double>::make_debug_string):
404         ...this.
405         (memento_of_new_rvalue_from_ptr::make_debug_string)
406         Convert to...
407         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
408         ...this.
409         (memento_of_new_rvalue_from_const <long>::make_debug_string):
410         New function.
411         * jit-recording.h: Within namespace gcc::jit::recording...
412         (context::new_rvalue_from_int): Eliminate.
413         (context::new_rvalue_from_double): Likewise.
414         (context::new_rvalue_from_ptr): Likewise, all in favor of...
415         (context::new_rvalue_from_const <HOST_TYPE>): New family of
416         methods.
417         (class memento_of_new_rvalue_from_int): Eliminate.
418         (class memento_of_new_rvalue_from_double): Likewise.
419         (class memento_of_new_rvalue_from_ptr): Likewise.
420         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
421         of rvalue subclasses.
422         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
423         "long".
424         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
425         rewriting of recording::context::new_rvalue_from_int to
426         recording::context::new_rvalue_from_const <int>.
427         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
428         (gcc_jit_context_new_rvalue_from_double): Update for
429         rewriting of recording::context::new_rvalue_from_double to
430         recording::context::new_rvalue_from_const <double>.
431         (gcc_jit_context_new_rvalue_from_ptr): Update for
432         rewriting of recording::context::new_rvalue_from_ptr to
433         recording::context::new_rvalue_from_const <void *>.
434         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
435         entrypoint.
436         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
438 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
440         PR jit/64206
441         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
442         shows tempdir creation/cleanup.
443         * docs/_build/texinfo/libgccjit.texi: Regenerate.
444         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
445         to the list of subclasses in the comment.
446         * jit-playback.c (gcc::jit::playback::context::context): Add a
447         comment clarifying when the tempdir gets cleaned up.
448         (gcc::jit::playback::context::compile): Pass the context's logger,
449         if any, to the tempdir.
450         (gcc::jit::playback::context::dlopen_built_dso): When creating the
451         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
452         over ownership of the tempdir to it.
453         * jit-result.c: Include "jit-tempdir.h".
454         (gcc::jit::result::result): Add tempdir param, saving it as
455         m_tempdir.
456         (gcc::jit::result::~result): Delete m_tempdir.
457         * jit-result.h (gcc::jit::result::result): Add tempdir param.
458         (gcc::jit::result::m_tempdir): New field.
459         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
460         add JIT_LOG_SCOPE.
461         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
462         and log m_path_template and m_path_tempdir.
463         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
464         entry/exit, and log the unlink and rmdir calls.
465         * jit-tempdir.h: Include "jit-logging.h".
466         (class gcc::jit::tempdir): Make this be a subclass of log_user.
467         (gcc::jit::tempdir::tempdir): Add logger param.
468         * notes.txt: Update to show the two possible places where the
469         tempdir can be cleaned up.
471 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
473         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
474         comment.
476 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
478         * docs/topics/contexts.rst (Error-handling): Document new
479         entrypoint gcc_jit_context_get_last_error.
480         * docs/_build/texinfo/libgccjit.texi: Regenerate.
481         * jit-recording.c (gcc::jit::recording::context::context):
482         Initialize new fields "m_last_error_str" and
483         "m_owns_last_error_str".
484         (gcc::jit::recording::context::~context): Clean up
485         m_last_error_str, if needed.
486         (gcc::jit::recording::context::add_error_va): Update
487         m_last_error_str and m_owns_last_error_str, freeing the old
488         value if appropriate.
489         (gcc::jit::recording::context::get_last_error): New function.
490         * jit-recording.h (gcc::jit::recording::context::get_last_error):
491         New function.
492         (gcc::jit::recording::context): New fields m_last_error_str and
493         m_owns_last_error_str.
494         * libgccjit.c (gcc_jit_context_get_last_error): New function.
495         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
496         * libgccjit.map (gcc_jit_context_get_last_error): New function.
498 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
500         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
501         * docs/internals/index.rst (Overview of code structure): Mention
502         gcc_jit_context_set_logfile, and embed the example logfile.
503         * docs/internals/test-hello-world.exe.log.txt: New file: example
504         of a logfile.
505         * docs/topics/contexts.rst (Debugging): Add documentation
506         for gcc_jit_context_set_logfile.
507         * docs/_build/texinfo/libgccjit.texi: Regenerate.
508         * dummy-frontend.c: Include "jit-logging.h".
509         (jit_langhook_init): Assert that there is an active playback
510         context.  If it has a logger, log entry/exit to this function.
511         (jit_langhook_write_globals): Likewise.
512         * jit-common.h (gcc::jit::logger): New forward declaration.
513         * jit-logging.c: New file.
514         * jit-logging.h: New file.
515         * jit-playback.c: Include "jit-logging.h".
516         (gcc::jit::playback::context::context): Initialize the log_user
517         base class from the recording context's logger (if any).  Use
518         JIT_LOG_SCOPE to log entry/exit from the function body.
519         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
520         log entry/exit from the function body.
521         (gcc::jit::playback::build_stmt_list): Likewise.
522         (gcc::jit::playback::function::postprocess): Likewise.
523         (gcc::jit::playback::context::compile): Likewise.  Log the
524         entry/exit to toplev::main and toplev::finalize.  Log the
525         fake argv passed to toplev::main.
526         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
527         log entry/exit from the function body.
528         (gcc::jit::playback::context::release_mutex): Likewise.
529         (gcc::jit::playback::context::make_fake_args): Likewise.
530         (gcc::jit::playback::context::extract_any_requested_dumps):
531         Likewise.
532         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
533         log the arguments that the driver is invoked with.
534         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
535         the logger to the result object.
536         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
537         log entry/exit from the function body.
538         (gcc::jit::playback::context::dump_generated_code): Likewise.
539         (gcc::jit::playback::context::handle_locations): Likewise.
540         * jit-playback.h (gcc::jit::playback::context): Make this be
541         a subclass of gcc::jit::log_user.
542         * jit-recording.c: Include "jit-logging.h".
543         (gcc::jit::recording::context::context: Initialize the logger to
544         NULL for root contexts, or to the parent's logger for child
545         contexts.
546         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
547         log entry/exit from the function body.
548         (gcc::jit::recording::context::replay_into): Likewise.
549         (gcc::jit::recording::context::disassociate_from_playback):
550         Likewise.
551         (gcc::jit::recording::context::compile): Likewise.
552         (recording::context::add_error_va): Likewise.  Also, log the
553         error.
554         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
555         log entry/exit from the function body.
556         * jit-recording.h: Include "jit-logging.h".
557         (gcc::jit::recording::context): Make this be a subclass of
558         gcc::jit::log_user.
559         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
560         (gcc::jit::result::result): Add logger param, recording it.
561         Use JIT_LOG_SCOPE to log entry/exit from the function body.
562         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
563         log entry/exit from the function body.
564         (gcc::jit::result::get_code): Likewise.
565         * jit-result.h (gcc::jit::result): Make this be a subclass of
566         gcc::jit::log_user.
567         (gcc::jit::result::result): Add logger parameter.
568         * libgccjit++.h (gccjit::context::set_logfile): New function.
569         * libgccjit.c: Include "jit-logging.h".
570         (gcc_jit_context_acquire): Log the context.
571         (gcc_jit_context_release): Use JIT_LOG_FUNC to
572         log entry/exit from the function body, and log the context.
573         (gcc_jit_context_new_child_context): Likewise, logging both
574         contexts.
575         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
576         log entry/exit from the function body.
577         (gcc_jit_context_get_type): Likewise.
578         (gcc_jit_context_get_int_type): Likewise.
579         (gcc_jit_context_new_array_type): Likewise.
580         (gcc_jit_context_new_field): Likewise.
581         (gcc_jit_context_new_struct_type): Likewise.
582         (gcc_jit_context_new_opaque_struct): Likewise.
583         (gcc_jit_struct_set_fields): Likewise.
584         (gcc_jit_context_new_union_type): Likewise.
585         (gcc_jit_context_new_function_ptr_type): Likewise.
586         (gcc_jit_context_new_param): Likewise.
587         (gcc_jit_context_new_function): Likewise.
588         (gcc_jit_context_get_builtin_function): Likewise.
589         (gcc_jit_function_get_param): Likewise.
590         (gcc_jit_function_dump_to_dot): Likewise.
591         (gcc_jit_function_new_block): Likewise.
592         (gcc_jit_context_new_global): Likewise.
593         (gcc_jit_context_new_rvalue_from_int): Likewise.
594         (gcc_jit_context_zero): Likewise.
595         (gcc_jit_context_one): Likewise.
596         (gcc_jit_context_new_rvalue_from_double): Likewise.
597         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
598         (gcc_jit_context_null): Likewise.
599         (gcc_jit_context_new_string_literal): Likewise.
600         (gcc_jit_context_new_unary_op): Likewise.
601         (gcc_jit_context_new_binary_op): Likewise.
602         (gcc_jit_context_new_comparison): Likewise.
603         (gcc_jit_context_new_call): Likewise.
604         (gcc_jit_context_new_call_through_ptr): Likewise.
605         (gcc_jit_context_new_cast): Likewise.
606         (gcc_jit_context_new_array_access): Likewise.
607         (gcc_jit_lvalue_access_field): Likewise.
608         (gcc_jit_rvalue_access_field): Likewise.
609         (gcc_jit_rvalue_dereference_field): Likewise.
610         (gcc_jit_rvalue_dereference): Likewise.
611         (gcc_jit_lvalue_get_address): Likewise.
612         (gcc_jit_function_new_local): Likewise.
613         (gcc_jit_block_add_eval): Likewise.
614         (gcc_jit_block_add_assignment): Likewise.
615         (gcc_jit_block_add_assignment_op): Likewise.
616         (gcc_jit_block_end_with_conditional): Likewise.
617         (gcc_jit_block_add_comment): Likewise.
618         (gcc_jit_block_end_with_jump): Likewise.
619         (gcc_jit_block_end_with_return): Likewise.
620         (gcc_jit_block_end_with_void_return): Likewise.
621         (gcc_jit_context_set_str_option): Likewise.
622         (gcc_jit_context_set_int_option): Likewise.
623         (gcc_jit_context_set_bool_option): Likewise.
624         (gcc_jit_context_enable_dump): Likewise.
625         (gcc_jit_context_compile): Likewise.  Also log the context,
626         and the result.
627         (gcc_jit_context_dump_to_file): Likewise.
628         (gcc_jit_context_set_logfile): New function.
629         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
630         log entry/exit from the function body.
631         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
632         and the ptr to be returned.
633         (gcc_jit_result_release): Likewise.  Also log the result.
634         * libgccjit.h: Include <stdio.h>, since we need FILE *.
635         (gcc_jit_context_set_logfile): New declaration.
636         * libgccjit.map (gcc_jit_context_set_logfile): New.
638 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
640         * jit-recording.h (gcc::jit::recording::type::is_void): New
641         virtual function.
642         (gcc::jit::recording::memento_of_get_type::is_void): New
643         function, overriding default implementation.
644         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
645         the underlying type is not "void".
647 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
649         * docs/topics/expressions.rst (Unary Operations): Add
650         GCC_JIT_UNARY_OP_ABS.
651         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
652         Likewise.
653         * jit-recording.c (unary_op_strings): Likewise.
654         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
655         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
656         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
657         * docs/_build/texinfo/libgccjit.texi: Regenerate.
659 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
661         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
662         typo in comment.
664 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
666         * TODO.rst (Test suite): Remove item about running C++ testcases.
667         * docs/internals/index.rst (Working on the JIT library): Add
668         "c++" to the enabled languages in the suggested "configure"
669         invocation, and add a description of why this is necessary.
670         * docs/_build/texinfo/libgccjit.texi: Regenerate.
672 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
674         * docs/internals/index.rst: Update to reflect that built
675         testcases are now test-foo.c.exe, rather than test-foo.exe.
676         * docs/_build/texinfo/libgccjit.texi: Regenerate.
678 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
680         Update copyright years.
682 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
684         * jit-playback.c (gcc::jit::playback::context::build_cast): In
685         case BOOLEAN_TYPE, don't assume that the source expression is
686         of type "int".
688 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
690         * jit-recording.c (gcc::jit::recording::context::context): When
691         copying string options from a parent context, take a copy of the
692         underlying buffers, rather than simply copying the pointer.
694 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
696         * jit-recording.c (gcc::jit::recording::context::set_str_option):
697         Handle NULL.
699 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
701         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
702         Document new function.
703         * docs/_build/texinfo/libgccjit.texi: Regenerate.
705 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
707         Minor interface cleanups of libgccjit
708         * jit-playback.c (convert_to_dso): Use auto_vec instead
709         of automatic array to build up command line.
710         * jit-recording.c (recording::context::set_str_option):
711         Make copy of the string.
712         (recording::context::~context): Free string options.
713         * jit-recording.h (recording::context): Adjust type
714         of m_str_options member.
715         * libgccjit.h: Adjust comment about
716         gcc_jit_context_set_str_option parameter being used after
717         the call.
718         Update comment now that all interfaces are copy strings
719         if necessary.
720         * libgccjit++.h (gccjit::context): Add set_str_option
721         member function.
723 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
725         * docs/cp/index.rst: New file.
726         * docs/cp/intro/index.rst: New file.
727         * docs/cp/intro/tutorial01.rst: New file.
728         * docs/cp/intro/tutorial02.rst: New file.
729         * docs/cp/intro/tutorial03.rst: New file.
730         * docs/cp/intro/tutorial04.rst: New file.
731         * docs/cp/topics/contexts.rst: New file.
732         * docs/cp/topics/expressions.rst: New file.
733         * docs/cp/topics/functions.rst: New file.
734         * docs/cp/topics/index.rst: New file.
735         * docs/cp/topics/locations.rst: New file.
736         * docs/cp/topics/objects.rst: New file.
737         * docs/cp/topics/results.rst: New file.
738         * docs/cp/topics/types.rst: New file.
739         * docs/examples/tut01-hello-world.cc: New file.
740         * docs/examples/tut02-square.c: Fix missing newline in output.
741         * docs/examples/tut02-square.cc: New file.
742         * docs/examples/tut03-sum-of-squares.cc: New file.
743         * docs/examples/tut04-toyvm/toyvm.cc: New file.
744         * docs/index.rst: Move summary to above the table of contents.
745         Add text about the C vs C++ APIs.
746         * docs/topics/contexts.rst: Fix a typo.
748         * docs/_build/texinfo/libgccjit.texi: Regenerate.
749         * docs/_build/texinfo/factorial1.png: New file.
750         * docs/_build/texinfo/sum-of-squares1.png: New file.
752 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
754         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
755         logic for determine "funcname" to new function...
756         (get_function_name): ...here, adding logic to skip any leading
757         path from the filename.
758         (toyvm_function_parse): Use the filename for fn_filename, rather
759         than "name", so that the debugger can locate the source .toy
760         file.
761         (toyvm_function_parse): Don't fclose a NULL FILE *.
763 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
765         PR jit/63854
766         * docs/internals/index.rst (Running under valgrind): New
767         subsection.
768         (docs/_build/texinfo/libgccjit.texi): Regenerate.
770 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
772         PR jit/64206
773         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
774         * jit-common.h (gcc::jit::tempdir): New forward decl.
775         * jit-playback.c: Include jit-tempdir.h.
776         (gcc::jit::playback::context::context): Initialize m_tempdir.
777         (gcc::jit::playback::context::~context): Move tempdir
778         cleanup to new file jit-tempdir.c
779         (make_tempdir_path_template): Move to new file jit-tempdir.c.
780         (gcc::jit::playback::context::compile): Move tempdir creation
781         to new tempdir object in new file jit-tempdir.c.
782         (gcc::jit::playback::context::make_fake_args): Get path from
783         tempdir object rather than from member data.
784         (gcc::jit::playback::context::convert_to_dso): Likewise.
785         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
786         (gcc::jit::playback::context::dump_generated_code): Likewise.
787         (gcc::jit::playback::context::get_path_c_file): New function.
788         (gcc::jit::playback::context::get_path_s_file): New function.
789         (gcc::jit::playback::context::get_path_so_file): New function.
790         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
791         New function.
792         (gcc::jit::playback::context::get_path_s_file): New function.
793         (gcc::jit::playback::context::get_path_so_file): New function.
794         (gcc::jit::playback::context): Move fields "m_path_template",
795         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
796         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
797         * jit-tempdir.c: New file.
798         * jit-tempdir.h: New file.
800 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
802         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
803         mutex here, immediately before using toplev, and release it here, on
804         each exit path after acquisition.
805         (jit_mutex): Move this variable here, from jit-recording.c.
806         (gcc::jit::playback::context::acquire_mutex): New function, based on
807         code in jit-recording.c.
808         (gcc::jit::playback::context::release_mutex): Likewise.
809         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
810         function.
811         (gcc::jit::playback::context::release_mutex): New function.
812         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
813         (gcc::jit::recording::context::compile): Move mutex-handling from
814         here into jit-playback.c's gcc::jit::playback::context::compile.
815         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
816         and RELEASE_MUTEX.
818 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
820         * jit-playback.c (gcc::jit::playback::context::compile): Move the
821         dlopen code into...
822         (gcc::jit::playback::context::dlopen_built_dso): ...this new
823         function.
824         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
825         New function.
827 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
829         PR jit/64166
830         * docs/topics/contexts.rst (Debugging): Add description of
831         gcc_jit_context_enable_dump.
832         * docs/_build/texinfo/libgccjit.texi: Regenerate.
833         * jit-playback.c: Include context.h.
834         (class auto_argvec): New class.
835         (auto_argvec::~auto_argvec): New function.
836         (gcc::jit::playback::context::compile): Convert fake_args to be
837         an auto_argvec, so that it can contain dynamically-allocated
838         strings.   Construct a vec of all requested dumps, and pass it to
839         make_fake_args.  Extract requested dumps between the calls to
840         toplev::main and toplev::finalize.
841         (gcc::jit::playback::context::make_fake_args): Convert param
842         "argvec" to be a vec <char *>, and gain a "requested_dumps"
843         param.  Convert to dynamically-allocated arg strings by converting
844         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
845         for args that are already a copy.  Add args for all requested dumps.
846         (gcc::jit::playback::context::extract_any_requested_dumps): New
847         function.
848         (gcc::jit::playback::context::read_dump_file): New function.
849         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
850         Convert param "argvec" to be a vec <char *>, and gain a
851         "requested_dumps" param.
852         (gcc::jit::playback::context::extract_any_requested_dumps): New
853         function.
854         (gcc::jit::playback::context::read_dump_file): New function.
855         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
856         function.
857         (gcc::jit::recording::context::get_all_requested_dumps): New
858         function.
859         * jit-recording.h (gcc::jit::recording::requested_dump): New
860         struct.
861         (gcc::jit::recording::context::enable_dump): New function.
862         (gcc::jit::recording::context::get_all_requested_dumps): New
863         function.
864         (gcc::jit::recording::context::m_requested_dumps): New field.
865         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
866         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
867         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
869 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
871         * libgccjit++.h: Indent the forward declarations of the classes to
872         show the inheritance hierarchy.
874 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
876         * notes.txt: Show the beginning and ending of
877         recording::context::compile vs playback::context::compile.  Show
878         the creation and unlinking of the tempdir.  Show toplev::finalize.
879         Move "RELEASE MUTEX" to the correct location.  Show
880         gcc_jit_result_release, and indicate where the
881         dlopen/dlsym/dlclose occur.
883 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
885         * docs/examples/tut02-square.c (main): Release the context
886         earlier, to show that this is possible.  Update error-handling
887         to avoid a double-release of the context, and to avoid
888         releasing a NULL result.
889         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
890         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
891         * docs/topics/results.rst (gcc_jit_result): Mention that this
892         controls the lifetimes of machine code functions.
893         (gcc_jit_result_get_code): Spell out the requirements for this
894         to succeed, and the lifetime of the result.
895         (gcc_jit_result_release): Mention that this invalidates any code
896         that was obtained from the result.
897         * docs/_build/texinfo/libgccjit.texi: Regenerate.
899 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
901         PR jit/64018
902         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
903         Add description of error-handling, taken in part from...
904         * docs/topics/contexts.rst (Error-handling): Expand, and move some
905         content to tutorial02.rst.
906         * docs/_build/texinfo/libgccjit.texi: Regenerate.
908 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
910         PR jit/64020
911         * docs/topics/types.rst (Standard types) Add new enum values to
912         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
913         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
914         Widen the left-hand column so that
915         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
916         * docs/_build/texinfo/libgccjit.texi: Regenerate.
918         * jit-builtins.c: Include stringpool.h and jit-playback.h.
919         Move everything out of the gcc::jit::recording namespace into
920         just gcc::jit.
921         (struct builtin_data): Add fields "fnclass", "attr", and
922         "implicit_p".
923         (DEF_BUILTIN): Update macro so populate the new fields.
924         (builtins_manager::builtins_manager): Update for move out of
925         recording namespace.  Initialize the m_attributes array.
926         (builtins_manager::get_builtin_function): Likewise.
927         (builtins_manager::get_builtin_function_by_id): New function.
928         (builtins_manager::make_builtin_function): Update for move out of
929         recording namespace.  Add fix for PR jit/64020 by detecting
930         specific builtin ids and having them ensure that builtins for
931         other ids are created as necessary.
932         (builtins_manager::get_type): Update for move out of recording
933         namespace.
934         (builtins_manager::make_type): Likewise.  Add some missing
935         #undefs.
936         (builtins_manager::make_primitive_type): Update for move out of
937         recording namespace.  Implement the three BT_COMPLEX_ cases and
938         BT_DOUBLE_PTR.
939         (builtins_manager::make_fn_type): Update for move out of recording
940         namespace.
941         (builtins_manager::make_ptr_type): Likewise.
942         (builtins_manager::finish_playback): New function.
943         (builtins_manager::get_class): New function.
944         (builtins_manager::implicit_p): New function.
945         (builtins_manager::get_attrs_tree): Two new functions.
946         (builtins_manager::make_attrs_tree): New function.
948         * jit-builtins.h: Move everything out of the gcc::jit::recording
949         namespace into just gcc::jit.
950         (enum built_in_attribute): New.
951         (builtins_manager::builtins_manager): Update decl for namespace
952         change.
953         (builtins_manager::get_builtin_function): Likewise.
954         (builtins_manager::get_class): New.
955         (builtins_manager::implicit_p): New.
956         (builtins_manager::get_attrs_tree): Two new functions.
957         (builtins_manager::make_attrs_tree): New function.
958         (builtins_manager::finish_playback): New.
959         (builtins_manager::get_builtin_function_by_id): New.
960         (builtins_manager::make_builtin_function): Update decl for
961         namespace change.
962         (builtins_manager::get_type): Likewise.
963         (builtins_manager::make_type): Likewise.
964         (builtins_manager::make_primitive_type): Likewise.
965         (builtins_manager::make_fn_type): Likewise.
966         (builtins_manager::make_ptr_type): Likewise.
967         (builtins_manager): Likewise for fields.  Add new field
968         "m_attributes".
970         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
971         (builtins_manager): Update forward decl to reflect namespace
972         change.
974         * jit-playback.c: Include attribs.h and jit-builtins.h.
975         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
976         for the new COMPLEX_ types.
977         (gcc::jit::playback::context::new_function): If creating a
978         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
979         and call set_builtin_decl.
980         (gcc::jit::playback::context::replay): If we have a
981         builtins_manager, call its finish_playback method when we're done.
983         * jit-playback.h:
984         (gcc::jit::playback::context::get_builtins_manager): New function.
986         * jit-recording.c
987         (gcc::jit::recording::context::get_builtins_manager): New function.
988         (gcc::jit::recording::get_builtin_function): Use
989         get_builtins_manager, in case we're a child context.
990         (gcc::jit::recording::memento_of_get_type::dereference): Add the
991         COMPLEX_ types.
992         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
993         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
994         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
995         (get_type_strings): Likewise.
997         * jit-recording.h
998         (gcc::jit::recording::context::get_builtins_manager): New.
1000         * libgccjit.h (enum gcc_jit_types): Add
1001         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1002         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1004 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1006         * jit-builtins.c
1007         (gcc::jit::recording::builtins_manager::get_builtin_function):
1008         Check for NULL return from make_builtin_function.
1009         (gcc::jit::recording::builtins_manager::make_builtin_function):
1010         Check for NULL return from get_type.
1012 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1014         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1015         creation code into...
1016         (gcc::jit::playback::context::convert_to_dso): New function.
1017         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1018         New function.
1020 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1022         * jit-playback.c (gcc::jit::playback::context::compile): Use an
1023         auto_vec<const char *> rather than a const char *[20] for the
1024         top-level argv, and move the logic to build it to...
1025         (gcc::jit::playback::context::make_fake_args): New function.
1026         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1027         New function.
1029 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1031         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1032         * jit-playback.c: Include new header jit-result.h.
1033         (gcc::jit::result::result): Move to new file jit-result.c.
1034         (gcc::jit::result::~result): Likewise.
1035         (gcc::jit::playback::result): Likewise.
1036         * jit-recording.h (class gcc::jit::result): Move to new
1037         header jit-result.h.
1038         * jit-result.c: New file, to contain...
1039         (gcc::jit::result::result): Move here from jit-playback.c,
1040         removing erroneous "playback" namespace from comment.
1041         (gcc::jit::result::~result): Likewise.
1042         (gcc::jit::playback::result): Likewise.
1043         * jit-result.h: New file, to contain...
1044         (class gcc::jit::result): Move from jit-recording.h.
1045         * libgccjit.c: Include jit-result.h.
1046         (gcc_jit_result_get_code): Update comment to reflect move
1047         of implementation.
1048         (gcc_jit_result_release): Likewise.
1050 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1052         PR jit/63854
1053         * docs/examples/tut04-toyvm/toyvm.c
1054         (toyvm_compiled_function): New typedef.
1055         (toyvm_compiled_func) Rename to...
1056         (toyvm_compiled_code) ...this.
1057         (struct toyvm_compiled_function): New struct.
1058         (toyvm_function_compile): Return a toyvm_compiled_function *
1059         rather than a toyvm_compiled_func, so that the caller can fully
1060         clean things up.  Free "funcname".
1061         (test_script): Update for change to toyvm_function_compile.
1062         Clean up the toyvm_compiled_function.
1063         (main): Likewise.
1064         (docs/intro/tutorial04.rst): Update to reflect the above changes,
1065         and to better spell out the lifetime of the compiled code.
1067 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1069         PR jit/63854
1070         * jit-builtins.c
1071         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1072         context's new_function_type method, rather than directly creating
1073         a function_type instance.
1074         * jit-recording.c
1075         (gcc::jit::recording::context::new_function_type): New method,
1076         adapted from part of...
1077         (gcc::jit::recording::context::new_function_ptr_type): ...this.
1078         Update to call new_function_type.
1079         * jit-recording.h
1080         (gcc::jit::recording::context::new_function_type): New method.
1082 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1084         PR jit/63969
1085         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1087 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1089         PR jit/63854
1090         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1091         Convert param from const vec<playback::field *> & to
1092         const auto_vec<playback::field *> *.
1093         (gcc::jit::playback::context::new_function_type): Convert param
1094         "param_types" from vec<type *> * to const auto_vec<type *> *.
1095         (gcc::jit::playback::context::new_function): Convert param
1096         "params" from vec<param *> * to const auto_vec<param *> *.
1097         (gcc::jit::playback::context::build_call): Convert param "args"
1098         from vec<rvalue *> to const auto_vec<rvalue *> *.
1099         (gcc::jit::playback::context::new_call): Likewise.
1100         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1101         (wrapper_finalizer): New function.
1102         (gcc::jit::playback::wrapper::operator new): Call the finalizer
1103         variant of ggc_internal_cleared_alloc, supplying
1104         wrapper_finalizer.
1105         (gcc::jit::playback::function::finalizer): New.
1106         (gcc::jit::playback::block::finalizer): New.
1107         (gcc::jit::playback::source_file::finalizer): New.
1108         (gcc::jit::playback::source_line::finalizer): New.
1110         * jit-playback.h
1111         (gcc::jit::playback::context::new_function_type): Convert param
1112         "param_types" from vec<type *> * to const auto_vec<type *> *.
1113         (gcc::jit::playback::context::new_function): Convert param
1114         "params" from vec<param *> * to const auto_vec<param *> *.
1115         (gcc::jit::playback::context::new_call): Convert param
1116         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1117         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1118         (gcc::jit::playback::context::build_call): Likewise.
1119         (gcc::jit::playback::context): Convert fields "m_functions",
1120         "m_source_files", "m_cached_locations" from vec to auto_vec.
1121         (gcc::jit::playback::wrapper::finalizer): New virtual function.
1122         (gcc::jit::playback::compound_type::set_fields): Convert param fro
1123         const vec<playback::field *> & to
1124         const auto_vec<playback::field *> *.
1125         (gcc::jit::playback::function::finalizer): New.
1126         (gcc::jit::playback::block::finalizer): New.
1127         (gcc::jit::playback::source_file::finalizer): New.
1128         (gcc::jit::playback::source_line::finalizer): New.
1130         * jit-recording.c
1131         (gcc::jit::recording::function_type::replay_into): Convert local
1132         from a vec into an auto_vec.
1133         (gcc::jit::recording::fields::replay_into): Likewise.
1134         (gcc::jit::recording::function::replay_into): Likewise.
1135         (gcc::jit::recording::call::replay_into): Likewise.
1136         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1138         * jit-recording.h (gcc::jit::recording::context): Convert fields
1139         "m_mementos", "m_compound_types", "m_functions" from vec<> to
1140         auto_vec <>.
1141         (gcc::jit::recording::function_type::get_param_types): Convert
1142         return type from vec<type *> to const vec<type *> &.
1143         (gcc::jit::recording::function_type): Convert field
1144         "m_param_types" from a vec<> to an auto_vec<>.
1145         (gcc::jit::recording::fields): Likewise for field "m_fields".
1146         (gcc::jit::recording::function::get_params): Convert return type
1147         from vec <param *> to const vec<param *> &.
1148         (gcc::jit::recording::function): Convert fields "m_params",
1149         "m_locals", "m_blocks" from vec<> to auto_vec<>.
1150         (gcc::jit::recording::block): Likewise for field "m_statements".
1151         vec<> to auto_vec<>.
1152         (gcc::jit::recording::call): Likewise for field "m_args".
1153         (gcc::jit::recording::call_through_ptr): Likewise.
1155 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1157         PR jit/63854
1158         * jit-recording.c (recording::function::validate): Convert
1159         "worklist" from vec<> to autovec<> to fix a leak.
1161 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
1163         * ChangeLog.jit: New.
1164         * ChangeLog: New.
1165         * Make-lang.in: New.
1166         * TODO.rst: New.
1167         * config-lang.in: New.
1168         * docs/Makefile: New.
1169         * docs/_build/texinfo/Makefile: New.
1170         * docs/_build/texinfo/factorial.png: New.
1171         * docs/_build/texinfo/libgccjit.texi: New.
1172         * docs/_build/texinfo/sum-of-squares.png: New.
1173         * docs/conf.py: New.
1174         * docs/examples/tut01-hello-world.c: New.
1175         * docs/examples/tut02-square.c: New.
1176         * docs/examples/tut03-sum-of-squares.c: New.
1177         * docs/examples/tut04-toyvm/Makefile: New.
1178         * docs/examples/tut04-toyvm/factorial.toy: New.
1179         * docs/examples/tut04-toyvm/fibonacci.toy: New.
1180         * docs/examples/tut04-toyvm/toyvm.c: New.
1181         * docs/index.rst: New.
1182         * docs/internals/index.rst: New.
1183         * docs/intro/factorial.png: New.
1184         * docs/intro/index.rst: New.
1185         * docs/intro/sum-of-squares.png: New.
1186         * docs/intro/tutorial01.rst: New.
1187         * docs/intro/tutorial02.rst: New.
1188         * docs/intro/tutorial03.rst: New.
1189         * docs/intro/tutorial04.rst: New.
1190         * docs/topics/contexts.rst: New.
1191         * docs/topics/expressions.rst: New.
1192         * docs/topics/functions.rst: New.
1193         * docs/topics/index.rst: New.
1194         * docs/topics/locations.rst: New.
1195         * docs/topics/objects.rst: New.
1196         * docs/topics/results.rst: New.
1197         * docs/topics/types.rst: New.
1198         * dummy-frontend.c: New.
1199         * jit-builtins.c: New.
1200         * jit-builtins.h: New.
1201         * jit-common.h: New.
1202         * jit-playback.c: New.
1203         * jit-playback.h: New.
1204         * jit-recording.c: New.
1205         * jit-recording.h: New.
1206         * libgccjit++.h: New.
1207         * libgccjit.c: New.
1208         * libgccjit.h: New.
1209         * libgccjit.map: New.
1210         * notes.txt: New.
1212 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
1214         * Initial creation
1216 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1218 Copying and distribution of this file, with or without modification,
1219 are permitted in any medium without royalty provided the copyright
1220 notice and this notice are preserved.