1 2015-01-15 Richard Sandiford <richard.sandiford@arm.com>
3 Update copyright years in docs/.
5 2015-01-15 David Malcolm <dmalcolm@redhat.com>
7 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
8 lvalue and the rvalue are of compatible type.
10 2015-01-13 David Malcolm <dmalcolm@redhat.com>
12 * docs/cp/topics/contexts.rst (Debugging): Add
13 gccjit::context::dump_reproducer_to_file.
14 * docs/internals/index.rst (Design notes): New section,
15 discussing input validation and
16 gcc_jit_context_dump_reproducer_to_file.
17 * docs/topics/contexts.rst (Debugging): Add
18 gcc_jit_context_dump_reproducer_to_file.
19 * docs/_build/texinfo/libgccjit.texi: Regenerate.
20 * jit-common.h (gcc::jit::dump::get_context): New accessor.
21 * jit-recording.c: Include "hash-map.h".
22 Within namespace ::gcc::jit...
23 (dump::write): Flush each line.
24 (dump::make_location): Pass false for new param "created_by_user".
25 (class allocator): New class.
26 (allocator::~allocator): New function.
27 (allocator::xstrdup_printf): New function.
28 (allocator::xstrdup_printf_va): New function.
29 (class reproducer): New subclass of dump.
30 (reproducer::reproducer): New function.
31 (reproducer::write_params): New function.
32 (reproducer::write_args): New function.
33 (reproducer::make_identifier): New function.
34 (reproducer::make_tmp_identifier): New function.
35 (reproducer::get_identifier): New pair of functions.
36 (reproducer::get_identifier_as_rvalue): New function.
37 (reproducer::get_identifier_as_lvalue): New function.
38 (reproducer::get_identifier_as_type): New function.
39 (reproducer::xstrdup_printf): New function.
40 (recording::context::context): Initialize m_toplevel_ctxt.
41 (recording::context::new_location): Add param created_by_user.
42 (str_option_reproducer_strings): New table of strings.
43 (int_option_reproducer_strings): Likewise.
44 (bool_option_reproducer_strings): Likewise.
45 (get_type_enum_strings): Likewise.
46 (names_of_function_kinds): Likewise.
47 (global_kind_reproducer_strings): Likewise.
48 (unary_op_reproducer_strings): Likewise.
49 (binary_op_reproducer_strings): Likewise.
50 (comparison_reproducer_strings): Likewise.
51 Within namespace ::gcc::jit::recording::...
52 (context::dump_reproducer_to_file): New function.
53 (string::write_reproducer): Likewise.
54 (location::write_reproducer): Likewise.
55 (type::access_as_type): Likewise.
56 (memento_of_get_type::write_reproducer): Likewise.
57 (memento_of_get_pointer::write_reproducer): Likewise.
58 (memento_of_get_const::write_reproducer): Likewise.
59 (memento_of_get_volatile::write_reproducer): Likewise.
60 (array_type::write_reproducer): Likewise.
61 (function_type::write_reproducer): Likewise.
62 (function_type::write_deferred_reproducer): Likewise.
63 (field::write_reproducer): Likewise.
64 (struct_::access_as_type): Likewise.
65 (struct_::write_reproducer): Likewise.
66 (union_::write_reproducer): Likewise.
67 (fields::write_reproducer): Likewise.
68 (rvalue::access_as_rvalue): Likewise.
69 (lvalue::access_as_rvalue): Likewise.
70 (lvalue::access_as_lvalue): Likewise.
71 (param::access_as_rvalue): Likewise.
72 (param::access_as_lvalue): Likewise.
73 (param::write_reproducer): Likewise.
74 (function::write_reproducer): Likewise.
75 (block::write_reproducer): Likewise.
76 (global::write_reproducer): Likewise.
77 (memento_of_new_rvalue_from_const <int>::write_reproducer):
79 (memento_of_new_rvalue_from_const <long>::write_reproducer):
81 (memento_of_new_rvalue_from_const <double>::write_reproducer):
83 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
85 (memento_of_new_string_literal::write_reproducer): Likewise.
86 (unary_op::write_reproducer): Likewise.
87 (binary_op::write_reproducer): Likewise.
88 (comparison::write_reproducer): Likewise.
89 (cast::write_reproducer): Likewise.
90 (call::write_reproducer): Likewise.
91 (call_through_ptr::write_reproducer): Likewise.
92 (array_access::write_reproducer): Likewise.
93 (access_field_of_lvalue::write_reproducer): Likewise.
94 (access_field_rvalue::write_reproducer): Likewise.
95 (dereference_field_rvalue::write_reproducer): Likewise.
96 (dereference_rvalue::write_reproducer): Likewise.
97 (get_address_of_lvalue::write_reproducer): Likewise.
98 (local::write_reproducer): Likewise.
99 (eval::write_reproducer): Likewise.
100 (assignment::write_reproducer): Likewise.
101 (assignment_op::write_reproducer): Likewise.
102 (comment::write_reproducer): Likewise.
103 (conditional::write_reproducer): Likewise.
104 (jump::write_reproducer): Likewise.
105 (return_::write_reproducer): Likewise.
106 * jit-recording.h (gcc::jit::reproducer): New forward declararion.
107 Within namespace ::gcc::jit::recording::...
108 (context::new_location): Add "created_by_user" param.
109 (context::dump_reproducer_to_file): New method.
110 (context::m_toplevel_ctxt): New field.
111 (memento::write_reproducer): New pure virtual function.
112 (memento::dyn_cast_location): New virtual function.
113 (string::write_reproducer):
114 (location::location): Add "created_by_user" param.
115 (location::dyn_cast_location): New function.
116 (location::created_by_user): New accessor.
117 (location::write_reproducer): New function.
118 (location::m_created_by_user): New field.
119 (type::access_as_type): New virtual function.
120 (location::write_reproducer): Likewise.
121 (type::access_as_type): Likewise.
122 (memento_of_get_type::write_reproducer): Likewise.
123 (memento_of_get_pointer::write_reproducer): Likewise.
124 (memento_of_get_const::write_reproducer): Likewise.
125 (memento_of_get_volatile::write_reproducer): Likewise.
126 (array_type::write_reproducer): Likewise.
127 (function_type::write_reproducer): Likewise.
128 (function_type::write_deferred_reproducer): Likewise.
129 (field::write_reproducer): Likewise.
130 (struct_::access_as_type): Likewise.
131 (struct_::write_reproducer): Likewise.
132 (union_::write_reproducer): Likewise.
133 (union_::m_fields): Remove stray unused field.
134 (fields::length): New accessor.
135 (fields::get_field): New accessor.
136 (fields::write_reproducer): New function.
137 (rvalue::access_as_rvalue): Likewise.
138 (lvalue::access_as_rvalue): Likewise.
139 (lvalue::access_as_lvalue): Likewise.
140 (param::access_as_rvalue): Likewise.
141 (param::access_as_lvalue): Likewise.
142 (param::write_reproducer): Likewise.
143 (function::write_reproducer): Likewise.
144 (block::write_reproducer): Likewise.
145 (global::write_reproducer): Likewise.
146 (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
148 (memento_of_new_string_literal::write_reproducer): Likewise.
149 (unary_op::write_reproducer): Likewise.
150 (binary_op::write_reproducer): Likewise.
151 (comparison::write_reproducer): Likewise.
152 (cast::write_reproducer): Likewise.
153 (call::write_reproducer): Likewise.
154 (call_through_ptr::write_reproducer): Likewise.
155 (array_access::write_reproducer): Likewise.
156 (access_field_of_lvalue::write_reproducer): Likewise.
157 (access_field_rvalue::write_reproducer): Likewise.
158 (dereference_field_rvalue::write_reproducer): Likewise.
159 (dereference_rvalue::write_reproducer): Likewise.
160 (get_address_of_lvalue::write_reproducer): Likewise.
161 (local::write_reproducer): Likewise.
162 (eval::write_reproducer): Likewise.
163 (assignment::write_reproducer): Likewise.
164 (assignment_op::write_reproducer): Likewise.
165 (comment::write_reproducer): Likewise.
166 (conditional::write_reproducer): Likewise.
167 (jump::write_reproducer): Likewise.
168 (return_::write_reproducer): Likewise.
169 * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
170 * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
171 param "created_by_user".
172 (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
173 * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
175 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
178 2015-01-12 David Malcolm <dmalcolm@redhat.com>
180 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
181 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
183 (gcc::jit::rvalue_usage_validator::visit): New function.
184 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
186 (gcc::jit::recording::rvalue::set_scope): New function.
187 (gcc::jit::recording::function::function): Call set_scope on each
188 param, issuing errors for any params that already have a function.
189 (gcc::jit::recording::block::add_eval): Return the new statement;
190 update the comment given that some error-checking now happens after
192 (gcc::jit::recording::block::add_assignment): Likewise.
193 (gcc::jit::recording::block::add_assignment_op): Likewise.
194 (gcc::jit::recording::block::add_comment): Likewise.
195 (gcc::jit::recording::block::end_with_conditional): Likewise.
196 (gcc::jit::recording::block::end_with_jump): Likewise.
197 (gcc::jit::recording::block::end_with_return): Likewise.
198 (gcc::jit::recording::block::validate): Add a comment.
199 (gcc::jit::recording::unary_op::visit_children): New function.
200 (gcc::jit::recording::binary_op::visit_children): New function.
201 (gcc::jit::recording::comparison::visit_children): New function.
202 (gcc::jit::recording::cast::visit_children): New function.
203 (gcc::jit::recording::call::visit_children): New function.
204 (gcc::jit::recording::call_through_ptr::visit_children): New function.
205 (gcc::jit::recording::array_access::visit_children): New function.
206 (gcc::jit::recording::access_field_of_lvalue::visit_children): New
208 (gcc::jit::recording::access_field_rvalue::visit_children): New
210 (gcc::jit::recording::dereference_field_rvalue::visit_children):
212 (gcc::jit::recording::dereference_rvalue::visit_children): New
214 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
216 * jit-recording.h: Within namespace gcc::jit::recording...
217 (class rvalue_visitor): New.
218 (rvalue::rvalue): Initialize m_scope.
219 (rvalue::get_loc): New accessor.
220 (rvalue::verify_valid_within_stmt): New function.
221 (rvalue::visit_children): New pure virtual function.
222 (rvalue::set_scope): New function.
223 (rvalue::get_scope): New function.
224 (rvalue::dyn_cast_param): New function.
225 (rvalue::m_scope): New field.
226 (param::visit_children): New empty function.
227 (param::dyn_cast_param): New function.
228 (function::get_loc): New function.
229 (block::add_eval): Return the new statement.
230 (block::add_assignment): Likewise.
231 (block::add_assignment_op): Likewise.
232 (block::add_comment): Likewise.
233 (block::end_with_conditional): Likewise.
234 (block::end_with_jump): Likewise.
235 (block::end_with_return): Likewise.
236 (global::visit_children): New function.
237 (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
239 (memento_of_new_string_literal::visit_children): New function.
240 (unary_op::visit_children): New function.
241 (binary_op::visit_children): New function.
242 (comparison::visit_children): New function.
243 (cast::visit_children): New function.
244 (call::visit_children): New function.
245 (call_through_ptr::visit_children): New function.
246 (array_access::visit_children): New function.
247 (access_field_of_lvalue::visit_children): New function.
248 (access_field_rvalue::visit_children): New function.
249 (dereference_field_rvalue::visit_children): New function.
250 (dereference_rvalue::visit_children): New function.
251 (get_address_of_lvalue::visit_children): New function.
252 (local::local): Call set_scope.
253 (local::visit_children): New function.
254 (statement::get_block): Make public.
255 * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
256 (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
257 (gcc_jit_context_new_function): Verify that each param has
258 not yet been used for creating another function.
259 (gcc_jit_block_add_eval): After creating the stmt, verify
260 that the rvalue expression tree is valid to use within it.
261 (gcc_jit_block_add_assignment): Likewise for the lvalue and
262 rvalue expression trees.
263 (gcc_jit_block_add_assignment_op): Likewise.
264 (gcc_jit_block_end_with_conditional): Likewise for the boolval
266 (gcc_jit_block_end_with_return): Likewise for the rvalue
268 (gcc_jit_block_end_with_void_return): Remove return of "void",
269 now that block::end_with_return is now non-void.
271 2015-01-12 David Malcolm <dmalcolm@redhat.com>
273 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
274 Add missing fclose on error-handling path.
276 2015-01-12 David Malcolm <dmalcolm@redhat.com>
278 * docs/cp/topics/expressions.rst (Global variables): Add
279 enum gcc_jit_global_kind param to gccjit::context::new_global.
280 * docs/topics/expressions.rst (Global variables): Likewise.
281 Document the new enum.
282 * docs/topics/results.rst (Compilation results): Document
284 * docs/_build/texinfo/libgccjit.texi: Regenerate.
285 * dummy-frontend.c (jit_langhook_write_globals): Call into the
286 playback context's write_global_decls_1 and write_global_decls_2
287 before and after calling symtab->finalize_compilation_unit ().
288 * jit-playback.c: Include "debug.h".
289 (gcc::jit::playback::context::new_global): Add "kind" param and
290 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
291 underlying VAR_DECL. Call varpool_node::get_create on the
292 VAR_DECL, and add it to m_globals.
293 (gcc::jit::playback::context::write_global_decls_1): New function.
294 (gcc::jit::playback::context::write_global_decls_2): New function.
295 * jit-playback.h (gcc::jit::playback::context::context): Call
297 (gcc::jit::playback::context::new_global): Add "kind" param.
298 (gcc::jit::playback::context::write_global_decls_1): New function.
299 (gcc::jit::playback::context::write_global_decls_2): New function.
300 (gcc::jit::playback::context::m_globals): New field.
301 * jit-recording.c (gcc::jit::recording::context::context):
302 Initialize m_globals.
303 (gcc::jit::recording::context::new_global): Add param "kind".
304 Add the new global to m_globals.
305 (gcc::jit::recording::context::dump_to_file): Dump the globals.
306 (gcc::jit::recording::global::replay_into): Add field m_kind.
307 (gcc::jit::recording::global::write_to_dump): New override.
308 * jit-recording.h (gcc::jit::recording::context::new_global): Add
310 (gcc::jit::recording::context::m_globals): New field.
311 (gcc::jit::recording::global::global): Add param kind.
312 (gcc::jit::recording::global::write_to_dump): New override.
313 (gcc::jit::recording::global::m_kind): New field.
314 * jit-result.c (gcc::jit::result::get_global): New function.
315 * jit-result.h (gcc::jit::result::get_global): New function.
316 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
317 * libgccjit.c (gcc_jit_context_new_global): Likewise.
318 (gcc_jit_result_get_global): New API entrypoint.
319 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
320 (enum gcc_jit_global_kind): New enum.
321 (gcc_jit_context_new_global): API change: add "kind" param.
322 * libgccjit.map (gcc_jit_result_get_global): New symbol.
324 2015-01-09 David Malcolm <dmalcolm@redhat.com>
326 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
327 "symtab.h", "inchash.h". Move include of "hash-set.h" much
329 * jit-builtins.c: Remove redundant includes of "opts.h" and
331 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
332 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
333 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
334 "statistics.h", "vec.h", "double-int.h", "real.h",
335 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
336 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
338 * jit-recording.c: Remove redundant includes of "opts.h" and
341 2015-01-09 David Malcolm <dmalcolm@redhat.com>
343 * docs/cp/topics/expressions.rst (Simple expressions): Use
344 ":c:type:" for C types. Document new overload of
345 gcc::jit::context::new_rvalue.
346 * docs/topics/expressions.rst (Simple expressions): Use
347 ":c:type:" for C types. Document new entrypoint
348 gcc_jit_context_new_rvalue_from_long.
349 * docs/_build/texinfo/libgccjit.texi: Regenerate.
350 * jit-playback.c: Within namespace gcc::jit::playback...
351 (context::new_rvalue_from_int): Eliminate in favor of...
352 (context::new_rvalue_from_const <int>): ...this.
353 (context::new_rvalue_from_double): Eliminate in favor of...
354 (context::new_rvalue_from_const <double>): ...this.
355 (context::new_rvalue_from_const <long>): New.
356 (context::new_rvalue_from_ptr): Eliminate in favor of...
357 (context::new_rvalue_from_const <void *>): ...this.
358 * jit-playback.h: Within namespace gcc::jit::playback...
359 (context::new_rvalue_from_int): Eliminate in favor of...
360 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
361 (context::new_rvalue_from_double): Likewise.
362 (context::new_rvalue_from_ptr): Likewise.
363 * jit-recording.c: Within namespace gcc::jit::recording...
364 (context::new_rvalue_from_int): Eliminate.
365 (context::new_rvalue_from_double): Likewise.
366 (context::new_rvalue_from_ptr): Likewise.
367 (class memento_of_new_rvalue_from_const <int>):
368 Add explicit specialization.
369 (class memento_of_new_rvalue_from_const <long>):
371 (class memento_of_new_rvalue_from_const <double>):
373 (class memento_of_new_rvalue_from_const <void *>):
375 (memento_of_new_rvalue_from_int::replay_into):
377 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
379 (memento_of_new_rvalue_from_double::replay_into):
381 (memento_of_new_rvalue_from_ptr::replay_into):
382 ...and this to be deleted.
383 (memento_of_new_rvalue_from_int::make_debug_string):
385 (memento_of_new_rvalue_from_const <int>::make_debug_string):
387 (memento_of_new_rvalue_from_double::make_debug_string):
389 (memento_of_new_rvalue_from_const <double>::make_debug_string):
391 (memento_of_new_rvalue_from_ptr::make_debug_string)
393 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
395 (memento_of_new_rvalue_from_const <long>::make_debug_string):
397 * jit-recording.h: Within namespace gcc::jit::recording...
398 (context::new_rvalue_from_int): Eliminate.
399 (context::new_rvalue_from_double): Likewise.
400 (context::new_rvalue_from_ptr): Likewise, all in favor of...
401 (context::new_rvalue_from_const <HOST_TYPE>): New family of
403 (class memento_of_new_rvalue_from_int): Eliminate.
404 (class memento_of_new_rvalue_from_double): Likewise.
405 (class memento_of_new_rvalue_from_ptr): Likewise.
406 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
407 of rvalue subclasses.
408 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
410 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
411 rewriting of recording::context::new_rvalue_from_int to
412 recording::context::new_rvalue_from_const <int>.
413 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
414 (gcc_jit_context_new_rvalue_from_double): Update for
415 rewriting of recording::context::new_rvalue_from_double to
416 recording::context::new_rvalue_from_const <double>.
417 (gcc_jit_context_new_rvalue_from_ptr): Update for
418 rewriting of recording::context::new_rvalue_from_ptr to
419 recording::context::new_rvalue_from_const <void *>.
420 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
422 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
424 2015-01-09 David Malcolm <dmalcolm@redhat.com>
427 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
428 shows tempdir creation/cleanup.
429 * docs/_build/texinfo/libgccjit.texi: Regenerate.
430 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
431 to the list of subclasses in the comment.
432 * jit-playback.c (gcc::jit::playback::context::context): Add a
433 comment clarifying when the tempdir gets cleaned up.
434 (gcc::jit::playback::context::compile): Pass the context's logger,
435 if any, to the tempdir.
436 (gcc::jit::playback::context::dlopen_built_dso): When creating the
437 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
438 over ownership of the tempdir to it.
439 * jit-result.c: Include "jit-tempdir.h".
440 (gcc::jit::result::result): Add tempdir param, saving it as
442 (gcc::jit::result::~result): Delete m_tempdir.
443 * jit-result.h (gcc::jit::result::result): Add tempdir param.
444 (gcc::jit::result::m_tempdir): New field.
445 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
447 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
448 and log m_path_template and m_path_tempdir.
449 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
450 entry/exit, and log the unlink and rmdir calls.
451 * jit-tempdir.h: Include "jit-logging.h".
452 (class gcc::jit::tempdir): Make this be a subclass of log_user.
453 (gcc::jit::tempdir::tempdir): Add logger param.
454 * notes.txt: Update to show the two possible places where the
455 tempdir can be cleaned up.
457 2015-01-08 David Malcolm <dmalcolm@redhat.com>
459 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
462 2015-01-08 David Malcolm <dmalcolm@redhat.com>
464 * docs/topics/contexts.rst (Error-handling): Document new
465 entrypoint gcc_jit_context_get_last_error.
466 * docs/_build/texinfo/libgccjit.texi: Regenerate.
467 * jit-recording.c (gcc::jit::recording::context::context):
468 Initialize new fields "m_last_error_str" and
469 "m_owns_last_error_str".
470 (gcc::jit::recording::context::~context): Clean up
471 m_last_error_str, if needed.
472 (gcc::jit::recording::context::add_error_va): Update
473 m_last_error_str and m_owns_last_error_str, freeing the old
474 value if appropriate.
475 (gcc::jit::recording::context::get_last_error): New function.
476 * jit-recording.h (gcc::jit::recording::context::get_last_error):
478 (gcc::jit::recording::context): New fields m_last_error_str and
479 m_owns_last_error_str.
480 * libgccjit.c (gcc_jit_context_get_last_error): New function.
481 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
482 * libgccjit.map (gcc_jit_context_get_last_error): New function.
484 2015-01-08 David Malcolm <dmalcolm@redhat.com>
486 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
487 * docs/internals/index.rst (Overview of code structure): Mention
488 gcc_jit_context_set_logfile, and embed the example logfile.
489 * docs/internals/test-hello-world.exe.log.txt: New file: example
491 * docs/topics/contexts.rst (Debugging): Add documentation
492 for gcc_jit_context_set_logfile.
493 * docs/_build/texinfo/libgccjit.texi: Regenerate.
494 * dummy-frontend.c: Include "jit-logging.h".
495 (jit_langhook_init): Assert that there is an active playback
496 context. If it has a logger, log entry/exit to this function.
497 (jit_langhook_write_globals): Likewise.
498 * jit-common.h (gcc::jit::logger): New forward declaration.
499 * jit-logging.c: New file.
500 * jit-logging.h: New file.
501 * jit-playback.c: Include "jit-logging.h".
502 (gcc::jit::playback::context::context): Initialize the log_user
503 base class from the recording context's logger (if any). Use
504 JIT_LOG_SCOPE to log entry/exit from the function body.
505 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
506 log entry/exit from the function body.
507 (gcc::jit::playback::build_stmt_list): Likewise.
508 (gcc::jit::playback::function::postprocess): Likewise.
509 (gcc::jit::playback::context::compile): Likewise. Log the
510 entry/exit to toplev::main and toplev::finalize. Log the
511 fake argv passed to toplev::main.
512 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
513 log entry/exit from the function body.
514 (gcc::jit::playback::context::release_mutex): Likewise.
515 (gcc::jit::playback::context::make_fake_args): Likewise.
516 (gcc::jit::playback::context::extract_any_requested_dumps):
518 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
519 log the arguments that the driver is invoked with.
520 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
521 the logger to the result object.
522 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
523 log entry/exit from the function body.
524 (gcc::jit::playback::context::dump_generated_code): Likewise.
525 (gcc::jit::playback::context::handle_locations): Likewise.
526 * jit-playback.h (gcc::jit::playback::context): Make this be
527 a subclass of gcc::jit::log_user.
528 * jit-recording.c: Include "jit-logging.h".
529 (gcc::jit::recording::context::context: Initialize the logger to
530 NULL for root contexts, or to the parent's logger for child
532 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
533 log entry/exit from the function body.
534 (gcc::jit::recording::context::replay_into): Likewise.
535 (gcc::jit::recording::context::disassociate_from_playback):
537 (gcc::jit::recording::context::compile): Likewise.
538 (recording::context::add_error_va): Likewise. Also, log the
540 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
541 log entry/exit from the function body.
542 * jit-recording.h: Include "jit-logging.h".
543 (gcc::jit::recording::context): Make this be a subclass of
545 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
546 (gcc::jit::result::result): Add logger param, recording it.
547 Use JIT_LOG_SCOPE to log entry/exit from the function body.
548 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
549 log entry/exit from the function body.
550 (gcc::jit::result::get_code): Likewise.
551 * jit-result.h (gcc::jit::result): Make this be a subclass of
553 (gcc::jit::result::result): Add logger parameter.
554 * libgccjit++.h (gccjit::context::set_logfile): New function.
555 * libgccjit.c: Include "jit-logging.h".
556 (gcc_jit_context_acquire): Log the context.
557 (gcc_jit_context_release): Use JIT_LOG_FUNC to
558 log entry/exit from the function body, and log the context.
559 (gcc_jit_context_new_child_context): Likewise, logging both
561 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
562 log entry/exit from the function body.
563 (gcc_jit_context_get_type): Likewise.
564 (gcc_jit_context_get_int_type): Likewise.
565 (gcc_jit_context_new_array_type): Likewise.
566 (gcc_jit_context_new_field): Likewise.
567 (gcc_jit_context_new_struct_type): Likewise.
568 (gcc_jit_context_new_opaque_struct): Likewise.
569 (gcc_jit_struct_set_fields): Likewise.
570 (gcc_jit_context_new_union_type): Likewise.
571 (gcc_jit_context_new_function_ptr_type): Likewise.
572 (gcc_jit_context_new_param): Likewise.
573 (gcc_jit_context_new_function): Likewise.
574 (gcc_jit_context_get_builtin_function): Likewise.
575 (gcc_jit_function_get_param): Likewise.
576 (gcc_jit_function_dump_to_dot): Likewise.
577 (gcc_jit_function_new_block): Likewise.
578 (gcc_jit_context_new_global): Likewise.
579 (gcc_jit_context_new_rvalue_from_int): Likewise.
580 (gcc_jit_context_zero): Likewise.
581 (gcc_jit_context_one): Likewise.
582 (gcc_jit_context_new_rvalue_from_double): Likewise.
583 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
584 (gcc_jit_context_null): Likewise.
585 (gcc_jit_context_new_string_literal): Likewise.
586 (gcc_jit_context_new_unary_op): Likewise.
587 (gcc_jit_context_new_binary_op): Likewise.
588 (gcc_jit_context_new_comparison): Likewise.
589 (gcc_jit_context_new_call): Likewise.
590 (gcc_jit_context_new_call_through_ptr): Likewise.
591 (gcc_jit_context_new_cast): Likewise.
592 (gcc_jit_context_new_array_access): Likewise.
593 (gcc_jit_lvalue_access_field): Likewise.
594 (gcc_jit_rvalue_access_field): Likewise.
595 (gcc_jit_rvalue_dereference_field): Likewise.
596 (gcc_jit_rvalue_dereference): Likewise.
597 (gcc_jit_lvalue_get_address): Likewise.
598 (gcc_jit_function_new_local): Likewise.
599 (gcc_jit_block_add_eval): Likewise.
600 (gcc_jit_block_add_assignment): Likewise.
601 (gcc_jit_block_add_assignment_op): Likewise.
602 (gcc_jit_block_end_with_conditional): Likewise.
603 (gcc_jit_block_add_comment): Likewise.
604 (gcc_jit_block_end_with_jump): Likewise.
605 (gcc_jit_block_end_with_return): Likewise.
606 (gcc_jit_block_end_with_void_return): Likewise.
607 (gcc_jit_context_set_str_option): Likewise.
608 (gcc_jit_context_set_int_option): Likewise.
609 (gcc_jit_context_set_bool_option): Likewise.
610 (gcc_jit_context_enable_dump): Likewise.
611 (gcc_jit_context_compile): Likewise. Also log the context,
613 (gcc_jit_context_dump_to_file): Likewise.
614 (gcc_jit_context_set_logfile): New function.
615 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
616 log entry/exit from the function body.
617 (gcc_jit_result_get_code): Likewise. Also log the fnname)
618 and the ptr to be returned.
619 (gcc_jit_result_release): Likewise. Also log the result.
620 * libgccjit.h: Include <stdio.h>, since we need FILE *.
621 (gcc_jit_context_set_logfile): New declaration.
622 * libgccjit.map (gcc_jit_context_set_logfile): New.
624 2015-01-07 David Malcolm <dmalcolm@redhat.com>
626 * jit-recording.h (gcc::jit::recording::type::is_void): New
628 (gcc::jit::recording::memento_of_get_type::is_void): New
629 function, overriding default implementation.
630 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
631 the underlying type is not "void".
633 2015-01-07 David Malcolm <dmalcolm@redhat.com>
635 * docs/topics/expressions.rst (Unary Operations): Add
636 GCC_JIT_UNARY_OP_ABS.
637 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
639 * jit-recording.c (unary_op_strings): Likewise.
640 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
641 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
642 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
643 * docs/_build/texinfo/libgccjit.texi: Regenerate.
645 2015-01-07 David Malcolm <dmalcolm@redhat.com>
647 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
650 2015-01-07 David Malcolm <dmalcolm@redhat.com>
652 * TODO.rst (Test suite): Remove item about running C++ testcases.
653 * docs/internals/index.rst (Working on the JIT library): Add
654 "c++" to the enabled languages in the suggested "configure"
655 invocation, and add a description of why this is necessary.
656 * docs/_build/texinfo/libgccjit.texi: Regenerate.
658 2015-01-07 David Malcolm <dmalcolm@redhat.com>
660 * docs/internals/index.rst: Update to reflect that built
661 testcases are now test-foo.c.exe, rather than test-foo.exe.
662 * docs/_build/texinfo/libgccjit.texi: Regenerate.
664 2015-01-05 Jakub Jelinek <jakub@redhat.com>
666 Update copyright years.
668 2014-12-19 David Malcolm <dmalcolm@redhat.com>
670 * jit-playback.c (gcc::jit::playback::context::build_cast): In
671 case BOOLEAN_TYPE, don't assume that the source expression is
674 2014-12-19 David Malcolm <dmalcolm@redhat.com>
676 * jit-recording.c (gcc::jit::recording::context::context): When
677 copying string options from a parent context, take a copy of the
678 underlying buffers, rather than simply copying the pointer.
680 2014-12-19 David Malcolm <dmalcolm@redhat.com>
682 * jit-recording.c (gcc::jit::recording::context::set_str_option):
685 2014-12-11 David Malcolm <dmalcolm@redhat.com>
687 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
688 Document new function.
689 * docs/_build/texinfo/libgccjit.texi: Regenerate.
691 2014-12-10 Ulrich Drepper <drepper@gmail.com>
693 Minor interface cleanups of libgccjit
694 * jit-playback.c (convert_to_dso): Use auto_vec instead
695 of automatic array to build up command line.
696 * jit-recording.c (recording::context::set_str_option):
697 Make copy of the string.
698 (recording::context::~context): Free string options.
699 * jit-recording.h (recording::context): Adjust type
700 of m_str_options member.
701 * libgccjit.h: Adjust comment about
702 gcc_jit_context_set_str_option parameter being used after
704 Update comment now that all interfaces are copy strings
706 * libgccjit++.h (gccjit::context): Add set_str_option
709 2014-12-10 David Malcolm <dmalcolm@redhat.com>
711 * docs/cp/index.rst: New file.
712 * docs/cp/intro/index.rst: New file.
713 * docs/cp/intro/tutorial01.rst: New file.
714 * docs/cp/intro/tutorial02.rst: New file.
715 * docs/cp/intro/tutorial03.rst: New file.
716 * docs/cp/intro/tutorial04.rst: New file.
717 * docs/cp/topics/contexts.rst: New file.
718 * docs/cp/topics/expressions.rst: New file.
719 * docs/cp/topics/functions.rst: New file.
720 * docs/cp/topics/index.rst: New file.
721 * docs/cp/topics/locations.rst: New file.
722 * docs/cp/topics/objects.rst: New file.
723 * docs/cp/topics/results.rst: New file.
724 * docs/cp/topics/types.rst: New file.
725 * docs/examples/tut01-hello-world.cc: New file.
726 * docs/examples/tut02-square.c: Fix missing newline in output.
727 * docs/examples/tut02-square.cc: New file.
728 * docs/examples/tut03-sum-of-squares.cc: New file.
729 * docs/examples/tut04-toyvm/toyvm.cc: New file.
730 * docs/index.rst: Move summary to above the table of contents.
731 Add text about the C vs C++ APIs.
732 * docs/topics/contexts.rst: Fix a typo.
734 * docs/_build/texinfo/libgccjit.texi: Regenerate.
735 * docs/_build/texinfo/factorial1.png: New file.
736 * docs/_build/texinfo/sum-of-squares1.png: New file.
738 2014-12-09 David Malcolm <dmalcolm@redhat.com>
740 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
741 logic for determine "funcname" to new function...
742 (get_function_name): ...here, adding logic to skip any leading
743 path from the filename.
744 (toyvm_function_parse): Use the filename for fn_filename, rather
745 than "name", so that the debugger can locate the source .toy
747 (toyvm_function_parse): Don't fclose a NULL FILE *.
749 2014-12-09 David Malcolm <dmalcolm@redhat.com>
752 * docs/internals/index.rst (Running under valgrind): New
754 (docs/_build/texinfo/libgccjit.texi): Regenerate.
756 2014-12-09 David Malcolm <dmalcolm@redhat.com>
759 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
760 * jit-common.h (gcc::jit::tempdir): New forward decl.
761 * jit-playback.c: Include jit-tempdir.h.
762 (gcc::jit::playback::context::context): Initialize m_tempdir.
763 (gcc::jit::playback::context::~context): Move tempdir
764 cleanup to new file jit-tempdir.c
765 (make_tempdir_path_template): Move to new file jit-tempdir.c.
766 (gcc::jit::playback::context::compile): Move tempdir creation
767 to new tempdir object in new file jit-tempdir.c.
768 (gcc::jit::playback::context::make_fake_args): Get path from
769 tempdir object rather than from member data.
770 (gcc::jit::playback::context::convert_to_dso): Likewise.
771 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
772 (gcc::jit::playback::context::dump_generated_code): Likewise.
773 (gcc::jit::playback::context::get_path_c_file): New function.
774 (gcc::jit::playback::context::get_path_s_file): New function.
775 (gcc::jit::playback::context::get_path_so_file): New function.
776 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
778 (gcc::jit::playback::context::get_path_s_file): New function.
779 (gcc::jit::playback::context::get_path_so_file): New function.
780 (gcc::jit::playback::context): Move fields "m_path_template",
781 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
782 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
783 * jit-tempdir.c: New file.
784 * jit-tempdir.h: New file.
786 2014-12-09 David Malcolm <dmalcolm@redhat.com>
788 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
789 mutex here, immediately before using toplev, and release it here, on
790 each exit path after acquisition.
791 (jit_mutex): Move this variable here, from jit-recording.c.
792 (gcc::jit::playback::context::acquire_mutex): New function, based on
793 code in jit-recording.c.
794 (gcc::jit::playback::context::release_mutex): Likewise.
795 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
797 (gcc::jit::playback::context::release_mutex): New function.
798 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
799 (gcc::jit::recording::context::compile): Move mutex-handling from
800 here into jit-playback.c's gcc::jit::playback::context::compile.
801 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
804 2014-12-09 David Malcolm <dmalcolm@redhat.com>
806 * jit-playback.c (gcc::jit::playback::context::compile): Move the
808 (gcc::jit::playback::context::dlopen_built_dso): ...this new
810 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
813 2014-12-09 David Malcolm <dmalcolm@redhat.com>
816 * docs/topics/contexts.rst (Debugging): Add description of
817 gcc_jit_context_enable_dump.
818 * docs/_build/texinfo/libgccjit.texi: Regenerate.
819 * jit-playback.c: Include context.h.
820 (class auto_argvec): New class.
821 (auto_argvec::~auto_argvec): New function.
822 (gcc::jit::playback::context::compile): Convert fake_args to be
823 an auto_argvec, so that it can contain dynamically-allocated
824 strings. Construct a vec of all requested dumps, and pass it to
825 make_fake_args. Extract requested dumps between the calls to
826 toplev::main and toplev::finalize.
827 (gcc::jit::playback::context::make_fake_args): Convert param
828 "argvec" to be a vec <char *>, and gain a "requested_dumps"
829 param. Convert to dynamically-allocated arg strings by converting
830 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
831 for args that are already a copy. Add args for all requested dumps.
832 (gcc::jit::playback::context::extract_any_requested_dumps): New
834 (gcc::jit::playback::context::read_dump_file): New function.
835 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
836 Convert param "argvec" to be a vec <char *>, and gain a
837 "requested_dumps" param.
838 (gcc::jit::playback::context::extract_any_requested_dumps): New
840 (gcc::jit::playback::context::read_dump_file): New function.
841 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
843 (gcc::jit::recording::context::get_all_requested_dumps): New
845 * jit-recording.h (gcc::jit::recording::requested_dump): New
847 (gcc::jit::recording::context::enable_dump): New function.
848 (gcc::jit::recording::context::get_all_requested_dumps): New
850 (gcc::jit::recording::context::m_requested_dumps): New field.
851 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
852 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
853 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
855 2014-12-08 David Malcolm <dmalcolm@redhat.com>
857 * libgccjit++.h: Indent the forward declarations of the classes to
858 show the inheritance hierarchy.
860 2014-12-08 David Malcolm <dmalcolm@redhat.com>
862 * notes.txt: Show the beginning and ending of
863 recording::context::compile vs playback::context::compile. Show
864 the creation and unlinking of the tempdir. Show toplev::finalize.
865 Move "RELEASE MUTEX" to the correct location. Show
866 gcc_jit_result_release, and indicate where the
867 dlopen/dlsym/dlclose occur.
869 2014-12-01 David Malcolm <dmalcolm@redhat.com>
871 * docs/examples/tut02-square.c (main): Release the context
872 earlier, to show that this is possible. Update error-handling
873 to avoid a double-release of the context, and to avoid
874 releasing a NULL result.
875 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
876 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
877 * docs/topics/results.rst (gcc_jit_result): Mention that this
878 controls the lifetimes of machine code functions.
879 (gcc_jit_result_get_code): Spell out the requirements for this
880 to succeed, and the lifetime of the result.
881 (gcc_jit_result_release): Mention that this invalidates any code
882 that was obtained from the result.
883 * docs/_build/texinfo/libgccjit.texi: Regenerate.
885 2014-12-01 David Malcolm <dmalcolm@redhat.com>
888 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
889 Add description of error-handling, taken in part from...
890 * docs/topics/contexts.rst (Error-handling): Expand, and move some
891 content to tutorial02.rst.
892 * docs/_build/texinfo/libgccjit.texi: Regenerate.
894 2014-12-01 David Malcolm <dmalcolm@redhat.com>
897 * docs/topics/types.rst (Standard types) Add new enum values to
898 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
899 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
900 Widen the left-hand column so that
901 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
902 * docs/_build/texinfo/libgccjit.texi: Regenerate.
904 * jit-builtins.c: Include stringpool.h and jit-playback.h.
905 Move everything out of the gcc::jit::recording namespace into
907 (struct builtin_data): Add fields "fnclass", "attr", and
909 (DEF_BUILTIN): Update macro so populate the new fields.
910 (builtins_manager::builtins_manager): Update for move out of
911 recording namespace. Initialize the m_attributes array.
912 (builtins_manager::get_builtin_function): Likewise.
913 (builtins_manager::get_builtin_function_by_id): New function.
914 (builtins_manager::make_builtin_function): Update for move out of
915 recording namespace. Add fix for PR jit/64020 by detecting
916 specific builtin ids and having them ensure that builtins for
917 other ids are created as necessary.
918 (builtins_manager::get_type): Update for move out of recording
920 (builtins_manager::make_type): Likewise. Add some missing
922 (builtins_manager::make_primitive_type): Update for move out of
923 recording namespace. Implement the three BT_COMPLEX_ cases and
925 (builtins_manager::make_fn_type): Update for move out of recording
927 (builtins_manager::make_ptr_type): Likewise.
928 (builtins_manager::finish_playback): New function.
929 (builtins_manager::get_class): New function.
930 (builtins_manager::implicit_p): New function.
931 (builtins_manager::get_attrs_tree): Two new functions.
932 (builtins_manager::make_attrs_tree): New function.
934 * jit-builtins.h: Move everything out of the gcc::jit::recording
935 namespace into just gcc::jit.
936 (enum built_in_attribute): New.
937 (builtins_manager::builtins_manager): Update decl for namespace
939 (builtins_manager::get_builtin_function): Likewise.
940 (builtins_manager::get_class): New.
941 (builtins_manager::implicit_p): New.
942 (builtins_manager::get_attrs_tree): Two new functions.
943 (builtins_manager::make_attrs_tree): New function.
944 (builtins_manager::finish_playback): New.
945 (builtins_manager::get_builtin_function_by_id): New.
946 (builtins_manager::make_builtin_function): Update decl for
948 (builtins_manager::get_type): Likewise.
949 (builtins_manager::make_type): Likewise.
950 (builtins_manager::make_primitive_type): Likewise.
951 (builtins_manager::make_fn_type): Likewise.
952 (builtins_manager::make_ptr_type): Likewise.
953 (builtins_manager): Likewise for fields. Add new field
956 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
957 (builtins_manager): Update forward decl to reflect namespace
960 * jit-playback.c: Include attribs.h and jit-builtins.h.
961 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
962 for the new COMPLEX_ types.
963 (gcc::jit::playback::context::new_function): If creating a
964 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
965 and call set_builtin_decl.
966 (gcc::jit::playback::context::replay): If we have a
967 builtins_manager, call its finish_playback method when we're done.
970 (gcc::jit::playback::context::get_builtins_manager): New function.
973 (gcc::jit::recording::context::get_builtins_manager): New function.
974 (gcc::jit::recording::get_builtin_function): Use
975 get_builtins_manager, in case we're a child context.
976 (gcc::jit::recording::memento_of_get_type::dereference): Add the
978 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
979 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
980 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
981 (get_type_strings): Likewise.
984 (gcc::jit::recording::context::get_builtins_manager): New.
986 * libgccjit.h (enum gcc_jit_types): Add
987 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
988 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
990 2014-12-01 David Malcolm <dmalcolm@redhat.com>
993 (gcc::jit::recording::builtins_manager::get_builtin_function):
994 Check for NULL return from make_builtin_function.
995 (gcc::jit::recording::builtins_manager::make_builtin_function):
996 Check for NULL return from get_type.
998 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1000 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1001 creation code into...
1002 (gcc::jit::playback::context::convert_to_dso): New function.
1003 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1006 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1008 * jit-playback.c (gcc::jit::playback::context::compile): Use an
1009 auto_vec<const char *> rather than a const char *[20] for the
1010 top-level argv, and move the logic to build it to...
1011 (gcc::jit::playback::context::make_fake_args): New function.
1012 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1015 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1017 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1018 * jit-playback.c: Include new header jit-result.h.
1019 (gcc::jit::result::result): Move to new file jit-result.c.
1020 (gcc::jit::result::~result): Likewise.
1021 (gcc::jit::playback::result): Likewise.
1022 * jit-recording.h (class gcc::jit::result): Move to new
1023 header jit-result.h.
1024 * jit-result.c: New file, to contain...
1025 (gcc::jit::result::result): Move here from jit-playback.c,
1026 removing erroneous "playback" namespace from comment.
1027 (gcc::jit::result::~result): Likewise.
1028 (gcc::jit::playback::result): Likewise.
1029 * jit-result.h: New file, to contain...
1030 (class gcc::jit::result): Move from jit-recording.h.
1031 * libgccjit.c: Include jit-result.h.
1032 (gcc_jit_result_get_code): Update comment to reflect move
1034 (gcc_jit_result_release): Likewise.
1036 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1039 * docs/examples/tut04-toyvm/toyvm.c
1040 (toyvm_compiled_function): New typedef.
1041 (toyvm_compiled_func) Rename to...
1042 (toyvm_compiled_code) ...this.
1043 (struct toyvm_compiled_function): New struct.
1044 (toyvm_function_compile): Return a toyvm_compiled_function *
1045 rather than a toyvm_compiled_func, so that the caller can fully
1046 clean things up. Free "funcname".
1047 (test_script): Update for change to toyvm_function_compile.
1048 Clean up the toyvm_compiled_function.
1050 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1051 and to better spell out the lifetime of the compiled code.
1053 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1057 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1058 context's new_function_type method, rather than directly creating
1059 a function_type instance.
1061 (gcc::jit::recording::context::new_function_type): New method,
1062 adapted from part of...
1063 (gcc::jit::recording::context::new_function_ptr_type): ...this.
1064 Update to call new_function_type.
1066 (gcc::jit::recording::context::new_function_type): New method.
1068 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1071 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1073 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1076 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1077 Convert param from const vec<playback::field *> & to
1078 const auto_vec<playback::field *> *.
1079 (gcc::jit::playback::context::new_function_type): Convert param
1080 "param_types" from vec<type *> * to const auto_vec<type *> *.
1081 (gcc::jit::playback::context::new_function): Convert param
1082 "params" from vec<param *> * to const auto_vec<param *> *.
1083 (gcc::jit::playback::context::build_call): Convert param "args"
1084 from vec<rvalue *> to const auto_vec<rvalue *> *.
1085 (gcc::jit::playback::context::new_call): Likewise.
1086 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1087 (wrapper_finalizer): New function.
1088 (gcc::jit::playback::wrapper::operator new): Call the finalizer
1089 variant of ggc_internal_cleared_alloc, supplying
1091 (gcc::jit::playback::function::finalizer): New.
1092 (gcc::jit::playback::block::finalizer): New.
1093 (gcc::jit::playback::source_file::finalizer): New.
1094 (gcc::jit::playback::source_line::finalizer): New.
1097 (gcc::jit::playback::context::new_function_type): Convert param
1098 "param_types" from vec<type *> * to const auto_vec<type *> *.
1099 (gcc::jit::playback::context::new_function): Convert param
1100 "params" from vec<param *> * to const auto_vec<param *> *.
1101 (gcc::jit::playback::context::new_call): Convert param
1102 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1103 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1104 (gcc::jit::playback::context::build_call): Likewise.
1105 (gcc::jit::playback::context): Convert fields "m_functions",
1106 "m_source_files", "m_cached_locations" from vec to auto_vec.
1107 (gcc::jit::playback::wrapper::finalizer): New virtual function.
1108 (gcc::jit::playback::compound_type::set_fields): Convert param fro
1109 const vec<playback::field *> & to
1110 const auto_vec<playback::field *> *.
1111 (gcc::jit::playback::function::finalizer): New.
1112 (gcc::jit::playback::block::finalizer): New.
1113 (gcc::jit::playback::source_file::finalizer): New.
1114 (gcc::jit::playback::source_line::finalizer): New.
1117 (gcc::jit::recording::function_type::replay_into): Convert local
1118 from a vec into an auto_vec.
1119 (gcc::jit::recording::fields::replay_into): Likewise.
1120 (gcc::jit::recording::function::replay_into): Likewise.
1121 (gcc::jit::recording::call::replay_into): Likewise.
1122 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1124 * jit-recording.h (gcc::jit::recording::context): Convert fields
1125 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1127 (gcc::jit::recording::function_type::get_param_types): Convert
1128 return type from vec<type *> to const vec<type *> &.
1129 (gcc::jit::recording::function_type): Convert field
1130 "m_param_types" from a vec<> to an auto_vec<>.
1131 (gcc::jit::recording::fields): Likewise for field "m_fields".
1132 (gcc::jit::recording::function::get_params): Convert return type
1133 from vec <param *> to const vec<param *> &.
1134 (gcc::jit::recording::function): Convert fields "m_params",
1135 "m_locals", "m_blocks" from vec<> to auto_vec<>.
1136 (gcc::jit::recording::block): Likewise for field "m_statements".
1137 vec<> to auto_vec<>.
1138 (gcc::jit::recording::call): Likewise for field "m_args".
1139 (gcc::jit::recording::call_through_ptr): Likewise.
1141 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1144 * jit-recording.c (recording::function::validate): Convert
1145 "worklist" from vec<> to autovec<> to fix a leak.
1147 2014-11-11 David Malcolm <dmalcolm@redhat.com>
1149 * ChangeLog.jit: New.
1151 * Make-lang.in: New.
1153 * config-lang.in: New.
1154 * docs/Makefile: New.
1155 * docs/_build/texinfo/Makefile: New.
1156 * docs/_build/texinfo/factorial.png: New.
1157 * docs/_build/texinfo/libgccjit.texi: New.
1158 * docs/_build/texinfo/sum-of-squares.png: New.
1159 * docs/conf.py: New.
1160 * docs/examples/tut01-hello-world.c: New.
1161 * docs/examples/tut02-square.c: New.
1162 * docs/examples/tut03-sum-of-squares.c: New.
1163 * docs/examples/tut04-toyvm/Makefile: New.
1164 * docs/examples/tut04-toyvm/factorial.toy: New.
1165 * docs/examples/tut04-toyvm/fibonacci.toy: New.
1166 * docs/examples/tut04-toyvm/toyvm.c: New.
1167 * docs/index.rst: New.
1168 * docs/internals/index.rst: New.
1169 * docs/intro/factorial.png: New.
1170 * docs/intro/index.rst: New.
1171 * docs/intro/sum-of-squares.png: New.
1172 * docs/intro/tutorial01.rst: New.
1173 * docs/intro/tutorial02.rst: New.
1174 * docs/intro/tutorial03.rst: New.
1175 * docs/intro/tutorial04.rst: New.
1176 * docs/topics/contexts.rst: New.
1177 * docs/topics/expressions.rst: New.
1178 * docs/topics/functions.rst: New.
1179 * docs/topics/index.rst: New.
1180 * docs/topics/locations.rst: New.
1181 * docs/topics/objects.rst: New.
1182 * docs/topics/results.rst: New.
1183 * docs/topics/types.rst: New.
1184 * dummy-frontend.c: New.
1185 * jit-builtins.c: New.
1186 * jit-builtins.h: New.
1187 * jit-common.h: New.
1188 * jit-playback.c: New.
1189 * jit-playback.h: New.
1190 * jit-recording.c: New.
1191 * jit-recording.h: New.
1192 * libgccjit++.h: New.
1195 * libgccjit.map: New.
1198 2013-07-26 David Malcolm <dmalcolm@redhat.com>
1202 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1204 Copying and distribution of this file, with or without modification,
1205 are permitted in any medium without royalty provided the copyright
1206 notice and this notice are preserved.