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