]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/jit/ChangeLog
Add PR marker for last commit
[thirdparty/gcc.git] / gcc / jit / ChangeLog
CommitLineData
791cfef8
DM
12015-01-12 David Malcolm <dmalcolm@redhat.com>
2
3 * docs/cp/topics/expressions.rst (Global variables): Add
4 enum gcc_jit_global_kind param to gccjit::context::new_global.
5 * docs/topics/expressions.rst (Global variables): Likewise.
6 Document the new enum.
7 * docs/topics/results.rst (Compilation results): Document
8 globals-handling.
9 * docs/_build/texinfo/libgccjit.texi: Regenerate.
10 * dummy-frontend.c (jit_langhook_write_globals): Call into the
11 playback context's write_global_decls_1 and write_global_decls_2
12 before and after calling symtab->finalize_compilation_unit ().
13 * jit-playback.c: Include "debug.h".
14 (gcc::jit::playback::context::new_global): Add "kind" param and
15 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
16 underlying VAR_DECL. Call varpool_node::get_create on the
17 VAR_DECL, and add it to m_globals.
18 (gcc::jit::playback::context::write_global_decls_1): New function.
19 (gcc::jit::playback::context::write_global_decls_2): New function.
20 * jit-playback.h (gcc::jit::playback::context::context): Call
21 create on m_globals.
22 (gcc::jit::playback::context::new_global): Add "kind" param.
23 (gcc::jit::playback::context::write_global_decls_1): New function.
24 (gcc::jit::playback::context::write_global_decls_2): New function.
25 (gcc::jit::playback::context::m_globals): New field.
26 * jit-recording.c (gcc::jit::recording::context::context):
27 Initialize m_globals.
28 (gcc::jit::recording::context::new_global): Add param "kind".
29 Add the new global to m_globals.
30 (gcc::jit::recording::context::dump_to_file): Dump the globals.
31 (gcc::jit::recording::global::replay_into): Add field m_kind.
32 (gcc::jit::recording::global::write_to_dump): New override.
33 * jit-recording.h (gcc::jit::recording::context::new_global): Add
34 param "kind".
35 (gcc::jit::recording::context::m_globals): New field.
36 (gcc::jit::recording::global::global): Add param kind.
37 (gcc::jit::recording::global::write_to_dump): New override.
38 (gcc::jit::recording::global::m_kind): New field.
39 * jit-result.c (gcc::jit::result::get_global): New function.
40 * jit-result.h (gcc::jit::result::get_global): New function.
41 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
42 * libgccjit.c (gcc_jit_context_new_global): Likewise.
43 (gcc_jit_result_get_global): New API entrypoint.
44 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
45 (enum gcc_jit_global_kind): New enum.
46 (gcc_jit_context_new_global): API change: add "kind" param.
47 * libgccjit.map (gcc_jit_result_get_global): New symbol.
48
860e981c
DM
492015-01-09 David Malcolm <dmalcolm@redhat.com>
50
51 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
52 "symtab.h", "inchash.h". Move include of "hash-set.h" much
53 earlier.
54 * jit-builtins.c: Remove redundant includes of "opts.h" and
55 "tree.h".
56 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
57 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
58 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
59 "statistics.h", "vec.h", "double-int.h", "real.h",
60 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
61 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
62 earlier.
63 * jit-recording.c: Remove redundant includes of "opts.h" and
64 "tree.h".
65
ccce3b2a
DM
662015-01-09 David Malcolm <dmalcolm@redhat.com>
67
68 * docs/cp/topics/expressions.rst (Simple expressions): Use
69 ":c:type:" for C types. Document new overload of
70 gcc::jit::context::new_rvalue.
71 * docs/topics/expressions.rst (Simple expressions): Use
72 ":c:type:" for C types. Document new entrypoint
73 gcc_jit_context_new_rvalue_from_long.
74 * docs/_build/texinfo/libgccjit.texi: Regenerate.
75 * jit-playback.c: Within namespace gcc::jit::playback...
76 (context::new_rvalue_from_int): Eliminate in favor of...
77 (context::new_rvalue_from_const <int>): ...this.
78 (context::new_rvalue_from_double): Eliminate in favor of...
79 (context::new_rvalue_from_const <double>): ...this.
80 (context::new_rvalue_from_const <long>): New.
81 (context::new_rvalue_from_ptr): Eliminate in favor of...
82 (context::new_rvalue_from_const <void *>): ...this.
83 * jit-playback.h: Within namespace gcc::jit::playback...
84 (context::new_rvalue_from_int): Eliminate in favor of...
85 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
86 (context::new_rvalue_from_double): Likewise.
87 (context::new_rvalue_from_ptr): Likewise.
88 * jit-recording.c: Within namespace gcc::jit::recording...
89 (context::new_rvalue_from_int): Eliminate.
90 (context::new_rvalue_from_double): Likewise.
91 (context::new_rvalue_from_ptr): Likewise.
92 (class memento_of_new_rvalue_from_const <int>):
93 Add explicit specialization.
94 (class memento_of_new_rvalue_from_const <long>):
95 Likewise.
96 (class memento_of_new_rvalue_from_const <double>):
97 Likewise.
98 (class memento_of_new_rvalue_from_const <void *>):
99 Likewise.
100 (memento_of_new_rvalue_from_int::replay_into):
101 Generalize into...
102 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
103 ...this...
104 (memento_of_new_rvalue_from_double::replay_into):
105 ...allowing this...
106 (memento_of_new_rvalue_from_ptr::replay_into):
107 ...and this to be deleted.
108 (memento_of_new_rvalue_from_int::make_debug_string):
109 Convert to...
110 (memento_of_new_rvalue_from_const <int>::make_debug_string):
111 ...this.
112 (memento_of_new_rvalue_from_double::make_debug_string):
113 Convert to...
114 (memento_of_new_rvalue_from_const <double>::make_debug_string):
115 ...this.
116 (memento_of_new_rvalue_from_ptr::make_debug_string)
117 Convert to...
118 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
119 ...this.
120 (memento_of_new_rvalue_from_const <long>::make_debug_string):
121 New function.
122 * jit-recording.h: Within namespace gcc::jit::recording...
123 (context::new_rvalue_from_int): Eliminate.
124 (context::new_rvalue_from_double): Likewise.
125 (context::new_rvalue_from_ptr): Likewise, all in favor of...
126 (context::new_rvalue_from_const <HOST_TYPE>): New family of
127 methods.
128 (class memento_of_new_rvalue_from_int): Eliminate.
129 (class memento_of_new_rvalue_from_double): Likewise.
130 (class memento_of_new_rvalue_from_ptr): Likewise.
131 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
132 of rvalue subclasses.
133 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
134 "long".
135 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
136 rewriting of recording::context::new_rvalue_from_int to
137 recording::context::new_rvalue_from_const <int>.
138 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
139 (gcc_jit_context_new_rvalue_from_double): Update for
140 rewriting of recording::context::new_rvalue_from_double to
141 recording::context::new_rvalue_from_const <double>.
142 (gcc_jit_context_new_rvalue_from_ptr): Update for
143 rewriting of recording::context::new_rvalue_from_ptr to
144 recording::context::new_rvalue_from_const <void *>.
145 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
146 entrypoint.
147 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
148
d2286af3
DM
1492015-01-09 David Malcolm <dmalcolm@redhat.com>
150
151 PR jit/64206
152 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
153 shows tempdir creation/cleanup.
154 * docs/_build/texinfo/libgccjit.texi: Regenerate.
155 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
156 to the list of subclasses in the comment.
157 * jit-playback.c (gcc::jit::playback::context::context): Add a
158 comment clarifying when the tempdir gets cleaned up.
159 (gcc::jit::playback::context::compile): Pass the context's logger,
160 if any, to the tempdir.
161 (gcc::jit::playback::context::dlopen_built_dso): When creating the
162 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
163 over ownership of the tempdir to it.
164 * jit-result.c: Include "jit-tempdir.h".
165 (gcc::jit::result::result): Add tempdir param, saving it as
166 m_tempdir.
167 (gcc::jit::result::~result): Delete m_tempdir.
168 * jit-result.h (gcc::jit::result::result): Add tempdir param.
169 (gcc::jit::result::m_tempdir): New field.
170 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
171 add JIT_LOG_SCOPE.
172 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
173 and log m_path_template and m_path_tempdir.
174 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
175 entry/exit, and log the unlink and rmdir calls.
176 * jit-tempdir.h: Include "jit-logging.h".
177 (class gcc::jit::tempdir): Make this be a subclass of log_user.
178 (gcc::jit::tempdir::tempdir): Add logger param.
179 * notes.txt: Update to show the two possible places where the
180 tempdir can be cleaned up.
181
7c8db13e
DM
1822015-01-08 David Malcolm <dmalcolm@redhat.com>
183
184 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
185 comment.
186
303e1d56
DM
1872015-01-08 David Malcolm <dmalcolm@redhat.com>
188
189 * docs/topics/contexts.rst (Error-handling): Document new
190 entrypoint gcc_jit_context_get_last_error.
191 * docs/_build/texinfo/libgccjit.texi: Regenerate.
192 * jit-recording.c (gcc::jit::recording::context::context):
193 Initialize new fields "m_last_error_str" and
194 "m_owns_last_error_str".
195 (gcc::jit::recording::context::~context): Clean up
196 m_last_error_str, if needed.
197 (gcc::jit::recording::context::add_error_va): Update
198 m_last_error_str and m_owns_last_error_str, freeing the old
199 value if appropriate.
200 (gcc::jit::recording::context::get_last_error): New function.
201 * jit-recording.h (gcc::jit::recording::context::get_last_error):
202 New function.
203 (gcc::jit::recording::context): New fields m_last_error_str and
204 m_owns_last_error_str.
205 * libgccjit.c (gcc_jit_context_get_last_error): New function.
206 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
207 * libgccjit.map (gcc_jit_context_get_last_error): New function.
208
eb4c16eb
DM
2092015-01-08 David Malcolm <dmalcolm@redhat.com>
210
211 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
212 * docs/internals/index.rst (Overview of code structure): Mention
213 gcc_jit_context_set_logfile, and embed the example logfile.
214 * docs/internals/test-hello-world.exe.log.txt: New file: example
215 of a logfile.
216 * docs/topics/contexts.rst (Debugging): Add documentation
217 for gcc_jit_context_set_logfile.
218 * docs/_build/texinfo/libgccjit.texi: Regenerate.
219 * dummy-frontend.c: Include "jit-logging.h".
220 (jit_langhook_init): Assert that there is an active playback
221 context. If it has a logger, log entry/exit to this function.
222 (jit_langhook_write_globals): Likewise.
223 * jit-common.h (gcc::jit::logger): New forward declaration.
224 * jit-logging.c: New file.
225 * jit-logging.h: New file.
226 * jit-playback.c: Include "jit-logging.h".
227 (gcc::jit::playback::context::context): Initialize the log_user
228 base class from the recording context's logger (if any). Use
229 JIT_LOG_SCOPE to log entry/exit from the function body.
230 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
231 log entry/exit from the function body.
232 (gcc::jit::playback::build_stmt_list): Likewise.
233 (gcc::jit::playback::function::postprocess): Likewise.
234 (gcc::jit::playback::context::compile): Likewise. Log the
235 entry/exit to toplev::main and toplev::finalize. Log the
236 fake argv passed to toplev::main.
237 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
238 log entry/exit from the function body.
239 (gcc::jit::playback::context::release_mutex): Likewise.
240 (gcc::jit::playback::context::make_fake_args): Likewise.
241 (gcc::jit::playback::context::extract_any_requested_dumps):
242 Likewise.
243 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
244 log the arguments that the driver is invoked with.
245 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
246 the logger to the result object.
247 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
248 log entry/exit from the function body.
249 (gcc::jit::playback::context::dump_generated_code): Likewise.
250 (gcc::jit::playback::context::handle_locations): Likewise.
251 * jit-playback.h (gcc::jit::playback::context): Make this be
252 a subclass of gcc::jit::log_user.
253 * jit-recording.c: Include "jit-logging.h".
254 (gcc::jit::recording::context::context: Initialize the logger to
255 NULL for root contexts, or to the parent's logger for child
256 contexts.
257 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
258 log entry/exit from the function body.
259 (gcc::jit::recording::context::replay_into): Likewise.
260 (gcc::jit::recording::context::disassociate_from_playback):
261 Likewise.
262 (gcc::jit::recording::context::compile): Likewise.
263 (recording::context::add_error_va): Likewise. Also, log the
264 error.
265 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
266 log entry/exit from the function body.
267 * jit-recording.h: Include "jit-logging.h".
268 (gcc::jit::recording::context): Make this be a subclass of
269 gcc::jit::log_user.
270 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
271 (gcc::jit::result::result): Add logger param, recording it.
272 Use JIT_LOG_SCOPE to log entry/exit from the function body.
273 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
274 log entry/exit from the function body.
275 (gcc::jit::result::get_code): Likewise.
276 * jit-result.h (gcc::jit::result): Make this be a subclass of
277 gcc::jit::log_user.
278 (gcc::jit::result::result): Add logger parameter.
279 * libgccjit++.h (gccjit::context::set_logfile): New function.
280 * libgccjit.c: Include "jit-logging.h".
281 (gcc_jit_context_acquire): Log the context.
282 (gcc_jit_context_release): Use JIT_LOG_FUNC to
283 log entry/exit from the function body, and log the context.
284 (gcc_jit_context_new_child_context): Likewise, logging both
285 contexts.
286 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
287 log entry/exit from the function body.
288 (gcc_jit_context_get_type): Likewise.
289 (gcc_jit_context_get_int_type): Likewise.
290 (gcc_jit_context_new_array_type): Likewise.
291 (gcc_jit_context_new_field): Likewise.
292 (gcc_jit_context_new_struct_type): Likewise.
293 (gcc_jit_context_new_opaque_struct): Likewise.
294 (gcc_jit_struct_set_fields): Likewise.
295 (gcc_jit_context_new_union_type): Likewise.
296 (gcc_jit_context_new_function_ptr_type): Likewise.
297 (gcc_jit_context_new_param): Likewise.
298 (gcc_jit_context_new_function): Likewise.
299 (gcc_jit_context_get_builtin_function): Likewise.
300 (gcc_jit_function_get_param): Likewise.
301 (gcc_jit_function_dump_to_dot): Likewise.
302 (gcc_jit_function_new_block): Likewise.
303 (gcc_jit_context_new_global): Likewise.
304 (gcc_jit_context_new_rvalue_from_int): Likewise.
305 (gcc_jit_context_zero): Likewise.
306 (gcc_jit_context_one): Likewise.
307 (gcc_jit_context_new_rvalue_from_double): Likewise.
308 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
309 (gcc_jit_context_null): Likewise.
310 (gcc_jit_context_new_string_literal): Likewise.
311 (gcc_jit_context_new_unary_op): Likewise.
312 (gcc_jit_context_new_binary_op): Likewise.
313 (gcc_jit_context_new_comparison): Likewise.
314 (gcc_jit_context_new_call): Likewise.
315 (gcc_jit_context_new_call_through_ptr): Likewise.
316 (gcc_jit_context_new_cast): Likewise.
317 (gcc_jit_context_new_array_access): Likewise.
318 (gcc_jit_lvalue_access_field): Likewise.
319 (gcc_jit_rvalue_access_field): Likewise.
320 (gcc_jit_rvalue_dereference_field): Likewise.
321 (gcc_jit_rvalue_dereference): Likewise.
322 (gcc_jit_lvalue_get_address): Likewise.
323 (gcc_jit_function_new_local): Likewise.
324 (gcc_jit_block_add_eval): Likewise.
325 (gcc_jit_block_add_assignment): Likewise.
326 (gcc_jit_block_add_assignment_op): Likewise.
327 (gcc_jit_block_end_with_conditional): Likewise.
328 (gcc_jit_block_add_comment): Likewise.
329 (gcc_jit_block_end_with_jump): Likewise.
330 (gcc_jit_block_end_with_return): Likewise.
331 (gcc_jit_block_end_with_void_return): Likewise.
332 (gcc_jit_context_set_str_option): Likewise.
333 (gcc_jit_context_set_int_option): Likewise.
334 (gcc_jit_context_set_bool_option): Likewise.
335 (gcc_jit_context_enable_dump): Likewise.
336 (gcc_jit_context_compile): Likewise. Also log the context,
337 and the result.
338 (gcc_jit_context_dump_to_file): Likewise.
339 (gcc_jit_context_set_logfile): New function.
340 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
341 log entry/exit from the function body.
342 (gcc_jit_result_get_code): Likewise. Also log the fnname)
343 and the ptr to be returned.
344 (gcc_jit_result_release): Likewise. Also log the result.
345 * libgccjit.h: Include <stdio.h>, since we need FILE *.
346 (gcc_jit_context_set_logfile): New declaration.
347 * libgccjit.map (gcc_jit_context_set_logfile): New.
348
c211cd23
DM
3492015-01-07 David Malcolm <dmalcolm@redhat.com>
350
351 * jit-recording.h (gcc::jit::recording::type::is_void): New
352 virtual function.
353 (gcc::jit::recording::memento_of_get_type::is_void): New
354 function, overriding default implementation.
355 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
356 the underlying type is not "void".
357
18146f45
DM
3582015-01-07 David Malcolm <dmalcolm@redhat.com>
359
360 * docs/topics/expressions.rst (Unary Operations): Add
361 GCC_JIT_UNARY_OP_ABS.
362 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
363 Likewise.
364 * jit-recording.c (unary_op_strings): Likewise.
365 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
366 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
367 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
368 * docs/_build/texinfo/libgccjit.texi: Regenerate.
369
11af98ff
DM
3702015-01-07 David Malcolm <dmalcolm@redhat.com>
371
372 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
373 typo in comment.
374
433d16df
DM
3752015-01-07 David Malcolm <dmalcolm@redhat.com>
376
377 * TODO.rst (Test suite): Remove item about running C++ testcases.
378 * docs/internals/index.rst (Working on the JIT library): Add
379 "c++" to the enabled languages in the suggested "configure"
380 invocation, and add a description of why this is necessary.
381 * docs/_build/texinfo/libgccjit.texi: Regenerate.
382
50bb6c8e
DM
3832015-01-07 David Malcolm <dmalcolm@redhat.com>
384
385 * docs/internals/index.rst: Update to reflect that built
386 testcases are now test-foo.c.exe, rather than test-foo.exe.
387 * docs/_build/texinfo/libgccjit.texi: Regenerate.
388
1e3b6a3d
JJ
3892015-01-05 Jakub Jelinek <jakub@redhat.com>
390
391 Update copyright years.
392
e8af59bc
DM
3932014-12-19 David Malcolm <dmalcolm@redhat.com>
394
395 * jit-playback.c (gcc::jit::playback::context::build_cast): In
396 case BOOLEAN_TYPE, don't assume that the source expression is
397 of type "int".
398
5afd44e3
DM
3992014-12-19 David Malcolm <dmalcolm@redhat.com>
400
401 * jit-recording.c (gcc::jit::recording::context::context): When
402 copying string options from a parent context, take a copy of the
403 underlying buffers, rather than simply copying the pointer.
404
1f0858d7
DM
4052014-12-19 David Malcolm <dmalcolm@redhat.com>
406
407 * jit-recording.c (gcc::jit::recording::context::set_str_option):
408 Handle NULL.
409
35291c7d
DM
4102014-12-11 David Malcolm <dmalcolm@redhat.com>
411
412 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
413 Document new function.
414 * docs/_build/texinfo/libgccjit.texi: Regenerate.
415
7b31ff5e
DM
4162014-12-10 Ulrich Drepper <drepper@gmail.com>
417
418 Minor interface cleanups of libgccjit
419 * jit-playback.c (convert_to_dso): Use auto_vec instead
420 of automatic array to build up command line.
421 * jit-recording.c (recording::context::set_str_option):
422 Make copy of the string.
423 (recording::context::~context): Free string options.
424 * jit-recording.h (recording::context): Adjust type
425 of m_str_options member.
426 * libgccjit.h: Adjust comment about
427 gcc_jit_context_set_str_option parameter being used after
428 the call.
429 Update comment now that all interfaces are copy strings
430 if necessary.
431 * libgccjit++.h (gccjit::context): Add set_str_option
432 member function.
433
29df5715
DM
4342014-12-10 David Malcolm <dmalcolm@redhat.com>
435
436 * docs/cp/index.rst: New file.
437 * docs/cp/intro/index.rst: New file.
438 * docs/cp/intro/tutorial01.rst: New file.
439 * docs/cp/intro/tutorial02.rst: New file.
440 * docs/cp/intro/tutorial03.rst: New file.
441 * docs/cp/intro/tutorial04.rst: New file.
442 * docs/cp/topics/contexts.rst: New file.
443 * docs/cp/topics/expressions.rst: New file.
444 * docs/cp/topics/functions.rst: New file.
445 * docs/cp/topics/index.rst: New file.
446 * docs/cp/topics/locations.rst: New file.
447 * docs/cp/topics/objects.rst: New file.
448 * docs/cp/topics/results.rst: New file.
449 * docs/cp/topics/types.rst: New file.
450 * docs/examples/tut01-hello-world.cc: New file.
451 * docs/examples/tut02-square.c: Fix missing newline in output.
452 * docs/examples/tut02-square.cc: New file.
453 * docs/examples/tut03-sum-of-squares.cc: New file.
454 * docs/examples/tut04-toyvm/toyvm.cc: New file.
455 * docs/index.rst: Move summary to above the table of contents.
456 Add text about the C vs C++ APIs.
457 * docs/topics/contexts.rst: Fix a typo.
458
459 * docs/_build/texinfo/libgccjit.texi: Regenerate.
460 * docs/_build/texinfo/factorial1.png: New file.
461 * docs/_build/texinfo/sum-of-squares1.png: New file.
462
5cd614ce
DM
4632014-12-09 David Malcolm <dmalcolm@redhat.com>
464
465 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
466 logic for determine "funcname" to new function...
467 (get_function_name): ...here, adding logic to skip any leading
468 path from the filename.
469 (toyvm_function_parse): Use the filename for fn_filename, rather
470 than "name", so that the debugger can locate the source .toy
471 file.
472 (toyvm_function_parse): Don't fclose a NULL FILE *.
473
2712de78
DM
4742014-12-09 David Malcolm <dmalcolm@redhat.com>
475
476 PR jit/63854
477 * docs/internals/index.rst (Running under valgrind): New
478 subsection.
479 (docs/_build/texinfo/libgccjit.texi): Regenerate.
480
d1e5f2c7
DM
4812014-12-09 David Malcolm <dmalcolm@redhat.com>
482
483 PR jit/64206
484 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
485 * jit-common.h (gcc::jit::tempdir): New forward decl.
486 * jit-playback.c: Include jit-tempdir.h.
487 (gcc::jit::playback::context::context): Initialize m_tempdir.
488 (gcc::jit::playback::context::~context): Move tempdir
489 cleanup to new file jit-tempdir.c
490 (make_tempdir_path_template): Move to new file jit-tempdir.c.
491 (gcc::jit::playback::context::compile): Move tempdir creation
492 to new tempdir object in new file jit-tempdir.c.
493 (gcc::jit::playback::context::make_fake_args): Get path from
494 tempdir object rather than from member data.
495 (gcc::jit::playback::context::convert_to_dso): Likewise.
496 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
497 (gcc::jit::playback::context::dump_generated_code): Likewise.
498 (gcc::jit::playback::context::get_path_c_file): New function.
499 (gcc::jit::playback::context::get_path_s_file): New function.
500 (gcc::jit::playback::context::get_path_so_file): New function.
501 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
502 New function.
503 (gcc::jit::playback::context::get_path_s_file): New function.
504 (gcc::jit::playback::context::get_path_so_file): New function.
505 (gcc::jit::playback::context): Move fields "m_path_template",
506 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
507 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
508 * jit-tempdir.c: New file.
509 * jit-tempdir.h: New file.
510
38771e4e
DM
5112014-12-09 David Malcolm <dmalcolm@redhat.com>
512
513 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
514 mutex here, immediately before using toplev, and release it here, on
515 each exit path after acquisition.
516 (jit_mutex): Move this variable here, from jit-recording.c.
517 (gcc::jit::playback::context::acquire_mutex): New function, based on
518 code in jit-recording.c.
519 (gcc::jit::playback::context::release_mutex): Likewise.
520 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
521 function.
522 (gcc::jit::playback::context::release_mutex): New function.
523 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
524 (gcc::jit::recording::context::compile): Move mutex-handling from
525 here into jit-playback.c's gcc::jit::playback::context::compile.
526 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
527 and RELEASE_MUTEX.
528
38f4f641
DM
5292014-12-09 David Malcolm <dmalcolm@redhat.com>
530
531 * jit-playback.c (gcc::jit::playback::context::compile): Move the
532 dlopen code into...
533 (gcc::jit::playback::context::dlopen_built_dso): ...this new
534 function.
535 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
536 New function.
537
82e0c914
DM
5382014-12-09 David Malcolm <dmalcolm@redhat.com>
539
540 PR jit/64166
541 * docs/topics/contexts.rst (Debugging): Add description of
542 gcc_jit_context_enable_dump.
543 * docs/_build/texinfo/libgccjit.texi: Regenerate.
544 * jit-playback.c: Include context.h.
545 (class auto_argvec): New class.
546 (auto_argvec::~auto_argvec): New function.
547 (gcc::jit::playback::context::compile): Convert fake_args to be
548 an auto_argvec, so that it can contain dynamically-allocated
549 strings. Construct a vec of all requested dumps, and pass it to
550 make_fake_args. Extract requested dumps between the calls to
551 toplev::main and toplev::finalize.
552 (gcc::jit::playback::context::make_fake_args): Convert param
553 "argvec" to be a vec <char *>, and gain a "requested_dumps"
554 param. Convert to dynamically-allocated arg strings by converting
555 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
556 for args that are already a copy. Add args for all requested dumps.
557 (gcc::jit::playback::context::extract_any_requested_dumps): New
558 function.
559 (gcc::jit::playback::context::read_dump_file): New function.
560 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
561 Convert param "argvec" to be a vec <char *>, and gain a
562 "requested_dumps" param.
563 (gcc::jit::playback::context::extract_any_requested_dumps): New
564 function.
565 (gcc::jit::playback::context::read_dump_file): New function.
566 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
567 function.
568 (gcc::jit::recording::context::get_all_requested_dumps): New
569 function.
570 * jit-recording.h (gcc::jit::recording::requested_dump): New
571 struct.
572 (gcc::jit::recording::context::enable_dump): New function.
573 (gcc::jit::recording::context::get_all_requested_dumps): New
574 function.
575 (gcc::jit::recording::context::m_requested_dumps): New field.
576 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
577 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
578 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
579
53b730ff
DM
5802014-12-08 David Malcolm <dmalcolm@redhat.com>
581
582 * libgccjit++.h: Indent the forward declarations of the classes to
583 show the inheritance hierarchy.
584
0f379445
DM
5852014-12-08 David Malcolm <dmalcolm@redhat.com>
586
587 * notes.txt: Show the beginning and ending of
588 recording::context::compile vs playback::context::compile. Show
589 the creation and unlinking of the tempdir. Show toplev::finalize.
590 Move "RELEASE MUTEX" to the correct location. Show
591 gcc_jit_result_release, and indicate where the
592 dlopen/dlsym/dlclose occur.
593
81ba15f1
DM
5942014-12-01 David Malcolm <dmalcolm@redhat.com>
595
596 * docs/examples/tut02-square.c (main): Release the context
597 earlier, to show that this is possible. Update error-handling
598 to avoid a double-release of the context, and to avoid
599 releasing a NULL result.
600 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
601 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
602 * docs/topics/results.rst (gcc_jit_result): Mention that this
603 controls the lifetimes of machine code functions.
604 (gcc_jit_result_get_code): Spell out the requirements for this
605 to succeed, and the lifetime of the result.
606 (gcc_jit_result_release): Mention that this invalidates any code
607 that was obtained from the result.
608 * docs/_build/texinfo/libgccjit.texi: Regenerate.
609
e250f0dc
DM
6102014-12-01 David Malcolm <dmalcolm@redhat.com>
611
612 PR jit/64018
613 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
614 Add description of error-handling, taken in part from...
615 * docs/topics/contexts.rst (Error-handling): Expand, and move some
616 content to tutorial02.rst.
617 * docs/_build/texinfo/libgccjit.texi: Regenerate.
618
eeafb319
DM
6192014-12-01 David Malcolm <dmalcolm@redhat.com>
620
621 PR jit/64020
622 * docs/topics/types.rst (Standard types) Add new enum values to
623 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
624 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
625 Widen the left-hand column so that
626 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
627 * docs/_build/texinfo/libgccjit.texi: Regenerate.
628
629 * jit-builtins.c: Include stringpool.h and jit-playback.h.
630 Move everything out of the gcc::jit::recording namespace into
631 just gcc::jit.
632 (struct builtin_data): Add fields "fnclass", "attr", and
633 "implicit_p".
634 (DEF_BUILTIN): Update macro so populate the new fields.
635 (builtins_manager::builtins_manager): Update for move out of
636 recording namespace. Initialize the m_attributes array.
637 (builtins_manager::get_builtin_function): Likewise.
638 (builtins_manager::get_builtin_function_by_id): New function.
639 (builtins_manager::make_builtin_function): Update for move out of
640 recording namespace. Add fix for PR jit/64020 by detecting
641 specific builtin ids and having them ensure that builtins for
642 other ids are created as necessary.
643 (builtins_manager::get_type): Update for move out of recording
644 namespace.
645 (builtins_manager::make_type): Likewise. Add some missing
646 #undefs.
647 (builtins_manager::make_primitive_type): Update for move out of
648 recording namespace. Implement the three BT_COMPLEX_ cases and
649 BT_DOUBLE_PTR.
650 (builtins_manager::make_fn_type): Update for move out of recording
651 namespace.
652 (builtins_manager::make_ptr_type): Likewise.
653 (builtins_manager::finish_playback): New function.
654 (builtins_manager::get_class): New function.
655 (builtins_manager::implicit_p): New function.
656 (builtins_manager::get_attrs_tree): Two new functions.
657 (builtins_manager::make_attrs_tree): New function.
658
659 * jit-builtins.h: Move everything out of the gcc::jit::recording
660 namespace into just gcc::jit.
661 (enum built_in_attribute): New.
662 (builtins_manager::builtins_manager): Update decl for namespace
663 change.
664 (builtins_manager::get_builtin_function): Likewise.
665 (builtins_manager::get_class): New.
666 (builtins_manager::implicit_p): New.
667 (builtins_manager::get_attrs_tree): Two new functions.
668 (builtins_manager::make_attrs_tree): New function.
669 (builtins_manager::finish_playback): New.
670 (builtins_manager::get_builtin_function_by_id): New.
671 (builtins_manager::make_builtin_function): Update decl for
672 namespace change.
673 (builtins_manager::get_type): Likewise.
674 (builtins_manager::make_type): Likewise.
675 (builtins_manager::make_primitive_type): Likewise.
676 (builtins_manager::make_fn_type): Likewise.
677 (builtins_manager::make_ptr_type): Likewise.
678 (builtins_manager): Likewise for fields. Add new field
679 "m_attributes".
680
681 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
682 (builtins_manager): Update forward decl to reflect namespace
683 change.
684
685 * jit-playback.c: Include attribs.h and jit-builtins.h.
686 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
687 for the new COMPLEX_ types.
688 (gcc::jit::playback::context::new_function): If creating a
689 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
690 and call set_builtin_decl.
691 (gcc::jit::playback::context::replay): If we have a
692 builtins_manager, call its finish_playback method when we're done.
693
694 * jit-playback.h:
695 (gcc::jit::playback::context::get_builtins_manager): New function.
696
697 * jit-recording.c
698 (gcc::jit::recording::context::get_builtins_manager): New function.
699 (gcc::jit::recording::get_builtin_function): Use
700 get_builtins_manager, in case we're a child context.
701 (gcc::jit::recording::memento_of_get_type::dereference): Add the
702 COMPLEX_ types.
703 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
704 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
705 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
706 (get_type_strings): Likewise.
707
708 * jit-recording.h
709 (gcc::jit::recording::context::get_builtins_manager): New.
710
711 * libgccjit.h (enum gcc_jit_types): Add
712 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
713 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
714
23844fd7
DM
7152014-12-01 David Malcolm <dmalcolm@redhat.com>
716
717 * jit-builtins.c
718 (gcc::jit::recording::builtins_manager::get_builtin_function):
719 Check for NULL return from make_builtin_function.
720 (gcc::jit::recording::builtins_manager::make_builtin_function):
721 Check for NULL return from get_type.
722
c6760a13
DM
7232014-12-01 David Malcolm <dmalcolm@redhat.com>
724
725 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
726 creation code into...
727 (gcc::jit::playback::context::convert_to_dso): New function.
728 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
729 New function.
730
8f50ee3c
DM
7312014-12-01 David Malcolm <dmalcolm@redhat.com>
732
733 * jit-playback.c (gcc::jit::playback::context::compile): Use an
734 auto_vec<const char *> rather than a const char *[20] for the
735 top-level argv, and move the logic to build it to...
736 (gcc::jit::playback::context::make_fake_args): New function.
737 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
738 New function.
739
56dea35f
DM
7402014-12-01 David Malcolm <dmalcolm@redhat.com>
741
742 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
743 * jit-playback.c: Include new header jit-result.h.
744 (gcc::jit::result::result): Move to new file jit-result.c.
745 (gcc::jit::result::~result): Likewise.
746 (gcc::jit::playback::result): Likewise.
747 * jit-recording.h (class gcc::jit::result): Move to new
748 header jit-result.h.
749 * jit-result.c: New file, to contain...
750 (gcc::jit::result::result): Move here from jit-playback.c,
751 removing erroneous "playback" namespace from comment.
752 (gcc::jit::result::~result): Likewise.
753 (gcc::jit::playback::result): Likewise.
754 * jit-result.h: New file, to contain...
755 (class gcc::jit::result): Move from jit-recording.h.
756 * libgccjit.c: Include jit-result.h.
757 (gcc_jit_result_get_code): Update comment to reflect move
758 of implementation.
759 (gcc_jit_result_release): Likewise.
760
52b9468f
DM
7612014-12-01 David Malcolm <dmalcolm@redhat.com>
762
763 PR jit/63854
764 * docs/examples/tut04-toyvm/toyvm.c
765 (toyvm_compiled_function): New typedef.
766 (toyvm_compiled_func) Rename to...
767 (toyvm_compiled_code) ...this.
768 (struct toyvm_compiled_function): New struct.
769 (toyvm_function_compile): Return a toyvm_compiled_function *
770 rather than a toyvm_compiled_func, so that the caller can fully
771 clean things up. Free "funcname".
772 (test_script): Update for change to toyvm_function_compile.
773 Clean up the toyvm_compiled_function.
774 (main): Likewise.
775 (docs/intro/tutorial04.rst): Update to reflect the above changes,
776 and to better spell out the lifetime of the compiled code.
777
c8d19a69
DM
7782014-12-01 David Malcolm <dmalcolm@redhat.com>
779
780 PR jit/63854
781 * jit-builtins.c
782 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
783 context's new_function_type method, rather than directly creating
784 a function_type instance.
785 * jit-recording.c
786 (gcc::jit::recording::context::new_function_type): New method,
787 adapted from part of...
788 (gcc::jit::recording::context::new_function_ptr_type): ...this.
789 Update to call new_function_type.
790 * jit-recording.h
791 (gcc::jit::recording::context::new_function_type): New method.
792
c985705a
DM
7932014-12-01 David Malcolm <dmalcolm@redhat.com>
794
795 PR jit/63969
796 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
797
b957b2e0
DM
7982014-11-19 David Malcolm <dmalcolm@redhat.com>
799
800 PR jit/63854
801 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
802 Convert param from const vec<playback::field *> & to
803 const auto_vec<playback::field *> *.
804 (gcc::jit::playback::context::new_function_type): Convert param
805 "param_types" from vec<type *> * to const auto_vec<type *> *.
806 (gcc::jit::playback::context::new_function): Convert param
807 "params" from vec<param *> * to const auto_vec<param *> *.
808 (gcc::jit::playback::context::build_call): Convert param "args"
809 from vec<rvalue *> to const auto_vec<rvalue *> *.
810 (gcc::jit::playback::context::new_call): Likewise.
811 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
812 (wrapper_finalizer): New function.
813 (gcc::jit::playback::wrapper::operator new): Call the finalizer
814 variant of ggc_internal_cleared_alloc, supplying
815 wrapper_finalizer.
816 (gcc::jit::playback::function::finalizer): New.
817 (gcc::jit::playback::block::finalizer): New.
818 (gcc::jit::playback::source_file::finalizer): New.
819 (gcc::jit::playback::source_line::finalizer): New.
820
821 * jit-playback.h
822 (gcc::jit::playback::context::new_function_type): Convert param
823 "param_types" from vec<type *> * to const auto_vec<type *> *.
824 (gcc::jit::playback::context::new_function): Convert param
825 "params" from vec<param *> * to const auto_vec<param *> *.
826 (gcc::jit::playback::context::new_call): Convert param
827 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
828 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
829 (gcc::jit::playback::context::build_call): Likewise.
830 (gcc::jit::playback::context): Convert fields "m_functions",
831 "m_source_files", "m_cached_locations" from vec to auto_vec.
832 (gcc::jit::playback::wrapper::finalizer): New virtual function.
833 (gcc::jit::playback::compound_type::set_fields): Convert param fro
834 const vec<playback::field *> & to
835 const auto_vec<playback::field *> *.
836 (gcc::jit::playback::function::finalizer): New.
837 (gcc::jit::playback::block::finalizer): New.
838 (gcc::jit::playback::source_file::finalizer): New.
839 (gcc::jit::playback::source_line::finalizer): New.
840
841 * jit-recording.c
842 (gcc::jit::recording::function_type::replay_into): Convert local
843 from a vec into an auto_vec.
844 (gcc::jit::recording::fields::replay_into): Likewise.
845 (gcc::jit::recording::function::replay_into): Likewise.
846 (gcc::jit::recording::call::replay_into): Likewise.
847 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
848
849 * jit-recording.h (gcc::jit::recording::context): Convert fields
850 "m_mementos", "m_compound_types", "m_functions" from vec<> to
851 auto_vec <>.
852 (gcc::jit::recording::function_type::get_param_types): Convert
853 return type from vec<type *> to const vec<type *> &.
854 (gcc::jit::recording::function_type): Convert field
855 "m_param_types" from a vec<> to an auto_vec<>.
856 (gcc::jit::recording::fields): Likewise for field "m_fields".
857 (gcc::jit::recording::function::get_params): Convert return type
858 from vec <param *> to const vec<param *> &.
859 (gcc::jit::recording::function): Convert fields "m_params",
860 "m_locals", "m_blocks" from vec<> to auto_vec<>.
861 (gcc::jit::recording::block): Likewise for field "m_statements".
862 vec<> to auto_vec<>.
863 (gcc::jit::recording::call): Likewise for field "m_args".
864 (gcc::jit::recording::call_through_ptr): Likewise.
865
79cafc7a
DM
8662014-11-19 David Malcolm <dmalcolm@redhat.com>
867
868 PR jit/63854
869 * jit-recording.c (recording::function::validate): Convert
870 "worklist" from vec<> to autovec<> to fix a leak.
871
35485da9
DM
8722014-11-11 David Malcolm <dmalcolm@redhat.com>
873
874 * ChangeLog.jit: New.
875 * ChangeLog: New.
876 * Make-lang.in: New.
877 * TODO.rst: New.
878 * config-lang.in: New.
879 * docs/Makefile: New.
880 * docs/_build/texinfo/Makefile: New.
881 * docs/_build/texinfo/factorial.png: New.
882 * docs/_build/texinfo/libgccjit.texi: New.
883 * docs/_build/texinfo/sum-of-squares.png: New.
884 * docs/conf.py: New.
885 * docs/examples/tut01-hello-world.c: New.
886 * docs/examples/tut02-square.c: New.
887 * docs/examples/tut03-sum-of-squares.c: New.
888 * docs/examples/tut04-toyvm/Makefile: New.
889 * docs/examples/tut04-toyvm/factorial.toy: New.
890 * docs/examples/tut04-toyvm/fibonacci.toy: New.
891 * docs/examples/tut04-toyvm/toyvm.c: New.
892 * docs/index.rst: New.
893 * docs/internals/index.rst: New.
894 * docs/intro/factorial.png: New.
895 * docs/intro/index.rst: New.
896 * docs/intro/sum-of-squares.png: New.
897 * docs/intro/tutorial01.rst: New.
898 * docs/intro/tutorial02.rst: New.
899 * docs/intro/tutorial03.rst: New.
900 * docs/intro/tutorial04.rst: New.
901 * docs/topics/contexts.rst: New.
902 * docs/topics/expressions.rst: New.
903 * docs/topics/functions.rst: New.
904 * docs/topics/index.rst: New.
905 * docs/topics/locations.rst: New.
906 * docs/topics/objects.rst: New.
907 * docs/topics/results.rst: New.
908 * docs/topics/types.rst: New.
909 * dummy-frontend.c: New.
910 * jit-builtins.c: New.
911 * jit-builtins.h: New.
912 * jit-common.h: New.
913 * jit-playback.c: New.
914 * jit-playback.h: New.
915 * jit-recording.c: New.
916 * jit-recording.h: New.
917 * libgccjit++.h: New.
918 * libgccjit.c: New.
919 * libgccjit.h: New.
920 * libgccjit.map: New.
921 * notes.txt: New.
922
9232013-07-26 David Malcolm <dmalcolm@redhat.com>
924
925 * Initial creation
926
1e3b6a3d 927Copyright (C) 2013-2015 Free Software Foundation, Inc.
35485da9
DM
928
929Copying and distribution of this file, with or without modification,
930are permitted in any medium without royalty provided the copyright
931notice and this notice are preserved.