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