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