1 2015-01-26 David Malcolm <dmalcolm@redhat.com>
4 * config-lang.in (compilers): Drop "libgccjit.so".
6 2015-01-23 David Malcolm <dmalcolm@redhat.com>
9 * jit-playback.c (gcc::jit::playback::context::compile): Construct
10 toplev instances with init_signals=false.
12 2015-01-19 David Malcolm <dmalcolm@redhat.com>
14 * docs/cp/topics/results.rst: Rename to...
15 * docs/cp/topics/compilation.rst: ...this, and add section on
16 ahead-of-time compilation.
17 * docs/cp/topics/index.rst: Update for renaming of results.rst
19 * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
21 * docs/examples/tut05-bf.c: New file, implementing a compiler
23 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
24 changes to logger output.
25 * docs/intro/index.rst: Add tutorial05.rst
26 * docs/intro/tutorial05.rst: New file.
27 * docs/topics/results.rst: Rename to...
28 * docs/topics/compilation.rst: ...this, and add section on
29 ahead-of-time compilation.
30 * docs/topics/index.rst: Update for renaming of results.rst to
32 * docs/_build/texinfo/libgccjit.texi: Regenerate.
33 * jit-playback.c (gcc::jit::playback::context::compile): Convert
34 return type from result * to void. Move the code to convert to
35 dso and dlopen the result to a new pure virtual "postprocess"
37 (gcc::jit::playback::compile_to_memory::compile_to_memory): New
39 (gcc::jit::playback::compile_to_memory::postprocess): New
40 function, based on playback::context::compile.
41 (gcc::jit::playback::compile_to_file::compile_to_file): New
43 (gcc::jit::playback::compile_to_file::postprocess): New function.
44 (gcc::jit::playback::compile_to_file::copy_file): New function.
45 (gcc::jit::playback::context::convert_to_dso): Move internals
47 (gcc::jit::playback::context::invoke_driver): New method. Add
48 "-shared" and "-c" options to driver's argv as needed.
49 * jit-playback.h: Include "timevar.h".
50 (gcc::jit::playback::context::compile): Convert return type from
52 (gcc::jit::playback::context::postprocess): New pure virtual
53 function, making this an abstract base class.
54 (gcc::jit::playback::context::get_tempdir): New accessor.
55 (gcc::jit::playback::context::invoke_driver): New function.
56 (class gcc::jit::playback::compile_to_memory): New subclass of
58 (class gcc::jit::playback::compile_to_file): Likewise.
59 * jit-recording.c (gcc::jit::recording::context::compile): Use a
60 playback::compile_to_memory, and extract its result.
61 (gcc::jit::recording::context::compile_to_file): New function.
62 * jit-recording.h (gcc::jit::recording::context::compile_to_file):
64 * libgccjit++.h (gccjit::context::compile_to_file): New method.
65 * libgccjit.c (gcc_jit_context_compile): Update log message to
66 clarify that this is an in-memory compile.
67 (gcc_jit_context_compile_to_file): New function.
68 * libgccjit.h (gcc_jit_context): Clarify that you can compile
69 a context more than once, and that you can compile to a file
71 (gcc_jit_result): Clarify that this is the result of an
72 in-memory compilation.
73 (gcc_jit_context_compile): Clarify that you can compile, and that
74 this is an in-memory compilation.
75 (enum gcc_jit_output_kind): New enum.
76 (gcc_jit_context_compile_to_file): New function.
77 (gcc_jit_context_enable_dump): Clarify comment to cover both forms
79 * libgccjit.map (gcc_jit_context_compile_to_file): New API
81 * notes.txt: Update to show the playback::context::postprocess
84 2015-01-19 David Malcolm <dmalcolm@redhat.com>
87 (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
88 Add missing format string.
90 2015-01-16 David Malcolm <dmalcolm@redhat.com>
92 * Make-lang.in (lang_checks_parallelized): Add "check-jit".
93 (check_jit_parallelize): Set this to an arbitrary value (10).
95 2015-01-16 Jakub Jelinek <jakub@redhat.com>
97 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
99 (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
101 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
104 2015-01-15 Richard Sandiford <richard.sandiford@arm.com>
106 Update copyright years in docs/.
108 2015-01-15 David Malcolm <dmalcolm@redhat.com>
110 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
111 lvalue and the rvalue are of compatible type.
113 2015-01-13 David Malcolm <dmalcolm@redhat.com>
115 * docs/cp/topics/contexts.rst (Debugging): Add
116 gccjit::context::dump_reproducer_to_file.
117 * docs/internals/index.rst (Design notes): New section,
118 discussing input validation and
119 gcc_jit_context_dump_reproducer_to_file.
120 * docs/topics/contexts.rst (Debugging): Add
121 gcc_jit_context_dump_reproducer_to_file.
122 * docs/_build/texinfo/libgccjit.texi: Regenerate.
123 * jit-common.h (gcc::jit::dump::get_context): New accessor.
124 * jit-recording.c: Include "hash-map.h".
125 Within namespace ::gcc::jit...
126 (dump::write): Flush each line.
127 (dump::make_location): Pass false for new param "created_by_user".
128 (class allocator): New class.
129 (allocator::~allocator): New function.
130 (allocator::xstrdup_printf): New function.
131 (allocator::xstrdup_printf_va): New function.
132 (class reproducer): New subclass of dump.
133 (reproducer::reproducer): New function.
134 (reproducer::write_params): New function.
135 (reproducer::write_args): New function.
136 (reproducer::make_identifier): New function.
137 (reproducer::make_tmp_identifier): New function.
138 (reproducer::get_identifier): New pair of functions.
139 (reproducer::get_identifier_as_rvalue): New function.
140 (reproducer::get_identifier_as_lvalue): New function.
141 (reproducer::get_identifier_as_type): New function.
142 (reproducer::xstrdup_printf): New function.
143 (recording::context::context): Initialize m_toplevel_ctxt.
144 (recording::context::new_location): Add param created_by_user.
145 (str_option_reproducer_strings): New table of strings.
146 (int_option_reproducer_strings): Likewise.
147 (bool_option_reproducer_strings): Likewise.
148 (get_type_enum_strings): Likewise.
149 (names_of_function_kinds): Likewise.
150 (global_kind_reproducer_strings): Likewise.
151 (unary_op_reproducer_strings): Likewise.
152 (binary_op_reproducer_strings): Likewise.
153 (comparison_reproducer_strings): Likewise.
154 Within namespace ::gcc::jit::recording::...
155 (context::dump_reproducer_to_file): New function.
156 (string::write_reproducer): Likewise.
157 (location::write_reproducer): Likewise.
158 (type::access_as_type): Likewise.
159 (memento_of_get_type::write_reproducer): Likewise.
160 (memento_of_get_pointer::write_reproducer): Likewise.
161 (memento_of_get_const::write_reproducer): Likewise.
162 (memento_of_get_volatile::write_reproducer): Likewise.
163 (array_type::write_reproducer): Likewise.
164 (function_type::write_reproducer): Likewise.
165 (function_type::write_deferred_reproducer): Likewise.
166 (field::write_reproducer): Likewise.
167 (struct_::access_as_type): Likewise.
168 (struct_::write_reproducer): Likewise.
169 (union_::write_reproducer): Likewise.
170 (fields::write_reproducer): Likewise.
171 (rvalue::access_as_rvalue): Likewise.
172 (lvalue::access_as_rvalue): Likewise.
173 (lvalue::access_as_lvalue): Likewise.
174 (param::access_as_rvalue): Likewise.
175 (param::access_as_lvalue): Likewise.
176 (param::write_reproducer): Likewise.
177 (function::write_reproducer): Likewise.
178 (block::write_reproducer): Likewise.
179 (global::write_reproducer): Likewise.
180 (memento_of_new_rvalue_from_const <int>::write_reproducer):
182 (memento_of_new_rvalue_from_const <long>::write_reproducer):
184 (memento_of_new_rvalue_from_const <double>::write_reproducer):
186 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
188 (memento_of_new_string_literal::write_reproducer): Likewise.
189 (unary_op::write_reproducer): Likewise.
190 (binary_op::write_reproducer): Likewise.
191 (comparison::write_reproducer): Likewise.
192 (cast::write_reproducer): Likewise.
193 (call::write_reproducer): Likewise.
194 (call_through_ptr::write_reproducer): Likewise.
195 (array_access::write_reproducer): Likewise.
196 (access_field_of_lvalue::write_reproducer): Likewise.
197 (access_field_rvalue::write_reproducer): Likewise.
198 (dereference_field_rvalue::write_reproducer): Likewise.
199 (dereference_rvalue::write_reproducer): Likewise.
200 (get_address_of_lvalue::write_reproducer): Likewise.
201 (local::write_reproducer): Likewise.
202 (eval::write_reproducer): Likewise.
203 (assignment::write_reproducer): Likewise.
204 (assignment_op::write_reproducer): Likewise.
205 (comment::write_reproducer): Likewise.
206 (conditional::write_reproducer): Likewise.
207 (jump::write_reproducer): Likewise.
208 (return_::write_reproducer): Likewise.
209 * jit-recording.h (gcc::jit::reproducer): New forward declararion.
210 Within namespace ::gcc::jit::recording::...
211 (context::new_location): Add "created_by_user" param.
212 (context::dump_reproducer_to_file): New method.
213 (context::m_toplevel_ctxt): New field.
214 (memento::write_reproducer): New pure virtual function.
215 (memento::dyn_cast_location): New virtual function.
216 (string::write_reproducer):
217 (location::location): Add "created_by_user" param.
218 (location::dyn_cast_location): New function.
219 (location::created_by_user): New accessor.
220 (location::write_reproducer): New function.
221 (location::m_created_by_user): New field.
222 (type::access_as_type): New virtual function.
223 (location::write_reproducer): Likewise.
224 (type::access_as_type): Likewise.
225 (memento_of_get_type::write_reproducer): Likewise.
226 (memento_of_get_pointer::write_reproducer): Likewise.
227 (memento_of_get_const::write_reproducer): Likewise.
228 (memento_of_get_volatile::write_reproducer): Likewise.
229 (array_type::write_reproducer): Likewise.
230 (function_type::write_reproducer): Likewise.
231 (function_type::write_deferred_reproducer): Likewise.
232 (field::write_reproducer): Likewise.
233 (struct_::access_as_type): Likewise.
234 (struct_::write_reproducer): Likewise.
235 (union_::write_reproducer): Likewise.
236 (union_::m_fields): Remove stray unused field.
237 (fields::length): New accessor.
238 (fields::get_field): New accessor.
239 (fields::write_reproducer): New function.
240 (rvalue::access_as_rvalue): Likewise.
241 (lvalue::access_as_rvalue): Likewise.
242 (lvalue::access_as_lvalue): Likewise.
243 (param::access_as_rvalue): Likewise.
244 (param::access_as_lvalue): Likewise.
245 (param::write_reproducer): Likewise.
246 (function::write_reproducer): Likewise.
247 (block::write_reproducer): Likewise.
248 (global::write_reproducer): Likewise.
249 (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
251 (memento_of_new_string_literal::write_reproducer): Likewise.
252 (unary_op::write_reproducer): Likewise.
253 (binary_op::write_reproducer): Likewise.
254 (comparison::write_reproducer): Likewise.
255 (cast::write_reproducer): Likewise.
256 (call::write_reproducer): Likewise.
257 (call_through_ptr::write_reproducer): Likewise.
258 (array_access::write_reproducer): Likewise.
259 (access_field_of_lvalue::write_reproducer): Likewise.
260 (access_field_rvalue::write_reproducer): Likewise.
261 (dereference_field_rvalue::write_reproducer): Likewise.
262 (dereference_rvalue::write_reproducer): Likewise.
263 (get_address_of_lvalue::write_reproducer): Likewise.
264 (local::write_reproducer): Likewise.
265 (eval::write_reproducer): Likewise.
266 (assignment::write_reproducer): Likewise.
267 (assignment_op::write_reproducer): Likewise.
268 (comment::write_reproducer): Likewise.
269 (conditional::write_reproducer): Likewise.
270 (jump::write_reproducer): Likewise.
271 (return_::write_reproducer): Likewise.
272 * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
273 * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
274 param "created_by_user".
275 (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
276 * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
278 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
281 2015-01-12 David Malcolm <dmalcolm@redhat.com>
283 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
284 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
286 (gcc::jit::rvalue_usage_validator::visit): New function.
287 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
289 (gcc::jit::recording::rvalue::set_scope): New function.
290 (gcc::jit::recording::function::function): Call set_scope on each
291 param, issuing errors for any params that already have a function.
292 (gcc::jit::recording::block::add_eval): Return the new statement;
293 update the comment given that some error-checking now happens after
295 (gcc::jit::recording::block::add_assignment): Likewise.
296 (gcc::jit::recording::block::add_assignment_op): Likewise.
297 (gcc::jit::recording::block::add_comment): Likewise.
298 (gcc::jit::recording::block::end_with_conditional): Likewise.
299 (gcc::jit::recording::block::end_with_jump): Likewise.
300 (gcc::jit::recording::block::end_with_return): Likewise.
301 (gcc::jit::recording::block::validate): Add a comment.
302 (gcc::jit::recording::unary_op::visit_children): New function.
303 (gcc::jit::recording::binary_op::visit_children): New function.
304 (gcc::jit::recording::comparison::visit_children): New function.
305 (gcc::jit::recording::cast::visit_children): New function.
306 (gcc::jit::recording::call::visit_children): New function.
307 (gcc::jit::recording::call_through_ptr::visit_children): New function.
308 (gcc::jit::recording::array_access::visit_children): New function.
309 (gcc::jit::recording::access_field_of_lvalue::visit_children): New
311 (gcc::jit::recording::access_field_rvalue::visit_children): New
313 (gcc::jit::recording::dereference_field_rvalue::visit_children):
315 (gcc::jit::recording::dereference_rvalue::visit_children): New
317 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
319 * jit-recording.h: Within namespace gcc::jit::recording...
320 (class rvalue_visitor): New.
321 (rvalue::rvalue): Initialize m_scope.
322 (rvalue::get_loc): New accessor.
323 (rvalue::verify_valid_within_stmt): New function.
324 (rvalue::visit_children): New pure virtual function.
325 (rvalue::set_scope): New function.
326 (rvalue::get_scope): New function.
327 (rvalue::dyn_cast_param): New function.
328 (rvalue::m_scope): New field.
329 (param::visit_children): New empty function.
330 (param::dyn_cast_param): New function.
331 (function::get_loc): New function.
332 (block::add_eval): Return the new statement.
333 (block::add_assignment): Likewise.
334 (block::add_assignment_op): Likewise.
335 (block::add_comment): Likewise.
336 (block::end_with_conditional): Likewise.
337 (block::end_with_jump): Likewise.
338 (block::end_with_return): Likewise.
339 (global::visit_children): New function.
340 (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
342 (memento_of_new_string_literal::visit_children): New function.
343 (unary_op::visit_children): New function.
344 (binary_op::visit_children): New function.
345 (comparison::visit_children): New function.
346 (cast::visit_children): New function.
347 (call::visit_children): New function.
348 (call_through_ptr::visit_children): New function.
349 (array_access::visit_children): New function.
350 (access_field_of_lvalue::visit_children): New function.
351 (access_field_rvalue::visit_children): New function.
352 (dereference_field_rvalue::visit_children): New function.
353 (dereference_rvalue::visit_children): New function.
354 (get_address_of_lvalue::visit_children): New function.
355 (local::local): Call set_scope.
356 (local::visit_children): New function.
357 (statement::get_block): Make public.
358 * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
359 (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
360 (gcc_jit_context_new_function): Verify that each param has
361 not yet been used for creating another function.
362 (gcc_jit_block_add_eval): After creating the stmt, verify
363 that the rvalue expression tree is valid to use within it.
364 (gcc_jit_block_add_assignment): Likewise for the lvalue and
365 rvalue expression trees.
366 (gcc_jit_block_add_assignment_op): Likewise.
367 (gcc_jit_block_end_with_conditional): Likewise for the boolval
369 (gcc_jit_block_end_with_return): Likewise for the rvalue
371 (gcc_jit_block_end_with_void_return): Remove return of "void",
372 now that block::end_with_return is now non-void.
374 2015-01-12 David Malcolm <dmalcolm@redhat.com>
376 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
377 Add missing fclose on error-handling path.
379 2015-01-12 David Malcolm <dmalcolm@redhat.com>
381 * docs/cp/topics/expressions.rst (Global variables): Add
382 enum gcc_jit_global_kind param to gccjit::context::new_global.
383 * docs/topics/expressions.rst (Global variables): Likewise.
384 Document the new enum.
385 * docs/topics/results.rst (Compilation results): Document
387 * docs/_build/texinfo/libgccjit.texi: Regenerate.
388 * dummy-frontend.c (jit_langhook_write_globals): Call into the
389 playback context's write_global_decls_1 and write_global_decls_2
390 before and after calling symtab->finalize_compilation_unit ().
391 * jit-playback.c: Include "debug.h".
392 (gcc::jit::playback::context::new_global): Add "kind" param and
393 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
394 underlying VAR_DECL. Call varpool_node::get_create on the
395 VAR_DECL, and add it to m_globals.
396 (gcc::jit::playback::context::write_global_decls_1): New function.
397 (gcc::jit::playback::context::write_global_decls_2): New function.
398 * jit-playback.h (gcc::jit::playback::context::context): Call
400 (gcc::jit::playback::context::new_global): Add "kind" param.
401 (gcc::jit::playback::context::write_global_decls_1): New function.
402 (gcc::jit::playback::context::write_global_decls_2): New function.
403 (gcc::jit::playback::context::m_globals): New field.
404 * jit-recording.c (gcc::jit::recording::context::context):
405 Initialize m_globals.
406 (gcc::jit::recording::context::new_global): Add param "kind".
407 Add the new global to m_globals.
408 (gcc::jit::recording::context::dump_to_file): Dump the globals.
409 (gcc::jit::recording::global::replay_into): Add field m_kind.
410 (gcc::jit::recording::global::write_to_dump): New override.
411 * jit-recording.h (gcc::jit::recording::context::new_global): Add
413 (gcc::jit::recording::context::m_globals): New field.
414 (gcc::jit::recording::global::global): Add param kind.
415 (gcc::jit::recording::global::write_to_dump): New override.
416 (gcc::jit::recording::global::m_kind): New field.
417 * jit-result.c (gcc::jit::result::get_global): New function.
418 * jit-result.h (gcc::jit::result::get_global): New function.
419 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
420 * libgccjit.c (gcc_jit_context_new_global): Likewise.
421 (gcc_jit_result_get_global): New API entrypoint.
422 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
423 (enum gcc_jit_global_kind): New enum.
424 (gcc_jit_context_new_global): API change: add "kind" param.
425 * libgccjit.map (gcc_jit_result_get_global): New symbol.
427 2015-01-09 David Malcolm <dmalcolm@redhat.com>
429 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
430 "symtab.h", "inchash.h". Move include of "hash-set.h" much
432 * jit-builtins.c: Remove redundant includes of "opts.h" and
434 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
435 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
436 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
437 "statistics.h", "vec.h", "double-int.h", "real.h",
438 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
439 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
441 * jit-recording.c: Remove redundant includes of "opts.h" and
444 2015-01-09 David Malcolm <dmalcolm@redhat.com>
446 * docs/cp/topics/expressions.rst (Simple expressions): Use
447 ":c:type:" for C types. Document new overload of
448 gcc::jit::context::new_rvalue.
449 * docs/topics/expressions.rst (Simple expressions): Use
450 ":c:type:" for C types. Document new entrypoint
451 gcc_jit_context_new_rvalue_from_long.
452 * docs/_build/texinfo/libgccjit.texi: Regenerate.
453 * jit-playback.c: Within namespace gcc::jit::playback...
454 (context::new_rvalue_from_int): Eliminate in favor of...
455 (context::new_rvalue_from_const <int>): ...this.
456 (context::new_rvalue_from_double): Eliminate in favor of...
457 (context::new_rvalue_from_const <double>): ...this.
458 (context::new_rvalue_from_const <long>): New.
459 (context::new_rvalue_from_ptr): Eliminate in favor of...
460 (context::new_rvalue_from_const <void *>): ...this.
461 * jit-playback.h: Within namespace gcc::jit::playback...
462 (context::new_rvalue_from_int): Eliminate in favor of...
463 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
464 (context::new_rvalue_from_double): Likewise.
465 (context::new_rvalue_from_ptr): Likewise.
466 * jit-recording.c: Within namespace gcc::jit::recording...
467 (context::new_rvalue_from_int): Eliminate.
468 (context::new_rvalue_from_double): Likewise.
469 (context::new_rvalue_from_ptr): Likewise.
470 (class memento_of_new_rvalue_from_const <int>):
471 Add explicit specialization.
472 (class memento_of_new_rvalue_from_const <long>):
474 (class memento_of_new_rvalue_from_const <double>):
476 (class memento_of_new_rvalue_from_const <void *>):
478 (memento_of_new_rvalue_from_int::replay_into):
480 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
482 (memento_of_new_rvalue_from_double::replay_into):
484 (memento_of_new_rvalue_from_ptr::replay_into):
485 ...and this to be deleted.
486 (memento_of_new_rvalue_from_int::make_debug_string):
488 (memento_of_new_rvalue_from_const <int>::make_debug_string):
490 (memento_of_new_rvalue_from_double::make_debug_string):
492 (memento_of_new_rvalue_from_const <double>::make_debug_string):
494 (memento_of_new_rvalue_from_ptr::make_debug_string)
496 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
498 (memento_of_new_rvalue_from_const <long>::make_debug_string):
500 * jit-recording.h: Within namespace gcc::jit::recording...
501 (context::new_rvalue_from_int): Eliminate.
502 (context::new_rvalue_from_double): Likewise.
503 (context::new_rvalue_from_ptr): Likewise, all in favor of...
504 (context::new_rvalue_from_const <HOST_TYPE>): New family of
506 (class memento_of_new_rvalue_from_int): Eliminate.
507 (class memento_of_new_rvalue_from_double): Likewise.
508 (class memento_of_new_rvalue_from_ptr): Likewise.
509 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
510 of rvalue subclasses.
511 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
513 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
514 rewriting of recording::context::new_rvalue_from_int to
515 recording::context::new_rvalue_from_const <int>.
516 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
517 (gcc_jit_context_new_rvalue_from_double): Update for
518 rewriting of recording::context::new_rvalue_from_double to
519 recording::context::new_rvalue_from_const <double>.
520 (gcc_jit_context_new_rvalue_from_ptr): Update for
521 rewriting of recording::context::new_rvalue_from_ptr to
522 recording::context::new_rvalue_from_const <void *>.
523 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
525 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
527 2015-01-09 David Malcolm <dmalcolm@redhat.com>
530 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
531 shows tempdir creation/cleanup.
532 * docs/_build/texinfo/libgccjit.texi: Regenerate.
533 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
534 to the list of subclasses in the comment.
535 * jit-playback.c (gcc::jit::playback::context::context): Add a
536 comment clarifying when the tempdir gets cleaned up.
537 (gcc::jit::playback::context::compile): Pass the context's logger,
538 if any, to the tempdir.
539 (gcc::jit::playback::context::dlopen_built_dso): When creating the
540 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
541 over ownership of the tempdir to it.
542 * jit-result.c: Include "jit-tempdir.h".
543 (gcc::jit::result::result): Add tempdir param, saving it as
545 (gcc::jit::result::~result): Delete m_tempdir.
546 * jit-result.h (gcc::jit::result::result): Add tempdir param.
547 (gcc::jit::result::m_tempdir): New field.
548 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
550 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
551 and log m_path_template and m_path_tempdir.
552 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
553 entry/exit, and log the unlink and rmdir calls.
554 * jit-tempdir.h: Include "jit-logging.h".
555 (class gcc::jit::tempdir): Make this be a subclass of log_user.
556 (gcc::jit::tempdir::tempdir): Add logger param.
557 * notes.txt: Update to show the two possible places where the
558 tempdir can be cleaned up.
560 2015-01-08 David Malcolm <dmalcolm@redhat.com>
562 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
565 2015-01-08 David Malcolm <dmalcolm@redhat.com>
567 * docs/topics/contexts.rst (Error-handling): Document new
568 entrypoint gcc_jit_context_get_last_error.
569 * docs/_build/texinfo/libgccjit.texi: Regenerate.
570 * jit-recording.c (gcc::jit::recording::context::context):
571 Initialize new fields "m_last_error_str" and
572 "m_owns_last_error_str".
573 (gcc::jit::recording::context::~context): Clean up
574 m_last_error_str, if needed.
575 (gcc::jit::recording::context::add_error_va): Update
576 m_last_error_str and m_owns_last_error_str, freeing the old
577 value if appropriate.
578 (gcc::jit::recording::context::get_last_error): New function.
579 * jit-recording.h (gcc::jit::recording::context::get_last_error):
581 (gcc::jit::recording::context): New fields m_last_error_str and
582 m_owns_last_error_str.
583 * libgccjit.c (gcc_jit_context_get_last_error): New function.
584 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
585 * libgccjit.map (gcc_jit_context_get_last_error): New function.
587 2015-01-08 David Malcolm <dmalcolm@redhat.com>
589 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
590 * docs/internals/index.rst (Overview of code structure): Mention
591 gcc_jit_context_set_logfile, and embed the example logfile.
592 * docs/internals/test-hello-world.exe.log.txt: New file: example
594 * docs/topics/contexts.rst (Debugging): Add documentation
595 for gcc_jit_context_set_logfile.
596 * docs/_build/texinfo/libgccjit.texi: Regenerate.
597 * dummy-frontend.c: Include "jit-logging.h".
598 (jit_langhook_init): Assert that there is an active playback
599 context. If it has a logger, log entry/exit to this function.
600 (jit_langhook_write_globals): Likewise.
601 * jit-common.h (gcc::jit::logger): New forward declaration.
602 * jit-logging.c: New file.
603 * jit-logging.h: New file.
604 * jit-playback.c: Include "jit-logging.h".
605 (gcc::jit::playback::context::context): Initialize the log_user
606 base class from the recording context's logger (if any). Use
607 JIT_LOG_SCOPE to log entry/exit from the function body.
608 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
609 log entry/exit from the function body.
610 (gcc::jit::playback::build_stmt_list): Likewise.
611 (gcc::jit::playback::function::postprocess): Likewise.
612 (gcc::jit::playback::context::compile): Likewise. Log the
613 entry/exit to toplev::main and toplev::finalize. Log the
614 fake argv passed to toplev::main.
615 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
616 log entry/exit from the function body.
617 (gcc::jit::playback::context::release_mutex): Likewise.
618 (gcc::jit::playback::context::make_fake_args): Likewise.
619 (gcc::jit::playback::context::extract_any_requested_dumps):
621 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
622 log the arguments that the driver is invoked with.
623 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
624 the logger to the result object.
625 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
626 log entry/exit from the function body.
627 (gcc::jit::playback::context::dump_generated_code): Likewise.
628 (gcc::jit::playback::context::handle_locations): Likewise.
629 * jit-playback.h (gcc::jit::playback::context): Make this be
630 a subclass of gcc::jit::log_user.
631 * jit-recording.c: Include "jit-logging.h".
632 (gcc::jit::recording::context::context: Initialize the logger to
633 NULL for root contexts, or to the parent's logger for child
635 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
636 log entry/exit from the function body.
637 (gcc::jit::recording::context::replay_into): Likewise.
638 (gcc::jit::recording::context::disassociate_from_playback):
640 (gcc::jit::recording::context::compile): Likewise.
641 (recording::context::add_error_va): Likewise. Also, log the
643 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
644 log entry/exit from the function body.
645 * jit-recording.h: Include "jit-logging.h".
646 (gcc::jit::recording::context): Make this be a subclass of
648 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
649 (gcc::jit::result::result): Add logger param, recording it.
650 Use JIT_LOG_SCOPE to log entry/exit from the function body.
651 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
652 log entry/exit from the function body.
653 (gcc::jit::result::get_code): Likewise.
654 * jit-result.h (gcc::jit::result): Make this be a subclass of
656 (gcc::jit::result::result): Add logger parameter.
657 * libgccjit++.h (gccjit::context::set_logfile): New function.
658 * libgccjit.c: Include "jit-logging.h".
659 (gcc_jit_context_acquire): Log the context.
660 (gcc_jit_context_release): Use JIT_LOG_FUNC to
661 log entry/exit from the function body, and log the context.
662 (gcc_jit_context_new_child_context): Likewise, logging both
664 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
665 log entry/exit from the function body.
666 (gcc_jit_context_get_type): Likewise.
667 (gcc_jit_context_get_int_type): Likewise.
668 (gcc_jit_context_new_array_type): Likewise.
669 (gcc_jit_context_new_field): Likewise.
670 (gcc_jit_context_new_struct_type): Likewise.
671 (gcc_jit_context_new_opaque_struct): Likewise.
672 (gcc_jit_struct_set_fields): Likewise.
673 (gcc_jit_context_new_union_type): Likewise.
674 (gcc_jit_context_new_function_ptr_type): Likewise.
675 (gcc_jit_context_new_param): Likewise.
676 (gcc_jit_context_new_function): Likewise.
677 (gcc_jit_context_get_builtin_function): Likewise.
678 (gcc_jit_function_get_param): Likewise.
679 (gcc_jit_function_dump_to_dot): Likewise.
680 (gcc_jit_function_new_block): Likewise.
681 (gcc_jit_context_new_global): Likewise.
682 (gcc_jit_context_new_rvalue_from_int): Likewise.
683 (gcc_jit_context_zero): Likewise.
684 (gcc_jit_context_one): Likewise.
685 (gcc_jit_context_new_rvalue_from_double): Likewise.
686 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
687 (gcc_jit_context_null): Likewise.
688 (gcc_jit_context_new_string_literal): Likewise.
689 (gcc_jit_context_new_unary_op): Likewise.
690 (gcc_jit_context_new_binary_op): Likewise.
691 (gcc_jit_context_new_comparison): Likewise.
692 (gcc_jit_context_new_call): Likewise.
693 (gcc_jit_context_new_call_through_ptr): Likewise.
694 (gcc_jit_context_new_cast): Likewise.
695 (gcc_jit_context_new_array_access): Likewise.
696 (gcc_jit_lvalue_access_field): Likewise.
697 (gcc_jit_rvalue_access_field): Likewise.
698 (gcc_jit_rvalue_dereference_field): Likewise.
699 (gcc_jit_rvalue_dereference): Likewise.
700 (gcc_jit_lvalue_get_address): Likewise.
701 (gcc_jit_function_new_local): Likewise.
702 (gcc_jit_block_add_eval): Likewise.
703 (gcc_jit_block_add_assignment): Likewise.
704 (gcc_jit_block_add_assignment_op): Likewise.
705 (gcc_jit_block_end_with_conditional): Likewise.
706 (gcc_jit_block_add_comment): Likewise.
707 (gcc_jit_block_end_with_jump): Likewise.
708 (gcc_jit_block_end_with_return): Likewise.
709 (gcc_jit_block_end_with_void_return): Likewise.
710 (gcc_jit_context_set_str_option): Likewise.
711 (gcc_jit_context_set_int_option): Likewise.
712 (gcc_jit_context_set_bool_option): Likewise.
713 (gcc_jit_context_enable_dump): Likewise.
714 (gcc_jit_context_compile): Likewise. Also log the context,
716 (gcc_jit_context_dump_to_file): Likewise.
717 (gcc_jit_context_set_logfile): New function.
718 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
719 log entry/exit from the function body.
720 (gcc_jit_result_get_code): Likewise. Also log the fnname)
721 and the ptr to be returned.
722 (gcc_jit_result_release): Likewise. Also log the result.
723 * libgccjit.h: Include <stdio.h>, since we need FILE *.
724 (gcc_jit_context_set_logfile): New declaration.
725 * libgccjit.map (gcc_jit_context_set_logfile): New.
727 2015-01-07 David Malcolm <dmalcolm@redhat.com>
729 * jit-recording.h (gcc::jit::recording::type::is_void): New
731 (gcc::jit::recording::memento_of_get_type::is_void): New
732 function, overriding default implementation.
733 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
734 the underlying type is not "void".
736 2015-01-07 David Malcolm <dmalcolm@redhat.com>
738 * docs/topics/expressions.rst (Unary Operations): Add
739 GCC_JIT_UNARY_OP_ABS.
740 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
742 * jit-recording.c (unary_op_strings): Likewise.
743 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
744 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
745 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
746 * docs/_build/texinfo/libgccjit.texi: Regenerate.
748 2015-01-07 David Malcolm <dmalcolm@redhat.com>
750 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
753 2015-01-07 David Malcolm <dmalcolm@redhat.com>
755 * TODO.rst (Test suite): Remove item about running C++ testcases.
756 * docs/internals/index.rst (Working on the JIT library): Add
757 "c++" to the enabled languages in the suggested "configure"
758 invocation, and add a description of why this is necessary.
759 * docs/_build/texinfo/libgccjit.texi: Regenerate.
761 2015-01-07 David Malcolm <dmalcolm@redhat.com>
763 * docs/internals/index.rst: Update to reflect that built
764 testcases are now test-foo.c.exe, rather than test-foo.exe.
765 * docs/_build/texinfo/libgccjit.texi: Regenerate.
767 2015-01-05 Jakub Jelinek <jakub@redhat.com>
769 Update copyright years.
771 2014-12-19 David Malcolm <dmalcolm@redhat.com>
773 * jit-playback.c (gcc::jit::playback::context::build_cast): In
774 case BOOLEAN_TYPE, don't assume that the source expression is
777 2014-12-19 David Malcolm <dmalcolm@redhat.com>
779 * jit-recording.c (gcc::jit::recording::context::context): When
780 copying string options from a parent context, take a copy of the
781 underlying buffers, rather than simply copying the pointer.
783 2014-12-19 David Malcolm <dmalcolm@redhat.com>
785 * jit-recording.c (gcc::jit::recording::context::set_str_option):
788 2014-12-11 David Malcolm <dmalcolm@redhat.com>
790 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
791 Document new function.
792 * docs/_build/texinfo/libgccjit.texi: Regenerate.
794 2014-12-10 Ulrich Drepper <drepper@gmail.com>
796 Minor interface cleanups of libgccjit
797 * jit-playback.c (convert_to_dso): Use auto_vec instead
798 of automatic array to build up command line.
799 * jit-recording.c (recording::context::set_str_option):
800 Make copy of the string.
801 (recording::context::~context): Free string options.
802 * jit-recording.h (recording::context): Adjust type
803 of m_str_options member.
804 * libgccjit.h: Adjust comment about
805 gcc_jit_context_set_str_option parameter being used after
807 Update comment now that all interfaces are copy strings
809 * libgccjit++.h (gccjit::context): Add set_str_option
812 2014-12-10 David Malcolm <dmalcolm@redhat.com>
814 * docs/cp/index.rst: New file.
815 * docs/cp/intro/index.rst: New file.
816 * docs/cp/intro/tutorial01.rst: New file.
817 * docs/cp/intro/tutorial02.rst: New file.
818 * docs/cp/intro/tutorial03.rst: New file.
819 * docs/cp/intro/tutorial04.rst: New file.
820 * docs/cp/topics/contexts.rst: New file.
821 * docs/cp/topics/expressions.rst: New file.
822 * docs/cp/topics/functions.rst: New file.
823 * docs/cp/topics/index.rst: New file.
824 * docs/cp/topics/locations.rst: New file.
825 * docs/cp/topics/objects.rst: New file.
826 * docs/cp/topics/results.rst: New file.
827 * docs/cp/topics/types.rst: New file.
828 * docs/examples/tut01-hello-world.cc: New file.
829 * docs/examples/tut02-square.c: Fix missing newline in output.
830 * docs/examples/tut02-square.cc: New file.
831 * docs/examples/tut03-sum-of-squares.cc: New file.
832 * docs/examples/tut04-toyvm/toyvm.cc: New file.
833 * docs/index.rst: Move summary to above the table of contents.
834 Add text about the C vs C++ APIs.
835 * docs/topics/contexts.rst: Fix a typo.
837 * docs/_build/texinfo/libgccjit.texi: Regenerate.
838 * docs/_build/texinfo/factorial1.png: New file.
839 * docs/_build/texinfo/sum-of-squares1.png: New file.
841 2014-12-09 David Malcolm <dmalcolm@redhat.com>
843 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
844 logic for determine "funcname" to new function...
845 (get_function_name): ...here, adding logic to skip any leading
846 path from the filename.
847 (toyvm_function_parse): Use the filename for fn_filename, rather
848 than "name", so that the debugger can locate the source .toy
850 (toyvm_function_parse): Don't fclose a NULL FILE *.
852 2014-12-09 David Malcolm <dmalcolm@redhat.com>
855 * docs/internals/index.rst (Running under valgrind): New
857 (docs/_build/texinfo/libgccjit.texi): Regenerate.
859 2014-12-09 David Malcolm <dmalcolm@redhat.com>
862 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
863 * jit-common.h (gcc::jit::tempdir): New forward decl.
864 * jit-playback.c: Include jit-tempdir.h.
865 (gcc::jit::playback::context::context): Initialize m_tempdir.
866 (gcc::jit::playback::context::~context): Move tempdir
867 cleanup to new file jit-tempdir.c
868 (make_tempdir_path_template): Move to new file jit-tempdir.c.
869 (gcc::jit::playback::context::compile): Move tempdir creation
870 to new tempdir object in new file jit-tempdir.c.
871 (gcc::jit::playback::context::make_fake_args): Get path from
872 tempdir object rather than from member data.
873 (gcc::jit::playback::context::convert_to_dso): Likewise.
874 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
875 (gcc::jit::playback::context::dump_generated_code): Likewise.
876 (gcc::jit::playback::context::get_path_c_file): New function.
877 (gcc::jit::playback::context::get_path_s_file): New function.
878 (gcc::jit::playback::context::get_path_so_file): New function.
879 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
881 (gcc::jit::playback::context::get_path_s_file): New function.
882 (gcc::jit::playback::context::get_path_so_file): New function.
883 (gcc::jit::playback::context): Move fields "m_path_template",
884 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
885 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
886 * jit-tempdir.c: New file.
887 * jit-tempdir.h: New file.
889 2014-12-09 David Malcolm <dmalcolm@redhat.com>
891 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
892 mutex here, immediately before using toplev, and release it here, on
893 each exit path after acquisition.
894 (jit_mutex): Move this variable here, from jit-recording.c.
895 (gcc::jit::playback::context::acquire_mutex): New function, based on
896 code in jit-recording.c.
897 (gcc::jit::playback::context::release_mutex): Likewise.
898 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
900 (gcc::jit::playback::context::release_mutex): New function.
901 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
902 (gcc::jit::recording::context::compile): Move mutex-handling from
903 here into jit-playback.c's gcc::jit::playback::context::compile.
904 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
907 2014-12-09 David Malcolm <dmalcolm@redhat.com>
909 * jit-playback.c (gcc::jit::playback::context::compile): Move the
911 (gcc::jit::playback::context::dlopen_built_dso): ...this new
913 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
916 2014-12-09 David Malcolm <dmalcolm@redhat.com>
919 * docs/topics/contexts.rst (Debugging): Add description of
920 gcc_jit_context_enable_dump.
921 * docs/_build/texinfo/libgccjit.texi: Regenerate.
922 * jit-playback.c: Include context.h.
923 (class auto_argvec): New class.
924 (auto_argvec::~auto_argvec): New function.
925 (gcc::jit::playback::context::compile): Convert fake_args to be
926 an auto_argvec, so that it can contain dynamically-allocated
927 strings. Construct a vec of all requested dumps, and pass it to
928 make_fake_args. Extract requested dumps between the calls to
929 toplev::main and toplev::finalize.
930 (gcc::jit::playback::context::make_fake_args): Convert param
931 "argvec" to be a vec <char *>, and gain a "requested_dumps"
932 param. Convert to dynamically-allocated arg strings by converting
933 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
934 for args that are already a copy. Add args for all requested dumps.
935 (gcc::jit::playback::context::extract_any_requested_dumps): New
937 (gcc::jit::playback::context::read_dump_file): New function.
938 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
939 Convert param "argvec" to be a vec <char *>, and gain a
940 "requested_dumps" param.
941 (gcc::jit::playback::context::extract_any_requested_dumps): New
943 (gcc::jit::playback::context::read_dump_file): New function.
944 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
946 (gcc::jit::recording::context::get_all_requested_dumps): New
948 * jit-recording.h (gcc::jit::recording::requested_dump): New
950 (gcc::jit::recording::context::enable_dump): New function.
951 (gcc::jit::recording::context::get_all_requested_dumps): New
953 (gcc::jit::recording::context::m_requested_dumps): New field.
954 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
955 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
956 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
958 2014-12-08 David Malcolm <dmalcolm@redhat.com>
960 * libgccjit++.h: Indent the forward declarations of the classes to
961 show the inheritance hierarchy.
963 2014-12-08 David Malcolm <dmalcolm@redhat.com>
965 * notes.txt: Show the beginning and ending of
966 recording::context::compile vs playback::context::compile. Show
967 the creation and unlinking of the tempdir. Show toplev::finalize.
968 Move "RELEASE MUTEX" to the correct location. Show
969 gcc_jit_result_release, and indicate where the
970 dlopen/dlsym/dlclose occur.
972 2014-12-01 David Malcolm <dmalcolm@redhat.com>
974 * docs/examples/tut02-square.c (main): Release the context
975 earlier, to show that this is possible. Update error-handling
976 to avoid a double-release of the context, and to avoid
977 releasing a NULL result.
978 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
979 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
980 * docs/topics/results.rst (gcc_jit_result): Mention that this
981 controls the lifetimes of machine code functions.
982 (gcc_jit_result_get_code): Spell out the requirements for this
983 to succeed, and the lifetime of the result.
984 (gcc_jit_result_release): Mention that this invalidates any code
985 that was obtained from the result.
986 * docs/_build/texinfo/libgccjit.texi: Regenerate.
988 2014-12-01 David Malcolm <dmalcolm@redhat.com>
991 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
992 Add description of error-handling, taken in part from...
993 * docs/topics/contexts.rst (Error-handling): Expand, and move some
994 content to tutorial02.rst.
995 * docs/_build/texinfo/libgccjit.texi: Regenerate.
997 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1000 * docs/topics/types.rst (Standard types) Add new enum values to
1001 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1002 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1003 Widen the left-hand column so that
1004 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1005 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1007 * jit-builtins.c: Include stringpool.h and jit-playback.h.
1008 Move everything out of the gcc::jit::recording namespace into
1010 (struct builtin_data): Add fields "fnclass", "attr", and
1012 (DEF_BUILTIN): Update macro so populate the new fields.
1013 (builtins_manager::builtins_manager): Update for move out of
1014 recording namespace. Initialize the m_attributes array.
1015 (builtins_manager::get_builtin_function): Likewise.
1016 (builtins_manager::get_builtin_function_by_id): New function.
1017 (builtins_manager::make_builtin_function): Update for move out of
1018 recording namespace. Add fix for PR jit/64020 by detecting
1019 specific builtin ids and having them ensure that builtins for
1020 other ids are created as necessary.
1021 (builtins_manager::get_type): Update for move out of recording
1023 (builtins_manager::make_type): Likewise. Add some missing
1025 (builtins_manager::make_primitive_type): Update for move out of
1026 recording namespace. Implement the three BT_COMPLEX_ cases and
1028 (builtins_manager::make_fn_type): Update for move out of recording
1030 (builtins_manager::make_ptr_type): Likewise.
1031 (builtins_manager::finish_playback): New function.
1032 (builtins_manager::get_class): New function.
1033 (builtins_manager::implicit_p): New function.
1034 (builtins_manager::get_attrs_tree): Two new functions.
1035 (builtins_manager::make_attrs_tree): New function.
1037 * jit-builtins.h: Move everything out of the gcc::jit::recording
1038 namespace into just gcc::jit.
1039 (enum built_in_attribute): New.
1040 (builtins_manager::builtins_manager): Update decl for namespace
1042 (builtins_manager::get_builtin_function): Likewise.
1043 (builtins_manager::get_class): New.
1044 (builtins_manager::implicit_p): New.
1045 (builtins_manager::get_attrs_tree): Two new functions.
1046 (builtins_manager::make_attrs_tree): New function.
1047 (builtins_manager::finish_playback): New.
1048 (builtins_manager::get_builtin_function_by_id): New.
1049 (builtins_manager::make_builtin_function): Update decl for
1051 (builtins_manager::get_type): Likewise.
1052 (builtins_manager::make_type): Likewise.
1053 (builtins_manager::make_primitive_type): Likewise.
1054 (builtins_manager::make_fn_type): Likewise.
1055 (builtins_manager::make_ptr_type): Likewise.
1056 (builtins_manager): Likewise for fields. Add new field
1059 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1060 (builtins_manager): Update forward decl to reflect namespace
1063 * jit-playback.c: Include attribs.h and jit-builtins.h.
1064 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1065 for the new COMPLEX_ types.
1066 (gcc::jit::playback::context::new_function): If creating a
1067 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1068 and call set_builtin_decl.
1069 (gcc::jit::playback::context::replay): If we have a
1070 builtins_manager, call its finish_playback method when we're done.
1073 (gcc::jit::playback::context::get_builtins_manager): New function.
1076 (gcc::jit::recording::context::get_builtins_manager): New function.
1077 (gcc::jit::recording::get_builtin_function): Use
1078 get_builtins_manager, in case we're a child context.
1079 (gcc::jit::recording::memento_of_get_type::dereference): Add the
1081 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1082 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1083 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1084 (get_type_strings): Likewise.
1087 (gcc::jit::recording::context::get_builtins_manager): New.
1089 * libgccjit.h (enum gcc_jit_types): Add
1090 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1091 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1093 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1096 (gcc::jit::recording::builtins_manager::get_builtin_function):
1097 Check for NULL return from make_builtin_function.
1098 (gcc::jit::recording::builtins_manager::make_builtin_function):
1099 Check for NULL return from get_type.
1101 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1103 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1104 creation code into...
1105 (gcc::jit::playback::context::convert_to_dso): New function.
1106 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1109 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1111 * jit-playback.c (gcc::jit::playback::context::compile): Use an
1112 auto_vec<const char *> rather than a const char *[20] for the
1113 top-level argv, and move the logic to build it to...
1114 (gcc::jit::playback::context::make_fake_args): New function.
1115 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1118 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1120 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1121 * jit-playback.c: Include new header jit-result.h.
1122 (gcc::jit::result::result): Move to new file jit-result.c.
1123 (gcc::jit::result::~result): Likewise.
1124 (gcc::jit::playback::result): Likewise.
1125 * jit-recording.h (class gcc::jit::result): Move to new
1126 header jit-result.h.
1127 * jit-result.c: New file, to contain...
1128 (gcc::jit::result::result): Move here from jit-playback.c,
1129 removing erroneous "playback" namespace from comment.
1130 (gcc::jit::result::~result): Likewise.
1131 (gcc::jit::playback::result): Likewise.
1132 * jit-result.h: New file, to contain...
1133 (class gcc::jit::result): Move from jit-recording.h.
1134 * libgccjit.c: Include jit-result.h.
1135 (gcc_jit_result_get_code): Update comment to reflect move
1137 (gcc_jit_result_release): Likewise.
1139 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1142 * docs/examples/tut04-toyvm/toyvm.c
1143 (toyvm_compiled_function): New typedef.
1144 (toyvm_compiled_func) Rename to...
1145 (toyvm_compiled_code) ...this.
1146 (struct toyvm_compiled_function): New struct.
1147 (toyvm_function_compile): Return a toyvm_compiled_function *
1148 rather than a toyvm_compiled_func, so that the caller can fully
1149 clean things up. Free "funcname".
1150 (test_script): Update for change to toyvm_function_compile.
1151 Clean up the toyvm_compiled_function.
1153 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1154 and to better spell out the lifetime of the compiled code.
1156 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1160 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1161 context's new_function_type method, rather than directly creating
1162 a function_type instance.
1164 (gcc::jit::recording::context::new_function_type): New method,
1165 adapted from part of...
1166 (gcc::jit::recording::context::new_function_ptr_type): ...this.
1167 Update to call new_function_type.
1169 (gcc::jit::recording::context::new_function_type): New method.
1171 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1174 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1176 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1179 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1180 Convert param from const vec<playback::field *> & to
1181 const auto_vec<playback::field *> *.
1182 (gcc::jit::playback::context::new_function_type): Convert param
1183 "param_types" from vec<type *> * to const auto_vec<type *> *.
1184 (gcc::jit::playback::context::new_function): Convert param
1185 "params" from vec<param *> * to const auto_vec<param *> *.
1186 (gcc::jit::playback::context::build_call): Convert param "args"
1187 from vec<rvalue *> to const auto_vec<rvalue *> *.
1188 (gcc::jit::playback::context::new_call): Likewise.
1189 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1190 (wrapper_finalizer): New function.
1191 (gcc::jit::playback::wrapper::operator new): Call the finalizer
1192 variant of ggc_internal_cleared_alloc, supplying
1194 (gcc::jit::playback::function::finalizer): New.
1195 (gcc::jit::playback::block::finalizer): New.
1196 (gcc::jit::playback::source_file::finalizer): New.
1197 (gcc::jit::playback::source_line::finalizer): New.
1200 (gcc::jit::playback::context::new_function_type): Convert param
1201 "param_types" from vec<type *> * to const auto_vec<type *> *.
1202 (gcc::jit::playback::context::new_function): Convert param
1203 "params" from vec<param *> * to const auto_vec<param *> *.
1204 (gcc::jit::playback::context::new_call): Convert param
1205 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1206 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1207 (gcc::jit::playback::context::build_call): Likewise.
1208 (gcc::jit::playback::context): Convert fields "m_functions",
1209 "m_source_files", "m_cached_locations" from vec to auto_vec.
1210 (gcc::jit::playback::wrapper::finalizer): New virtual function.
1211 (gcc::jit::playback::compound_type::set_fields): Convert param fro
1212 const vec<playback::field *> & to
1213 const auto_vec<playback::field *> *.
1214 (gcc::jit::playback::function::finalizer): New.
1215 (gcc::jit::playback::block::finalizer): New.
1216 (gcc::jit::playback::source_file::finalizer): New.
1217 (gcc::jit::playback::source_line::finalizer): New.
1220 (gcc::jit::recording::function_type::replay_into): Convert local
1221 from a vec into an auto_vec.
1222 (gcc::jit::recording::fields::replay_into): Likewise.
1223 (gcc::jit::recording::function::replay_into): Likewise.
1224 (gcc::jit::recording::call::replay_into): Likewise.
1225 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1227 * jit-recording.h (gcc::jit::recording::context): Convert fields
1228 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1230 (gcc::jit::recording::function_type::get_param_types): Convert
1231 return type from vec<type *> to const vec<type *> &.
1232 (gcc::jit::recording::function_type): Convert field
1233 "m_param_types" from a vec<> to an auto_vec<>.
1234 (gcc::jit::recording::fields): Likewise for field "m_fields".
1235 (gcc::jit::recording::function::get_params): Convert return type
1236 from vec <param *> to const vec<param *> &.
1237 (gcc::jit::recording::function): Convert fields "m_params",
1238 "m_locals", "m_blocks" from vec<> to auto_vec<>.
1239 (gcc::jit::recording::block): Likewise for field "m_statements".
1240 vec<> to auto_vec<>.
1241 (gcc::jit::recording::call): Likewise for field "m_args".
1242 (gcc::jit::recording::call_through_ptr): Likewise.
1244 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1247 * jit-recording.c (recording::function::validate): Convert
1248 "worklist" from vec<> to autovec<> to fix a leak.
1250 2014-11-11 David Malcolm <dmalcolm@redhat.com>
1252 * ChangeLog.jit: New.
1254 * Make-lang.in: New.
1256 * config-lang.in: New.
1257 * docs/Makefile: New.
1258 * docs/_build/texinfo/Makefile: New.
1259 * docs/_build/texinfo/factorial.png: New.
1260 * docs/_build/texinfo/libgccjit.texi: New.
1261 * docs/_build/texinfo/sum-of-squares.png: New.
1262 * docs/conf.py: New.
1263 * docs/examples/tut01-hello-world.c: New.
1264 * docs/examples/tut02-square.c: New.
1265 * docs/examples/tut03-sum-of-squares.c: New.
1266 * docs/examples/tut04-toyvm/Makefile: New.
1267 * docs/examples/tut04-toyvm/factorial.toy: New.
1268 * docs/examples/tut04-toyvm/fibonacci.toy: New.
1269 * docs/examples/tut04-toyvm/toyvm.c: New.
1270 * docs/index.rst: New.
1271 * docs/internals/index.rst: New.
1272 * docs/intro/factorial.png: New.
1273 * docs/intro/index.rst: New.
1274 * docs/intro/sum-of-squares.png: New.
1275 * docs/intro/tutorial01.rst: New.
1276 * docs/intro/tutorial02.rst: New.
1277 * docs/intro/tutorial03.rst: New.
1278 * docs/intro/tutorial04.rst: New.
1279 * docs/topics/contexts.rst: New.
1280 * docs/topics/expressions.rst: New.
1281 * docs/topics/functions.rst: New.
1282 * docs/topics/index.rst: New.
1283 * docs/topics/locations.rst: New.
1284 * docs/topics/objects.rst: New.
1285 * docs/topics/results.rst: New.
1286 * docs/topics/types.rst: New.
1287 * dummy-frontend.c: New.
1288 * jit-builtins.c: New.
1289 * jit-builtins.h: New.
1290 * jit-common.h: New.
1291 * jit-playback.c: New.
1292 * jit-playback.h: New.
1293 * jit-recording.c: New.
1294 * jit-recording.h: New.
1295 * libgccjit++.h: New.
1298 * libgccjit.map: New.
1301 2013-07-26 David Malcolm <dmalcolm@redhat.com>
1305 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1307 Copying and distribution of this file, with or without modification,
1308 are permitted in any medium without royalty provided the copyright
1309 notice and this notice are preserved.