New jit API entrypoint: gcc_jit_context_set_logfile
[official-gcc.git] / gcc / jit / ChangeLog
blob670f6a2c3fb31696fba1753ebcdb58a72420f533
1 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
3         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
4         * docs/internals/index.rst (Overview of code structure): Mention
5         gcc_jit_context_set_logfile, and embed the example logfile.
6         * docs/internals/test-hello-world.exe.log.txt: New file: example
7         of a logfile.
8         * docs/topics/contexts.rst (Debugging): Add documentation
9         for gcc_jit_context_set_logfile.
10         * docs/_build/texinfo/libgccjit.texi: Regenerate.
11         * dummy-frontend.c: Include "jit-logging.h".
12         (jit_langhook_init): Assert that there is an active playback
13         context.  If it has a logger, log entry/exit to this function.
14         (jit_langhook_write_globals): Likewise.
15         * jit-common.h (gcc::jit::logger): New forward declaration.
16         * jit-logging.c: New file.
17         * jit-logging.h: New file.
18         * jit-playback.c: Include "jit-logging.h".
19         (gcc::jit::playback::context::context): Initialize the log_user
20         base class from the recording context's logger (if any).  Use
21         JIT_LOG_SCOPE to log entry/exit from the function body.
22         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
23         log entry/exit from the function body.
24         (gcc::jit::playback::build_stmt_list): Likewise.
25         (gcc::jit::playback::function::postprocess): Likewise.
26         (gcc::jit::playback::context::compile): Likewise.  Log the
27         entry/exit to toplev::main and toplev::finalize.  Log the
28         fake argv passed to toplev::main.
29         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
30         log entry/exit from the function body.
31         (gcc::jit::playback::context::release_mutex): Likewise.
32         (gcc::jit::playback::context::make_fake_args): Likewise.
33         (gcc::jit::playback::context::extract_any_requested_dumps):
34         Likewise.
35         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
36         log the arguments that the driver is invoked with.
37         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
38         the logger to the result object.
39         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
40         log entry/exit from the function body.
41         (gcc::jit::playback::context::dump_generated_code): Likewise.
42         (gcc::jit::playback::context::handle_locations): Likewise.
43         * jit-playback.h (gcc::jit::playback::context): Make this be
44         a subclass of gcc::jit::log_user.
45         * jit-recording.c: Include "jit-logging.h".
46         (gcc::jit::recording::context::context: Initialize the logger to
47         NULL for root contexts, or to the parent's logger for child
48         contexts.
49         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
50         log entry/exit from the function body.
51         (gcc::jit::recording::context::replay_into): Likewise.
52         (gcc::jit::recording::context::disassociate_from_playback):
53         Likewise.
54         (gcc::jit::recording::context::compile): Likewise.
55         (recording::context::add_error_va): Likewise.  Also, log the
56         error.
57         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
58         log entry/exit from the function body.
59         * jit-recording.h: Include "jit-logging.h".
60         (gcc::jit::recording::context): Make this be a subclass of
61         gcc::jit::log_user.
62         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
63         (gcc::jit::result::result): Add logger param, recording it.
64         Use JIT_LOG_SCOPE to log entry/exit from the function body.
65         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
66         log entry/exit from the function body.
67         (gcc::jit::result::get_code): Likewise.
68         * jit-result.h (gcc::jit::result): Make this be a subclass of
69         gcc::jit::log_user.
70         (gcc::jit::result::result): Add logger parameter.
71         * libgccjit++.h (gccjit::context::set_logfile): New function.
72         * libgccjit.c: Include "jit-logging.h".
73         (gcc_jit_context_acquire): Log the context.
74         (gcc_jit_context_release): Use JIT_LOG_FUNC to
75         log entry/exit from the function body, and log the context.
76         (gcc_jit_context_new_child_context): Likewise, logging both
77         contexts.
78         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
79         log entry/exit from the function body.
80         (gcc_jit_context_get_type): Likewise.
81         (gcc_jit_context_get_int_type): Likewise.
82         (gcc_jit_context_new_array_type): Likewise.
83         (gcc_jit_context_new_field): Likewise.
84         (gcc_jit_context_new_struct_type): Likewise.
85         (gcc_jit_context_new_opaque_struct): Likewise.
86         (gcc_jit_struct_set_fields): Likewise.
87         (gcc_jit_context_new_union_type): Likewise.
88         (gcc_jit_context_new_function_ptr_type): Likewise.
89         (gcc_jit_context_new_param): Likewise.
90         (gcc_jit_context_new_function): Likewise.
91         (gcc_jit_context_get_builtin_function): Likewise.
92         (gcc_jit_function_get_param): Likewise.
93         (gcc_jit_function_dump_to_dot): Likewise.
94         (gcc_jit_function_new_block): Likewise.
95         (gcc_jit_context_new_global): Likewise.
96         (gcc_jit_context_new_rvalue_from_int): Likewise.
97         (gcc_jit_context_zero): Likewise.
98         (gcc_jit_context_one): Likewise.
99         (gcc_jit_context_new_rvalue_from_double): Likewise.
100         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
101         (gcc_jit_context_null): Likewise.
102         (gcc_jit_context_new_string_literal): Likewise.
103         (gcc_jit_context_new_unary_op): Likewise.
104         (gcc_jit_context_new_binary_op): Likewise.
105         (gcc_jit_context_new_comparison): Likewise.
106         (gcc_jit_context_new_call): Likewise.
107         (gcc_jit_context_new_call_through_ptr): Likewise.
108         (gcc_jit_context_new_cast): Likewise.
109         (gcc_jit_context_new_array_access): Likewise.
110         (gcc_jit_lvalue_access_field): Likewise.
111         (gcc_jit_rvalue_access_field): Likewise.
112         (gcc_jit_rvalue_dereference_field): Likewise.
113         (gcc_jit_rvalue_dereference): Likewise.
114         (gcc_jit_lvalue_get_address): Likewise.
115         (gcc_jit_function_new_local): Likewise.
116         (gcc_jit_block_add_eval): Likewise.
117         (gcc_jit_block_add_assignment): Likewise.
118         (gcc_jit_block_add_assignment_op): Likewise.
119         (gcc_jit_block_end_with_conditional): Likewise.
120         (gcc_jit_block_add_comment): Likewise.
121         (gcc_jit_block_end_with_jump): Likewise.
122         (gcc_jit_block_end_with_return): Likewise.
123         (gcc_jit_block_end_with_void_return): Likewise.
124         (gcc_jit_context_set_str_option): Likewise.
125         (gcc_jit_context_set_int_option): Likewise.
126         (gcc_jit_context_set_bool_option): Likewise.
127         (gcc_jit_context_enable_dump): Likewise.
128         (gcc_jit_context_compile): Likewise.  Also log the context,
129         and the result.
130         (gcc_jit_context_dump_to_file): Likewise.
131         (gcc_jit_context_set_logfile): New function.
132         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
133         log entry/exit from the function body.
134         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
135         and the ptr to be returned.
136         (gcc_jit_result_release): Likewise.  Also log the result.
137         * libgccjit.h: Include <stdio.h>, since we need FILE *.
138         (gcc_jit_context_set_logfile): New declaration.
139         * libgccjit.map (gcc_jit_context_set_logfile): New.
141 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
143         * jit-recording.h (gcc::jit::recording::type::is_void): New
144         virtual function.
145         (gcc::jit::recording::memento_of_get_type::is_void): New
146         function, overriding default implementation.
147         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
148         the underlying type is not "void".
150 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
152         * docs/topics/expressions.rst (Unary Operations): Add
153         GCC_JIT_UNARY_OP_ABS.
154         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
155         Likewise.
156         * jit-recording.c (unary_op_strings): Likewise.
157         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
158         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
159         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
160         * docs/_build/texinfo/libgccjit.texi: Regenerate.
162 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
164         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
165         typo in comment.
167 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
169         * TODO.rst (Test suite): Remove item about running C++ testcases.
170         * docs/internals/index.rst (Working on the JIT library): Add
171         "c++" to the enabled languages in the suggested "configure"
172         invocation, and add a description of why this is necessary.
173         * docs/_build/texinfo/libgccjit.texi: Regenerate.
175 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
177         * docs/internals/index.rst: Update to reflect that built
178         testcases are now test-foo.c.exe, rather than test-foo.exe.
179         * docs/_build/texinfo/libgccjit.texi: Regenerate.
181 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
183         Update copyright years.
185 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
187         * jit-playback.c (gcc::jit::playback::context::build_cast): In
188         case BOOLEAN_TYPE, don't assume that the source expression is
189         of type "int".
191 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
193         * jit-recording.c (gcc::jit::recording::context::context): When
194         copying string options from a parent context, take a copy of the
195         underlying buffers, rather than simply copying the pointer.
197 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
199         * jit-recording.c (gcc::jit::recording::context::set_str_option):
200         Handle NULL.
202 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
204         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
205         Document new function.
206         * docs/_build/texinfo/libgccjit.texi: Regenerate.
208 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
210         Minor interface cleanups of libgccjit
211         * jit-playback.c (convert_to_dso): Use auto_vec instead
212         of automatic array to build up command line.
213         * jit-recording.c (recording::context::set_str_option):
214         Make copy of the string.
215         (recording::context::~context): Free string options.
216         * jit-recording.h (recording::context): Adjust type
217         of m_str_options member.
218         * libgccjit.h: Adjust comment about
219         gcc_jit_context_set_str_option parameter being used after
220         the call.
221         Update comment now that all interfaces are copy strings
222         if necessary.
223         * libgccjit++.h (gccjit::context): Add set_str_option
224         member function.
226 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
228         * docs/cp/index.rst: New file.
229         * docs/cp/intro/index.rst: New file.
230         * docs/cp/intro/tutorial01.rst: New file.
231         * docs/cp/intro/tutorial02.rst: New file.
232         * docs/cp/intro/tutorial03.rst: New file.
233         * docs/cp/intro/tutorial04.rst: New file.
234         * docs/cp/topics/contexts.rst: New file.
235         * docs/cp/topics/expressions.rst: New file.
236         * docs/cp/topics/functions.rst: New file.
237         * docs/cp/topics/index.rst: New file.
238         * docs/cp/topics/locations.rst: New file.
239         * docs/cp/topics/objects.rst: New file.
240         * docs/cp/topics/results.rst: New file.
241         * docs/cp/topics/types.rst: New file.
242         * docs/examples/tut01-hello-world.cc: New file.
243         * docs/examples/tut02-square.c: Fix missing newline in output.
244         * docs/examples/tut02-square.cc: New file.
245         * docs/examples/tut03-sum-of-squares.cc: New file.
246         * docs/examples/tut04-toyvm/toyvm.cc: New file.
247         * docs/index.rst: Move summary to above the table of contents.
248         Add text about the C vs C++ APIs.
249         * docs/topics/contexts.rst: Fix a typo.
251         * docs/_build/texinfo/libgccjit.texi: Regenerate.
252         * docs/_build/texinfo/factorial1.png: New file.
253         * docs/_build/texinfo/sum-of-squares1.png: New file.
255 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
257         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
258         logic for determine "funcname" to new function...
259         (get_function_name): ...here, adding logic to skip any leading
260         path from the filename.
261         (toyvm_function_parse): Use the filename for fn_filename, rather
262         than "name", so that the debugger can locate the source .toy
263         file.
264         (toyvm_function_parse): Don't fclose a NULL FILE *.
266 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
268         PR jit/63854
269         * docs/internals/index.rst (Running under valgrind): New
270         subsection.
271         (docs/_build/texinfo/libgccjit.texi): Regenerate.
273 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
275         PR jit/64206
276         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
277         * jit-common.h (gcc::jit::tempdir): New forward decl.
278         * jit-playback.c: Include jit-tempdir.h.
279         (gcc::jit::playback::context::context): Initialize m_tempdir.
280         (gcc::jit::playback::context::~context): Move tempdir
281         cleanup to new file jit-tempdir.c
282         (make_tempdir_path_template): Move to new file jit-tempdir.c.
283         (gcc::jit::playback::context::compile): Move tempdir creation
284         to new tempdir object in new file jit-tempdir.c.
285         (gcc::jit::playback::context::make_fake_args): Get path from
286         tempdir object rather than from member data.
287         (gcc::jit::playback::context::convert_to_dso): Likewise.
288         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
289         (gcc::jit::playback::context::dump_generated_code): Likewise.
290         (gcc::jit::playback::context::get_path_c_file): New function.
291         (gcc::jit::playback::context::get_path_s_file): New function.
292         (gcc::jit::playback::context::get_path_so_file): New function.
293         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
294         New function.
295         (gcc::jit::playback::context::get_path_s_file): New function.
296         (gcc::jit::playback::context::get_path_so_file): New function.
297         (gcc::jit::playback::context): Move fields "m_path_template",
298         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
299         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
300         * jit-tempdir.c: New file.
301         * jit-tempdir.h: New file.
303 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
305         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
306         mutex here, immediately before using toplev, and release it here, on
307         each exit path after acquisition.
308         (jit_mutex): Move this variable here, from jit-recording.c.
309         (gcc::jit::playback::context::acquire_mutex): New function, based on
310         code in jit-recording.c.
311         (gcc::jit::playback::context::release_mutex): Likewise.
312         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
313         function.
314         (gcc::jit::playback::context::release_mutex): New function.
315         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
316         (gcc::jit::recording::context::compile): Move mutex-handling from
317         here into jit-playback.c's gcc::jit::playback::context::compile.
318         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
319         and RELEASE_MUTEX.
321 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
323         * jit-playback.c (gcc::jit::playback::context::compile): Move the
324         dlopen code into...
325         (gcc::jit::playback::context::dlopen_built_dso): ...this new
326         function.
327         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
328         New function.
330 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
332         PR jit/64166
333         * docs/topics/contexts.rst (Debugging): Add description of
334         gcc_jit_context_enable_dump.
335         * docs/_build/texinfo/libgccjit.texi: Regenerate.
336         * jit-playback.c: Include context.h.
337         (class auto_argvec): New class.
338         (auto_argvec::~auto_argvec): New function.
339         (gcc::jit::playback::context::compile): Convert fake_args to be
340         an auto_argvec, so that it can contain dynamically-allocated
341         strings.   Construct a vec of all requested dumps, and pass it to
342         make_fake_args.  Extract requested dumps between the calls to
343         toplev::main and toplev::finalize.
344         (gcc::jit::playback::context::make_fake_args): Convert param
345         "argvec" to be a vec <char *>, and gain a "requested_dumps"
346         param.  Convert to dynamically-allocated arg strings by converting
347         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
348         for args that are already a copy.  Add args for all requested dumps.
349         (gcc::jit::playback::context::extract_any_requested_dumps): New
350         function.
351         (gcc::jit::playback::context::read_dump_file): New function.
352         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
353         Convert param "argvec" to be a vec <char *>, and gain a
354         "requested_dumps" param.
355         (gcc::jit::playback::context::extract_any_requested_dumps): New
356         function.
357         (gcc::jit::playback::context::read_dump_file): New function.
358         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
359         function.
360         (gcc::jit::recording::context::get_all_requested_dumps): New
361         function.
362         * jit-recording.h (gcc::jit::recording::requested_dump): New
363         struct.
364         (gcc::jit::recording::context::enable_dump): New function.
365         (gcc::jit::recording::context::get_all_requested_dumps): New
366         function.
367         (gcc::jit::recording::context::m_requested_dumps): New field.
368         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
369         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
370         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
372 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
374         * libgccjit++.h: Indent the forward declarations of the classes to
375         show the inheritance hierarchy.
377 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
379         * notes.txt: Show the beginning and ending of
380         recording::context::compile vs playback::context::compile.  Show
381         the creation and unlinking of the tempdir.  Show toplev::finalize.
382         Move "RELEASE MUTEX" to the correct location.  Show
383         gcc_jit_result_release, and indicate where the
384         dlopen/dlsym/dlclose occur.
386 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
388         * docs/examples/tut02-square.c (main): Release the context
389         earlier, to show that this is possible.  Update error-handling
390         to avoid a double-release of the context, and to avoid
391         releasing a NULL result.
392         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
393         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
394         * docs/topics/results.rst (gcc_jit_result): Mention that this
395         controls the lifetimes of machine code functions.
396         (gcc_jit_result_get_code): Spell out the requirements for this
397         to succeed, and the lifetime of the result.
398         (gcc_jit_result_release): Mention that this invalidates any code
399         that was obtained from the result.
400         * docs/_build/texinfo/libgccjit.texi: Regenerate.
402 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
404         PR jit/64018
405         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
406         Add description of error-handling, taken in part from...
407         * docs/topics/contexts.rst (Error-handling): Expand, and move some
408         content to tutorial02.rst.
409         * docs/_build/texinfo/libgccjit.texi: Regenerate.
411 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
413         PR jit/64020
414         * docs/topics/types.rst (Standard types) Add new enum values to
415         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
416         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
417         Widen the left-hand column so that
418         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
419         * docs/_build/texinfo/libgccjit.texi: Regenerate.
421         * jit-builtins.c: Include stringpool.h and jit-playback.h.
422         Move everything out of the gcc::jit::recording namespace into
423         just gcc::jit.
424         (struct builtin_data): Add fields "fnclass", "attr", and
425         "implicit_p".
426         (DEF_BUILTIN): Update macro so populate the new fields.
427         (builtins_manager::builtins_manager): Update for move out of
428         recording namespace.  Initialize the m_attributes array.
429         (builtins_manager::get_builtin_function): Likewise.
430         (builtins_manager::get_builtin_function_by_id): New function.
431         (builtins_manager::make_builtin_function): Update for move out of
432         recording namespace.  Add fix for PR jit/64020 by detecting
433         specific builtin ids and having them ensure that builtins for
434         other ids are created as necessary.
435         (builtins_manager::get_type): Update for move out of recording
436         namespace.
437         (builtins_manager::make_type): Likewise.  Add some missing
438         #undefs.
439         (builtins_manager::make_primitive_type): Update for move out of
440         recording namespace.  Implement the three BT_COMPLEX_ cases and
441         BT_DOUBLE_PTR.
442         (builtins_manager::make_fn_type): Update for move out of recording
443         namespace.
444         (builtins_manager::make_ptr_type): Likewise.
445         (builtins_manager::finish_playback): New function.
446         (builtins_manager::get_class): New function.
447         (builtins_manager::implicit_p): New function.
448         (builtins_manager::get_attrs_tree): Two new functions.
449         (builtins_manager::make_attrs_tree): New function.
451         * jit-builtins.h: Move everything out of the gcc::jit::recording
452         namespace into just gcc::jit.
453         (enum built_in_attribute): New.
454         (builtins_manager::builtins_manager): Update decl for namespace
455         change.
456         (builtins_manager::get_builtin_function): Likewise.
457         (builtins_manager::get_class): New.
458         (builtins_manager::implicit_p): New.
459         (builtins_manager::get_attrs_tree): Two new functions.
460         (builtins_manager::make_attrs_tree): New function.
461         (builtins_manager::finish_playback): New.
462         (builtins_manager::get_builtin_function_by_id): New.
463         (builtins_manager::make_builtin_function): Update decl for
464         namespace change.
465         (builtins_manager::get_type): Likewise.
466         (builtins_manager::make_type): Likewise.
467         (builtins_manager::make_primitive_type): Likewise.
468         (builtins_manager::make_fn_type): Likewise.
469         (builtins_manager::make_ptr_type): Likewise.
470         (builtins_manager): Likewise for fields.  Add new field
471         "m_attributes".
473         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
474         (builtins_manager): Update forward decl to reflect namespace
475         change.
477         * jit-playback.c: Include attribs.h and jit-builtins.h.
478         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
479         for the new COMPLEX_ types.
480         (gcc::jit::playback::context::new_function): If creating a
481         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
482         and call set_builtin_decl.
483         (gcc::jit::playback::context::replay): If we have a
484         builtins_manager, call its finish_playback method when we're done.
486         * jit-playback.h:
487         (gcc::jit::playback::context::get_builtins_manager): New function.
489         * jit-recording.c
490         (gcc::jit::recording::context::get_builtins_manager): New function.
491         (gcc::jit::recording::get_builtin_function): Use
492         get_builtins_manager, in case we're a child context.
493         (gcc::jit::recording::memento_of_get_type::dereference): Add the
494         COMPLEX_ types.
495         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
496         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
497         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
498         (get_type_strings): Likewise.
500         * jit-recording.h
501         (gcc::jit::recording::context::get_builtins_manager): New.
503         * libgccjit.h (enum gcc_jit_types): Add
504         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
505         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
507 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
509         * jit-builtins.c
510         (gcc::jit::recording::builtins_manager::get_builtin_function):
511         Check for NULL return from make_builtin_function.
512         (gcc::jit::recording::builtins_manager::make_builtin_function):
513         Check for NULL return from get_type.
515 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
517         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
518         creation code into...
519         (gcc::jit::playback::context::convert_to_dso): New function.
520         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
521         New function.
523 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
525         * jit-playback.c (gcc::jit::playback::context::compile): Use an
526         auto_vec<const char *> rather than a const char *[20] for the
527         top-level argv, and move the logic to build it to...
528         (gcc::jit::playback::context::make_fake_args): New function.
529         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
530         New function.
532 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
534         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
535         * jit-playback.c: Include new header jit-result.h.
536         (gcc::jit::result::result): Move to new file jit-result.c.
537         (gcc::jit::result::~result): Likewise.
538         (gcc::jit::playback::result): Likewise.
539         * jit-recording.h (class gcc::jit::result): Move to new
540         header jit-result.h.
541         * jit-result.c: New file, to contain...
542         (gcc::jit::result::result): Move here from jit-playback.c,
543         removing erroneous "playback" namespace from comment.
544         (gcc::jit::result::~result): Likewise.
545         (gcc::jit::playback::result): Likewise.
546         * jit-result.h: New file, to contain...
547         (class gcc::jit::result): Move from jit-recording.h.
548         * libgccjit.c: Include jit-result.h.
549         (gcc_jit_result_get_code): Update comment to reflect move
550         of implementation.
551         (gcc_jit_result_release): Likewise.
553 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
555         PR jit/63854
556         * docs/examples/tut04-toyvm/toyvm.c
557         (toyvm_compiled_function): New typedef.
558         (toyvm_compiled_func) Rename to...
559         (toyvm_compiled_code) ...this.
560         (struct toyvm_compiled_function): New struct.
561         (toyvm_function_compile): Return a toyvm_compiled_function *
562         rather than a toyvm_compiled_func, so that the caller can fully
563         clean things up.  Free "funcname".
564         (test_script): Update for change to toyvm_function_compile.
565         Clean up the toyvm_compiled_function.
566         (main): Likewise.
567         (docs/intro/tutorial04.rst): Update to reflect the above changes,
568         and to better spell out the lifetime of the compiled code.
570 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
572         PR jit/63854
573         * jit-builtins.c
574         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
575         context's new_function_type method, rather than directly creating
576         a function_type instance.
577         * jit-recording.c
578         (gcc::jit::recording::context::new_function_type): New method,
579         adapted from part of...
580         (gcc::jit::recording::context::new_function_ptr_type): ...this.
581         Update to call new_function_type.
582         * jit-recording.h
583         (gcc::jit::recording::context::new_function_type): New method.
585 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
587         PR jit/63969
588         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
590 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
592         PR jit/63854
593         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
594         Convert param from const vec<playback::field *> & to
595         const auto_vec<playback::field *> *.
596         (gcc::jit::playback::context::new_function_type): Convert param
597         "param_types" from vec<type *> * to const auto_vec<type *> *.
598         (gcc::jit::playback::context::new_function): Convert param
599         "params" from vec<param *> * to const auto_vec<param *> *.
600         (gcc::jit::playback::context::build_call): Convert param "args"
601         from vec<rvalue *> to const auto_vec<rvalue *> *.
602         (gcc::jit::playback::context::new_call): Likewise.
603         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
604         (wrapper_finalizer): New function.
605         (gcc::jit::playback::wrapper::operator new): Call the finalizer
606         variant of ggc_internal_cleared_alloc, supplying
607         wrapper_finalizer.
608         (gcc::jit::playback::function::finalizer): New.
609         (gcc::jit::playback::block::finalizer): New.
610         (gcc::jit::playback::source_file::finalizer): New.
611         (gcc::jit::playback::source_line::finalizer): New.
613         * jit-playback.h
614         (gcc::jit::playback::context::new_function_type): Convert param
615         "param_types" from vec<type *> * to const auto_vec<type *> *.
616         (gcc::jit::playback::context::new_function): Convert param
617         "params" from vec<param *> * to const auto_vec<param *> *.
618         (gcc::jit::playback::context::new_call): Convert param
619         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
620         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
621         (gcc::jit::playback::context::build_call): Likewise.
622         (gcc::jit::playback::context): Convert fields "m_functions",
623         "m_source_files", "m_cached_locations" from vec to auto_vec.
624         (gcc::jit::playback::wrapper::finalizer): New virtual function.
625         (gcc::jit::playback::compound_type::set_fields): Convert param fro
626         const vec<playback::field *> & to
627         const auto_vec<playback::field *> *.
628         (gcc::jit::playback::function::finalizer): New.
629         (gcc::jit::playback::block::finalizer): New.
630         (gcc::jit::playback::source_file::finalizer): New.
631         (gcc::jit::playback::source_line::finalizer): New.
633         * jit-recording.c
634         (gcc::jit::recording::function_type::replay_into): Convert local
635         from a vec into an auto_vec.
636         (gcc::jit::recording::fields::replay_into): Likewise.
637         (gcc::jit::recording::function::replay_into): Likewise.
638         (gcc::jit::recording::call::replay_into): Likewise.
639         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
641         * jit-recording.h (gcc::jit::recording::context): Convert fields
642         "m_mementos", "m_compound_types", "m_functions" from vec<> to
643         auto_vec <>.
644         (gcc::jit::recording::function_type::get_param_types): Convert
645         return type from vec<type *> to const vec<type *> &.
646         (gcc::jit::recording::function_type): Convert field
647         "m_param_types" from a vec<> to an auto_vec<>.
648         (gcc::jit::recording::fields): Likewise for field "m_fields".
649         (gcc::jit::recording::function::get_params): Convert return type
650         from vec <param *> to const vec<param *> &.
651         (gcc::jit::recording::function): Convert fields "m_params",
652         "m_locals", "m_blocks" from vec<> to auto_vec<>.
653         (gcc::jit::recording::block): Likewise for field "m_statements".
654         vec<> to auto_vec<>.
655         (gcc::jit::recording::call): Likewise for field "m_args".
656         (gcc::jit::recording::call_through_ptr): Likewise.
658 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
660         PR jit/63854
661         * jit-recording.c (recording::function::validate): Convert
662         "worklist" from vec<> to autovec<> to fix a leak.
664 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
666         * ChangeLog.jit: New.
667         * ChangeLog: New.
668         * Make-lang.in: New.
669         * TODO.rst: New.
670         * config-lang.in: New.
671         * docs/Makefile: New.
672         * docs/_build/texinfo/Makefile: New.
673         * docs/_build/texinfo/factorial.png: New.
674         * docs/_build/texinfo/libgccjit.texi: New.
675         * docs/_build/texinfo/sum-of-squares.png: New.
676         * docs/conf.py: New.
677         * docs/examples/tut01-hello-world.c: New.
678         * docs/examples/tut02-square.c: New.
679         * docs/examples/tut03-sum-of-squares.c: New.
680         * docs/examples/tut04-toyvm/Makefile: New.
681         * docs/examples/tut04-toyvm/factorial.toy: New.
682         * docs/examples/tut04-toyvm/fibonacci.toy: New.
683         * docs/examples/tut04-toyvm/toyvm.c: New.
684         * docs/index.rst: New.
685         * docs/internals/index.rst: New.
686         * docs/intro/factorial.png: New.
687         * docs/intro/index.rst: New.
688         * docs/intro/sum-of-squares.png: New.
689         * docs/intro/tutorial01.rst: New.
690         * docs/intro/tutorial02.rst: New.
691         * docs/intro/tutorial03.rst: New.
692         * docs/intro/tutorial04.rst: New.
693         * docs/topics/contexts.rst: New.
694         * docs/topics/expressions.rst: New.
695         * docs/topics/functions.rst: New.
696         * docs/topics/index.rst: New.
697         * docs/topics/locations.rst: New.
698         * docs/topics/objects.rst: New.
699         * docs/topics/results.rst: New.
700         * docs/topics/types.rst: New.
701         * dummy-frontend.c: New.
702         * jit-builtins.c: New.
703         * jit-builtins.h: New.
704         * jit-common.h: New.
705         * jit-playback.c: New.
706         * jit-playback.h: New.
707         * jit-recording.c: New.
708         * jit-recording.h: New.
709         * libgccjit++.h: New.
710         * libgccjit.c: New.
711         * libgccjit.h: New.
712         * libgccjit.map: New.
713         * notes.txt: New.
715 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
717         * Initial creation
719 Copyright (C) 2013-2015 Free Software Foundation, Inc.
721 Copying and distribution of this file, with or without modification,
722 are permitted in any medium without royalty provided the copyright
723 notice and this notice are preserved.