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