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