]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/jit/ChangeLog
Revert ISA change
[thirdparty/gcc.git] / gcc / jit / ChangeLog
CommitLineData
179ed8f5
RS
12015-01-15 Richard Sandiford <richard.sandiford@arm.com>
2
3 Update copyright years in docs/.
4
96a87981
DM
52015-01-15 David Malcolm <dmalcolm@redhat.com>
6
7 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
8 lvalue and the rvalue are of compatible type.
9
86d0ac88
DM
102015-01-13 David Malcolm <dmalcolm@redhat.com>
11
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):
78 Likewise.
79 (memento_of_new_rvalue_from_const <long>::write_reproducer):
80 Likewise.
81 (memento_of_new_rvalue_from_const <double>::write_reproducer):
82 Likewise.
83 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
84 Likewise.
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):
147 Likewise.
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
174 entrypoint.
175 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
176 entrypoint.
177
f6f2b019
DM
1782015-01-12 David Malcolm <dmalcolm@redhat.com>
179
180 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
181 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
182 ctor.
183 (gcc::jit::rvalue_usage_validator::visit): New function.
184 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
185 function.
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
191 this returns.
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
207 function.
208 (gcc::jit::recording::access_field_rvalue::visit_children): New
209 function.
210 (gcc::jit::recording::dereference_field_rvalue::visit_children):
211 New function.
212 (gcc::jit::recording::dereference_rvalue::visit_children): New
213 function.
214 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
215 function.
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):
238 New function.
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
265 expression tree.
266 (gcc_jit_block_end_with_return): Likewise for the rvalue
267 expression tree.
268 (gcc_jit_block_end_with_void_return): Remove return of "void",
269 now that block::end_with_return is now non-void.
270
1c35cc2c
DM
2712015-01-12 David Malcolm <dmalcolm@redhat.com>
272
273 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
274 Add missing fclose on error-handling path.
275
791cfef8
DM
2762015-01-12 David Malcolm <dmalcolm@redhat.com>
277
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
283 globals-handling.
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
296 create on m_globals.
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
309 param "kind".
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.
323
860e981c
DM
3242015-01-09 David Malcolm <dmalcolm@redhat.com>
325
326 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
327 "symtab.h", "inchash.h". Move include of "hash-set.h" much
328 earlier.
329 * jit-builtins.c: Remove redundant includes of "opts.h" and
330 "tree.h".
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
337 earlier.
338 * jit-recording.c: Remove redundant includes of "opts.h" and
339 "tree.h".
340
ccce3b2a
DM
3412015-01-09 David Malcolm <dmalcolm@redhat.com>
342
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>):
370 Likewise.
371 (class memento_of_new_rvalue_from_const <double>):
372 Likewise.
373 (class memento_of_new_rvalue_from_const <void *>):
374 Likewise.
375 (memento_of_new_rvalue_from_int::replay_into):
376 Generalize into...
377 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
378 ...this...
379 (memento_of_new_rvalue_from_double::replay_into):
380 ...allowing this...
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):
384 Convert to...
385 (memento_of_new_rvalue_from_const <int>::make_debug_string):
386 ...this.
387 (memento_of_new_rvalue_from_double::make_debug_string):
388 Convert to...
389 (memento_of_new_rvalue_from_const <double>::make_debug_string):
390 ...this.
391 (memento_of_new_rvalue_from_ptr::make_debug_string)
392 Convert to...
393 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
394 ...this.
395 (memento_of_new_rvalue_from_const <long>::make_debug_string):
396 New function.
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
402 methods.
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
409 "long".
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
421 entrypoint.
422 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
423
d2286af3
DM
4242015-01-09 David Malcolm <dmalcolm@redhat.com>
425
426 PR jit/64206
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
441 m_tempdir.
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;
446 add JIT_LOG_SCOPE.
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.
456
7c8db13e
DM
4572015-01-08 David Malcolm <dmalcolm@redhat.com>
458
459 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
460 comment.
461
303e1d56
DM
4622015-01-08 David Malcolm <dmalcolm@redhat.com>
463
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):
477 New function.
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.
483
eb4c16eb
DM
4842015-01-08 David Malcolm <dmalcolm@redhat.com>
485
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
490 of a logfile.
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):
517 Likewise.
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
531 contexts.
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):
536 Likewise.
537 (gcc::jit::recording::context::compile): Likewise.
538 (recording::context::add_error_va): Likewise. Also, log the
539 error.
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
544 gcc::jit::log_user.
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
552 gcc::jit::log_user.
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
560 contexts.
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,
612 and the result.
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.
623
c211cd23
DM
6242015-01-07 David Malcolm <dmalcolm@redhat.com>
625
626 * jit-recording.h (gcc::jit::recording::type::is_void): New
627 virtual function.
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".
632
18146f45
DM
6332015-01-07 David Malcolm <dmalcolm@redhat.com>
634
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):
638 Likewise.
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.
644
11af98ff
DM
6452015-01-07 David Malcolm <dmalcolm@redhat.com>
646
647 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
648 typo in comment.
649
433d16df
DM
6502015-01-07 David Malcolm <dmalcolm@redhat.com>
651
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.
657
50bb6c8e
DM
6582015-01-07 David Malcolm <dmalcolm@redhat.com>
659
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.
663
1e3b6a3d
JJ
6642015-01-05 Jakub Jelinek <jakub@redhat.com>
665
666 Update copyright years.
667
e8af59bc
DM
6682014-12-19 David Malcolm <dmalcolm@redhat.com>
669
670 * jit-playback.c (gcc::jit::playback::context::build_cast): In
671 case BOOLEAN_TYPE, don't assume that the source expression is
672 of type "int".
673
5afd44e3
DM
6742014-12-19 David Malcolm <dmalcolm@redhat.com>
675
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.
679
1f0858d7
DM
6802014-12-19 David Malcolm <dmalcolm@redhat.com>
681
682 * jit-recording.c (gcc::jit::recording::context::set_str_option):
683 Handle NULL.
684
35291c7d
DM
6852014-12-11 David Malcolm <dmalcolm@redhat.com>
686
687 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
688 Document new function.
689 * docs/_build/texinfo/libgccjit.texi: Regenerate.
690
7b31ff5e
DM
6912014-12-10 Ulrich Drepper <drepper@gmail.com>
692
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
703 the call.
704 Update comment now that all interfaces are copy strings
705 if necessary.
706 * libgccjit++.h (gccjit::context): Add set_str_option
707 member function.
708
29df5715
DM
7092014-12-10 David Malcolm <dmalcolm@redhat.com>
710
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.
733
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.
737
5cd614ce
DM
7382014-12-09 David Malcolm <dmalcolm@redhat.com>
739
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
746 file.
747 (toyvm_function_parse): Don't fclose a NULL FILE *.
748
2712de78
DM
7492014-12-09 David Malcolm <dmalcolm@redhat.com>
750
751 PR jit/63854
752 * docs/internals/index.rst (Running under valgrind): New
753 subsection.
754 (docs/_build/texinfo/libgccjit.texi): Regenerate.
755
d1e5f2c7
DM
7562014-12-09 David Malcolm <dmalcolm@redhat.com>
757
758 PR jit/64206
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):
777 New function.
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.
785
38771e4e
DM
7862014-12-09 David Malcolm <dmalcolm@redhat.com>
787
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
796 function.
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
802 and RELEASE_MUTEX.
803
38f4f641
DM
8042014-12-09 David Malcolm <dmalcolm@redhat.com>
805
806 * jit-playback.c (gcc::jit::playback::context::compile): Move the
807 dlopen code into...
808 (gcc::jit::playback::context::dlopen_built_dso): ...this new
809 function.
810 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
811 New function.
812
82e0c914
DM
8132014-12-09 David Malcolm <dmalcolm@redhat.com>
814
815 PR jit/64166
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
833 function.
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
839 function.
840 (gcc::jit::playback::context::read_dump_file): New function.
841 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
842 function.
843 (gcc::jit::recording::context::get_all_requested_dumps): New
844 function.
845 * jit-recording.h (gcc::jit::recording::requested_dump): New
846 struct.
847 (gcc::jit::recording::context::enable_dump): New function.
848 (gcc::jit::recording::context::get_all_requested_dumps): New
849 function.
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.
854
53b730ff
DM
8552014-12-08 David Malcolm <dmalcolm@redhat.com>
856
857 * libgccjit++.h: Indent the forward declarations of the classes to
858 show the inheritance hierarchy.
859
0f379445
DM
8602014-12-08 David Malcolm <dmalcolm@redhat.com>
861
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.
868
81ba15f1
DM
8692014-12-01 David Malcolm <dmalcolm@redhat.com>
870
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.
884
e250f0dc
DM
8852014-12-01 David Malcolm <dmalcolm@redhat.com>
886
887 PR jit/64018
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.
893
eeafb319
DM
8942014-12-01 David Malcolm <dmalcolm@redhat.com>
895
896 PR jit/64020
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.
903
904 * jit-builtins.c: Include stringpool.h and jit-playback.h.
905 Move everything out of the gcc::jit::recording namespace into
906 just gcc::jit.
907 (struct builtin_data): Add fields "fnclass", "attr", and
908 "implicit_p".
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
919 namespace.
920 (builtins_manager::make_type): Likewise. Add some missing
921 #undefs.
922 (builtins_manager::make_primitive_type): Update for move out of
923 recording namespace. Implement the three BT_COMPLEX_ cases and
924 BT_DOUBLE_PTR.
925 (builtins_manager::make_fn_type): Update for move out of recording
926 namespace.
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.
933
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
938 change.
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
947 namespace change.
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
954 "m_attributes".
955
956 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
957 (builtins_manager): Update forward decl to reflect namespace
958 change.
959
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.
968
969 * jit-playback.h:
970 (gcc::jit::playback::context::get_builtins_manager): New function.
971
972 * jit-recording.c
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
977 COMPLEX_ types.
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.
982
983 * jit-recording.h
984 (gcc::jit::recording::context::get_builtins_manager): New.
985
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.
989
23844fd7
DM
9902014-12-01 David Malcolm <dmalcolm@redhat.com>
991
992 * jit-builtins.c
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.
997
c6760a13
DM
9982014-12-01 David Malcolm <dmalcolm@redhat.com>
999
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):
1004 New function.
1005
8f50ee3c
DM
10062014-12-01 David Malcolm <dmalcolm@redhat.com>
1007
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):
1013 New function.
1014
56dea35f
DM
10152014-12-01 David Malcolm <dmalcolm@redhat.com>
1016
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
1033 of implementation.
1034 (gcc_jit_result_release): Likewise.
1035
52b9468f
DM
10362014-12-01 David Malcolm <dmalcolm@redhat.com>
1037
1038 PR jit/63854
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.
1049 (main): Likewise.
1050 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1051 and to better spell out the lifetime of the compiled code.
1052
c8d19a69
DM
10532014-12-01 David Malcolm <dmalcolm@redhat.com>
1054
1055 PR jit/63854
1056 * jit-builtins.c
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.
1060 * jit-recording.c
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.
1065 * jit-recording.h
1066 (gcc::jit::recording::context::new_function_type): New method.
1067
c985705a
DM
10682014-12-01 David Malcolm <dmalcolm@redhat.com>
1069
1070 PR jit/63969
1071 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1072
b957b2e0
DM
10732014-11-19 David Malcolm <dmalcolm@redhat.com>
1074
1075 PR jit/63854
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
1090 wrapper_finalizer.
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.
1095
1096 * jit-playback.h
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.
1115
1116 * jit-recording.c
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.
1123
1124 * jit-recording.h (gcc::jit::recording::context): Convert fields
1125 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1126 auto_vec <>.
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.
1140
79cafc7a
DM
11412014-11-19 David Malcolm <dmalcolm@redhat.com>
1142
1143 PR jit/63854
1144 * jit-recording.c (recording::function::validate): Convert
1145 "worklist" from vec<> to autovec<> to fix a leak.
1146
35485da9
DM
11472014-11-11 David Malcolm <dmalcolm@redhat.com>
1148
1149 * ChangeLog.jit: New.
1150 * ChangeLog: New.
1151 * Make-lang.in: New.
1152 * TODO.rst: 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.
1193 * libgccjit.c: New.
1194 * libgccjit.h: New.
1195 * libgccjit.map: New.
1196 * notes.txt: New.
1197
11982013-07-26 David Malcolm <dmalcolm@redhat.com>
1199
1200 * Initial creation
1201
1e3b6a3d 1202Copyright (C) 2013-2015 Free Software Foundation, Inc.
35485da9
DM
1203
1204Copying and distribution of this file, with or without modification,
1205are permitted in any medium without royalty provided the copyright
1206notice and this notice are preserved.