]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/jit/ChangeLog
jit: clarify (lack of) lifetime requirements on input const char *
[thirdparty/gcc.git] / gcc / jit / ChangeLog
CommitLineData
c575221a
DM
12015-07-01 David Malcolm <dmalcolm@redhat.com>
2
3 * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
4 Clarify lack of lifetime requirements on (const char *) parameter.
5 * docs/topics/expressions.rst
6 (gcc_jit_context_new_string_literal): Likewise.
7 (gcc_jit_context_new_global): Likewise.
8 * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
9 (gcc_jit_context_new_function): Likewise.
10 (gcc_jit_function_new_block): Likewise.
11 (gcc_jit_block_add_comment): Likewise.
12 * docs/topics/locations.rst (gcc_jit_context_new_location):
13 Likewise.
14 * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
15 (gcc_jit_context_new_struct_type): Likewise.
16 * docs/_build/texinfo/libgccjit.texi: Regenerate.
17
ec5d0088
DM
182015-06-30 David Malcolm <dmalcolm@redhat.com>
19
20 * docs/cp/topics/functions.rst (Blocks): Add switch statements to
21 list of ways to terminate a block.
22 (gccjit::block::end_with_switch): Add function description.
23 (gccjit::case_): Add class.
24 (gccjit::context::new_case): Add function description.
25 * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
26 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
27 * docs/topics/functions.rst (Blocks): Add switch statements to
28 list of ways to terminate a block.
29 (gcc_jit_block_end_with_switch): Add function description.
30 (gcc_jit_case): Add type.
31 (gcc_jit_context_new_case): Add function description.
32 (gcc_jit_case_as_object): Add function description.
33 * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
34 * docs/_build/texinfo/libgccjit.texi: Regenerate.
35 * jit-common.h (gcc::jit::recording::case_): Add forward decl.
36 (gcc::jit::playback::case_): Add forward decl.
37 * jit-playback.c (add_case): New function.
38 (gcc::jit::playback::block::add_switch): New function.
39 * jit-playback.h (gcc::jit::playback::case_): New struct.
40 (gcc::jit::playback::block::get_function): New method.
41 (gcc::jit::playback::block::add_switch): New method.
42 * jit-recording.c: Within namespace gcc::jit...
43 (recording::context::new_case): New method.
44 (recording::function::validate): Update for change to
45 get_successor_blocks.
46 (recording::block::end_with_switch): New method.
47 (recording::block::get_successor_blocks): Update to support an
48 arbitrary number of successor blocks.
49 (recording::block::dump_edges_to_dot): Likewise.
50 (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
51 (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
52 (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
53 (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
54 (recording::statement::get_successor_blocks): Update to support an
55 arbitrary number of successor blocks.
56 (recording::conditional::get_successor_blocks): Likewise.
57 (recording::jump::get_successor_blocks): Likewise.
58 (recording::return_::get_successor_blocks): Likewise.
59 (recording::case_::write_reproducer): New.
60 (recording::case_::make_debug_string): New.
61 (recording::switch_::switch_): New.
62 (recording::switch_::replay_into): New.
63 (recording::switch_::get_successor_blocks): New.
64 (recording::switch_::make_debug_string): New.
65 (recording::switch_::write_reproducer): New.
66 * jit-recording.h: Within namespace gcc::jit::recording...
67 (context::new_case): New.
68 (rvalue::is_constant): New.
69 (rvalue::get_wide_int): New.
70 (block::end_with_switch): New.
71 (block::get_successor_blocks): Update to support an arbitrary
72 number of successor blocks.
73 (memento_of_new_rvalue_from_const::is_constant): New.
74 (memento_of_new_rvalue_from_const::get_wide_int): New.
75 (statement::get_successor_blocks): Update to support an arbitrary
76 number of successor blocks.
77 (conditional::get_successor_blocks): Likewise.
78 (jump::get_successor_blocks): Likewise.
79 (return_::get_successor_blocks): Likewise.
80 (case_): New subclass of memento.
81 (switch_): New subclass of statement.
82 * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
83 (gccjit::context::new_case): New method.
84 (gccjit::block::end_with_switch): New method.
85 (gccjit::case_::case): New ctors.
86 (gccjit::case_::get_inner_case): New method.
87 * libgccjit.c: Include "typed-splay-tree.h"
88 (struct gcc_jit_case): New.
89 (gcc_jit_context_new_case): New function.
90 (gcc_jit_case_as_object): New function.
91 (valid_dest_for_switch): New function.
92 (valid_case_for_switch): New function.
93 (class api_call_validator): New class.
94 (class case_range_validator): New class.
95 (case_range_validator::case_range_validator): New.
96 (case_range_validator::validate): New.
97 (case_range_validator::case_compare): New.
98 (case_range_validator::get_wide_int): new.
99 (gcc_jit_block_end_with_switch): New.
100 * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
101 (gcc_jit_case): New typedef.
102 (gcc_jit_context_new_case): New function.
103 (gcc_jit_case_as_object): New function.
104 (gcc_jit_block_end_with_switch): New function.
105 (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
106 * libgccjit.map: Add gcc_jit_block_end_with_switch,
107 gcc_jit_case_as_object and gcc_jit_context_new_case.
108
6a3603e3
DM
1092015-06-30 David Malcolm <dmalcolm@redhat.com>
110
111 PR jit/66546
112 * docs/cp/topics/contexts.rst
113 (gccjit::context::set_bool_allow_unreachable_blocks): New.
114 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
115 * docs/topics/contexts.rst (Options): Add notes discussing the
116 transition from enums to entrypoints for new options.
117 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
118 * docs/_build/texinfo/libgccjit.texi: Regenerate.
119 * jit-common.h (gcc::jit::inner_bool_option): New enum.
120 * jit-recording.c: Within namespace gcc::jit...
121 (recording::context::context): Handle m_inner_bool_options.
122 (recording::context::set_inner_bool_option): New.
123 (inner_bool_option_reproducer_strings): New.
124 (recording::context::log_all_options): Log the "inner" bool
125 options.
126 (recording::context::log_inner_bool_option): New.
127 (recording::context::dump_reproducer_to_file): Write initializers
128 for "inner" bool options.
129 (recording::function::validate): Don't check for block
130 reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
131 * jit-recording.h: Within namespace gcc::jit...
132 (recording::context::set_inner_bool_option): New.
133 (recording::context::get_inner_bool_option): New.
134 (recording::context::log_inner_bool_option): New.
135 (recording::context::m_inner_bool_options): New.
136 * libgccjit++.h
137 (gccjit::context::set_bool_allow_unreachable_blocks): New.
138 * libgccjit.c
139 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
140 * libgccjit.h: Add note about options present in the
141 initial release of libgccjit.
142 (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
143 entrypoint.
144 (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
145 New macro.
146 * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
147 (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
148 entrypoint.
149
fa22c20d
DM
1502015-06-30 David Malcolm <dmalcolm@redhat.com>
151
152 PR jit/66628
153 * docs/cp/topics/contexts.rst (Additional command-line options):
154 New section.
155 * docs/topics/compatibility.rst: New file.
156 * docs/topics/contexts.rst (Additional command-line options): New
157 section.
158 * docs/topics/index.rst: Add compatibility.rst.
159 * docs/_build/texinfo/libgccjit.texi: Regenerate.
160 * jit-playback.c (make_fake_args): Add call to
161 append_command_line_options.
162 * jit-recording.c: Within namespace gcc::jit...
163 (recording::context::~context): Free the optnames within
164 m_command_line_options.
165 (recording::context::set_bool_option): Likewise.
166 (recording::context::add_command_line_option): New method.
167 (recording::context::append_command_line_options): New method.
168 (recording::context::dump_reproducer_to_file): Add command-line
169 options.
170 * jit-recording.h: Within namespace gcc::jit...
171 (recording::context::add_command_line_option): New method.
172 (recording::context::append_command_line_options): New method.
173 (recording::context::m_command_line_options): New field.
174 * libgccjit++.h (gccjit::context::add_command_line_option): New
175 method.
176 * libgccjit.c (gcc_jit_context_add_command_line_option): New API
177 entrypoint.
178 * libgccjit.h (gcc_jit_context_add_command_line_option): New API
179 entrypoint.
180 (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
181 macro.
182 * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
183 LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
184
a6314e15
DM
1852015-06-30 David Malcolm <dmalcolm@redhat.com>
186
187 * jit-recording.c
188 (gcc::jit::recording::context::dump_reproducer_to_file):
189 Add pragma to generated reproducers to disable -Wunused-variable.
190 Fix handling of NULL string options.
191
adb6d84b
DM
1922015-06-30 David Malcolm <dmalcolm@redhat.com>
193
194 * docs/cp/topics/expressions.rst: Remove stray semicolon.
195 * docs/cp/topics/functions.rst: Remove stray backslash.
196 * docs/_build/texinfo/libgccjit.texi: Regenerate.
197
f0889939
AM
1982015-06-25 Andrew MacLeod <amacleod@redhat.com>
199
200 * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
201 * jit-playback.c: Likewise.
202
9cad7a76
AM
2032015-06-25 Andrew Macleod <amacleod@redhat.com>
204
205 * jit-common.h: Don't include alias.h.
206
41571b55
DM
2072015-06-17 David Malcolm <dmalcolm@redhat.com>
208
209 * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
210 is for the correct struct.
211 (gcc_jit_rvalue_access_field): Likewise.
212
abb226c9
AM
2132015-06-17 Andrew MacLeod <amacleod@redhat.com>
214
215 * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
216 * jit-common.h: Likewise.
217 * jit-playback.c: Likewise.
218
bd93aa1a
DM
2192015-06-16 David Malcolm <dmalcolm@redhat.com>
220
221 PR jit/66539
222 * jit-recording.c: Within namespace gcc::jit::recording::
223 (rvalue::get_debug_string_parens): New function.
224 (binary_op::make_debug_string): Update to mimic C precedence
225 rules.
226 (binary_op_precedence): New array.
227 (binary_op::get_precedence): New function.
228 (comparison::make_debug_string): Update to mimic C precedence
229 rules.
230 (comparison_precedence): New array.
231 (comparison::get_precedence): New function.
232 (cast::make_debug_string): Update to mimic C precedence rules.
233 (call::make_debug_string): Likewise.
234 (call_through_ptr::make_debug_string): Likewise.
235 (array_access::make_debug_string): Likewise.
236 (access_field_of_lvalue::make_debug_string): Likewise.
237 (access_field_rvalue::make_debug_string): Likewise.
238 (dereference_field_rvalue::make_debug_string): Likewise.
239 (dereference_rvalue::make_debug_string): Likewise.
240 (get_address_of_lvalue::make_debug_string): Likewise.
241 * jit-recording.h: Within namespace gcc::jit::recording::
242 (precedence): New enum.
243 (rvalue::rvalue): Initialize field "m_parenthesized_string".
244 (rvalue::get_debug_string_parens): New method.
245 (rvalue::get_precedence): New pure virtual function.
246 (rvalue::m_parenthesized_string): New field.
247 (param::get_precedence): New function.
248 (global::get_precedence): New function.
249 (memento_of_new_rvalue_from_const::get_precedence): New function.
250 (memento_of_new_string_literal::get_precedence): New function.
251 (unary_op::get_precedence): New function.
252 (binary_op::get_precedence): New function.
253 (comparison::get_precedence): New function.
254 (cast::get_precedence): New function.
255 (call::get_precedence): New function.
256 (call_through_ptr::get_precedence): New function.
257 (array_access::get_precedence): New function.
258 (access_field_of_lvalue::get_precedence): New function.
259 (access_field_rvalue::get_precedence): New function.
260 (dereference_field_rvalue::get_precedence): New function.
261 (dereference_rvalue::get_precedence): New function.
262 (get_address_of_lvalue::get_precedence): New function.
263 (local::get_precedence): New function.
264
83c1b80e
MK
2652015-06-09 Matthias Klose <doko@ubuntu.com>
266
267 * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
268
13fdf2e2
AM
2692015-06-08 Andrew MacLeod <amacleod@redhat.com>
270
271 * dummy-frontend.c : Adjust include files.
272 * jit-common.h : Likewise.
273 * jit-playback.c : Likewise.
274
e4753451
DM
2752015-06-05 David Malcolm <dmalcolm@redhat.com>
276
277 * dummy-frontend.c
278 (jit_langhook_post_compilation_parsing_cleanups): Remove.
279 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
280 * jit-playback.c (gcc::jit::playback::context::new_global): Add
281 call to varpool_node::finalize_decl.
282 (gcc::jit::playback::context::finalize_global_decls): Remove.
283 * jit-playback.h
284 (gcc::jit::playback::context::finalize_global_decls): Remove.
285
e7547bc6
DM
2862015-06-05 David Malcolm <dmalcolm@redhat.com>
287
288 * dummy-frontend.c (jit_langhook_write_globals): Rename to...
289 (jit_langhook_post_compilation_parsing_cleanups): ...this, and
290 eliminate calls to finalize_compilation_unit and
291 write_global_decls_2.
292 (LANG_HOOKS_WRITE_GLOBALS): Rename to...
293 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
294 redirect from jit_langhook_write_globals to
295 jit_langhook_post_compilation_parsing_cleanups.
296 * jit-playback.c
297 (gcc::jit::playback::context::write_global_decls_1): Rename to...
298 (gcc::jit::playback::context::finalize_global_decls): ...this.
299 (gcc::jit::playback::context::write_global_decls_1): Delete.
300 * jit-playback.h
301 (gcc::jit::playback::context::write_global_decls_1): Rename to...
302 (gcc::jit::playback::context::finalize_global_decls): ...this.
303 (gcc::jit::playback::context::write_global_decls_1): Delete.
304
ecb9f223
AM
3052015-06-04 Andrew MacLeod <amacleod@redhat.com>
306
307 * dummy-frontend.c: Adjust includes for restructured coretypes.h.
308 * jit-common.h: Likewise.
309 * jit-playback.c: Likewise.
310
2637afb7
DM
3112015-05-12 David Malcolm <dmalcolm@redhat.com>
312
313 * jit-builtins.c: Include vec.h before target.h.
314
46bf0b0a
JW
3152015-04-27 Jim Wilson <jim.wilson@linaro.org>
316
317 * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
318 files.
319
51c5c6b5
DM
3202015-04-09 David Malcolm <dmalcolm@redhat.com>
321
322 PR jit/65691
323 * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
324 and paste error in description of gccjit::context::one.
325 * docs/topics/expressions.rst (Simple expressions): Likewise in
326 description of gcc_jit_context_one.
327 * docs/_build/texinfo/libgccjit.texi: Regenerate.
328
f40fd895
UB
3292015-03-13 Uros Bizjak <ubizjak@gmail.com>
330
331 * jit-recording.c (dump::write): Also check vasprintf return value.
332 (recording::context::add_error_va): Ditto.
333 (recording::string::from_printf): Ditto.
334
18eb0d13
DM
3352015-03-13 David Malcolm <dmalcolm@redhat.com>
336
337 * docs/internals/index.rst (Packaging notes): New section.
338 * docs/_build/texinfo/libgccjit.texi: Regenerate.
339
7ef96183
DM
3402015-03-05 David Malcolm <dmalcolm@redhat.com>
341
342 * docs/cp/intro/tutorial03.rst: Add missing arguments to
343 gccjit::block::end_with_conditional call. Add on_true/on_false
344 comments. Tweak the wording.
345 * docs/intro/tutorial03.rst: Add missing arguments to
346 gcc_jit_block_end_with_conditional call. Add some clarifying
347 comments.
348 * docs/topics/compilation.rst: Tweak the wording to avoid an
349 ambiguous use of "this".
350 * docs/topics/contexts.rst: Fix a typo.
351 * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
352 a stray backtick.
353 * docs/_build/texinfo/libgccjit.texi: Regenerate.
354
56a9f6bc
TS
3552015-02-24 Thomas Schwinge <thomas@codesourcery.com>
356
357 PR libgomp/64625
358 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
359 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
360 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
361 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
362 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
363 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
364
a4be4e91
DM
3652015-02-04 David Malcolm <dmalcolm@redhat.com>
366
367 PR jit/64257
368 * docs/conf.py (html_theme): Change from 'pyramid'
369 to 'sphinxdoc'.
370
f435bff3
DM
3712015-02-04 David Malcolm <dmalcolm@redhat.com>
372
373 * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
374 typo.
375 * docs/_build/texinfo/libgccjit.texi: Regenerate.
376
0ed4f017
DM
3772015-02-03 David Malcolm <dmalcolm@redhat.com>
378
379 * jit-logging.h (gcc::jit::log_user::log): Make const.
380 * jit-recording.c (gcc::jit::recording::context::set_str_option):
381 Log the new value of the option.
382 (gcc::jit::recording::context::set_int_option): Likewise.
383 (gcc::jit::recording::context::set_bool_option): Likewise.
384 (gcc::jit::recording::context::compile): Log the value of all
385 options.
386 (gcc::jit::recording::context::compile_to_file): Likewise.
387 (gcc::jit::recording::context::log_all_options): New function.
388 (gcc::jit::recording::context::log_str_option): New function.
389 (gcc::jit::recording::context::log_int_option): New function.
390 (gcc::jit::recording::context::log_bool_option): New function.
391 * jit-recording.h (gcc::jit::recording::context::log_all_options):
392 New function.
393 (gcc::jit::recording::context::log_str_option): New function.
394 (gcc::jit::recording::context::log_int_option): New function.
395 (gcc::jit::recording::context::log_bool_option): New function.
396 * docs/internals/test-hello-world.exe.log.txt: Update for above
397 changes.
398 * docs/_build/texinfo/libgccjit.texi: Regenerate.
399
2cb844ce
DM
4002015-02-03 David Malcolm <dmalcolm@redhat.com>
401
402 PR jit/64810
403 * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
404 (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
405 * jit-playback.c: Include gcc.h.
406 (gcc::jit::playback::context::compile): Move mutex acquisition
407 to before the call to make_fake_args.
408 (append_arg_from_driver): New function.
409 (gcc::jit::playback::context::make_fake_args): On the first call,
410 call into driver_get_configure_time_options to get configure-time
411 default options and cache them. Add them to the args for
412 toplev::main.
413 * jit-spec.c: New source file.
414 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
415 above changes.
416 * docs/_build/texinfo/libgccjit.texi: Regenerate.
417
16a71c50
DM
4182015-02-02 David Malcolm <dmalcolm@redhat.com>
419
420 PR jit/64810
421 * dummy-frontend.c (jit_langhook_type_for_mode): Support
422 TYPE_MODE (long_long_integer_type_node).
423
53c04ec9
DM
4242015-01-27 David Malcolm <dmalcolm@redhat.com>
425
426 * docs/internals/test-hello-world.exe.log.txt: Add example version
427 lines.
428 * docs/_build/texinfo/libgccjit.texi: Regenerate.
429 * jit-common.h (gcc::jit::dump::get_file): New accessor.
430 * jit-logging.c: Include toplev.h.
431 (gcc::jit::logger::logger): Log the GCC version.
432 * jit-recording.c: Include toplev.h.
433 (gcc:jit::recording::context::dump_reproducer_to_file): Log the
434 GCC version.
435
dc44ee3a
DM
4362015-01-26 David Malcolm <dmalcolm@redhat.com>
437
438 * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
439 * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
440 error buffer is only valid until the next call to the context.
441 * docs/_build/texinfo/libgccjit.texi: Regenerate.
442 * libgccjit.h (gcc_jit_context_get_first_error): Reword the
443 comment to omit mention of compiling.
444 (gcc_jit_context_get_last_error): The error buffer is only valid
445 until the next call to the context.
446
3349605d
DM
4472015-01-26 David Malcolm <dmalcolm@redhat.com>
448
449 PR jit/64708
450 * config-lang.in (compilers): Drop "libgccjit.so".
451
6fc2d0f3
DM
4522015-01-23 David Malcolm <dmalcolm@redhat.com>
453
454 PR jit/64721
455 * jit-playback.c (gcc::jit::playback::context::compile): Construct
456 toplev instances with init_signals=false.
457
fdce7209
DM
4582015-01-19 David Malcolm <dmalcolm@redhat.com>
459
460 * docs/cp/topics/results.rst: Rename to...
461 * docs/cp/topics/compilation.rst: ...this, and add section on
462 ahead-of-time compilation.
463 * docs/cp/topics/index.rst: Update for renaming of results.rst
464 to compilation.rst.
465 * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
466 script.
467 * docs/examples/tut05-bf.c: New file, implementing a compiler
468 for "brainf".
469 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
470 changes to logger output.
471 * docs/intro/index.rst: Add tutorial05.rst
472 * docs/intro/tutorial05.rst: New file.
473 * docs/topics/results.rst: Rename to...
474 * docs/topics/compilation.rst: ...this, and add section on
475 ahead-of-time compilation.
476 * docs/topics/index.rst: Update for renaming of results.rst to
477 compilation.rst.
478 * docs/_build/texinfo/libgccjit.texi: Regenerate.
479 * jit-playback.c (gcc::jit::playback::context::compile): Convert
480 return type from result * to void. Move the code to convert to
481 dso and dlopen the result to a new pure virtual "postprocess"
482 method.
483 (gcc::jit::playback::compile_to_memory::compile_to_memory): New
484 function.
485 (gcc::jit::playback::compile_to_memory::postprocess): New
486 function, based on playback::context::compile.
487 (gcc::jit::playback::compile_to_file::compile_to_file): New
488 function.
489 (gcc::jit::playback::compile_to_file::postprocess): New function.
490 (gcc::jit::playback::compile_to_file::copy_file): New function.
491 (gcc::jit::playback::context::convert_to_dso): Move internals
492 to...
493 (gcc::jit::playback::context::invoke_driver): New method. Add
494 "-shared" and "-c" options to driver's argv as needed.
495 * jit-playback.h: Include "timevar.h".
496 (gcc::jit::playback::context::compile): Convert return type from
497 result * to void.
498 (gcc::jit::playback::context::postprocess): New pure virtual
499 function, making this an abstract base class.
500 (gcc::jit::playback::context::get_tempdir): New accessor.
501 (gcc::jit::playback::context::invoke_driver): New function.
502 (class gcc::jit::playback::compile_to_memory): New subclass of
503 playback::context.
504 (class gcc::jit::playback::compile_to_file): Likewise.
505 * jit-recording.c (gcc::jit::recording::context::compile): Use a
506 playback::compile_to_memory, and extract its result.
507 (gcc::jit::recording::context::compile_to_file): New function.
508 * jit-recording.h (gcc::jit::recording::context::compile_to_file):
509 New function.
510 * libgccjit++.h (gccjit::context::compile_to_file): New method.
511 * libgccjit.c (gcc_jit_context_compile): Update log message to
512 clarify that this is an in-memory compile.
513 (gcc_jit_context_compile_to_file): New function.
514 * libgccjit.h (gcc_jit_context): Clarify that you can compile
515 a context more than once, and that you can compile to a file
516 as well as to memory.
517 (gcc_jit_result): Clarify that this is the result of an
518 in-memory compilation.
519 (gcc_jit_context_compile): Clarify that you can compile, and that
520 this is an in-memory compilation.
521 (enum gcc_jit_output_kind): New enum.
522 (gcc_jit_context_compile_to_file): New function.
523 (gcc_jit_context_enable_dump): Clarify comment to cover both forms
524 of compilation.
525 * libgccjit.map (gcc_jit_context_compile_to_file): New API
526 entrypoint.
527 * notes.txt: Update to show the playback::context::postprocess
528 virtual function.
529
450e225b
DM
5302015-01-19 David Malcolm <dmalcolm@redhat.com>
531
532 * jit-recording.c
533 (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
534 Add missing format string.
535
499de348
DM
5362015-01-16 David Malcolm <dmalcolm@redhat.com>
537
538 * Make-lang.in (lang_checks_parallelized): Add "check-jit".
539 (check_jit_parallelize): Set this to an arbitrary value (10).
540
e989e68d
JJ
5412015-01-16 Jakub Jelinek <jakub@redhat.com>
542
543 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
544 last argument.
545 (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
546 undef afterwards.
547 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
548 Likewise.
549
179ed8f5
RS
5502015-01-15 Richard Sandiford <richard.sandiford@arm.com>
551
552 Update copyright years in docs/.
553
96a87981
DM
5542015-01-15 David Malcolm <dmalcolm@redhat.com>
555
556 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
557 lvalue and the rvalue are of compatible type.
558
86d0ac88
DM
5592015-01-13 David Malcolm <dmalcolm@redhat.com>
560
561 * docs/cp/topics/contexts.rst (Debugging): Add
562 gccjit::context::dump_reproducer_to_file.
563 * docs/internals/index.rst (Design notes): New section,
564 discussing input validation and
565 gcc_jit_context_dump_reproducer_to_file.
566 * docs/topics/contexts.rst (Debugging): Add
567 gcc_jit_context_dump_reproducer_to_file.
568 * docs/_build/texinfo/libgccjit.texi: Regenerate.
569 * jit-common.h (gcc::jit::dump::get_context): New accessor.
570 * jit-recording.c: Include "hash-map.h".
571 Within namespace ::gcc::jit...
572 (dump::write): Flush each line.
573 (dump::make_location): Pass false for new param "created_by_user".
574 (class allocator): New class.
575 (allocator::~allocator): New function.
576 (allocator::xstrdup_printf): New function.
577 (allocator::xstrdup_printf_va): New function.
578 (class reproducer): New subclass of dump.
579 (reproducer::reproducer): New function.
580 (reproducer::write_params): New function.
581 (reproducer::write_args): New function.
582 (reproducer::make_identifier): New function.
583 (reproducer::make_tmp_identifier): New function.
584 (reproducer::get_identifier): New pair of functions.
585 (reproducer::get_identifier_as_rvalue): New function.
586 (reproducer::get_identifier_as_lvalue): New function.
587 (reproducer::get_identifier_as_type): New function.
588 (reproducer::xstrdup_printf): New function.
589 (recording::context::context): Initialize m_toplevel_ctxt.
590 (recording::context::new_location): Add param created_by_user.
591 (str_option_reproducer_strings): New table of strings.
592 (int_option_reproducer_strings): Likewise.
593 (bool_option_reproducer_strings): Likewise.
594 (get_type_enum_strings): Likewise.
595 (names_of_function_kinds): Likewise.
596 (global_kind_reproducer_strings): Likewise.
597 (unary_op_reproducer_strings): Likewise.
598 (binary_op_reproducer_strings): Likewise.
599 (comparison_reproducer_strings): Likewise.
600 Within namespace ::gcc::jit::recording::...
601 (context::dump_reproducer_to_file): New function.
602 (string::write_reproducer): Likewise.
603 (location::write_reproducer): Likewise.
604 (type::access_as_type): Likewise.
605 (memento_of_get_type::write_reproducer): Likewise.
606 (memento_of_get_pointer::write_reproducer): Likewise.
607 (memento_of_get_const::write_reproducer): Likewise.
608 (memento_of_get_volatile::write_reproducer): Likewise.
609 (array_type::write_reproducer): Likewise.
610 (function_type::write_reproducer): Likewise.
611 (function_type::write_deferred_reproducer): Likewise.
612 (field::write_reproducer): Likewise.
613 (struct_::access_as_type): Likewise.
614 (struct_::write_reproducer): Likewise.
615 (union_::write_reproducer): Likewise.
616 (fields::write_reproducer): Likewise.
617 (rvalue::access_as_rvalue): Likewise.
618 (lvalue::access_as_rvalue): Likewise.
619 (lvalue::access_as_lvalue): Likewise.
620 (param::access_as_rvalue): Likewise.
621 (param::access_as_lvalue): Likewise.
622 (param::write_reproducer): Likewise.
623 (function::write_reproducer): Likewise.
624 (block::write_reproducer): Likewise.
625 (global::write_reproducer): Likewise.
626 (memento_of_new_rvalue_from_const <int>::write_reproducer):
627 Likewise.
628 (memento_of_new_rvalue_from_const <long>::write_reproducer):
629 Likewise.
630 (memento_of_new_rvalue_from_const <double>::write_reproducer):
631 Likewise.
632 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
633 Likewise.
634 (memento_of_new_string_literal::write_reproducer): Likewise.
635 (unary_op::write_reproducer): Likewise.
636 (binary_op::write_reproducer): Likewise.
637 (comparison::write_reproducer): Likewise.
638 (cast::write_reproducer): Likewise.
639 (call::write_reproducer): Likewise.
640 (call_through_ptr::write_reproducer): Likewise.
641 (array_access::write_reproducer): Likewise.
642 (access_field_of_lvalue::write_reproducer): Likewise.
643 (access_field_rvalue::write_reproducer): Likewise.
644 (dereference_field_rvalue::write_reproducer): Likewise.
645 (dereference_rvalue::write_reproducer): Likewise.
646 (get_address_of_lvalue::write_reproducer): Likewise.
647 (local::write_reproducer): Likewise.
648 (eval::write_reproducer): Likewise.
649 (assignment::write_reproducer): Likewise.
650 (assignment_op::write_reproducer): Likewise.
651 (comment::write_reproducer): Likewise.
652 (conditional::write_reproducer): Likewise.
653 (jump::write_reproducer): Likewise.
654 (return_::write_reproducer): Likewise.
655 * jit-recording.h (gcc::jit::reproducer): New forward declararion.
656 Within namespace ::gcc::jit::recording::...
657 (context::new_location): Add "created_by_user" param.
658 (context::dump_reproducer_to_file): New method.
659 (context::m_toplevel_ctxt): New field.
660 (memento::write_reproducer): New pure virtual function.
661 (memento::dyn_cast_location): New virtual function.
662 (string::write_reproducer):
663 (location::location): Add "created_by_user" param.
664 (location::dyn_cast_location): New function.
665 (location::created_by_user): New accessor.
666 (location::write_reproducer): New function.
667 (location::m_created_by_user): New field.
668 (type::access_as_type): New virtual function.
669 (location::write_reproducer): Likewise.
670 (type::access_as_type): Likewise.
671 (memento_of_get_type::write_reproducer): Likewise.
672 (memento_of_get_pointer::write_reproducer): Likewise.
673 (memento_of_get_const::write_reproducer): Likewise.
674 (memento_of_get_volatile::write_reproducer): Likewise.
675 (array_type::write_reproducer): Likewise.
676 (function_type::write_reproducer): Likewise.
677 (function_type::write_deferred_reproducer): Likewise.
678 (field::write_reproducer): Likewise.
679 (struct_::access_as_type): Likewise.
680 (struct_::write_reproducer): Likewise.
681 (union_::write_reproducer): Likewise.
682 (union_::m_fields): Remove stray unused field.
683 (fields::length): New accessor.
684 (fields::get_field): New accessor.
685 (fields::write_reproducer): New function.
686 (rvalue::access_as_rvalue): Likewise.
687 (lvalue::access_as_rvalue): Likewise.
688 (lvalue::access_as_lvalue): Likewise.
689 (param::access_as_rvalue): Likewise.
690 (param::access_as_lvalue): Likewise.
691 (param::write_reproducer): Likewise.
692 (function::write_reproducer): Likewise.
693 (block::write_reproducer): Likewise.
694 (global::write_reproducer): Likewise.
695 (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
696 Likewise.
697 (memento_of_new_string_literal::write_reproducer): Likewise.
698 (unary_op::write_reproducer): Likewise.
699 (binary_op::write_reproducer): Likewise.
700 (comparison::write_reproducer): Likewise.
701 (cast::write_reproducer): Likewise.
702 (call::write_reproducer): Likewise.
703 (call_through_ptr::write_reproducer): Likewise.
704 (array_access::write_reproducer): Likewise.
705 (access_field_of_lvalue::write_reproducer): Likewise.
706 (access_field_rvalue::write_reproducer): Likewise.
707 (dereference_field_rvalue::write_reproducer): Likewise.
708 (dereference_rvalue::write_reproducer): Likewise.
709 (get_address_of_lvalue::write_reproducer): Likewise.
710 (local::write_reproducer): Likewise.
711 (eval::write_reproducer): Likewise.
712 (assignment::write_reproducer): Likewise.
713 (assignment_op::write_reproducer): Likewise.
714 (comment::write_reproducer): Likewise.
715 (conditional::write_reproducer): Likewise.
716 (jump::write_reproducer): Likewise.
717 (return_::write_reproducer): Likewise.
718 * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
719 * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
720 param "created_by_user".
721 (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
722 * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
723 entrypoint.
724 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
725 entrypoint.
726
f6f2b019
DM
7272015-01-12 David Malcolm <dmalcolm@redhat.com>
728
729 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
730 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
731 ctor.
732 (gcc::jit::rvalue_usage_validator::visit): New function.
733 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
734 function.
735 (gcc::jit::recording::rvalue::set_scope): New function.
736 (gcc::jit::recording::function::function): Call set_scope on each
737 param, issuing errors for any params that already have a function.
738 (gcc::jit::recording::block::add_eval): Return the new statement;
739 update the comment given that some error-checking now happens after
740 this returns.
741 (gcc::jit::recording::block::add_assignment): Likewise.
742 (gcc::jit::recording::block::add_assignment_op): Likewise.
743 (gcc::jit::recording::block::add_comment): Likewise.
744 (gcc::jit::recording::block::end_with_conditional): Likewise.
745 (gcc::jit::recording::block::end_with_jump): Likewise.
746 (gcc::jit::recording::block::end_with_return): Likewise.
747 (gcc::jit::recording::block::validate): Add a comment.
748 (gcc::jit::recording::unary_op::visit_children): New function.
749 (gcc::jit::recording::binary_op::visit_children): New function.
750 (gcc::jit::recording::comparison::visit_children): New function.
751 (gcc::jit::recording::cast::visit_children): New function.
752 (gcc::jit::recording::call::visit_children): New function.
753 (gcc::jit::recording::call_through_ptr::visit_children): New function.
754 (gcc::jit::recording::array_access::visit_children): New function.
755 (gcc::jit::recording::access_field_of_lvalue::visit_children): New
756 function.
757 (gcc::jit::recording::access_field_rvalue::visit_children): New
758 function.
759 (gcc::jit::recording::dereference_field_rvalue::visit_children):
760 New function.
761 (gcc::jit::recording::dereference_rvalue::visit_children): New
762 function.
763 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
764 function.
765 * jit-recording.h: Within namespace gcc::jit::recording...
766 (class rvalue_visitor): New.
767 (rvalue::rvalue): Initialize m_scope.
768 (rvalue::get_loc): New accessor.
769 (rvalue::verify_valid_within_stmt): New function.
770 (rvalue::visit_children): New pure virtual function.
771 (rvalue::set_scope): New function.
772 (rvalue::get_scope): New function.
773 (rvalue::dyn_cast_param): New function.
774 (rvalue::m_scope): New field.
775 (param::visit_children): New empty function.
776 (param::dyn_cast_param): New function.
777 (function::get_loc): New function.
778 (block::add_eval): Return the new statement.
779 (block::add_assignment): Likewise.
780 (block::add_assignment_op): Likewise.
781 (block::add_comment): Likewise.
782 (block::end_with_conditional): Likewise.
783 (block::end_with_jump): Likewise.
784 (block::end_with_return): Likewise.
785 (global::visit_children): New function.
786 (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
787 New function.
788 (memento_of_new_string_literal::visit_children): New function.
789 (unary_op::visit_children): New function.
790 (binary_op::visit_children): New function.
791 (comparison::visit_children): New function.
792 (cast::visit_children): New function.
793 (call::visit_children): New function.
794 (call_through_ptr::visit_children): New function.
795 (array_access::visit_children): New function.
796 (access_field_of_lvalue::visit_children): New function.
797 (access_field_rvalue::visit_children): New function.
798 (dereference_field_rvalue::visit_children): New function.
799 (dereference_rvalue::visit_children): New function.
800 (get_address_of_lvalue::visit_children): New function.
801 (local::local): Call set_scope.
802 (local::visit_children): New function.
803 (statement::get_block): Make public.
804 * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
805 (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
806 (gcc_jit_context_new_function): Verify that each param has
807 not yet been used for creating another function.
808 (gcc_jit_block_add_eval): After creating the stmt, verify
809 that the rvalue expression tree is valid to use within it.
810 (gcc_jit_block_add_assignment): Likewise for the lvalue and
811 rvalue expression trees.
812 (gcc_jit_block_add_assignment_op): Likewise.
813 (gcc_jit_block_end_with_conditional): Likewise for the boolval
814 expression tree.
815 (gcc_jit_block_end_with_return): Likewise for the rvalue
816 expression tree.
817 (gcc_jit_block_end_with_void_return): Remove return of "void",
818 now that block::end_with_return is now non-void.
819
1c35cc2c
DM
8202015-01-12 David Malcolm <dmalcolm@redhat.com>
821
822 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
823 Add missing fclose on error-handling path.
824
791cfef8
DM
8252015-01-12 David Malcolm <dmalcolm@redhat.com>
826
827 * docs/cp/topics/expressions.rst (Global variables): Add
828 enum gcc_jit_global_kind param to gccjit::context::new_global.
829 * docs/topics/expressions.rst (Global variables): Likewise.
830 Document the new enum.
831 * docs/topics/results.rst (Compilation results): Document
832 globals-handling.
833 * docs/_build/texinfo/libgccjit.texi: Regenerate.
834 * dummy-frontend.c (jit_langhook_write_globals): Call into the
835 playback context's write_global_decls_1 and write_global_decls_2
836 before and after calling symtab->finalize_compilation_unit ().
837 * jit-playback.c: Include "debug.h".
838 (gcc::jit::playback::context::new_global): Add "kind" param and
839 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
840 underlying VAR_DECL. Call varpool_node::get_create on the
841 VAR_DECL, and add it to m_globals.
842 (gcc::jit::playback::context::write_global_decls_1): New function.
843 (gcc::jit::playback::context::write_global_decls_2): New function.
844 * jit-playback.h (gcc::jit::playback::context::context): Call
845 create on m_globals.
846 (gcc::jit::playback::context::new_global): Add "kind" param.
847 (gcc::jit::playback::context::write_global_decls_1): New function.
848 (gcc::jit::playback::context::write_global_decls_2): New function.
849 (gcc::jit::playback::context::m_globals): New field.
850 * jit-recording.c (gcc::jit::recording::context::context):
851 Initialize m_globals.
852 (gcc::jit::recording::context::new_global): Add param "kind".
853 Add the new global to m_globals.
854 (gcc::jit::recording::context::dump_to_file): Dump the globals.
855 (gcc::jit::recording::global::replay_into): Add field m_kind.
856 (gcc::jit::recording::global::write_to_dump): New override.
857 * jit-recording.h (gcc::jit::recording::context::new_global): Add
858 param "kind".
859 (gcc::jit::recording::context::m_globals): New field.
860 (gcc::jit::recording::global::global): Add param kind.
861 (gcc::jit::recording::global::write_to_dump): New override.
862 (gcc::jit::recording::global::m_kind): New field.
863 * jit-result.c (gcc::jit::result::get_global): New function.
864 * jit-result.h (gcc::jit::result::get_global): New function.
865 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
866 * libgccjit.c (gcc_jit_context_new_global): Likewise.
867 (gcc_jit_result_get_global): New API entrypoint.
868 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
869 (enum gcc_jit_global_kind): New enum.
870 (gcc_jit_context_new_global): API change: add "kind" param.
871 * libgccjit.map (gcc_jit_result_get_global): New symbol.
872
860e981c
DM
8732015-01-09 David Malcolm <dmalcolm@redhat.com>
874
875 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
876 "symtab.h", "inchash.h". Move include of "hash-set.h" much
877 earlier.
878 * jit-builtins.c: Remove redundant includes of "opts.h" and
879 "tree.h".
880 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
881 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
882 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
883 "statistics.h", "vec.h", "double-int.h", "real.h",
884 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
885 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
886 earlier.
887 * jit-recording.c: Remove redundant includes of "opts.h" and
888 "tree.h".
889
ccce3b2a
DM
8902015-01-09 David Malcolm <dmalcolm@redhat.com>
891
892 * docs/cp/topics/expressions.rst (Simple expressions): Use
893 ":c:type:" for C types. Document new overload of
894 gcc::jit::context::new_rvalue.
895 * docs/topics/expressions.rst (Simple expressions): Use
896 ":c:type:" for C types. Document new entrypoint
897 gcc_jit_context_new_rvalue_from_long.
898 * docs/_build/texinfo/libgccjit.texi: Regenerate.
899 * jit-playback.c: Within namespace gcc::jit::playback...
900 (context::new_rvalue_from_int): Eliminate in favor of...
901 (context::new_rvalue_from_const <int>): ...this.
902 (context::new_rvalue_from_double): Eliminate in favor of...
903 (context::new_rvalue_from_const <double>): ...this.
904 (context::new_rvalue_from_const <long>): New.
905 (context::new_rvalue_from_ptr): Eliminate in favor of...
906 (context::new_rvalue_from_const <void *>): ...this.
907 * jit-playback.h: Within namespace gcc::jit::playback...
908 (context::new_rvalue_from_int): Eliminate in favor of...
909 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
910 (context::new_rvalue_from_double): Likewise.
911 (context::new_rvalue_from_ptr): Likewise.
912 * jit-recording.c: Within namespace gcc::jit::recording...
913 (context::new_rvalue_from_int): Eliminate.
914 (context::new_rvalue_from_double): Likewise.
915 (context::new_rvalue_from_ptr): Likewise.
916 (class memento_of_new_rvalue_from_const <int>):
917 Add explicit specialization.
918 (class memento_of_new_rvalue_from_const <long>):
919 Likewise.
920 (class memento_of_new_rvalue_from_const <double>):
921 Likewise.
922 (class memento_of_new_rvalue_from_const <void *>):
923 Likewise.
924 (memento_of_new_rvalue_from_int::replay_into):
925 Generalize into...
926 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
927 ...this...
928 (memento_of_new_rvalue_from_double::replay_into):
929 ...allowing this...
930 (memento_of_new_rvalue_from_ptr::replay_into):
931 ...and this to be deleted.
932 (memento_of_new_rvalue_from_int::make_debug_string):
933 Convert to...
934 (memento_of_new_rvalue_from_const <int>::make_debug_string):
935 ...this.
936 (memento_of_new_rvalue_from_double::make_debug_string):
937 Convert to...
938 (memento_of_new_rvalue_from_const <double>::make_debug_string):
939 ...this.
940 (memento_of_new_rvalue_from_ptr::make_debug_string)
941 Convert to...
942 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
943 ...this.
944 (memento_of_new_rvalue_from_const <long>::make_debug_string):
945 New function.
946 * jit-recording.h: Within namespace gcc::jit::recording...
947 (context::new_rvalue_from_int): Eliminate.
948 (context::new_rvalue_from_double): Likewise.
949 (context::new_rvalue_from_ptr): Likewise, all in favor of...
950 (context::new_rvalue_from_const <HOST_TYPE>): New family of
951 methods.
952 (class memento_of_new_rvalue_from_int): Eliminate.
953 (class memento_of_new_rvalue_from_double): Likewise.
954 (class memento_of_new_rvalue_from_ptr): Likewise.
955 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
956 of rvalue subclasses.
957 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
958 "long".
959 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
960 rewriting of recording::context::new_rvalue_from_int to
961 recording::context::new_rvalue_from_const <int>.
962 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
963 (gcc_jit_context_new_rvalue_from_double): Update for
964 rewriting of recording::context::new_rvalue_from_double to
965 recording::context::new_rvalue_from_const <double>.
966 (gcc_jit_context_new_rvalue_from_ptr): Update for
967 rewriting of recording::context::new_rvalue_from_ptr to
968 recording::context::new_rvalue_from_const <void *>.
969 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
970 entrypoint.
971 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
972
d2286af3
DM
9732015-01-09 David Malcolm <dmalcolm@redhat.com>
974
975 PR jit/64206
976 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
977 shows tempdir creation/cleanup.
978 * docs/_build/texinfo/libgccjit.texi: Regenerate.
979 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
980 to the list of subclasses in the comment.
981 * jit-playback.c (gcc::jit::playback::context::context): Add a
982 comment clarifying when the tempdir gets cleaned up.
983 (gcc::jit::playback::context::compile): Pass the context's logger,
984 if any, to the tempdir.
985 (gcc::jit::playback::context::dlopen_built_dso): When creating the
986 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
987 over ownership of the tempdir to it.
988 * jit-result.c: Include "jit-tempdir.h".
989 (gcc::jit::result::result): Add tempdir param, saving it as
990 m_tempdir.
991 (gcc::jit::result::~result): Delete m_tempdir.
992 * jit-result.h (gcc::jit::result::result): Add tempdir param.
993 (gcc::jit::result::m_tempdir): New field.
994 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
995 add JIT_LOG_SCOPE.
996 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
997 and log m_path_template and m_path_tempdir.
998 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
999 entry/exit, and log the unlink and rmdir calls.
1000 * jit-tempdir.h: Include "jit-logging.h".
1001 (class gcc::jit::tempdir): Make this be a subclass of log_user.
1002 (gcc::jit::tempdir::tempdir): Add logger param.
1003 * notes.txt: Update to show the two possible places where the
1004 tempdir can be cleaned up.
1005
7c8db13e
DM
10062015-01-08 David Malcolm <dmalcolm@redhat.com>
1007
1008 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1009 comment.
1010
303e1d56
DM
10112015-01-08 David Malcolm <dmalcolm@redhat.com>
1012
1013 * docs/topics/contexts.rst (Error-handling): Document new
1014 entrypoint gcc_jit_context_get_last_error.
1015 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1016 * jit-recording.c (gcc::jit::recording::context::context):
1017 Initialize new fields "m_last_error_str" and
1018 "m_owns_last_error_str".
1019 (gcc::jit::recording::context::~context): Clean up
1020 m_last_error_str, if needed.
1021 (gcc::jit::recording::context::add_error_va): Update
1022 m_last_error_str and m_owns_last_error_str, freeing the old
1023 value if appropriate.
1024 (gcc::jit::recording::context::get_last_error): New function.
1025 * jit-recording.h (gcc::jit::recording::context::get_last_error):
1026 New function.
1027 (gcc::jit::recording::context): New fields m_last_error_str and
1028 m_owns_last_error_str.
1029 * libgccjit.c (gcc_jit_context_get_last_error): New function.
1030 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1031 * libgccjit.map (gcc_jit_context_get_last_error): New function.
1032
eb4c16eb
DM
10332015-01-08 David Malcolm <dmalcolm@redhat.com>
1034
1035 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1036 * docs/internals/index.rst (Overview of code structure): Mention
1037 gcc_jit_context_set_logfile, and embed the example logfile.
1038 * docs/internals/test-hello-world.exe.log.txt: New file: example
1039 of a logfile.
1040 * docs/topics/contexts.rst (Debugging): Add documentation
1041 for gcc_jit_context_set_logfile.
1042 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1043 * dummy-frontend.c: Include "jit-logging.h".
1044 (jit_langhook_init): Assert that there is an active playback
1045 context. If it has a logger, log entry/exit to this function.
1046 (jit_langhook_write_globals): Likewise.
1047 * jit-common.h (gcc::jit::logger): New forward declaration.
1048 * jit-logging.c: New file.
1049 * jit-logging.h: New file.
1050 * jit-playback.c: Include "jit-logging.h".
1051 (gcc::jit::playback::context::context): Initialize the log_user
1052 base class from the recording context's logger (if any). Use
1053 JIT_LOG_SCOPE to log entry/exit from the function body.
1054 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1055 log entry/exit from the function body.
1056 (gcc::jit::playback::build_stmt_list): Likewise.
1057 (gcc::jit::playback::function::postprocess): Likewise.
1058 (gcc::jit::playback::context::compile): Likewise. Log the
1059 entry/exit to toplev::main and toplev::finalize. Log the
1060 fake argv passed to toplev::main.
1061 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1062 log entry/exit from the function body.
1063 (gcc::jit::playback::context::release_mutex): Likewise.
1064 (gcc::jit::playback::context::make_fake_args): Likewise.
1065 (gcc::jit::playback::context::extract_any_requested_dumps):
1066 Likewise.
1067 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1068 log the arguments that the driver is invoked with.
1069 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
1070 the logger to the result object.
1071 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1072 log entry/exit from the function body.
1073 (gcc::jit::playback::context::dump_generated_code): Likewise.
1074 (gcc::jit::playback::context::handle_locations): Likewise.
1075 * jit-playback.h (gcc::jit::playback::context): Make this be
1076 a subclass of gcc::jit::log_user.
1077 * jit-recording.c: Include "jit-logging.h".
1078 (gcc::jit::recording::context::context: Initialize the logger to
1079 NULL for root contexts, or to the parent's logger for child
1080 contexts.
1081 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1082 log entry/exit from the function body.
1083 (gcc::jit::recording::context::replay_into): Likewise.
1084 (gcc::jit::recording::context::disassociate_from_playback):
1085 Likewise.
1086 (gcc::jit::recording::context::compile): Likewise.
1087 (recording::context::add_error_va): Likewise. Also, log the
1088 error.
1089 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1090 log entry/exit from the function body.
1091 * jit-recording.h: Include "jit-logging.h".
1092 (gcc::jit::recording::context): Make this be a subclass of
1093 gcc::jit::log_user.
1094 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1095 (gcc::jit::result::result): Add logger param, recording it.
1096 Use JIT_LOG_SCOPE to log entry/exit from the function body.
1097 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1098 log entry/exit from the function body.
1099 (gcc::jit::result::get_code): Likewise.
1100 * jit-result.h (gcc::jit::result): Make this be a subclass of
1101 gcc::jit::log_user.
1102 (gcc::jit::result::result): Add logger parameter.
1103 * libgccjit++.h (gccjit::context::set_logfile): New function.
1104 * libgccjit.c: Include "jit-logging.h".
1105 (gcc_jit_context_acquire): Log the context.
1106 (gcc_jit_context_release): Use JIT_LOG_FUNC to
1107 log entry/exit from the function body, and log the context.
1108 (gcc_jit_context_new_child_context): Likewise, logging both
1109 contexts.
1110 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1111 log entry/exit from the function body.
1112 (gcc_jit_context_get_type): Likewise.
1113 (gcc_jit_context_get_int_type): Likewise.
1114 (gcc_jit_context_new_array_type): Likewise.
1115 (gcc_jit_context_new_field): Likewise.
1116 (gcc_jit_context_new_struct_type): Likewise.
1117 (gcc_jit_context_new_opaque_struct): Likewise.
1118 (gcc_jit_struct_set_fields): Likewise.
1119 (gcc_jit_context_new_union_type): Likewise.
1120 (gcc_jit_context_new_function_ptr_type): Likewise.
1121 (gcc_jit_context_new_param): Likewise.
1122 (gcc_jit_context_new_function): Likewise.
1123 (gcc_jit_context_get_builtin_function): Likewise.
1124 (gcc_jit_function_get_param): Likewise.
1125 (gcc_jit_function_dump_to_dot): Likewise.
1126 (gcc_jit_function_new_block): Likewise.
1127 (gcc_jit_context_new_global): Likewise.
1128 (gcc_jit_context_new_rvalue_from_int): Likewise.
1129 (gcc_jit_context_zero): Likewise.
1130 (gcc_jit_context_one): Likewise.
1131 (gcc_jit_context_new_rvalue_from_double): Likewise.
1132 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1133 (gcc_jit_context_null): Likewise.
1134 (gcc_jit_context_new_string_literal): Likewise.
1135 (gcc_jit_context_new_unary_op): Likewise.
1136 (gcc_jit_context_new_binary_op): Likewise.
1137 (gcc_jit_context_new_comparison): Likewise.
1138 (gcc_jit_context_new_call): Likewise.
1139 (gcc_jit_context_new_call_through_ptr): Likewise.
1140 (gcc_jit_context_new_cast): Likewise.
1141 (gcc_jit_context_new_array_access): Likewise.
1142 (gcc_jit_lvalue_access_field): Likewise.
1143 (gcc_jit_rvalue_access_field): Likewise.
1144 (gcc_jit_rvalue_dereference_field): Likewise.
1145 (gcc_jit_rvalue_dereference): Likewise.
1146 (gcc_jit_lvalue_get_address): Likewise.
1147 (gcc_jit_function_new_local): Likewise.
1148 (gcc_jit_block_add_eval): Likewise.
1149 (gcc_jit_block_add_assignment): Likewise.
1150 (gcc_jit_block_add_assignment_op): Likewise.
1151 (gcc_jit_block_end_with_conditional): Likewise.
1152 (gcc_jit_block_add_comment): Likewise.
1153 (gcc_jit_block_end_with_jump): Likewise.
1154 (gcc_jit_block_end_with_return): Likewise.
1155 (gcc_jit_block_end_with_void_return): Likewise.
1156 (gcc_jit_context_set_str_option): Likewise.
1157 (gcc_jit_context_set_int_option): Likewise.
1158 (gcc_jit_context_set_bool_option): Likewise.
1159 (gcc_jit_context_enable_dump): Likewise.
1160 (gcc_jit_context_compile): Likewise. Also log the context,
1161 and the result.
1162 (gcc_jit_context_dump_to_file): Likewise.
1163 (gcc_jit_context_set_logfile): New function.
1164 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1165 log entry/exit from the function body.
1166 (gcc_jit_result_get_code): Likewise. Also log the fnname)
1167 and the ptr to be returned.
1168 (gcc_jit_result_release): Likewise. Also log the result.
1169 * libgccjit.h: Include <stdio.h>, since we need FILE *.
1170 (gcc_jit_context_set_logfile): New declaration.
1171 * libgccjit.map (gcc_jit_context_set_logfile): New.
1172
c211cd23
DM
11732015-01-07 David Malcolm <dmalcolm@redhat.com>
1174
1175 * jit-recording.h (gcc::jit::recording::type::is_void): New
1176 virtual function.
1177 (gcc::jit::recording::memento_of_get_type::is_void): New
1178 function, overriding default implementation.
1179 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1180 the underlying type is not "void".
1181
18146f45
DM
11822015-01-07 David Malcolm <dmalcolm@redhat.com>
1183
1184 * docs/topics/expressions.rst (Unary Operations): Add
1185 GCC_JIT_UNARY_OP_ABS.
1186 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1187 Likewise.
1188 * jit-recording.c (unary_op_strings): Likewise.
1189 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1190 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1191 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1192 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1193
11af98ff
DM
11942015-01-07 David Malcolm <dmalcolm@redhat.com>
1195
1196 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1197 typo in comment.
1198
433d16df
DM
11992015-01-07 David Malcolm <dmalcolm@redhat.com>
1200
1201 * TODO.rst (Test suite): Remove item about running C++ testcases.
1202 * docs/internals/index.rst (Working on the JIT library): Add
1203 "c++" to the enabled languages in the suggested "configure"
1204 invocation, and add a description of why this is necessary.
1205 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1206
50bb6c8e
DM
12072015-01-07 David Malcolm <dmalcolm@redhat.com>
1208
1209 * docs/internals/index.rst: Update to reflect that built
1210 testcases are now test-foo.c.exe, rather than test-foo.exe.
1211 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1212
1e3b6a3d
JJ
12132015-01-05 Jakub Jelinek <jakub@redhat.com>
1214
1215 Update copyright years.
1216
e8af59bc
DM
12172014-12-19 David Malcolm <dmalcolm@redhat.com>
1218
1219 * jit-playback.c (gcc::jit::playback::context::build_cast): In
1220 case BOOLEAN_TYPE, don't assume that the source expression is
1221 of type "int".
1222
5afd44e3
DM
12232014-12-19 David Malcolm <dmalcolm@redhat.com>
1224
1225 * jit-recording.c (gcc::jit::recording::context::context): When
1226 copying string options from a parent context, take a copy of the
1227 underlying buffers, rather than simply copying the pointer.
1228
1f0858d7
DM
12292014-12-19 David Malcolm <dmalcolm@redhat.com>
1230
1231 * jit-recording.c (gcc::jit::recording::context::set_str_option):
1232 Handle NULL.
1233
35291c7d
DM
12342014-12-11 David Malcolm <dmalcolm@redhat.com>
1235
1236 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1237 Document new function.
1238 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1239
7b31ff5e
DM
12402014-12-10 Ulrich Drepper <drepper@gmail.com>
1241
1242 Minor interface cleanups of libgccjit
1243 * jit-playback.c (convert_to_dso): Use auto_vec instead
1244 of automatic array to build up command line.
1245 * jit-recording.c (recording::context::set_str_option):
1246 Make copy of the string.
1247 (recording::context::~context): Free string options.
1248 * jit-recording.h (recording::context): Adjust type
1249 of m_str_options member.
1250 * libgccjit.h: Adjust comment about
1251 gcc_jit_context_set_str_option parameter being used after
1252 the call.
1253 Update comment now that all interfaces are copy strings
1254 if necessary.
1255 * libgccjit++.h (gccjit::context): Add set_str_option
1256 member function.
1257
29df5715
DM
12582014-12-10 David Malcolm <dmalcolm@redhat.com>
1259
1260 * docs/cp/index.rst: New file.
1261 * docs/cp/intro/index.rst: New file.
1262 * docs/cp/intro/tutorial01.rst: New file.
1263 * docs/cp/intro/tutorial02.rst: New file.
1264 * docs/cp/intro/tutorial03.rst: New file.
1265 * docs/cp/intro/tutorial04.rst: New file.
1266 * docs/cp/topics/contexts.rst: New file.
1267 * docs/cp/topics/expressions.rst: New file.
1268 * docs/cp/topics/functions.rst: New file.
1269 * docs/cp/topics/index.rst: New file.
1270 * docs/cp/topics/locations.rst: New file.
1271 * docs/cp/topics/objects.rst: New file.
1272 * docs/cp/topics/results.rst: New file.
1273 * docs/cp/topics/types.rst: New file.
1274 * docs/examples/tut01-hello-world.cc: New file.
1275 * docs/examples/tut02-square.c: Fix missing newline in output.
1276 * docs/examples/tut02-square.cc: New file.
1277 * docs/examples/tut03-sum-of-squares.cc: New file.
1278 * docs/examples/tut04-toyvm/toyvm.cc: New file.
1279 * docs/index.rst: Move summary to above the table of contents.
1280 Add text about the C vs C++ APIs.
1281 * docs/topics/contexts.rst: Fix a typo.
1282
1283 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1284 * docs/_build/texinfo/factorial1.png: New file.
1285 * docs/_build/texinfo/sum-of-squares1.png: New file.
1286
5cd614ce
DM
12872014-12-09 David Malcolm <dmalcolm@redhat.com>
1288
1289 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1290 logic for determine "funcname" to new function...
1291 (get_function_name): ...here, adding logic to skip any leading
1292 path from the filename.
1293 (toyvm_function_parse): Use the filename for fn_filename, rather
1294 than "name", so that the debugger can locate the source .toy
1295 file.
1296 (toyvm_function_parse): Don't fclose a NULL FILE *.
1297
2712de78
DM
12982014-12-09 David Malcolm <dmalcolm@redhat.com>
1299
1300 PR jit/63854
1301 * docs/internals/index.rst (Running under valgrind): New
1302 subsection.
1303 (docs/_build/texinfo/libgccjit.texi): Regenerate.
1304
d1e5f2c7
DM
13052014-12-09 David Malcolm <dmalcolm@redhat.com>
1306
1307 PR jit/64206
1308 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1309 * jit-common.h (gcc::jit::tempdir): New forward decl.
1310 * jit-playback.c: Include jit-tempdir.h.
1311 (gcc::jit::playback::context::context): Initialize m_tempdir.
1312 (gcc::jit::playback::context::~context): Move tempdir
1313 cleanup to new file jit-tempdir.c
1314 (make_tempdir_path_template): Move to new file jit-tempdir.c.
1315 (gcc::jit::playback::context::compile): Move tempdir creation
1316 to new tempdir object in new file jit-tempdir.c.
1317 (gcc::jit::playback::context::make_fake_args): Get path from
1318 tempdir object rather than from member data.
1319 (gcc::jit::playback::context::convert_to_dso): Likewise.
1320 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1321 (gcc::jit::playback::context::dump_generated_code): Likewise.
1322 (gcc::jit::playback::context::get_path_c_file): New function.
1323 (gcc::jit::playback::context::get_path_s_file): New function.
1324 (gcc::jit::playback::context::get_path_so_file): New function.
1325 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1326 New function.
1327 (gcc::jit::playback::context::get_path_s_file): New function.
1328 (gcc::jit::playback::context::get_path_so_file): New function.
1329 (gcc::jit::playback::context): Move fields "m_path_template",
1330 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1331 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1332 * jit-tempdir.c: New file.
1333 * jit-tempdir.h: New file.
1334
38771e4e
DM
13352014-12-09 David Malcolm <dmalcolm@redhat.com>
1336
1337 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1338 mutex here, immediately before using toplev, and release it here, on
1339 each exit path after acquisition.
1340 (jit_mutex): Move this variable here, from jit-recording.c.
1341 (gcc::jit::playback::context::acquire_mutex): New function, based on
1342 code in jit-recording.c.
1343 (gcc::jit::playback::context::release_mutex): Likewise.
1344 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1345 function.
1346 (gcc::jit::playback::context::release_mutex): New function.
1347 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1348 (gcc::jit::recording::context::compile): Move mutex-handling from
1349 here into jit-playback.c's gcc::jit::playback::context::compile.
1350 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1351 and RELEASE_MUTEX.
1352
38f4f641
DM
13532014-12-09 David Malcolm <dmalcolm@redhat.com>
1354
1355 * jit-playback.c (gcc::jit::playback::context::compile): Move the
1356 dlopen code into...
1357 (gcc::jit::playback::context::dlopen_built_dso): ...this new
1358 function.
1359 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1360 New function.
1361
82e0c914
DM
13622014-12-09 David Malcolm <dmalcolm@redhat.com>
1363
1364 PR jit/64166
1365 * docs/topics/contexts.rst (Debugging): Add description of
1366 gcc_jit_context_enable_dump.
1367 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1368 * jit-playback.c: Include context.h.
1369 (class auto_argvec): New class.
1370 (auto_argvec::~auto_argvec): New function.
1371 (gcc::jit::playback::context::compile): Convert fake_args to be
1372 an auto_argvec, so that it can contain dynamically-allocated
1373 strings. Construct a vec of all requested dumps, and pass it to
1374 make_fake_args. Extract requested dumps between the calls to
1375 toplev::main and toplev::finalize.
1376 (gcc::jit::playback::context::make_fake_args): Convert param
1377 "argvec" to be a vec <char *>, and gain a "requested_dumps"
1378 param. Convert to dynamically-allocated arg strings by converting
1379 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1380 for args that are already a copy. Add args for all requested dumps.
1381 (gcc::jit::playback::context::extract_any_requested_dumps): New
1382 function.
1383 (gcc::jit::playback::context::read_dump_file): New function.
1384 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1385 Convert param "argvec" to be a vec <char *>, and gain a
1386 "requested_dumps" param.
1387 (gcc::jit::playback::context::extract_any_requested_dumps): New
1388 function.
1389 (gcc::jit::playback::context::read_dump_file): New function.
1390 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1391 function.
1392 (gcc::jit::recording::context::get_all_requested_dumps): New
1393 function.
1394 * jit-recording.h (gcc::jit::recording::requested_dump): New
1395 struct.
1396 (gcc::jit::recording::context::enable_dump): New function.
1397 (gcc::jit::recording::context::get_all_requested_dumps): New
1398 function.
1399 (gcc::jit::recording::context::m_requested_dumps): New field.
1400 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1401 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1402 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1403
53b730ff
DM
14042014-12-08 David Malcolm <dmalcolm@redhat.com>
1405
1406 * libgccjit++.h: Indent the forward declarations of the classes to
1407 show the inheritance hierarchy.
1408
0f379445
DM
14092014-12-08 David Malcolm <dmalcolm@redhat.com>
1410
1411 * notes.txt: Show the beginning and ending of
1412 recording::context::compile vs playback::context::compile. Show
1413 the creation and unlinking of the tempdir. Show toplev::finalize.
1414 Move "RELEASE MUTEX" to the correct location. Show
1415 gcc_jit_result_release, and indicate where the
1416 dlopen/dlsym/dlclose occur.
1417
81ba15f1
DM
14182014-12-01 David Malcolm <dmalcolm@redhat.com>
1419
1420 * docs/examples/tut02-square.c (main): Release the context
1421 earlier, to show that this is possible. Update error-handling
1422 to avoid a double-release of the context, and to avoid
1423 releasing a NULL result.
1424 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1425 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1426 * docs/topics/results.rst (gcc_jit_result): Mention that this
1427 controls the lifetimes of machine code functions.
1428 (gcc_jit_result_get_code): Spell out the requirements for this
1429 to succeed, and the lifetime of the result.
1430 (gcc_jit_result_release): Mention that this invalidates any code
1431 that was obtained from the result.
1432 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1433
e250f0dc
DM
14342014-12-01 David Malcolm <dmalcolm@redhat.com>
1435
1436 PR jit/64018
1437 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1438 Add description of error-handling, taken in part from...
1439 * docs/topics/contexts.rst (Error-handling): Expand, and move some
1440 content to tutorial02.rst.
1441 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1442
eeafb319
DM
14432014-12-01 David Malcolm <dmalcolm@redhat.com>
1444
1445 PR jit/64020
1446 * docs/topics/types.rst (Standard types) Add new enum values to
1447 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1448 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1449 Widen the left-hand column so that
1450 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1451 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1452
1453 * jit-builtins.c: Include stringpool.h and jit-playback.h.
1454 Move everything out of the gcc::jit::recording namespace into
1455 just gcc::jit.
1456 (struct builtin_data): Add fields "fnclass", "attr", and
1457 "implicit_p".
1458 (DEF_BUILTIN): Update macro so populate the new fields.
1459 (builtins_manager::builtins_manager): Update for move out of
1460 recording namespace. Initialize the m_attributes array.
1461 (builtins_manager::get_builtin_function): Likewise.
1462 (builtins_manager::get_builtin_function_by_id): New function.
1463 (builtins_manager::make_builtin_function): Update for move out of
1464 recording namespace. Add fix for PR jit/64020 by detecting
1465 specific builtin ids and having them ensure that builtins for
1466 other ids are created as necessary.
1467 (builtins_manager::get_type): Update for move out of recording
1468 namespace.
1469 (builtins_manager::make_type): Likewise. Add some missing
1470 #undefs.
1471 (builtins_manager::make_primitive_type): Update for move out of
1472 recording namespace. Implement the three BT_COMPLEX_ cases and
1473 BT_DOUBLE_PTR.
1474 (builtins_manager::make_fn_type): Update for move out of recording
1475 namespace.
1476 (builtins_manager::make_ptr_type): Likewise.
1477 (builtins_manager::finish_playback): New function.
1478 (builtins_manager::get_class): New function.
1479 (builtins_manager::implicit_p): New function.
1480 (builtins_manager::get_attrs_tree): Two new functions.
1481 (builtins_manager::make_attrs_tree): New function.
1482
1483 * jit-builtins.h: Move everything out of the gcc::jit::recording
1484 namespace into just gcc::jit.
1485 (enum built_in_attribute): New.
1486 (builtins_manager::builtins_manager): Update decl for namespace
1487 change.
1488 (builtins_manager::get_builtin_function): Likewise.
1489 (builtins_manager::get_class): New.
1490 (builtins_manager::implicit_p): New.
1491 (builtins_manager::get_attrs_tree): Two new functions.
1492 (builtins_manager::make_attrs_tree): New function.
1493 (builtins_manager::finish_playback): New.
1494 (builtins_manager::get_builtin_function_by_id): New.
1495 (builtins_manager::make_builtin_function): Update decl for
1496 namespace change.
1497 (builtins_manager::get_type): Likewise.
1498 (builtins_manager::make_type): Likewise.
1499 (builtins_manager::make_primitive_type): Likewise.
1500 (builtins_manager::make_fn_type): Likewise.
1501 (builtins_manager::make_ptr_type): Likewise.
1502 (builtins_manager): Likewise for fields. Add new field
1503 "m_attributes".
1504
1505 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1506 (builtins_manager): Update forward decl to reflect namespace
1507 change.
1508
1509 * jit-playback.c: Include attribs.h and jit-builtins.h.
1510 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1511 for the new COMPLEX_ types.
1512 (gcc::jit::playback::context::new_function): If creating a
1513 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1514 and call set_builtin_decl.
1515 (gcc::jit::playback::context::replay): If we have a
1516 builtins_manager, call its finish_playback method when we're done.
1517
1518 * jit-playback.h:
1519 (gcc::jit::playback::context::get_builtins_manager): New function.
1520
1521 * jit-recording.c
1522 (gcc::jit::recording::context::get_builtins_manager): New function.
1523 (gcc::jit::recording::get_builtin_function): Use
1524 get_builtins_manager, in case we're a child context.
1525 (gcc::jit::recording::memento_of_get_type::dereference): Add the
1526 COMPLEX_ types.
1527 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1528 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1529 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1530 (get_type_strings): Likewise.
1531
1532 * jit-recording.h
1533 (gcc::jit::recording::context::get_builtins_manager): New.
1534
1535 * libgccjit.h (enum gcc_jit_types): Add
1536 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1537 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1538
23844fd7
DM
15392014-12-01 David Malcolm <dmalcolm@redhat.com>
1540
1541 * jit-builtins.c
1542 (gcc::jit::recording::builtins_manager::get_builtin_function):
1543 Check for NULL return from make_builtin_function.
1544 (gcc::jit::recording::builtins_manager::make_builtin_function):
1545 Check for NULL return from get_type.
1546
c6760a13
DM
15472014-12-01 David Malcolm <dmalcolm@redhat.com>
1548
1549 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1550 creation code into...
1551 (gcc::jit::playback::context::convert_to_dso): New function.
1552 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1553 New function.
1554
8f50ee3c
DM
15552014-12-01 David Malcolm <dmalcolm@redhat.com>
1556
1557 * jit-playback.c (gcc::jit::playback::context::compile): Use an
1558 auto_vec<const char *> rather than a const char *[20] for the
1559 top-level argv, and move the logic to build it to...
1560 (gcc::jit::playback::context::make_fake_args): New function.
1561 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1562 New function.
1563
56dea35f
DM
15642014-12-01 David Malcolm <dmalcolm@redhat.com>
1565
1566 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1567 * jit-playback.c: Include new header jit-result.h.
1568 (gcc::jit::result::result): Move to new file jit-result.c.
1569 (gcc::jit::result::~result): Likewise.
1570 (gcc::jit::playback::result): Likewise.
1571 * jit-recording.h (class gcc::jit::result): Move to new
1572 header jit-result.h.
1573 * jit-result.c: New file, to contain...
1574 (gcc::jit::result::result): Move here from jit-playback.c,
1575 removing erroneous "playback" namespace from comment.
1576 (gcc::jit::result::~result): Likewise.
1577 (gcc::jit::playback::result): Likewise.
1578 * jit-result.h: New file, to contain...
1579 (class gcc::jit::result): Move from jit-recording.h.
1580 * libgccjit.c: Include jit-result.h.
1581 (gcc_jit_result_get_code): Update comment to reflect move
1582 of implementation.
1583 (gcc_jit_result_release): Likewise.
1584
52b9468f
DM
15852014-12-01 David Malcolm <dmalcolm@redhat.com>
1586
1587 PR jit/63854
1588 * docs/examples/tut04-toyvm/toyvm.c
1589 (toyvm_compiled_function): New typedef.
1590 (toyvm_compiled_func) Rename to...
1591 (toyvm_compiled_code) ...this.
1592 (struct toyvm_compiled_function): New struct.
1593 (toyvm_function_compile): Return a toyvm_compiled_function *
1594 rather than a toyvm_compiled_func, so that the caller can fully
1595 clean things up. Free "funcname".
1596 (test_script): Update for change to toyvm_function_compile.
1597 Clean up the toyvm_compiled_function.
1598 (main): Likewise.
1599 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1600 and to better spell out the lifetime of the compiled code.
1601
c8d19a69
DM
16022014-12-01 David Malcolm <dmalcolm@redhat.com>
1603
1604 PR jit/63854
1605 * jit-builtins.c
1606 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1607 context's new_function_type method, rather than directly creating
1608 a function_type instance.
1609 * jit-recording.c
1610 (gcc::jit::recording::context::new_function_type): New method,
1611 adapted from part of...
1612 (gcc::jit::recording::context::new_function_ptr_type): ...this.
1613 Update to call new_function_type.
1614 * jit-recording.h
1615 (gcc::jit::recording::context::new_function_type): New method.
1616
c985705a
DM
16172014-12-01 David Malcolm <dmalcolm@redhat.com>
1618
1619 PR jit/63969
1620 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1621
b957b2e0
DM
16222014-11-19 David Malcolm <dmalcolm@redhat.com>
1623
1624 PR jit/63854
1625 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1626 Convert param from const vec<playback::field *> & to
1627 const auto_vec<playback::field *> *.
1628 (gcc::jit::playback::context::new_function_type): Convert param
1629 "param_types" from vec<type *> * to const auto_vec<type *> *.
1630 (gcc::jit::playback::context::new_function): Convert param
1631 "params" from vec<param *> * to const auto_vec<param *> *.
1632 (gcc::jit::playback::context::build_call): Convert param "args"
1633 from vec<rvalue *> to const auto_vec<rvalue *> *.
1634 (gcc::jit::playback::context::new_call): Likewise.
1635 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1636 (wrapper_finalizer): New function.
1637 (gcc::jit::playback::wrapper::operator new): Call the finalizer
1638 variant of ggc_internal_cleared_alloc, supplying
1639 wrapper_finalizer.
1640 (gcc::jit::playback::function::finalizer): New.
1641 (gcc::jit::playback::block::finalizer): New.
1642 (gcc::jit::playback::source_file::finalizer): New.
1643 (gcc::jit::playback::source_line::finalizer): New.
1644
1645 * jit-playback.h
1646 (gcc::jit::playback::context::new_function_type): Convert param
1647 "param_types" from vec<type *> * to const auto_vec<type *> *.
1648 (gcc::jit::playback::context::new_function): Convert param
1649 "params" from vec<param *> * to const auto_vec<param *> *.
1650 (gcc::jit::playback::context::new_call): Convert param
1651 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1652 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1653 (gcc::jit::playback::context::build_call): Likewise.
1654 (gcc::jit::playback::context): Convert fields "m_functions",
1655 "m_source_files", "m_cached_locations" from vec to auto_vec.
1656 (gcc::jit::playback::wrapper::finalizer): New virtual function.
1657 (gcc::jit::playback::compound_type::set_fields): Convert param fro
1658 const vec<playback::field *> & to
1659 const auto_vec<playback::field *> *.
1660 (gcc::jit::playback::function::finalizer): New.
1661 (gcc::jit::playback::block::finalizer): New.
1662 (gcc::jit::playback::source_file::finalizer): New.
1663 (gcc::jit::playback::source_line::finalizer): New.
1664
1665 * jit-recording.c
1666 (gcc::jit::recording::function_type::replay_into): Convert local
1667 from a vec into an auto_vec.
1668 (gcc::jit::recording::fields::replay_into): Likewise.
1669 (gcc::jit::recording::function::replay_into): Likewise.
1670 (gcc::jit::recording::call::replay_into): Likewise.
1671 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1672
1673 * jit-recording.h (gcc::jit::recording::context): Convert fields
1674 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1675 auto_vec <>.
1676 (gcc::jit::recording::function_type::get_param_types): Convert
1677 return type from vec<type *> to const vec<type *> &.
1678 (gcc::jit::recording::function_type): Convert field
1679 "m_param_types" from a vec<> to an auto_vec<>.
1680 (gcc::jit::recording::fields): Likewise for field "m_fields".
1681 (gcc::jit::recording::function::get_params): Convert return type
1682 from vec <param *> to const vec<param *> &.
1683 (gcc::jit::recording::function): Convert fields "m_params",
1684 "m_locals", "m_blocks" from vec<> to auto_vec<>.
1685 (gcc::jit::recording::block): Likewise for field "m_statements".
1686 vec<> to auto_vec<>.
1687 (gcc::jit::recording::call): Likewise for field "m_args".
1688 (gcc::jit::recording::call_through_ptr): Likewise.
1689
79cafc7a
DM
16902014-11-19 David Malcolm <dmalcolm@redhat.com>
1691
1692 PR jit/63854
1693 * jit-recording.c (recording::function::validate): Convert
1694 "worklist" from vec<> to autovec<> to fix a leak.
1695
35485da9
DM
16962014-11-11 David Malcolm <dmalcolm@redhat.com>
1697
1698 * ChangeLog.jit: New.
1699 * ChangeLog: New.
1700 * Make-lang.in: New.
1701 * TODO.rst: New.
1702 * config-lang.in: New.
1703 * docs/Makefile: New.
1704 * docs/_build/texinfo/Makefile: New.
1705 * docs/_build/texinfo/factorial.png: New.
1706 * docs/_build/texinfo/libgccjit.texi: New.
1707 * docs/_build/texinfo/sum-of-squares.png: New.
1708 * docs/conf.py: New.
1709 * docs/examples/tut01-hello-world.c: New.
1710 * docs/examples/tut02-square.c: New.
1711 * docs/examples/tut03-sum-of-squares.c: New.
1712 * docs/examples/tut04-toyvm/Makefile: New.
1713 * docs/examples/tut04-toyvm/factorial.toy: New.
1714 * docs/examples/tut04-toyvm/fibonacci.toy: New.
1715 * docs/examples/tut04-toyvm/toyvm.c: New.
1716 * docs/index.rst: New.
1717 * docs/internals/index.rst: New.
1718 * docs/intro/factorial.png: New.
1719 * docs/intro/index.rst: New.
1720 * docs/intro/sum-of-squares.png: New.
1721 * docs/intro/tutorial01.rst: New.
1722 * docs/intro/tutorial02.rst: New.
1723 * docs/intro/tutorial03.rst: New.
1724 * docs/intro/tutorial04.rst: New.
1725 * docs/topics/contexts.rst: New.
1726 * docs/topics/expressions.rst: New.
1727 * docs/topics/functions.rst: New.
1728 * docs/topics/index.rst: New.
1729 * docs/topics/locations.rst: New.
1730 * docs/topics/objects.rst: New.
1731 * docs/topics/results.rst: New.
1732 * docs/topics/types.rst: New.
1733 * dummy-frontend.c: New.
1734 * jit-builtins.c: New.
1735 * jit-builtins.h: New.
1736 * jit-common.h: New.
1737 * jit-playback.c: New.
1738 * jit-playback.h: New.
1739 * jit-recording.c: New.
1740 * jit-recording.h: New.
1741 * libgccjit++.h: New.
1742 * libgccjit.c: New.
1743 * libgccjit.h: New.
1744 * libgccjit.map: New.
1745 * notes.txt: New.
1746
17472013-07-26 David Malcolm <dmalcolm@redhat.com>
1748
1749 * Initial creation
1750
1e3b6a3d 1751Copyright (C) 2013-2015 Free Software Foundation, Inc.
35485da9
DM
1752
1753Copying and distribution of this file, with or without modification,
1754are permitted in any medium without royalty provided the copyright
1755notice and this notice are preserved.