1 2015-01-07 David Malcolm <dmalcolm@redhat.com>
3 * docs/internals/index.rst: Update to reflect that built
4 testcases are now test-foo.c.exe, rather than test-foo.exe.
5 * docs/_build/texinfo/libgccjit.texi: Regenerate.
7 2015-01-05 Jakub Jelinek <jakub@redhat.com>
9 Update copyright years.
11 2014-12-19 David Malcolm <dmalcolm@redhat.com>
13 * jit-playback.c (gcc::jit::playback::context::build_cast): In
14 case BOOLEAN_TYPE, don't assume that the source expression is
17 2014-12-19 David Malcolm <dmalcolm@redhat.com>
19 * jit-recording.c (gcc::jit::recording::context::context): When
20 copying string options from a parent context, take a copy of the
21 underlying buffers, rather than simply copying the pointer.
23 2014-12-19 David Malcolm <dmalcolm@redhat.com>
25 * jit-recording.c (gcc::jit::recording::context::set_str_option):
28 2014-12-11 David Malcolm <dmalcolm@redhat.com>
30 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
31 Document new function.
32 * docs/_build/texinfo/libgccjit.texi: Regenerate.
34 2014-12-10 Ulrich Drepper <drepper@gmail.com>
36 Minor interface cleanups of libgccjit
37 * jit-playback.c (convert_to_dso): Use auto_vec instead
38 of automatic array to build up command line.
39 * jit-recording.c (recording::context::set_str_option):
40 Make copy of the string.
41 (recording::context::~context): Free string options.
42 * jit-recording.h (recording::context): Adjust type
43 of m_str_options member.
44 * libgccjit.h: Adjust comment about
45 gcc_jit_context_set_str_option parameter being used after
47 Update comment now that all interfaces are copy strings
49 * libgccjit++.h (gccjit::context): Add set_str_option
52 2014-12-10 David Malcolm <dmalcolm@redhat.com>
54 * docs/cp/index.rst: New file.
55 * docs/cp/intro/index.rst: New file.
56 * docs/cp/intro/tutorial01.rst: New file.
57 * docs/cp/intro/tutorial02.rst: New file.
58 * docs/cp/intro/tutorial03.rst: New file.
59 * docs/cp/intro/tutorial04.rst: New file.
60 * docs/cp/topics/contexts.rst: New file.
61 * docs/cp/topics/expressions.rst: New file.
62 * docs/cp/topics/functions.rst: New file.
63 * docs/cp/topics/index.rst: New file.
64 * docs/cp/topics/locations.rst: New file.
65 * docs/cp/topics/objects.rst: New file.
66 * docs/cp/topics/results.rst: New file.
67 * docs/cp/topics/types.rst: New file.
68 * docs/examples/tut01-hello-world.cc: New file.
69 * docs/examples/tut02-square.c: Fix missing newline in output.
70 * docs/examples/tut02-square.cc: New file.
71 * docs/examples/tut03-sum-of-squares.cc: New file.
72 * docs/examples/tut04-toyvm/toyvm.cc: New file.
73 * docs/index.rst: Move summary to above the table of contents.
74 Add text about the C vs C++ APIs.
75 * docs/topics/contexts.rst: Fix a typo.
77 * docs/_build/texinfo/libgccjit.texi: Regenerate.
78 * docs/_build/texinfo/factorial1.png: New file.
79 * docs/_build/texinfo/sum-of-squares1.png: New file.
81 2014-12-09 David Malcolm <dmalcolm@redhat.com>
83 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
84 logic for determine "funcname" to new function...
85 (get_function_name): ...here, adding logic to skip any leading
86 path from the filename.
87 (toyvm_function_parse): Use the filename for fn_filename, rather
88 than "name", so that the debugger can locate the source .toy
90 (toyvm_function_parse): Don't fclose a NULL FILE *.
92 2014-12-09 David Malcolm <dmalcolm@redhat.com>
95 * docs/internals/index.rst (Running under valgrind): New
97 (docs/_build/texinfo/libgccjit.texi): Regenerate.
99 2014-12-09 David Malcolm <dmalcolm@redhat.com>
102 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
103 * jit-common.h (gcc::jit::tempdir): New forward decl.
104 * jit-playback.c: Include jit-tempdir.h.
105 (gcc::jit::playback::context::context): Initialize m_tempdir.
106 (gcc::jit::playback::context::~context): Move tempdir
107 cleanup to new file jit-tempdir.c
108 (make_tempdir_path_template): Move to new file jit-tempdir.c.
109 (gcc::jit::playback::context::compile): Move tempdir creation
110 to new tempdir object in new file jit-tempdir.c.
111 (gcc::jit::playback::context::make_fake_args): Get path from
112 tempdir object rather than from member data.
113 (gcc::jit::playback::context::convert_to_dso): Likewise.
114 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
115 (gcc::jit::playback::context::dump_generated_code): Likewise.
116 (gcc::jit::playback::context::get_path_c_file): New function.
117 (gcc::jit::playback::context::get_path_s_file): New function.
118 (gcc::jit::playback::context::get_path_so_file): New function.
119 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
121 (gcc::jit::playback::context::get_path_s_file): New function.
122 (gcc::jit::playback::context::get_path_so_file): New function.
123 (gcc::jit::playback::context): Move fields "m_path_template",
124 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
125 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
126 * jit-tempdir.c: New file.
127 * jit-tempdir.h: New file.
129 2014-12-09 David Malcolm <dmalcolm@redhat.com>
131 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
132 mutex here, immediately before using toplev, and release it here, on
133 each exit path after acquisition.
134 (jit_mutex): Move this variable here, from jit-recording.c.
135 (gcc::jit::playback::context::acquire_mutex): New function, based on
136 code in jit-recording.c.
137 (gcc::jit::playback::context::release_mutex): Likewise.
138 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
140 (gcc::jit::playback::context::release_mutex): New function.
141 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
142 (gcc::jit::recording::context::compile): Move mutex-handling from
143 here into jit-playback.c's gcc::jit::playback::context::compile.
144 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
147 2014-12-09 David Malcolm <dmalcolm@redhat.com>
149 * jit-playback.c (gcc::jit::playback::context::compile): Move the
151 (gcc::jit::playback::context::dlopen_built_dso): ...this new
153 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
156 2014-12-09 David Malcolm <dmalcolm@redhat.com>
159 * docs/topics/contexts.rst (Debugging): Add description of
160 gcc_jit_context_enable_dump.
161 * docs/_build/texinfo/libgccjit.texi: Regenerate.
162 * jit-playback.c: Include context.h.
163 (class auto_argvec): New class.
164 (auto_argvec::~auto_argvec): New function.
165 (gcc::jit::playback::context::compile): Convert fake_args to be
166 an auto_argvec, so that it can contain dynamically-allocated
167 strings. Construct a vec of all requested dumps, and pass it to
168 make_fake_args. Extract requested dumps between the calls to
169 toplev::main and toplev::finalize.
170 (gcc::jit::playback::context::make_fake_args): Convert param
171 "argvec" to be a vec <char *>, and gain a "requested_dumps"
172 param. Convert to dynamically-allocated arg strings by converting
173 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
174 for args that are already a copy. Add args for all requested dumps.
175 (gcc::jit::playback::context::extract_any_requested_dumps): New
177 (gcc::jit::playback::context::read_dump_file): New function.
178 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
179 Convert param "argvec" to be a vec <char *>, and gain a
180 "requested_dumps" param.
181 (gcc::jit::playback::context::extract_any_requested_dumps): New
183 (gcc::jit::playback::context::read_dump_file): New function.
184 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
186 (gcc::jit::recording::context::get_all_requested_dumps): New
188 * jit-recording.h (gcc::jit::recording::requested_dump): New
190 (gcc::jit::recording::context::enable_dump): New function.
191 (gcc::jit::recording::context::get_all_requested_dumps): New
193 (gcc::jit::recording::context::m_requested_dumps): New field.
194 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
195 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
196 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
198 2014-12-08 David Malcolm <dmalcolm@redhat.com>
200 * libgccjit++.h: Indent the forward declarations of the classes to
201 show the inheritance hierarchy.
203 2014-12-08 David Malcolm <dmalcolm@redhat.com>
205 * notes.txt: Show the beginning and ending of
206 recording::context::compile vs playback::context::compile. Show
207 the creation and unlinking of the tempdir. Show toplev::finalize.
208 Move "RELEASE MUTEX" to the correct location. Show
209 gcc_jit_result_release, and indicate where the
210 dlopen/dlsym/dlclose occur.
212 2014-12-01 David Malcolm <dmalcolm@redhat.com>
214 * docs/examples/tut02-square.c (main): Release the context
215 earlier, to show that this is possible. Update error-handling
216 to avoid a double-release of the context, and to avoid
217 releasing a NULL result.
218 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
219 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
220 * docs/topics/results.rst (gcc_jit_result): Mention that this
221 controls the lifetimes of machine code functions.
222 (gcc_jit_result_get_code): Spell out the requirements for this
223 to succeed, and the lifetime of the result.
224 (gcc_jit_result_release): Mention that this invalidates any code
225 that was obtained from the result.
226 * docs/_build/texinfo/libgccjit.texi: Regenerate.
228 2014-12-01 David Malcolm <dmalcolm@redhat.com>
231 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
232 Add description of error-handling, taken in part from...
233 * docs/topics/contexts.rst (Error-handling): Expand, and move some
234 content to tutorial02.rst.
235 * docs/_build/texinfo/libgccjit.texi: Regenerate.
237 2014-12-01 David Malcolm <dmalcolm@redhat.com>
240 * docs/topics/types.rst (Standard types) Add new enum values to
241 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
242 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
243 Widen the left-hand column so that
244 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
245 * docs/_build/texinfo/libgccjit.texi: Regenerate.
247 * jit-builtins.c: Include stringpool.h and jit-playback.h.
248 Move everything out of the gcc::jit::recording namespace into
250 (struct builtin_data): Add fields "fnclass", "attr", and
252 (DEF_BUILTIN): Update macro so populate the new fields.
253 (builtins_manager::builtins_manager): Update for move out of
254 recording namespace. Initialize the m_attributes array.
255 (builtins_manager::get_builtin_function): Likewise.
256 (builtins_manager::get_builtin_function_by_id): New function.
257 (builtins_manager::make_builtin_function): Update for move out of
258 recording namespace. Add fix for PR jit/64020 by detecting
259 specific builtin ids and having them ensure that builtins for
260 other ids are created as necessary.
261 (builtins_manager::get_type): Update for move out of recording
263 (builtins_manager::make_type): Likewise. Add some missing
265 (builtins_manager::make_primitive_type): Update for move out of
266 recording namespace. Implement the three BT_COMPLEX_ cases and
268 (builtins_manager::make_fn_type): Update for move out of recording
270 (builtins_manager::make_ptr_type): Likewise.
271 (builtins_manager::finish_playback): New function.
272 (builtins_manager::get_class): New function.
273 (builtins_manager::implicit_p): New function.
274 (builtins_manager::get_attrs_tree): Two new functions.
275 (builtins_manager::make_attrs_tree): New function.
277 * jit-builtins.h: Move everything out of the gcc::jit::recording
278 namespace into just gcc::jit.
279 (enum built_in_attribute): New.
280 (builtins_manager::builtins_manager): Update decl for namespace
282 (builtins_manager::get_builtin_function): Likewise.
283 (builtins_manager::get_class): New.
284 (builtins_manager::implicit_p): New.
285 (builtins_manager::get_attrs_tree): Two new functions.
286 (builtins_manager::make_attrs_tree): New function.
287 (builtins_manager::finish_playback): New.
288 (builtins_manager::get_builtin_function_by_id): New.
289 (builtins_manager::make_builtin_function): Update decl for
291 (builtins_manager::get_type): Likewise.
292 (builtins_manager::make_type): Likewise.
293 (builtins_manager::make_primitive_type): Likewise.
294 (builtins_manager::make_fn_type): Likewise.
295 (builtins_manager::make_ptr_type): Likewise.
296 (builtins_manager): Likewise for fields. Add new field
299 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
300 (builtins_manager): Update forward decl to reflect namespace
303 * jit-playback.c: Include attribs.h and jit-builtins.h.
304 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
305 for the new COMPLEX_ types.
306 (gcc::jit::playback::context::new_function): If creating a
307 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
308 and call set_builtin_decl.
309 (gcc::jit::playback::context::replay): If we have a
310 builtins_manager, call its finish_playback method when we're done.
313 (gcc::jit::playback::context::get_builtins_manager): New function.
316 (gcc::jit::recording::context::get_builtins_manager): New function.
317 (gcc::jit::recording::get_builtin_function): Use
318 get_builtins_manager, in case we're a child context.
319 (gcc::jit::recording::memento_of_get_type::dereference): Add the
321 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
322 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
323 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
324 (get_type_strings): Likewise.
327 (gcc::jit::recording::context::get_builtins_manager): New.
329 * libgccjit.h (enum gcc_jit_types): Add
330 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
331 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
333 2014-12-01 David Malcolm <dmalcolm@redhat.com>
336 (gcc::jit::recording::builtins_manager::get_builtin_function):
337 Check for NULL return from make_builtin_function.
338 (gcc::jit::recording::builtins_manager::make_builtin_function):
339 Check for NULL return from get_type.
341 2014-12-01 David Malcolm <dmalcolm@redhat.com>
343 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
344 creation code into...
345 (gcc::jit::playback::context::convert_to_dso): New function.
346 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
349 2014-12-01 David Malcolm <dmalcolm@redhat.com>
351 * jit-playback.c (gcc::jit::playback::context::compile): Use an
352 auto_vec<const char *> rather than a const char *[20] for the
353 top-level argv, and move the logic to build it to...
354 (gcc::jit::playback::context::make_fake_args): New function.
355 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
358 2014-12-01 David Malcolm <dmalcolm@redhat.com>
360 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
361 * jit-playback.c: Include new header jit-result.h.
362 (gcc::jit::result::result): Move to new file jit-result.c.
363 (gcc::jit::result::~result): Likewise.
364 (gcc::jit::playback::result): Likewise.
365 * jit-recording.h (class gcc::jit::result): Move to new
367 * jit-result.c: New file, to contain...
368 (gcc::jit::result::result): Move here from jit-playback.c,
369 removing erroneous "playback" namespace from comment.
370 (gcc::jit::result::~result): Likewise.
371 (gcc::jit::playback::result): Likewise.
372 * jit-result.h: New file, to contain...
373 (class gcc::jit::result): Move from jit-recording.h.
374 * libgccjit.c: Include jit-result.h.
375 (gcc_jit_result_get_code): Update comment to reflect move
377 (gcc_jit_result_release): Likewise.
379 2014-12-01 David Malcolm <dmalcolm@redhat.com>
382 * docs/examples/tut04-toyvm/toyvm.c
383 (toyvm_compiled_function): New typedef.
384 (toyvm_compiled_func) Rename to...
385 (toyvm_compiled_code) ...this.
386 (struct toyvm_compiled_function): New struct.
387 (toyvm_function_compile): Return a toyvm_compiled_function *
388 rather than a toyvm_compiled_func, so that the caller can fully
389 clean things up. Free "funcname".
390 (test_script): Update for change to toyvm_function_compile.
391 Clean up the toyvm_compiled_function.
393 (docs/intro/tutorial04.rst): Update to reflect the above changes,
394 and to better spell out the lifetime of the compiled code.
396 2014-12-01 David Malcolm <dmalcolm@redhat.com>
400 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
401 context's new_function_type method, rather than directly creating
402 a function_type instance.
404 (gcc::jit::recording::context::new_function_type): New method,
405 adapted from part of...
406 (gcc::jit::recording::context::new_function_ptr_type): ...this.
407 Update to call new_function_type.
409 (gcc::jit::recording::context::new_function_type): New method.
411 2014-12-01 David Malcolm <dmalcolm@redhat.com>
414 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
416 2014-11-19 David Malcolm <dmalcolm@redhat.com>
419 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
420 Convert param from const vec<playback::field *> & to
421 const auto_vec<playback::field *> *.
422 (gcc::jit::playback::context::new_function_type): Convert param
423 "param_types" from vec<type *> * to const auto_vec<type *> *.
424 (gcc::jit::playback::context::new_function): Convert param
425 "params" from vec<param *> * to const auto_vec<param *> *.
426 (gcc::jit::playback::context::build_call): Convert param "args"
427 from vec<rvalue *> to const auto_vec<rvalue *> *.
428 (gcc::jit::playback::context::new_call): Likewise.
429 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
430 (wrapper_finalizer): New function.
431 (gcc::jit::playback::wrapper::operator new): Call the finalizer
432 variant of ggc_internal_cleared_alloc, supplying
434 (gcc::jit::playback::function::finalizer): New.
435 (gcc::jit::playback::block::finalizer): New.
436 (gcc::jit::playback::source_file::finalizer): New.
437 (gcc::jit::playback::source_line::finalizer): New.
440 (gcc::jit::playback::context::new_function_type): Convert param
441 "param_types" from vec<type *> * to const auto_vec<type *> *.
442 (gcc::jit::playback::context::new_function): Convert param
443 "params" from vec<param *> * to const auto_vec<param *> *.
444 (gcc::jit::playback::context::new_call): Convert param
445 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
446 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
447 (gcc::jit::playback::context::build_call): Likewise.
448 (gcc::jit::playback::context): Convert fields "m_functions",
449 "m_source_files", "m_cached_locations" from vec to auto_vec.
450 (gcc::jit::playback::wrapper::finalizer): New virtual function.
451 (gcc::jit::playback::compound_type::set_fields): Convert param fro
452 const vec<playback::field *> & to
453 const auto_vec<playback::field *> *.
454 (gcc::jit::playback::function::finalizer): New.
455 (gcc::jit::playback::block::finalizer): New.
456 (gcc::jit::playback::source_file::finalizer): New.
457 (gcc::jit::playback::source_line::finalizer): New.
460 (gcc::jit::recording::function_type::replay_into): Convert local
461 from a vec into an auto_vec.
462 (gcc::jit::recording::fields::replay_into): Likewise.
463 (gcc::jit::recording::function::replay_into): Likewise.
464 (gcc::jit::recording::call::replay_into): Likewise.
465 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
467 * jit-recording.h (gcc::jit::recording::context): Convert fields
468 "m_mementos", "m_compound_types", "m_functions" from vec<> to
470 (gcc::jit::recording::function_type::get_param_types): Convert
471 return type from vec<type *> to const vec<type *> &.
472 (gcc::jit::recording::function_type): Convert field
473 "m_param_types" from a vec<> to an auto_vec<>.
474 (gcc::jit::recording::fields): Likewise for field "m_fields".
475 (gcc::jit::recording::function::get_params): Convert return type
476 from vec <param *> to const vec<param *> &.
477 (gcc::jit::recording::function): Convert fields "m_params",
478 "m_locals", "m_blocks" from vec<> to auto_vec<>.
479 (gcc::jit::recording::block): Likewise for field "m_statements".
481 (gcc::jit::recording::call): Likewise for field "m_args".
482 (gcc::jit::recording::call_through_ptr): Likewise.
484 2014-11-19 David Malcolm <dmalcolm@redhat.com>
487 * jit-recording.c (recording::function::validate): Convert
488 "worklist" from vec<> to autovec<> to fix a leak.
490 2014-11-11 David Malcolm <dmalcolm@redhat.com>
492 * ChangeLog.jit: New.
496 * config-lang.in: New.
497 * docs/Makefile: New.
498 * docs/_build/texinfo/Makefile: New.
499 * docs/_build/texinfo/factorial.png: New.
500 * docs/_build/texinfo/libgccjit.texi: New.
501 * docs/_build/texinfo/sum-of-squares.png: New.
503 * docs/examples/tut01-hello-world.c: New.
504 * docs/examples/tut02-square.c: New.
505 * docs/examples/tut03-sum-of-squares.c: New.
506 * docs/examples/tut04-toyvm/Makefile: New.
507 * docs/examples/tut04-toyvm/factorial.toy: New.
508 * docs/examples/tut04-toyvm/fibonacci.toy: New.
509 * docs/examples/tut04-toyvm/toyvm.c: New.
510 * docs/index.rst: New.
511 * docs/internals/index.rst: New.
512 * docs/intro/factorial.png: New.
513 * docs/intro/index.rst: New.
514 * docs/intro/sum-of-squares.png: New.
515 * docs/intro/tutorial01.rst: New.
516 * docs/intro/tutorial02.rst: New.
517 * docs/intro/tutorial03.rst: New.
518 * docs/intro/tutorial04.rst: New.
519 * docs/topics/contexts.rst: New.
520 * docs/topics/expressions.rst: New.
521 * docs/topics/functions.rst: New.
522 * docs/topics/index.rst: New.
523 * docs/topics/locations.rst: New.
524 * docs/topics/objects.rst: New.
525 * docs/topics/results.rst: New.
526 * docs/topics/types.rst: New.
527 * dummy-frontend.c: New.
528 * jit-builtins.c: New.
529 * jit-builtins.h: New.
531 * jit-playback.c: New.
532 * jit-playback.h: New.
533 * jit-recording.c: New.
534 * jit-recording.h: New.
535 * libgccjit++.h: New.
538 * libgccjit.map: New.
541 2013-07-26 David Malcolm <dmalcolm@redhat.com>
545 Copyright (C) 2013-2015 Free Software Foundation, Inc.
547 Copying and distribution of this file, with or without modification,
548 are permitted in any medium without royalty provided the copyright
549 notice and this notice are preserved.