1 2014-12-11 David Malcolm <dmalcolm@redhat.com>
3 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
5 * docs/_build/texinfo/libgccjit.texi: Regenerate.
7 2014-12-10 Ulrich Drepper <drepper@gmail.com>
9 Minor interface cleanups of libgccjit
10 * jit-playback.c (convert_to_dso): Use auto_vec instead
11 of automatic array to build up command line.
12 * jit-recording.c (recording::context::set_str_option):
13 Make copy of the string.
14 (recording::context::~context): Free string options.
15 * jit-recording.h (recording::context): Adjust type
16 of m_str_options member.
17 * libgccjit.h: Adjust comment about
18 gcc_jit_context_set_str_option parameter being used after
20 Update comment now that all interfaces are copy strings
22 * libgccjit++.h (gccjit::context): Add set_str_option
25 2014-12-10 David Malcolm <dmalcolm@redhat.com>
27 * docs/cp/index.rst: New file.
28 * docs/cp/intro/index.rst: New file.
29 * docs/cp/intro/tutorial01.rst: New file.
30 * docs/cp/intro/tutorial02.rst: New file.
31 * docs/cp/intro/tutorial03.rst: New file.
32 * docs/cp/intro/tutorial04.rst: New file.
33 * docs/cp/topics/contexts.rst: New file.
34 * docs/cp/topics/expressions.rst: New file.
35 * docs/cp/topics/functions.rst: New file.
36 * docs/cp/topics/index.rst: New file.
37 * docs/cp/topics/locations.rst: New file.
38 * docs/cp/topics/objects.rst: New file.
39 * docs/cp/topics/results.rst: New file.
40 * docs/cp/topics/types.rst: New file.
41 * docs/examples/tut01-hello-world.cc: New file.
42 * docs/examples/tut02-square.c: Fix missing newline in output.
43 * docs/examples/tut02-square.cc: New file.
44 * docs/examples/tut03-sum-of-squares.cc: New file.
45 * docs/examples/tut04-toyvm/toyvm.cc: New file.
46 * docs/index.rst: Move summary to above the table of contents.
47 Add text about the C vs C++ APIs.
48 * docs/topics/contexts.rst: Fix a typo.
50 * docs/_build/texinfo/libgccjit.texi: Regenerate.
51 * docs/_build/texinfo/factorial1.png: New file.
52 * docs/_build/texinfo/sum-of-squares1.png: New file.
54 2014-12-09 David Malcolm <dmalcolm@redhat.com>
56 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
57 logic for determine "funcname" to new function...
58 (get_function_name): ...here, adding logic to skip any leading
59 path from the filename.
60 (toyvm_function_parse): Use the filename for fn_filename, rather
61 than "name", so that the debugger can locate the source .toy
63 (toyvm_function_parse): Don't fclose a NULL FILE *.
65 2014-12-09 David Malcolm <dmalcolm@redhat.com>
68 * docs/internals/index.rst (Running under valgrind): New
70 (docs/_build/texinfo/libgccjit.texi): Regenerate.
72 2014-12-09 David Malcolm <dmalcolm@redhat.com>
75 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
76 * jit-common.h (gcc::jit::tempdir): New forward decl.
77 * jit-playback.c: Include jit-tempdir.h.
78 (gcc::jit::playback::context::context): Initialize m_tempdir.
79 (gcc::jit::playback::context::~context): Move tempdir
80 cleanup to new file jit-tempdir.c
81 (make_tempdir_path_template): Move to new file jit-tempdir.c.
82 (gcc::jit::playback::context::compile): Move tempdir creation
83 to new tempdir object in new file jit-tempdir.c.
84 (gcc::jit::playback::context::make_fake_args): Get path from
85 tempdir object rather than from member data.
86 (gcc::jit::playback::context::convert_to_dso): Likewise.
87 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
88 (gcc::jit::playback::context::dump_generated_code): Likewise.
89 (gcc::jit::playback::context::get_path_c_file): New function.
90 (gcc::jit::playback::context::get_path_s_file): New function.
91 (gcc::jit::playback::context::get_path_so_file): New function.
92 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
94 (gcc::jit::playback::context::get_path_s_file): New function.
95 (gcc::jit::playback::context::get_path_so_file): New function.
96 (gcc::jit::playback::context): Move fields "m_path_template",
97 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
98 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
99 * jit-tempdir.c: New file.
100 * jit-tempdir.h: New file.
102 2014-12-09 David Malcolm <dmalcolm@redhat.com>
104 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
105 mutex here, immediately before using toplev, and release it here, on
106 each exit path after acquisition.
107 (jit_mutex): Move this variable here, from jit-recording.c.
108 (gcc::jit::playback::context::acquire_mutex): New function, based on
109 code in jit-recording.c.
110 (gcc::jit::playback::context::release_mutex): Likewise.
111 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
113 (gcc::jit::playback::context::release_mutex): New function.
114 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
115 (gcc::jit::recording::context::compile): Move mutex-handling from
116 here into jit-playback.c's gcc::jit::playback::context::compile.
117 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
120 2014-12-09 David Malcolm <dmalcolm@redhat.com>
122 * jit-playback.c (gcc::jit::playback::context::compile): Move the
124 (gcc::jit::playback::context::dlopen_built_dso): ...this new
126 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
129 2014-12-09 David Malcolm <dmalcolm@redhat.com>
132 * docs/topics/contexts.rst (Debugging): Add description of
133 gcc_jit_context_enable_dump.
134 * docs/_build/texinfo/libgccjit.texi: Regenerate.
135 * jit-playback.c: Include context.h.
136 (class auto_argvec): New class.
137 (auto_argvec::~auto_argvec): New function.
138 (gcc::jit::playback::context::compile): Convert fake_args to be
139 an auto_argvec, so that it can contain dynamically-allocated
140 strings. Construct a vec of all requested dumps, and pass it to
141 make_fake_args. Extract requested dumps between the calls to
142 toplev::main and toplev::finalize.
143 (gcc::jit::playback::context::make_fake_args): Convert param
144 "argvec" to be a vec <char *>, and gain a "requested_dumps"
145 param. Convert to dynamically-allocated arg strings by converting
146 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
147 for args that are already a copy. Add args for all requested dumps.
148 (gcc::jit::playback::context::extract_any_requested_dumps): New
150 (gcc::jit::playback::context::read_dump_file): New function.
151 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
152 Convert param "argvec" to be a vec <char *>, and gain a
153 "requested_dumps" param.
154 (gcc::jit::playback::context::extract_any_requested_dumps): New
156 (gcc::jit::playback::context::read_dump_file): New function.
157 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
159 (gcc::jit::recording::context::get_all_requested_dumps): New
161 * jit-recording.h (gcc::jit::recording::requested_dump): New
163 (gcc::jit::recording::context::enable_dump): New function.
164 (gcc::jit::recording::context::get_all_requested_dumps): New
166 (gcc::jit::recording::context::m_requested_dumps): New field.
167 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
168 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
169 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
171 2014-12-08 David Malcolm <dmalcolm@redhat.com>
173 * libgccjit++.h: Indent the forward declarations of the classes to
174 show the inheritance hierarchy.
176 2014-12-08 David Malcolm <dmalcolm@redhat.com>
178 * notes.txt: Show the beginning and ending of
179 recording::context::compile vs playback::context::compile. Show
180 the creation and unlinking of the tempdir. Show toplev::finalize.
181 Move "RELEASE MUTEX" to the correct location. Show
182 gcc_jit_result_release, and indicate where the
183 dlopen/dlsym/dlclose occur.
185 2014-12-01 David Malcolm <dmalcolm@redhat.com>
187 * docs/examples/tut02-square.c (main): Release the context
188 earlier, to show that this is possible. Update error-handling
189 to avoid a double-release of the context, and to avoid
190 releasing a NULL result.
191 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
192 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
193 * docs/topics/results.rst (gcc_jit_result): Mention that this
194 controls the lifetimes of machine code functions.
195 (gcc_jit_result_get_code): Spell out the requirements for this
196 to succeed, and the lifetime of the result.
197 (gcc_jit_result_release): Mention that this invalidates any code
198 that was obtained from the result.
199 * docs/_build/texinfo/libgccjit.texi: Regenerate.
201 2014-12-01 David Malcolm <dmalcolm@redhat.com>
204 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
205 Add description of error-handling, taken in part from...
206 * docs/topics/contexts.rst (Error-handling): Expand, and move some
207 content to tutorial02.rst.
208 * docs/_build/texinfo/libgccjit.texi: Regenerate.
210 2014-12-01 David Malcolm <dmalcolm@redhat.com>
213 * docs/topics/types.rst (Standard types) Add new enum values to
214 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
215 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
216 Widen the left-hand column so that
217 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
218 * docs/_build/texinfo/libgccjit.texi: Regenerate.
220 * jit-builtins.c: Include stringpool.h and jit-playback.h.
221 Move everything out of the gcc::jit::recording namespace into
223 (struct builtin_data): Add fields "fnclass", "attr", and
225 (DEF_BUILTIN): Update macro so populate the new fields.
226 (builtins_manager::builtins_manager): Update for move out of
227 recording namespace. Initialize the m_attributes array.
228 (builtins_manager::get_builtin_function): Likewise.
229 (builtins_manager::get_builtin_function_by_id): New function.
230 (builtins_manager::make_builtin_function): Update for move out of
231 recording namespace. Add fix for PR jit/64020 by detecting
232 specific builtin ids and having them ensure that builtins for
233 other ids are created as necessary.
234 (builtins_manager::get_type): Update for move out of recording
236 (builtins_manager::make_type): Likewise. Add some missing
238 (builtins_manager::make_primitive_type): Update for move out of
239 recording namespace. Implement the three BT_COMPLEX_ cases and
241 (builtins_manager::make_fn_type): Update for move out of recording
243 (builtins_manager::make_ptr_type): Likewise.
244 (builtins_manager::finish_playback): New function.
245 (builtins_manager::get_class): New function.
246 (builtins_manager::implicit_p): New function.
247 (builtins_manager::get_attrs_tree): Two new functions.
248 (builtins_manager::make_attrs_tree): New function.
250 * jit-builtins.h: Move everything out of the gcc::jit::recording
251 namespace into just gcc::jit.
252 (enum built_in_attribute): New.
253 (builtins_manager::builtins_manager): Update decl for namespace
255 (builtins_manager::get_builtin_function): Likewise.
256 (builtins_manager::get_class): New.
257 (builtins_manager::implicit_p): New.
258 (builtins_manager::get_attrs_tree): Two new functions.
259 (builtins_manager::make_attrs_tree): New function.
260 (builtins_manager::finish_playback): New.
261 (builtins_manager::get_builtin_function_by_id): New.
262 (builtins_manager::make_builtin_function): Update decl for
264 (builtins_manager::get_type): Likewise.
265 (builtins_manager::make_type): Likewise.
266 (builtins_manager::make_primitive_type): Likewise.
267 (builtins_manager::make_fn_type): Likewise.
268 (builtins_manager::make_ptr_type): Likewise.
269 (builtins_manager): Likewise for fields. Add new field
272 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
273 (builtins_manager): Update forward decl to reflect namespace
276 * jit-playback.c: Include attribs.h and jit-builtins.h.
277 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
278 for the new COMPLEX_ types.
279 (gcc::jit::playback::context::new_function): If creating a
280 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
281 and call set_builtin_decl.
282 (gcc::jit::playback::context::replay): If we have a
283 builtins_manager, call its finish_playback method when we're done.
286 (gcc::jit::playback::context::get_builtins_manager): New function.
289 (gcc::jit::recording::context::get_builtins_manager): New function.
290 (gcc::jit::recording::get_builtin_function): Use
291 get_builtins_manager, in case we're a child context.
292 (gcc::jit::recording::memento_of_get_type::dereference): Add the
294 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
295 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
296 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
297 (get_type_strings): Likewise.
300 (gcc::jit::recording::context::get_builtins_manager): New.
302 * libgccjit.h (enum gcc_jit_types): Add
303 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
304 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
306 2014-12-01 David Malcolm <dmalcolm@redhat.com>
309 (gcc::jit::recording::builtins_manager::get_builtin_function):
310 Check for NULL return from make_builtin_function.
311 (gcc::jit::recording::builtins_manager::make_builtin_function):
312 Check for NULL return from get_type.
314 2014-12-01 David Malcolm <dmalcolm@redhat.com>
316 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
317 creation code into...
318 (gcc::jit::playback::context::convert_to_dso): New function.
319 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
322 2014-12-01 David Malcolm <dmalcolm@redhat.com>
324 * jit-playback.c (gcc::jit::playback::context::compile): Use an
325 auto_vec<const char *> rather than a const char *[20] for the
326 top-level argv, and move the logic to build it to...
327 (gcc::jit::playback::context::make_fake_args): New function.
328 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
331 2014-12-01 David Malcolm <dmalcolm@redhat.com>
333 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
334 * jit-playback.c: Include new header jit-result.h.
335 (gcc::jit::result::result): Move to new file jit-result.c.
336 (gcc::jit::result::~result): Likewise.
337 (gcc::jit::playback::result): Likewise.
338 * jit-recording.h (class gcc::jit::result): Move to new
340 * jit-result.c: New file, to contain...
341 (gcc::jit::result::result): Move here from jit-playback.c,
342 removing erroneous "playback" namespace from comment.
343 (gcc::jit::result::~result): Likewise.
344 (gcc::jit::playback::result): Likewise.
345 * jit-result.h: New file, to contain...
346 (class gcc::jit::result): Move from jit-recording.h.
347 * libgccjit.c: Include jit-result.h.
348 (gcc_jit_result_get_code): Update comment to reflect move
350 (gcc_jit_result_release): Likewise.
352 2014-12-01 David Malcolm <dmalcolm@redhat.com>
355 * docs/examples/tut04-toyvm/toyvm.c
356 (toyvm_compiled_function): New typedef.
357 (toyvm_compiled_func) Rename to...
358 (toyvm_compiled_code) ...this.
359 (struct toyvm_compiled_function): New struct.
360 (toyvm_function_compile): Return a toyvm_compiled_function *
361 rather than a toyvm_compiled_func, so that the caller can fully
362 clean things up. Free "funcname".
363 (test_script): Update for change to toyvm_function_compile.
364 Clean up the toyvm_compiled_function.
366 (docs/intro/tutorial04.rst): Update to reflect the above changes,
367 and to better spell out the lifetime of the compiled code.
369 2014-12-01 David Malcolm <dmalcolm@redhat.com>
373 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
374 context's new_function_type method, rather than directly creating
375 a function_type instance.
377 (gcc::jit::recording::context::new_function_type): New method,
378 adapted from part of...
379 (gcc::jit::recording::context::new_function_ptr_type): ...this.
380 Update to call new_function_type.
382 (gcc::jit::recording::context::new_function_type): New method.
384 2014-12-01 David Malcolm <dmalcolm@redhat.com>
387 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
389 2014-11-19 David Malcolm <dmalcolm@redhat.com>
392 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
393 Convert param from const vec<playback::field *> & to
394 const auto_vec<playback::field *> *.
395 (gcc::jit::playback::context::new_function_type): Convert param
396 "param_types" from vec<type *> * to const auto_vec<type *> *.
397 (gcc::jit::playback::context::new_function): Convert param
398 "params" from vec<param *> * to const auto_vec<param *> *.
399 (gcc::jit::playback::context::build_call): Convert param "args"
400 from vec<rvalue *> to const auto_vec<rvalue *> *.
401 (gcc::jit::playback::context::new_call): Likewise.
402 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
403 (wrapper_finalizer): New function.
404 (gcc::jit::playback::wrapper::operator new): Call the finalizer
405 variant of ggc_internal_cleared_alloc, supplying
407 (gcc::jit::playback::function::finalizer): New.
408 (gcc::jit::playback::block::finalizer): New.
409 (gcc::jit::playback::source_file::finalizer): New.
410 (gcc::jit::playback::source_line::finalizer): New.
413 (gcc::jit::playback::context::new_function_type): Convert param
414 "param_types" from vec<type *> * to const auto_vec<type *> *.
415 (gcc::jit::playback::context::new_function): Convert param
416 "params" from vec<param *> * to const auto_vec<param *> *.
417 (gcc::jit::playback::context::new_call): Convert param
418 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
419 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
420 (gcc::jit::playback::context::build_call): Likewise.
421 (gcc::jit::playback::context): Convert fields "m_functions",
422 "m_source_files", "m_cached_locations" from vec to auto_vec.
423 (gcc::jit::playback::wrapper::finalizer): New virtual function.
424 (gcc::jit::playback::compound_type::set_fields): Convert param fro
425 const vec<playback::field *> & to
426 const auto_vec<playback::field *> *.
427 (gcc::jit::playback::function::finalizer): New.
428 (gcc::jit::playback::block::finalizer): New.
429 (gcc::jit::playback::source_file::finalizer): New.
430 (gcc::jit::playback::source_line::finalizer): New.
433 (gcc::jit::recording::function_type::replay_into): Convert local
434 from a vec into an auto_vec.
435 (gcc::jit::recording::fields::replay_into): Likewise.
436 (gcc::jit::recording::function::replay_into): Likewise.
437 (gcc::jit::recording::call::replay_into): Likewise.
438 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
440 * jit-recording.h (gcc::jit::recording::context): Convert fields
441 "m_mementos", "m_compound_types", "m_functions" from vec<> to
443 (gcc::jit::recording::function_type::get_param_types): Convert
444 return type from vec<type *> to const vec<type *> &.
445 (gcc::jit::recording::function_type): Convert field
446 "m_param_types" from a vec<> to an auto_vec<>.
447 (gcc::jit::recording::fields): Likewise for field "m_fields".
448 (gcc::jit::recording::function::get_params): Convert return type
449 from vec <param *> to const vec<param *> &.
450 (gcc::jit::recording::function): Convert fields "m_params",
451 "m_locals", "m_blocks" from vec<> to auto_vec<>.
452 (gcc::jit::recording::block): Likewise for field "m_statements".
454 (gcc::jit::recording::call): Likewise for field "m_args".
455 (gcc::jit::recording::call_through_ptr): Likewise.
457 2014-11-19 David Malcolm <dmalcolm@redhat.com>
460 * jit-recording.c (recording::function::validate): Convert
461 "worklist" from vec<> to autovec<> to fix a leak.
463 2014-11-11 David Malcolm <dmalcolm@redhat.com>
465 * ChangeLog.jit: New.
469 * config-lang.in: New.
470 * docs/Makefile: New.
471 * docs/_build/texinfo/Makefile: New.
472 * docs/_build/texinfo/factorial.png: New.
473 * docs/_build/texinfo/libgccjit.texi: New.
474 * docs/_build/texinfo/sum-of-squares.png: New.
476 * docs/examples/tut01-hello-world.c: New.
477 * docs/examples/tut02-square.c: New.
478 * docs/examples/tut03-sum-of-squares.c: New.
479 * docs/examples/tut04-toyvm/Makefile: New.
480 * docs/examples/tut04-toyvm/factorial.toy: New.
481 * docs/examples/tut04-toyvm/fibonacci.toy: New.
482 * docs/examples/tut04-toyvm/toyvm.c: New.
483 * docs/index.rst: New.
484 * docs/internals/index.rst: New.
485 * docs/intro/factorial.png: New.
486 * docs/intro/index.rst: New.
487 * docs/intro/sum-of-squares.png: New.
488 * docs/intro/tutorial01.rst: New.
489 * docs/intro/tutorial02.rst: New.
490 * docs/intro/tutorial03.rst: New.
491 * docs/intro/tutorial04.rst: New.
492 * docs/topics/contexts.rst: New.
493 * docs/topics/expressions.rst: New.
494 * docs/topics/functions.rst: New.
495 * docs/topics/index.rst: New.
496 * docs/topics/locations.rst: New.
497 * docs/topics/objects.rst: New.
498 * docs/topics/results.rst: New.
499 * docs/topics/types.rst: New.
500 * dummy-frontend.c: New.
501 * jit-builtins.c: New.
502 * jit-builtins.h: New.
504 * jit-playback.c: New.
505 * jit-playback.h: New.
506 * jit-recording.c: New.
507 * jit-recording.h: New.
508 * libgccjit++.h: New.
511 * libgccjit.map: New.
514 2013-07-26 David Malcolm <dmalcolm@redhat.com>
518 Copyright (C) 2013-2014 Free Software Foundation, Inc.
520 Copying and distribution of this file, with or without modification,
521 are permitted in any medium without royalty provided the copyright
522 notice and this notice are preserved.